text: /*!
   * @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 center":"Align center","Align left":"Align left","Align right":"Align right","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","Bulleted List":"Bulleted List",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",Color:"Color","Color picker":"Color picker",Column:"Column","Could not insert image at the current position.":"Could not insert image at the current position.","Could not obtain resized image URL.":"Could not obtain resized image URL.",Dashed:"Dashed","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","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 toolbar":"Image toolbar","image widget":"image widget","Increase indent":"Increase indent","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert image or file":"Insert image or file","Insert media":"Insert media","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","Inserting image failed":"Inserting image failed",Inset:"Inset",Italic:"Italic",Justify:"Justify","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","Media URL":"Media URL","media widget":"media widget","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",None:"None","Numbered List":"Numbered List","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Outset:"Outset",Padding:"Padding","Page break":"Page break",Paragraph:"Paragraph","Paste the media URL in the input.":"Paste the media URL in the input.",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","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","Selecting resized image failed":"Selecting resized image failed","Show more items":"Show more items","Side image":"Side image",Small:"Small",Solid:"Solid","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",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 alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar","Text alternative":"Text alternative",'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 URL must not be empty.":"The URL must not be empty.",'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","This media URL is not supported.":"This media URL is not supported.",Tiny:"Tiny","Tip: Paste the URL into the content to embed faster.":"Tip: Paste the URL into the content to embed faster.",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Vertical text alignment toolbar":"Vertical text alignment toolbar",White:"White","Widget toolbar":"Widget toolbar",Width:"Width",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.ClassicEditor=t():e.ClassicEditor=t()}(window,(function(){return function(e){var t={};function o(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(i,n,function(t){return e[t]}.bind(null,n));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=122)}([function(e,t,o){"use strict";o.d(t,"a",(function(){return i})),o.d(t,"c",(function(){return n})),o.d(t,"b",(function(){return r}));class i extends Error{constructor(e,t,o){super(`${e}${o?" "+JSON.stringify(o):""}${s(e)}`),this.name="CKEditorError",this.context=t,this.data=o}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const o=new i(e.message,t);throw o.stack=e.stack,o}}function n(e,t){console.warn(...a(e,t))}function r(e,t){console.error(...a(e,t))}function s(e){return"\nRead more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-"+e}function a(e,t){const o=s(e);return t?[e,t,o]:[e,o]}},function(e,t,o){"use strict";var i,n=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},r=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),s=[];function a(e){for(var t=-1,o=0;o<s.length;o++)if(s[o].identifier===e){t=o;break}return t}function l(e,t){for(var o={},i=[],n=0;n<e.length;n++){var r=e[n],l=t.base?r[0]+t.base:r[0],c=o[l]||0,d="".concat(l," ").concat(c);o[l]=c+1;var u=a(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(s[u].references++,s[u].updater(h)):s.push({identifier:d,updater:p(h,t),references:1}),i.push(d)}return i}function c(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var n=o.nc;n&&(i.nonce=n)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[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,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,o,i){var n=o?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(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 f(e,t,o){var i=o.css,n=o.media,r=o.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var m=null,g=0;function p(e,t){var o,i,n;if(t.singleton){var r=g++;o=m||(m=c(t)),i=h.bind(null,o,r,!1),n=h.bind(null,o,r,!0)}else o=c(t),i=f.bind(null,o,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(o)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var o=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<o.length;i++){var n=a(o[i]);s[n].references--}for(var r=l(e,t),c=0;c<o.length;c++){var d=a(o[c]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}o=r}}}},,function(e,t,o){"use strict";var i=o(8),n="object"==typeof self&&self&&self.Object===Object&&self,r=i.a||n||Function("return this")();t.a=r},function(e,t,o){"use strict";(function(e){var i=o(3),n=o(15),r="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=r&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===r?i.a.Buffer:void 0,l=(a?a.isBuffer:void 0)||n.a;t.a=l}).call(this,o(10)(e))},function(e,t,o){"use strict";(function(e){var i=o(8),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===n&&i.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,o(10)(e))},function(e,t,o){"use strict";(function(e){var t=o(0);const i="object"==typeof window?window:e;if(i.CKEDITOR_VERSION)throw new t.a("ckeditor-duplicated-modules",null);i.CKEDITOR_VERSION="24.0.0"}).call(this,o(11))},function(e,t,o){var i=o(1),n=o(62);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t,o){"use strict";(function(e){var o="object"==typeof e&&e&&e.Object===Object&&e;t.a=o}).call(this,o(11))},function(e,t,o){"use strict";(function(e){var i=o(3),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===n?i.a.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var o=e.length,i=a?a(o):new e.constructor(o);return e.copy(i),i}}).call(this,o(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){var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(e){"object"==typeof window&&(o=window)}e.exports=o},function(e,t,o){var i=o(1),n=o(75);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t,o){var i=o(1),n=o(116);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t,o){"use strict";t.a=function(){return!1}},function(e,t,o){var i=o(1),n=o(17);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-placeholder:before,.ck .ck-placeholder:before{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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".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);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.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-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__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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-modal)}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-bottom-width:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar{border-bottom-width:1px;border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}"},function(e,t,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-link_selected{background: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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-resizer-size:10px;--ck-resizer-border-width:1px;--ck-resizer-border-radius:2px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-tooltip-offset:10px;--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2}.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:var(--ck-spacing-small)}.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)}: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))}.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 .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .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,o){var i=o(1),n=o(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};i(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.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.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.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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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){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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:1em auto}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:50px}"},function(e,t,o){var i=o(1),n=o(70);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-editor__editable .image{position:relative}.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:10px;right:10px;border-radius:50%}.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:20px;--ck-image-upload-icon-width:2px}.ck-image-upload-complete-icon{width:var(--ck-image-upload-icon-size);height:var(--ck-image-upload-icon-size);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:var(--ck-image-upload-icon-size);animation-delay:0ms,3s}.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,o){var i=o(1),n=o(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};i(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){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,o){var i=o(1),n=o(77);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}"},function(e,t,o){var i=o(1),n=o(79);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em}.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)}"},function(e,t,o){var i=o(1),n=o(81);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-media__wrapper .ck-media__placeholder{display:flex;flex-direction:column;align-items:center}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:block}@media (hover:none){.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:none}}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url{max-width:100%;position:relative}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url:hover .ck-tooltip{visibility:visible;opacity:1}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{overflow:hidden;display:block}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck-media__placeholder__icon *{display:none}.ck-editor__editable:not(.ck-read-only) .ck-media__wrapper>:not(.ck-media__placeholder),.ck-editor__editable:not(.ck-read-only) .ck-widget:not(.ck-widget_selected) .ck-media__placeholder{pointer-events:none}:root{--ck-media-embed-placeholder-icon-size:3em;--ck-color-media-embed-placeholder-url-text:#757575;--ck-color-media-embed-placeholder-url-text-hover:var(--ck-color-base-text)}.ck-media__wrapper{margin:0 auto}.ck-media__wrapper .ck-media__placeholder{padding:calc(var(--ck-spacing-standard)*3);background:var(--ck-color-base-foreground)}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon{min-width:var(--ck-media-embed-placeholder-icon-size);height:var(--ck-media-embed-placeholder-icon-size);margin-bottom:var(--ck-spacing-large);background-position:50%;background-size:cover}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon .ck-icon{width:100%;height:100%}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url__text{color:var(--ck-color-media-embed-placeholder-url-text);white-space:nowrap;text-align:center;font-style:italic;text-overflow:ellipsis}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:var(--ck-color-media-embed-placeholder-url-text-hover);cursor:pointer;text-decoration:underline}.ck-media__wrapper[data-oembed-url*="open.spotify.com"]{max-width:300px;max-height:380px}.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAuMzc4IiBoZWlnaHQ9IjI1NC4xNjciIHZpZXdCb3g9IjAgMCA2Ni4yNDYgNjcuMjQ4Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcyLjUzMSAtMjE4LjQ1NSkgc2NhbGUoLjk4MDEyKSI+PHJlY3Qgcnk9IjUuMjM4IiByeD0iNS4yMzgiIHk9IjIzMS4zOTkiIHg9IjE3Ni4wMzEiIGhlaWdodD0iNjAuMDk5IiB3aWR0aD0iNjAuMDk5IiBmaWxsPSIjMzRhNjY4IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0yMDYuNDc3IDI2MC45bC0yOC45ODcgMjguOTg3YTUuMjE4IDUuMjE4IDAgMDAzLjc4IDEuNjFoNDkuNjIxYzEuNjk0IDAgMy4xOS0uNzk4IDQuMTQ2LTIuMDM3eiIgZmlsbD0iIzVjODhjNSIvPjxwYXRoIGQ9Ik0yMjYuNzQyIDIyMi45ODhjLTkuMjY2IDAtMTYuNzc3IDcuMTctMTYuNzc3IDE2LjAxNC4wMDcgMi43NjIuNjYzIDUuNDc0IDIuMDkzIDcuODc1LjQzLjcwMy44MyAxLjQwOCAxLjE5IDIuMTA3LjMzMy41MDIuNjUgMS4wMDUuOTUgMS41MDguMzQzLjQ3Ny42NzMuOTU3Ljk4OCAxLjQ0IDEuMzEgMS43NjkgMi41IDMuNTAyIDMuNjM3IDUuMTY4Ljc5MyAxLjI3NSAxLjY4MyAyLjY0IDIuNDY2IDMuOTkgMi4zNjMgNC4wOTQgNC4wMDcgOC4wOTIgNC42IDEzLjkxNHYuMDEyYy4xODIuNDEyLjUxNi42NjYuODc5LjY2Ny40MDMtLjAwMS43NjgtLjMxNC45My0uNzk5LjYwMy01Ljc1NiAyLjIzOC05LjcyOSA0LjU4NS0xMy43OTQuNzgyLTEuMzUgMS42NzMtMi43MTUgMi40NjUtMy45OSAxLjEzNy0xLjY2NiAyLjMyOC0zLjQgMy42MzgtNS4xNjkuMzE1LS40ODIuNjQ1LS45NjIuOTg4LTEuNDM5LjMtLjUwMy42MTctMS4wMDYuOTUtMS41MDguMzU5LS43Ljc2LTEuNDA0IDEuMTktMi4xMDcgMS40MjYtMi40MDIgMi01LjExNCAyLjAwNC03Ljg3NSAwLTguODQ0LTcuNTExLTE2LjAxNC0xNi43NzYtMTYuMDE0eiIgZmlsbD0iI2RkNGIzZSIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48ZWxsaXBzZSByeT0iNS41NjQiIHJ4PSI1LjgyOCIgY3k9IjIzOS4wMDIiIGN4PSIyMjYuNzQyIiBmaWxsPSIjODAyZDI3IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0xOTAuMzAxIDIzNy4yODNjLTQuNjcgMC04LjQ1NyAzLjg1My04LjQ1NyA4LjYwNnMzLjc4NiA4LjYwNyA4LjQ1NyA4LjYwN2MzLjA0MyAwIDQuODA2LS45NTggNi4zMzctMi41MTYgMS41My0xLjU1NyAyLjA4Ny0zLjkxMyAyLjA4Ny02LjI5IDAtLjM2Mi0uMDIzLS43MjItLjA2NC0xLjA3OWgtOC4yNTd2My4wNDNoNC44NWMtLjE5Ny43NTktLjUzMSAxLjQ1LTEuMDU4IDEuOTg2LS45NDIuOTU4LTIuMDI4IDEuNTQ4LTMuOTAxIDEuNTQ4LTIuODc2IDAtNS4yMDgtMi4zNzItNS4yMDgtNS4yOTkgMC0yLjkyNiAyLjMzMi01LjI5OSA1LjIwOC01LjI5OSAxLjM5OSAwIDIuNjE4LjQwNyAzLjU4NCAxLjI5M2wyLjM4MS0yLjM4YzAtLjAwMi0uMDAzLS4wMDQtLjAwNC0uMDA1LTEuNTg4LTEuNTI0LTMuNjItMi4yMTUtNS45NTUtMi4yMTV6bTQuNDMgNS42NmwuMDAzLjAwNnYtLjAwM3oiIGZpbGw9IiNmZmYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxNS4xODQgMjUxLjkyOWwtNy45OCA3Ljk3OSAyOC40NzcgMjguNDc1YTUuMjMzIDUuMjMzIDAgMDAuNDQ5LTIuMTIzdi0zMS4xNjVjLS40NjkuNjc1LS45MzQgMS4zNDktMS4zODIgMi4wMDUtLjc5MiAxLjI3NS0xLjY4MiAyLjY0LTIuNDY1IDMuOTktMi4zNDcgNC4wNjUtMy45ODIgOC4wMzgtNC41ODUgMTMuNzk0LS4xNjIuNDg1LS41MjcuNzk4LS45My43OTktLjM2My0uMDAxLS42OTctLjI1NS0uODc5LS42Njd2LS4wMTJjLS41OTMtNS44MjItMi4yMzctOS44Mi00LjYtMTMuOTE0LS43ODMtMS4zNS0xLjY3My0yLjcxNS0yLjQ2Ni0zLjk5LTEuMTM3LTEuNjY2LTIuMzI3LTMuNC0zLjYzNy01LjE2OWwtLjAwMi0uMDAzeiIgZmlsbD0iI2MzYzNjMyIvPjxwYXRoIGQ9Ik0yMTIuOTgzIDI0OC40OTVsLTM2Ljk1MiAzNi45NTN2LjgxMmE1LjIyNyA1LjIyNyAwIDAwNS4yMzggNS4yMzhoMS4wMTVsMzUuNjY2LTM1LjY2NmExMzYuMjc1IDEzNi4yNzUgMCAwMC0yLjc2NC0zLjkgMzcuNTc1IDM3LjU3NSAwIDAwLS45ODktMS40NCAzNS4xMjcgMzUuMTI3IDAgMDAtLjk1LTEuNTA4Yy0uMDgzLS4xNjItLjE3Ni0uMzI2LS4yNjQtLjQ4OXoiIGZpbGw9IiNmZGRjNGYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxMS45OTggMjYxLjA4M2wtNi4xNTIgNi4xNTEgMjQuMjY0IDI0LjI2NGguNzgxYTUuMjI3IDUuMjI3IDAgMDA1LjIzOS01LjIzOHYtMS4wNDV6IiBmaWxsPSIjZmZmIiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjwvZz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder{background:#4268b3}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05NjcuNDg0IDBINTYuNTE3QzI1LjMwNCAwIDAgMjUuMzA0IDAgNTYuNTE3djkxMC45NjZDMCA5OTguNjk0IDI1LjI5NyAxMDI0IDU2LjUyMiAxMDI0SDU0N1Y2MjhINDE0VjQ3M2gxMzNWMzU5LjAyOWMwLTEzMi4yNjIgODAuNzczLTIwNC4yODIgMTk4Ljc1Ni0yMDQuMjgyIDU2LjUxMyAwIDEwNS4wODYgNC4yMDggMTE5LjI0NCA2LjA4OVYyOTlsLTgxLjYxNi4wMzdjLTYzLjk5MyAwLTc2LjM4NCAzMC40OTItNzYuMzg0IDc1LjIzNlY0NzNoMTUzLjQ4N2wtMTkuOTg2IDE1NUg3MDd2Mzk2aDI2MC40ODRjMzEuMjEzIDAgNTYuNTE2LTI1LjMwMyA1Ni41MTYtNTYuNTE2VjU2LjUxNUMxMDI0IDI1LjMwMyA5OTguNjk3IDAgOTY3LjQ4NCAwIiBmaWxsPSIjRkZGRkZFIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#cdf}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder{background:linear-gradient(-135deg,#1400c7,#b800b1,#f50000)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTA0IiBoZWlnaHQ9IjUwNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PHBhdGggaWQ9ImEiIGQ9Ik0wIC4xNTloNTAzLjg0MVY1MDMuOTRIMHoiLz48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjYSIvPjwvbWFzaz48cGF0aCBkPSJNMjUxLjkyMS4xNTljLTY4LjQxOCAwLTc2Ljk5Ny4yOS0xMDMuODY3IDEuNTE2LTI2LjgxNCAxLjIyMy00NS4xMjcgNS40ODItNjEuMTUxIDExLjcxLTE2LjU2NiA2LjQzNy0zMC42MTUgMTUuMDUxLTQ0LjYyMSAyOS4wNTYtMTQuMDA1IDE0LjAwNi0yMi42MTkgMjguMDU1LTI5LjA1NiA0NC42MjEtNi4yMjggMTYuMDI0LTEwLjQ4NyAzNC4zMzctMTEuNzEgNjEuMTUxQy4yOSAxNzUuMDgzIDAgMTgzLjY2MiAwIDI1Mi4wOGMwIDY4LjQxNy4yOSA3Ni45OTYgMS41MTYgMTAzLjg2NiAxLjIyMyAyNi44MTQgNS40ODIgNDUuMTI3IDExLjcxIDYxLjE1MSA2LjQzNyAxNi41NjYgMTUuMDUxIDMwLjYxNSAyOS4wNTYgNDQuNjIxIDE0LjAwNiAxNC4wMDUgMjguMDU1IDIyLjYxOSA0NC42MjEgMjkuMDU3IDE2LjAyNCA2LjIyNyAzNC4zMzcgMTAuNDg2IDYxLjE1MSAxMS43MDkgMjYuODcgMS4yMjYgMzUuNDQ5IDEuNTE2IDEwMy44NjcgMS41MTYgNjguNDE3IDAgNzYuOTk2LS4yOSAxMDMuODY2LTEuNTE2IDI2LjgxNC0xLjIyMyA0NS4xMjctNS40ODIgNjEuMTUxLTExLjcwOSAxNi41NjYtNi40MzggMzAuNjE1LTE1LjA1MiA0NC42MjEtMjkuMDU3IDE0LjAwNS0xNC4wMDYgMjIuNjE5LTI4LjA1NSAyOS4wNTctNDQuNjIxIDYuMjI3LTE2LjAyNCAxMC40ODYtMzQuMzM3IDExLjcwOS02MS4xNTEgMS4yMjYtMjYuODcgMS41MTYtMzUuNDQ5IDEuNTE2LTEwMy44NjYgMC02OC40MTgtLjI5LTc2Ljk5Ny0xLjUxNi0xMDMuODY3LTEuMjIzLTI2LjgxNC01LjQ4Mi00NS4xMjctMTEuNzA5LTYxLjE1MS02LjQzOC0xNi41NjYtMTUuMDUyLTMwLjYxNS0yOS4wNTctNDQuNjIxLTE0LjAwNi0xNC4wMDUtMjguMDU1LTIyLjYxOS00NC42MjEtMjkuMDU2LTE2LjAyNC02LjIyOC0zNC4zMzctMTAuNDg3LTYxLjE1MS0xMS43MUMzMjguOTE3LjQ0OSAzMjAuMzM4LjE1OSAyNTEuOTIxLjE1OXptMCA0NS4zOTFjNjcuMjY1IDAgNzUuMjMzLjI1NyAxMDEuNzk3IDEuNDY5IDI0LjU2MiAxLjEyIDM3LjkwMSA1LjIyNCA0Ni43NzggOC42NzQgMTEuNzU5IDQuNTcgMjAuMTUxIDEwLjAyOSAyOC45NjYgMTguODQ1IDguODE2IDguODE1IDE0LjI3NSAxNy4yMDcgMTguODQ1IDI4Ljk2NiAzLjQ1IDguODc3IDcuNTU0IDIyLjIxNiA4LjY3NCA0Ni43NzggMS4yMTIgMjYuNTY0IDEuNDY5IDM0LjUzMiAxLjQ2OSAxMDEuNzk4IDAgNjcuMjY1LS4yNTcgNzUuMjMzLTEuNDY5IDEwMS43OTctMS4xMiAyNC41NjItNS4yMjQgMzcuOTAxLTguNjc0IDQ2Ljc3OC00LjU3IDExLjc1OS0xMC4wMjkgMjAuMTUxLTE4Ljg0NSAyOC45NjYtOC44MTUgOC44MTYtMTcuMjA3IDE0LjI3NS0yOC45NjYgMTguODQ1LTguODc3IDMuNDUtMjIuMjE2IDcuNTU0LTQ2Ljc3OCA4LjY3NC0yNi41NiAxLjIxMi0zNC41MjcgMS40NjktMTAxLjc5NyAxLjQ2OS02Ny4yNzEgMC03NS4yMzctLjI1Ny0xMDEuNzk4LTEuNDY5LTI0LjU2Mi0xLjEyLTM3LjkwMS01LjIyNC00Ni43NzgtOC42NzQtMTEuNzU5LTQuNTctMjAuMTUxLTEwLjAyOS0yOC45NjYtMTguODQ1LTguODE1LTguODE1LTE0LjI3NS0xNy4yMDctMTguODQ1LTI4Ljk2Ni0zLjQ1LTguODc3LTcuNTU0LTIyLjIxNi04LjY3NC00Ni43NzgtMS4yMTItMjYuNTY0LTEuNDY5LTM0LjUzMi0xLjQ2OS0xMDEuNzk3IDAtNjcuMjY2LjI1Ny03NS4yMzQgMS40NjktMTAxLjc5OCAxLjEyLTI0LjU2MiA1LjIyNC0zNy45MDEgOC42NzQtNDYuNzc4IDQuNTctMTEuNzU5IDEwLjAyOS0yMC4xNTEgMTguODQ1LTI4Ljk2NiA4LjgxNS04LjgxNiAxNy4yMDctMTQuMjc1IDI4Ljk2Ni0xOC44NDUgOC44NzctMy40NSAyMi4yMTYtNy41NTQgNDYuNzc4LTguNjc0IDI2LjU2NC0xLjIxMiAzNC41MzItMS40NjkgMTAxLjc5OC0xLjQ2OXoiIGZpbGw9IiNGRkYiIG1hc2s9InVybCgjYikiLz48cGF0aCBkPSJNMjUxLjkyMSAzMzYuMDUzYy00Ni4zNzggMC04My45NzQtMzcuNTk2LTgzLjk3NC04My45NzMgMC00Ni4zNzggMzcuNTk2LTgzLjk3NCA4My45NzQtODMuOTc0IDQ2LjM3NyAwIDgzLjk3MyAzNy41OTYgODMuOTczIDgzLjk3NCAwIDQ2LjM3Ny0zNy41OTYgODMuOTczLTgzLjk3MyA4My45NzN6bTAtMjEzLjMzOGMtNzEuNDQ3IDAtMTI5LjM2NSA1Ny45MTgtMTI5LjM2NSAxMjkuMzY1IDAgNzEuNDQ2IDU3LjkxOCAxMjkuMzY0IDEyOS4zNjUgMTI5LjM2NCA3MS40NDYgMCAxMjkuMzY0LTU3LjkxOCAxMjkuMzY0LTEyOS4zNjQgMC03MS40NDctNTcuOTE4LTEyOS4zNjUtMTI5LjM2NC0xMjkuMzY1ek00MTYuNjI3IDExNy42MDRjMCAxNi42OTYtMTMuNTM1IDMwLjIzLTMwLjIzMSAzMC4yMy0xNi42OTUgMC0zMC4yMy0xMy41MzQtMzAuMjMtMzAuMjMgMC0xNi42OTYgMTMuNTM1LTMwLjIzMSAzMC4yMy0zMC4yMzEgMTYuNjk2IDAgMzAuMjMxIDEzLjUzNSAzMC4yMzEgMzAuMjMxIiBmaWxsPSIjRkZGIi8+PC9nPjwvc3ZnPg==)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#ffe0fe}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder{background:linear-gradient(90deg,#71c6f4,#0d70a5)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgNDAwIj48cGF0aCBkPSJNNDAwIDIwMGMwIDExMC41LTg5LjUgMjAwLTIwMCAyMDBTMCAzMTAuNSAwIDIwMCA4OS41IDAgMjAwIDBzMjAwIDg5LjUgMjAwIDIwMHpNMTYzLjQgMzA1LjVjODguNyAwIDEzNy4yLTczLjUgMTM3LjItMTM3LjIgMC0yLjEgMC00LjItLjEtNi4yIDkuNC02LjggMTcuNi0xNS4zIDI0LjEtMjUtOC42IDMuOC0xNy45IDYuNC0yNy43IDcuNiAxMC02IDE3LjYtMTUuNCAyMS4yLTI2LjctOS4zIDUuNS0xOS42IDkuNS0zMC42IDExLjctOC44LTkuNC0yMS4zLTE1LjItMzUuMi0xNS4yLTI2LjYgMC00OC4yIDIxLjYtNDguMiA0OC4yIDAgMy44LjQgNy41IDEuMyAxMS00MC4xLTItNzUuNi0yMS4yLTk5LjQtNTAuNC00LjEgNy4xLTYuNSAxNS40LTYuNSAyNC4yIDAgMTYuNyA4LjUgMzEuNSAyMS41IDQwLjEtNy45LS4yLTE1LjMtMi40LTIxLjgtNnYuNmMwIDIzLjQgMTYuNiA0Mi44IDM4LjcgNDcuMy00IDEuMS04LjMgMS43LTEyLjcgMS43LTMuMSAwLTYuMS0uMy05LjEtLjkgNi4xIDE5LjIgMjMuOSAzMy4xIDQ1IDMzLjUtMTYuNSAxMi45LTM3LjMgMjAuNi01OS45IDIwLjYtMy45IDAtNy43LS4yLTExLjUtLjcgMjEuMSAxMy44IDQ2LjUgMjEuOCA3My43IDIxLjgiIGZpbGw9IiNmZmYiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text{color:#b8e6ff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}'},function(e,t,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-media-form{display:flex;align-items:flex-start;flex-direction:row;flex-wrap:nowrap}.ck.ck-media-form .ck-labeled-field-view{display:inline-block}.ck.ck-media-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-media-form{flex-wrap:wrap}.ck.ck-media-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-media-form .ck-button{flex-basis:50%}}"},function(e,t,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .media{clear:both;margin:1em 0;display:block;min-width:15em}"},function(e,t,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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__action{border-top-right-radius:unset;border-bottom-right-radius:unset}[dir=rtl] .ck.ck-splitbutton>.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-radius:0}.ck-rounded-corners [dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow,[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow.ck-rounded-corners{border-radius:var(--ck-border-radius);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)}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-left-color:var(--ck-color-split-button-hover-border)}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-right-color:var(--ck-color-split-button-hover-border)}.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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .table{margin:1em 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}"},function(e,t,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-content .page-break{position:relative;clear:both;padding:5px 0;display:flex;align-items:center;justify-content:center}.ck-content .page-break:after{content:"";position:absolute;border-bottom:2px dashed #c4c4c4;width:100%}.ck-content .page-break__label{position:relative;z-index:1;padding:.3em .6em;display:block;text-transform:uppercase;border:1px solid #c4c4c4;border-radius:2px;font-family:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;font-size:.75em;font-weight:700;color:#333;background:#fff;box-shadow:2px 2px 1px rgba(0,0,0,.15);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media print{.ck-content .page-break{padding:0}.ck-content .page-break:after{display:none}}'},function(e,t,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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){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,o){var i=o(1),n=o(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};i(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,o){var i=o(1),n=o(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};i(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,o){"use strict";o.r(t),o.d(t,"default",(function(){return L_}));var i=o(3),n=i.a.Symbol,r=Object.prototype,s=r.hasOwnProperty,a=r.toString,l=n?n.toStringTag:void 0;var c=function(e){var t=s.call(e,l),o=e[l];try{e[l]=void 0;var i=!0}catch(e){}var n=a.call(e);return i&&(t?e[l]=o:delete e[l]),n},d=Object.prototype.toString;var u=function(e){return d.call(e)},h=n?n.toStringTag:void 0;var f=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":h&&h in Object(e)?c(e):u(e)};var m=function(e,t){return function(o){return e(t(o))}},g=m(Object.getPrototypeOf,Object);var p=function(e){return null!=e&&"object"==typeof e},b=Function.prototype,w=Object.prototype,k=b.toString,_=w.hasOwnProperty,v=k.call(Object);var y=function(e){if(!p(e)||"[object Object]"!=f(e))return!1;var t=g(e);if(null===t)return!0;var o=_.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&k.call(o)==v};var x=function(){this.__data__=[],this.size=0};var C=function(e,t){return e===t||e!=e&&t!=t};var A=function(e,t){for(var o=e.length;o--;)if(C(e[o][0],t))return o;return-1},T=Array.prototype.splice;var S=function(e){var t=this.__data__,o=A(t,e);return!(o<0)&&(o==t.length-1?t.pop():T.call(t,o,1),--this.size,!0)};var E=function(e){var t=this.__data__,o=A(t,e);return o<0?void 0:t[o][1]};var P=function(e){return A(this.__data__,e)>-1};var M=function(e,t){var o=this.__data__,i=A(o,e);return i<0?(++this.size,o.push([e,t])):o[i][1]=t,this};function I(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var i=e[t];this.set(i[0],i[1])}}I.prototype.clear=x,I.prototype.delete=S,I.prototype.get=E,I.prototype.has=P,I.prototype.set=M;var N=I;var R=function(){this.__data__=new N,this.size=0};var O=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o};var V=function(e){return this.__data__.get(e)};var L=function(e){return this.__data__.has(e)};var D=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var z,B=function(e){if(!D(e))return!1;var t=f(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},j=i.a["__core-js_shared__"],F=(z=/[^.]+$/.exec(j&&j.keys&&j.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"";var H=function(e){return!!F&&F in e},U=Function.prototype.toString;var W=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""},q=/^\[object .+?Constructor\]$/,$=Function.prototype,G=Object.prototype,Y=$.toString,K=G.hasOwnProperty,Q=RegExp("^"+Y.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var J=function(e){return!(!D(e)||H(e))&&(B(e)?Q:q).test(W(e))};var Z=function(e,t){return null==e?void 0:e[t]};var X=function(e,t){var o=Z(e,t);return J(o)?o:void 0},ee=X(i.a,"Map"),te=X(Object,"create");var oe=function(){this.__data__=te?te(null):{},this.size=0};var ie=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne=Object.prototype.hasOwnProperty;var re=function(e){var t=this.__data__;if(te){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return ne.call(t,e)?t[e]:void 0},se=Object.prototype.hasOwnProperty;var ae=function(e){var t=this.__data__;return te?void 0!==t[e]:se.call(t,e)};var le=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=te&&void 0===t?"__lodash_hash_undefined__":t,this};function ce(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var i=e[t];this.set(i[0],i[1])}}ce.prototype.clear=oe,ce.prototype.delete=ie,ce.prototype.get=re,ce.prototype.has=ae,ce.prototype.set=le;var de=ce;var ue=function(){this.size=0,this.__data__={hash:new de,map:new(ee||N),string:new de}};var he=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var fe=function(e,t){var o=e.__data__;return he(t)?o["string"==typeof t?"string":"hash"]:o.map};var me=function(e){var t=fe(this,e).delete(e);return this.size-=t?1:0,t};var ge=function(e){return fe(this,e).get(e)};var pe=function(e){return fe(this,e).has(e)};var be=function(e,t){var o=fe(this,e),i=o.size;return o.set(e,t),this.size+=o.size==i?0:1,this};function we(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var i=e[t];this.set(i[0],i[1])}}we.prototype.clear=ue,we.prototype.delete=me,we.prototype.get=ge,we.prototype.has=pe,we.prototype.set=be;var ke=we;var _e=function(e,t){var o=this.__data__;if(o instanceof N){var i=o.__data__;if(!ee||i.length<199)return i.push([e,t]),this.size=++o.size,this;o=this.__data__=new ke(i)}return o.set(e,t),this.size=o.size,this};function ve(e){var t=this.__data__=new N(e);this.size=t.size}ve.prototype.clear=R,ve.prototype.delete=O,ve.prototype.get=V,ve.prototype.has=L,ve.prototype.set=_e;var ye=ve;var xe=function(e,t){for(var o=-1,i=null==e?0:e.length;++o<i&&!1!==t(e[o],o,e););return e},Ce=function(){try{var e=X(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Ae=function(e,t,o){"__proto__"==t&&Ce?Ce(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o},Te=Object.prototype.hasOwnProperty;var Se=function(e,t,o){var i=e[t];Te.call(e,t)&&C(i,o)&&(void 0!==o||t in e)||Ae(e,t,o)};var Ee=function(e,t,o,i){var n=!o;o||(o={});for(var r=-1,s=t.length;++r<s;){var a=t[r],l=i?i(o[a],e[a],a,o,e):void 0;void 0===l&&(l=e[a]),n?Ae(o,a,l):Se(o,a,l)}return o};var Pe=function(e,t){for(var o=-1,i=Array(e);++o<e;)i[o]=t(o);return i};var Me=function(e){return p(e)&&"[object Arguments]"==f(e)},Ie=Object.prototype,Ne=Ie.hasOwnProperty,Re=Ie.propertyIsEnumerable,Oe=Me(function(){return arguments}())?Me:function(e){return p(e)&&Ne.call(e,"callee")&&!Re.call(e,"callee")},Ve=Array.isArray,Le=o(4),De=/^(?:0|[1-9]\d*)$/;var ze=function(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&De.test(e))&&e>-1&&e%1==0&&e<t};var Be=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},je={};je["[object Float32Array]"]=je["[object Float64Array]"]=je["[object Int8Array]"]=je["[object Int16Array]"]=je["[object Int32Array]"]=je["[object Uint8Array]"]=je["[object Uint8ClampedArray]"]=je["[object Uint16Array]"]=je["[object Uint32Array]"]=!0,je["[object Arguments]"]=je["[object Array]"]=je["[object ArrayBuffer]"]=je["[object Boolean]"]=je["[object DataView]"]=je["[object Date]"]=je["[object Error]"]=je["[object Function]"]=je["[object Map]"]=je["[object Number]"]=je["[object Object]"]=je["[object RegExp]"]=je["[object Set]"]=je["[object String]"]=je["[object WeakMap]"]=!1;var Fe=function(e){return p(e)&&Be(e.length)&&!!je[f(e)]};var He=function(e){return function(t){return e(t)}},Ue=o(5),We=Ue.a&&Ue.a.isTypedArray,qe=We?He(We):Fe,$e=Object.prototype.hasOwnProperty;var Ge=function(e,t){var o=Ve(e),i=!o&&Oe(e),n=!o&&!i&&Object(Le.a)(e),r=!o&&!i&&!n&&qe(e),s=o||i||n||r,a=s?Pe(e.length,String):[],l=a.length;for(var c in e)!t&&!$e.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ze(c,l))||a.push(c);return a},Ye=Object.prototype;var Ke=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ye)},Qe=m(Object.keys,Object),Je=Object.prototype.hasOwnProperty;var Ze=function(e){if(!Ke(e))return Qe(e);var t=[];for(var o in Object(e))Je.call(e,o)&&"constructor"!=o&&t.push(o);return t};var Xe=function(e){return null!=e&&Be(e.length)&&!B(e)};var et=function(e){return Xe(e)?Ge(e):Ze(e)};var tt=function(e,t){return e&&Ee(t,et(t),e)};var ot=function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t},it=Object.prototype.hasOwnProperty;var nt=function(e){if(!D(e))return ot(e);var t=Ke(e),o=[];for(var i in e)("constructor"!=i||!t&&it.call(e,i))&&o.push(i);return o};var rt=function(e){return Xe(e)?Ge(e,!0):nt(e)};var st=function(e,t){return e&&Ee(t,rt(t),e)},at=o(9);var lt=function(e,t){var o=-1,i=e.length;for(t||(t=Array(i));++o<i;)t[o]=e[o];return t};var ct=function(e,t){for(var o=-1,i=null==e?0:e.length,n=0,r=[];++o<i;){var s=e[o];t(s,o,e)&&(r[n++]=s)}return r};var dt=function(){return[]},ut=Object.prototype.propertyIsEnumerable,ht=Object.getOwnPropertySymbols,ft=ht?function(e){return null==e?[]:(e=Object(e),ct(ht(e),(function(t){return ut.call(e,t)})))}:dt;var mt=function(e,t){return Ee(e,ft(e),t)};var gt=function(e,t){for(var o=-1,i=t.length,n=e.length;++o<i;)e[n+o]=t[o];return e},pt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)gt(t,ft(e)),e=g(e);return t}:dt;var bt=function(e,t){return Ee(e,pt(e),t)};var wt=function(e,t,o){var i=t(e);return Ve(e)?i:gt(i,o(e))};var kt=function(e){return wt(e,et,ft)};var _t=function(e){return wt(e,rt,pt)},vt=X(i.a,"DataView"),yt=X(i.a,"Promise"),xt=X(i.a,"Set"),Ct=X(i.a,"WeakMap"),At=W(vt),Tt=W(ee),St=W(yt),Et=W(xt),Pt=W(Ct),Mt=f;(vt&&"[object DataView]"!=Mt(new vt(new ArrayBuffer(1)))||ee&&"[object Map]"!=Mt(new ee)||yt&&"[object Promise]"!=Mt(yt.resolve())||xt&&"[object Set]"!=Mt(new xt)||Ct&&"[object WeakMap]"!=Mt(new Ct))&&(Mt=function(e){var t=f(e),o="[object Object]"==t?e.constructor:void 0,i=o?W(o):"";if(i)switch(i){case At:return"[object DataView]";case Tt:return"[object Map]";case St:return"[object Promise]";case Et:return"[object Set]";case Pt:return"[object WeakMap]"}return t});var It=Mt,Nt=Object.prototype.hasOwnProperty;var Rt=function(e){var t=e.length,o=new e.constructor(t);return t&&"string"==typeof e[0]&&Nt.call(e,"index")&&(o.index=e.index,o.input=e.input),o},Ot=i.a.Uint8Array;var Vt=function(e){var t=new e.constructor(e.byteLength);return new Ot(t).set(new Ot(e)),t};var Lt=function(e,t){var o=t?Vt(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)},Dt=/\w*$/;var zt=function(e){var t=new e.constructor(e.source,Dt.exec(e));return t.lastIndex=e.lastIndex,t},Bt=n?n.prototype:void 0,jt=Bt?Bt.valueOf:void 0;var Ft=function(e){return jt?Object(jt.call(e)):{}};var Ht=function(e,t){var o=t?Vt(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)};var Ut=function(e,t,o){var i=e.constructor;switch(t){case"[object ArrayBuffer]":return Vt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return Lt(e,o);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 Ht(e,o);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return zt(e);case"[object Set]":return new i;case"[object Symbol]":return Ft(e)}},Wt=Object.create,qt=function(){function e(){}return function(t){if(!D(t))return{};if(Wt)return Wt(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}();var $t=function(e){return"function"!=typeof e.constructor||Ke(e)?{}:qt(g(e))};var Gt=function(e){return p(e)&&"[object Map]"==It(e)},Yt=Ue.a&&Ue.a.isMap,Kt=Yt?He(Yt):Gt;var Qt=function(e){return p(e)&&"[object Set]"==It(e)},Jt=Ue.a&&Ue.a.isSet,Zt=Jt?He(Jt):Qt,Xt={};Xt["[object Arguments]"]=Xt["[object Array]"]=Xt["[object ArrayBuffer]"]=Xt["[object DataView]"]=Xt["[object Boolean]"]=Xt["[object Date]"]=Xt["[object Float32Array]"]=Xt["[object Float64Array]"]=Xt["[object Int8Array]"]=Xt["[object Int16Array]"]=Xt["[object Int32Array]"]=Xt["[object Map]"]=Xt["[object Number]"]=Xt["[object Object]"]=Xt["[object RegExp]"]=Xt["[object Set]"]=Xt["[object String]"]=Xt["[object Symbol]"]=Xt["[object Uint8Array]"]=Xt["[object Uint8ClampedArray]"]=Xt["[object Uint16Array]"]=Xt["[object Uint32Array]"]=!0,Xt["[object Error]"]=Xt["[object Function]"]=Xt["[object WeakMap]"]=!1;var eo=function e(t,o,i,n,r,s){var a,l=1&o,c=2&o,d=4&o;if(i&&(a=r?i(t,n,r,s):i(t)),void 0!==a)return a;if(!D(t))return t;var u=Ve(t);if(u){if(a=Rt(t),!l)return lt(t,a)}else{var h=It(t),f="[object Function]"==h||"[object GeneratorFunction]"==h;if(Object(Le.a)(t))return Object(at.a)(t,l);if("[object Object]"==h||"[object Arguments]"==h||f&&!r){if(a=c||f?{}:$t(t),!l)return c?bt(t,st(a,t)):mt(t,tt(a,t))}else{if(!Xt[h])return r?t:{};a=Ut(t,h,l)}}s||(s=new ye);var m=s.get(t);if(m)return m;s.set(t,a),Zt(t)?t.forEach((function(n){a.add(e(n,o,i,n,t,s))})):Kt(t)&&t.forEach((function(n,r){a.set(r,e(n,o,i,r,t,s))}));var g=u?void 0:(d?c?_t:kt:c?rt:et)(t);return xe(g||t,(function(n,r){g&&(n=t[r=n]),Se(a,r,e(n,o,i,r,t,s))})),a};var to=function(e,t){return eo(e,5,t="function"==typeof t?t:void 0)};var oo=function(e){return p(e)&&1===e.nodeType&&!y(e)};class io{constructor(e,t){this._config={},t&&this.define(no(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,o,i=!1){if(y(t))return void this._setObjectToTarget(e,t,i);const n=t.split(".");t=n.pop();for(const t of n)y(e[t])||(e[t]={}),e=e[t];if(y(o))return y(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,o,i);i&&void 0!==e[t]||(e[t]=o)}_getFromSource(e,t){const o=t.split(".");t=o.pop();for(const t of o){if(!y(e[t])){e=null;break}e=e[t]}return e?no(e[t]):void 0}_setObjectToTarget(e,t,o){Object.keys(t).forEach(i=>{this._setToTarget(e,i,t[i],o)})}}function no(e){return to(e,ro)}function ro(e){return oo(e)?e:void 0}var so=function(){return function e(){e.called=!0}};class ao{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=so(),this.off=so()}}const lo=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function co(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0,i=4294967296*Math.random()>>>0;return"e"+lo[e>>0&255]+lo[e>>8&255]+lo[e>>16&255]+lo[e>>24&255]+lo[t>>0&255]+lo[t>>8&255]+lo[t>>16&255]+lo[t>>24&255]+lo[o>>0&255]+lo[o>>8&255]+lo[o>>16&255]+lo[o>>24&255]+lo[i>>0&255]+lo[i>>8&255]+lo[i>>16&255]+lo[i>>24&255]}var uo={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},ho=(o(6),o(0));const fo=Symbol("listeningTo"),mo=Symbol("emitterId");var go={on(e,t,o={}){this.listenTo(this,e,t,o)},once(e,t,o){let i=!1;this.listenTo(this,e,(function(e,...o){i||(i=!0,e.off(),t.call(this,e,...o))}),o)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,o,i={}){let n,r;this[fo]||(this[fo]={});const s=this[fo];bo(e)||po(e);const a=bo(e);(n=s[a])||(n=s[a]={emitter:e,callbacks:{}}),(r=n.callbacks[t])||(r=n.callbacks[t]=[]),r.push(o),function(e,t){const o=wo(e);if(o[t])return;let i=t,n=null;const r=[];for(;""!==i&&!o[i];)o[i]={callbacks:[],childEvents:[]},r.push(o[i]),n&&o[i].childEvents.push(n),n=i,i=i.substr(0,i.lastIndexOf(":"));if(""!==i){for(const e of r)e.callbacks=o[i].callbacks.slice();o[i].childEvents.push(n)}}(e,t);const l=ko(e,t),c=uo.get(i.priority),d={callback:o,priority:c};for(const e of l){let t=!1;for(let o=0;o<e.length;o++)if(e[o].priority<c){e.splice(o,0,d),t=!0;break}t||e.push(d)}},stopListening(e,t,o){const i=this[fo];let n=e&&bo(e);const r=i&&n&&i[n],s=r&&t&&r.callbacks[t];if(!(!i||e&&!r||t&&!s))if(o){vo(e,t,o);-1!==s.indexOf(o)&&(1===s.length?delete r.callbacks[t]:vo(e,t,o))}else if(s){for(;o=s.pop();)vo(e,t,o);delete r.callbacks[t]}else if(r){for(t in r.callbacks)this.stopListening(e,t);delete i[n]}else{for(n in i)this.stopListening(i[n].emitter);delete this[fo]}},fire(e,...t){try{const o=e instanceof ao?e:new ao(this,e),i=o.name;let n=function e(t,o){let i;if(!t._events||!(i=t._events[o])||!i.callbacks.length)return o.indexOf(":")>-1?e(t,o.substr(0,o.lastIndexOf(":"))):null;return i.callbacks}(this,i);if(o.path.push(this),n){const e=[o,...t];n=Array.from(n);for(let t=0;t<n.length&&(n[t].callback.apply(this,e),o.off.called&&(delete o.off.called,vo(this,i,n[t].callback)),!o.stop.called);t++);}if(this._delegations){const e=this._delegations.get(i),n=this._delegations.get("*");e&&_o(e,o,t),n&&_o(n,o,t)}return o.return}catch(e){ho.a.rethrowUnexpectedError(e,this)}},delegate(...e){return{to:(t,o)=>{this._delegations||(this._delegations=new Map),e.forEach(e=>{const i=this._delegations.get(e);i?i.set(t,o):this._delegations.set(e,new Map([[t,o]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const o=this._delegations.get(e);o&&o.delete(t)}else this._delegations.delete(e);else this._delegations.clear()}};function po(e,t){e[mo]||(e[mo]=t||co())}function bo(e){return e[mo]}function wo(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function ko(e,t){const o=wo(e)[t];if(!o)return[];let i=[o.callbacks];for(let t=0;t<o.childEvents.length;t++){const n=ko(e,o.childEvents[t]);i=i.concat(n)}return i}function _o(e,t,o){for(let[i,n]of e){n?"function"==typeof n&&(n=n(t.name)):n=t.name;const e=new ao(t.source,n);e.path=[...t.path],i.fire(e,...o)}}function vo(e,t,o){const i=ko(e,t);for(const e of i)for(let t=0;t<e.length;t++)e[t].callback==o&&(e.splice(t,1),t--)}function yo(e){return!(!e||!e[Symbol.iterator])}function xo(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(o=>{if(o in e.prototype)return;const i=Object.getOwnPropertyDescriptor(t,o);i.enumerable=!1,Object.defineProperty(e.prototype,o,i)})})}class Co{constructor(e={},t={}){const o=yo(e);if(o||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],o)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 ho.a("collection-add-item-invalid-index",this);for(let o=0;o<e.length;o++){const i=e[o],n=this._getItemIdBeforeAdding(i),r=t+o;this._items.splice(r,0,i),this._itemMap.set(n,i),this.fire("add",i,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 ho.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,o]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:o}),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 ho.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,o=(o,i,n)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(i);if(r&&s)this._bindToExternalToInternalMap.set(i,s),this._bindToInternalToExternalMap.set(s,i);else{const o=e(i);if(!o)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(i,o),this._bindToInternalToExternalMap.set(o,i),this.add(o,r);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)r<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)o(0,e,t.getIndex(e));this.listenTo(t,"add",o),this.listenTo(t,"remove",(e,t,o)=>{const i=this._bindToExternalToInternalMap.get(t);i&&this.remove(i),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(o<t&&e.push(t-1),o>t&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let o;if(t in e){if(o=e[t],"string"!=typeof o)throw new ho.a("collection-add-invalid-id",this);if(this.get(o))throw new ho.a("collection-add-item-already-exists",this)}else e[t]=o=co();return o}_remove(e){let t,o,i,n=!1;const r=this._idProperty;if("string"==typeof e?(o=e,i=this._itemMap.get(o),n=!i,i&&(t=this._items.indexOf(i))):"number"==typeof e?(t=e,i=this._items[t],n=!i,i&&(o=i[r])):(i=e,o=i[r],t=this._items.indexOf(i),n=-1==t||!this._itemMap.get(o)),n)throw new ho.a("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(o);const s=this._bindToInternalToExternalMap.get(i);return this._bindToInternalToExternalMap.delete(i),this._bindToExternalToInternalMap.delete(s),this.fire("remove",i,t),[i,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}xo(Co,go);class Ao{constructor(e,t=[],o=[]){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 o)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 ho.a("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[]){const o=this,i=this._context,n=new Set,r=[],s=h(e),a=h(t),l=function(e){const t=[];for(const o of e)u(o)||t.push(o);return t.length?t:null}(e);if(l){const e="plugincollection-plugin-not-found";return Object(ho.b)(e,{plugins:l}),Promise.reject(new ho.a(e,i,{plugins:l}))}return Promise.all(s.map(c)).then(()=>d(r,"init")).then(()=>d(r,"afterInit")).then(()=>r);function c(e){if(!a.includes(e)&&!o._plugins.has(e)&&!n.has(e))return function(e){return new Promise(s=>{n.add(e),e.requires&&e.requires.forEach(o=>{const n=u(o);if(e.isContextPlugin&&!n.isContextPlugin)throw new ho.a("plugincollection-context-required",null,{plugin:n.name,requiredBy:e.name});if(t.includes(n))throw new ho.a("plugincollection-required",i,{plugin:n.name,requiredBy:e.name});c(n)});const a=o._contextPlugins.get(e)||new e(i);o._add(e,a),r.push(a),s()})}(e).catch(t=>{throw Object(ho.b)("plugincollection-load",{plugin:e}),t})}function d(e,t){return e.reduce((e,i)=>i[t]?o._contextPlugins.has(i)?e:e.then(i[t].bind(i)):e,Promise.resolve())}function u(e){return"function"==typeof e?e:o._availablePlugins.get(e)}function h(e){return e.map(e=>u(e)).filter(e=>!!e)}}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 o=e.pluginName;if(o){if(this._plugins.has(o))throw new ho.a("plugincollection-plugin-name-conflict",null,{pluginName:o,plugin1:this._plugins.get(o).constructor,plugin2:e});this._plugins.set(o,t)}}}function To(e){return Array.isArray(e)?e:[e]}function So(e,t,o=1){if("number"!=typeof o)throw new ho.a("translation-service-quantity-not-a-number",null,{quantity:o});const i=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===i&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const n=t.id||t.string;if(0===i||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,n))return 1!==o?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(o));return r[n][a]}xo(Ao,go),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const Eo=["ar","fa","he","ku","ug"];class Po{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=Mo(this.uiLanguage),this.contentLanguageDirection=Mo(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 o=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,o)=>o<t.length?t[o]:e)}(So(this.uiLanguage,e,o),t)}}function Mo(e){return Eo.includes(e)?"rtl":"ltr"}class Io{constructor(e){this.config=new io(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new Ao(this,t);const o=this.config.get("language")||{};this.locale=new Po({uiLanguage:"string"==typeof o?o:o.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new Co,this._contextOwner=null}initPlugins(){const e=this.config.get("plugins")||[];for(const t of e){if("function"!=typeof t)throw new ho.a("context-initplugins-constructor-only",null,{Plugin:t});if(!0!==t.isContextPlugin)throw new ho.a("context-initplugins-invalid-plugin",null,{Plugin:t})}return this.plugins.init(e)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new ho.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 o=new this(e);t(o.initPlugins().then(()=>o))})}}function No(e,t){const o=Math.min(e.length,t.length);for(let i=0;i<o;i++)if(e[i]!=t[i])return i;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}var Ro=function(e){return eo(e,4)};class Oo{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 ho.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 o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),i=e.getAncestors(t);let n=0;for(;o[n]==i[n]&&o[n];)n++;return 0===n?null:o[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),i=No(t,o);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<o[i]}}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=Ro(this);return delete e.parent,e}is(e){return"node"===e||"view:node"===e}}xo(Oo,go);class Vo extends Oo{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 Vo&&(this===e||this.data===e.data)}_clone(){return new Vo(this.document,this.data)}}class Lo{constructor(e,t,o){if(this.textNode=e,t<0||t>e.data.length)throw new ho.a("view-textproxy-wrong-offsetintext",this);if(o<0||t+o>e.data.length)throw new ho.a("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+o),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 o=e.includeSelf?this.textNode:this.parent;for(;null!==o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}}function Do(e){return yo(e)?new Map(e):function(e){const t=new Map;for(const o in e)t.set(o,e[o]);return t}(e)}class zo{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),t.classes&&("string"==typeof t.classes||t.classes instanceof RegExp)&&(t.classes=[t.classes]),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const o=Bo(t,e);if(o)return{element:t,pattern:e,match:o}}return null}matchAll(...e){const t=[];for(const o of e)for(const e of this._patterns){const i=Bo(o,e);i&&t.push({element:o,pattern:e,match:i})}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 Bo(e,t){if("function"==typeof t)return t(e);const o={};return t.name&&(o.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!o.name)||t.attributes&&(o.attributes=function(e,t){const o=[];for(const i in e){const n=e[i];if(!t.hasAttribute(i))return null;{const e=t.getAttribute(i);if(!0===n)o.push(i);else if(n instanceof RegExp){if(!n.test(e))return null;o.push(i)}else{if(e!==n)return null;o.push(i)}}}return o}(t.attributes,e),!o.attributes)?null:!(t.classes&&(o.classes=function(e,t){const o=[];for(const i of e)if(i instanceof RegExp){const e=t.getClassNames();for(const t of e)i.test(t)&&o.push(t);if(0===o.length)return null}else{if(!t.hasClass(i))return null;o.push(i)}return o}(t.classes,e),!o.classes))&&(!(t.styles&&(o.styles=function(e,t){const o=[];for(const i in e){const n=e[i];if(!t.hasStyle(i))return null;{const e=t.getStyle(i);if(n instanceof RegExp){if(!n.test(e))return null;o.push(i)}else{if(e!==n)return null;o.push(i)}}}return o}(t.styles,e),!o.styles))&&o)}var jo=function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==f(e)},Fo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ho=/^\w*$/;var Uo=function(e,t){if(Ve(e))return!1;var o=typeof e;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=e&&!jo(e))||(Ho.test(e)||!Fo.test(e)||null!=t&&e in Object(t))};function Wo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var o=function(){var i=arguments,n=t?t.apply(this,i):i[0],r=o.cache;if(r.has(n))return r.get(n);var s=e.apply(this,i);return o.cache=r.set(n,s)||r,s};return o.cache=new(Wo.Cache||ke),o}Wo.Cache=ke;var qo=Wo;var $o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Go=/\\(\\)?/g,Yo=function(e){var t=qo(e,(function(e){return 500===o.size&&o.clear(),e})),o=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($o,(function(e,o,i,n){t.push(i?n.replace(Go,"$1"):o||e)})),t}));var Ko=function(e,t){for(var o=-1,i=null==e?0:e.length,n=Array(i);++o<i;)n[o]=t(e[o],o,e);return n},Qo=n?n.prototype:void 0,Jo=Qo?Qo.toString:void 0;var Zo=function e(t){if("string"==typeof t)return t;if(Ve(t))return Ko(t,e)+"";if(jo(t))return Jo?Jo.call(t):"";var o=t+"";return"0"==o&&1/t==-1/0?"-0":o};var Xo=function(e){return null==e?"":Zo(e)};var ei=function(e,t){return Ve(e)?e:Uo(e,t)?[e]:Yo(Xo(e))};var ti=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var oi=function(e){if("string"==typeof e||jo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var ii=function(e,t){for(var o=0,i=(t=ei(t,e)).length;null!=e&&o<i;)e=e[oi(t[o++])];return o&&o==i?e:void 0};var ni=function(e,t,o){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(o=o>n?n:o)<0&&(o+=n),n=t>o?0:o-t>>>0,t>>>=0;for(var r=Array(n);++i<n;)r[i]=e[i+t];return r};var ri=function(e,t){return t.length<2?e:ii(e,ni(t,0,-1))};var si=function(e,t){return t=ei(t,e),null==(e=ri(e,t))||delete e[oi(ti(t))]};var ai=function(e,t){return null==e||si(e,t)};var li=function(e,t,o){var i=null==e?void 0:ii(e,t);return void 0===i?o:i};var ci=function(e,t,o){(void 0!==o&&!C(e[t],o)||void 0===o&&!(t in e))&&Ae(e,t,o)};var di=function(e){return function(t,o,i){for(var n=-1,r=Object(t),s=i(t),a=s.length;a--;){var l=s[e?a:++n];if(!1===o(r[l],l,r))break}return t}}();var ui=function(e){return p(e)&&Xe(e)};var hi=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var fi=function(e){return Ee(e,rt(e))};var mi=function(e,t,o,i,n,r,s){var a=hi(e,o),l=hi(t,o),c=s.get(l);if(c)ci(e,o,c);else{var d=r?r(a,l,o+"",e,t,s):void 0,u=void 0===d;if(u){var h=Ve(l),f=!h&&Object(Le.a)(l),m=!h&&!f&&qe(l);d=l,h||f||m?Ve(a)?d=a:ui(a)?d=lt(a):f?(u=!1,d=Object(at.a)(l,!0)):m?(u=!1,d=Ht(l,!0)):d=[]:y(l)||Oe(l)?(d=a,Oe(a)?d=fi(a):D(a)&&!B(a)||(d=$t(l))):u=!1}u&&(s.set(l,d),n(d,l,i,r,s),s.delete(l)),ci(e,o,d)}};var gi=function e(t,o,i,n,r){t!==o&&di(o,(function(s,a){if(r||(r=new ye),D(s))mi(t,o,a,i,e,n,r);else{var l=n?n(hi(t,a),s,a+"",t,o,r):void 0;void 0===l&&(l=s),ci(t,a,l)}}),rt)};var pi=function(e){return e};var bi=function(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)},wi=Math.max;var ki=function(e,t,o){return t=wi(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,r=wi(i.length-t,0),s=Array(r);++n<r;)s[n]=i[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=i[n];return a[t]=o(s),bi(e,this,a)}};var _i=function(e){return function(){return e}},vi=Ce?function(e,t){return Ce(e,"toString",{configurable:!0,enumerable:!1,value:_i(t),writable:!0})}:pi,yi=Date.now;var xi=function(e){var t=0,o=0;return function(){var i=yi(),n=16-(i-o);if(o=i,n>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(vi);var Ci=function(e,t){return xi(ki(e,t,pi),e+"")};var Ai=function(e,t,o){if(!D(o))return!1;var i=typeof t;return!!("number"==i?Xe(o)&&ze(t,o.length):"string"==i&&t in o)&&C(o[t],e)};var Ti=function(e){return Ci((function(t,o){var i=-1,n=o.length,r=n>1?o[n-1]:void 0,s=n>2?o[2]:void 0;for(r=e.length>3&&"function"==typeof r?(n--,r):void 0,s&&Ai(o[0],o[1],s)&&(r=n<3?void 0:r,n=1),t=Object(t);++i<n;){var a=o[i];a&&e(t,a,i,r)}return t}))},Si=Ti((function(e,t,o){gi(e,t,o)}));var Ei=function(e,t,o,i){if(!D(e))return e;for(var n=-1,r=(t=ei(t,e)).length,s=r-1,a=e;null!=a&&++n<r;){var l=oi(t[n]),c=o;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(n!=s){var d=a[l];void 0===(c=i?i(d,l,a):void 0)&&(c=D(d)?d:ze(t[n+1])?[]:{})}Se(a,l,c),a=a[l]}return e};var Pi=function(e,t,o){return null==e?e:Ei(e,t,o)};class Mi{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,o=0,i=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(o,s-o),i=s+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(i,s-i);n&&r.set(n.trim(),t.trim()),n=null,o=s+1;break}}else a===t&&(t=null)}return r}(e).entries());for(const[e,o]of t)this._styleProcessor.toNormalizedForm(e,o,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(D(e))for(const[t,o]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,o,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=Ni(e);ai(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]&&!D(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(){if(this.isEmpty)return[];return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const o of t)e.push(...this._styleProcessor.getReducedForm(o,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const o=t.splice(0,t.length-1).join("."),i=li(this._styles,o);if(!i)return;!Array.from(Object.keys(i)).length&&this.remove(o)}}class Ii{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,o){if(D(t))Ri(o,Ni(e),t);else if(this._normalizers.has(e)){const i=this._normalizers.get(e),{path:n,value:r}=i(t);Ri(o,n,r)}else Ri(o,e,t)}getNormalized(e,t){if(!e)return Si({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const o=this._extractors.get(e);if("string"==typeof o)return li(t,o);const i=o(e,t);if(i)return i}return li(t,Ni(e))}getReducedForm(e,t){const o=this.getNormalized(e,t);if(void 0===o)return[];if(this._reducers.has(e)){return this._reducers.get(e)(o)}return[[e,o]]}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 o of t)this._mapStyleNames(o,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function Ni(e){return e.replace("-",".")}function Ri(e,t,o){let i=o;D(o)&&(i=Si({},li(e,t),o)),Pi(e,t,i)}class Oi extends Oo{constructor(e,t,o,i){if(super(e),this.name=t,this._attrs=function(e){e=Do(e);for(const[t,o]of e)null===o?e.delete(t):"string"!=typeof o&&e.set(t,String(o));return e}(o),this._children=[],i&&this._insertChild(0,i),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");Vi(this._classes,e),this._attrs.delete("class")}this._styles=new Mi(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}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 Oi))return!1;if(this===e)return!0;if(this.name!=e.name)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,o]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==o)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(){return this._styles.getStyleNames()}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new zo(...e);let o=this.parent;for(;o;){if(t.match(o))return o;o=o.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(),o=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==o?"":" "+o)}_clone(e=!1){const t=[];if(e)for(const o of this.getChildren())t.push(o._clone(e));const o=new this.constructor(this.document,this.name,this._attrs,t);return o._classes=new Set(this._classes),o._styles.set(this._styles.getNormalized()),o._customProperties=new Map(this._customProperties),o.getFillerOffset=this.getFillerOffset,o}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let o=0;const i=function(e,t){if("string"==typeof t)return[new Vo(e,t)];yo(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Vo(e,t):t instanceof Lo?new Vo(e,t.data):t)}(this.document,t);for(const t of i)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o<e+t;o++)this._children[o].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){t=String(t),this._fireChange("attributes",this),"class"==e?Vi(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 Vi(e,t){const o=t.split(/\s+/);e.clear(),o.forEach(t=>e.add(t))}class Li extends Oi{constructor(e,t,o,i){super(e,t,o,i),this.getFillerOffset=Di}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 Di(){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}var zi=Ti((function(e,t){Ee(t,rt(t),e)}));const Bi=Symbol("observableProperties"),ji=Symbol("boundObservables"),Fi=Symbol("boundProperties"),Hi={set(e,t){if(D(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);Wi(this);const o=this[Bi];if(e in this&&!o.has(e))throw new ho.a("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>o.get(e),set(t){const i=o.get(e);let n=this.fire("set:"+e,e,t,i);void 0===n&&(n=t),i===n&&o.has(e)||(o.set(e,n),this.fire("change:"+e,e,n,i))}}),this[e]=t},bind(...e){if(!e.length||!Gi(e))throw new ho.a("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new ho.a("observable-bind-duplicate-properties",this);Wi(this);const t=this[Fi];e.forEach(e=>{if(t.has(e))throw new ho.a("observable-bind-rebind",this)});const o=new Map;return e.forEach(e=>{const i={property:e,to:[]};t.set(e,i),o.set(e,i)}),{to:qi,toMany:$i,_observable:this,_bindProperties:e,_to:[],_bindings:o}},unbind(...e){if(!this[Bi])return;const t=this[Fi],o=this[ji];if(e.length){if(!Gi(e))throw new ho.a("observable-unbind-wrong-properties",this);e.forEach(e=>{const i=t.get(e);if(!i)return;let n,r,s,a;i.to.forEach(e=>{n=e[0],r=e[1],s=o.get(n),a=s[r],a.delete(i),a.size||delete s[r],Object.keys(s).length||(o.delete(n),this.stopListening(n,"change"))}),t.delete(e)})}else o.forEach((e,t)=>{this.stopListening(t,"change")}),o.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new ho.a("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(e,o)=>{e.return=t.apply(this,o)}),this[e]=function(...t){return this.fire(e,t)}}};zi(Hi,go);var Ui=Hi;function Wi(e){e[Bi]||(Object.defineProperty(e,Bi,{value:new Map}),Object.defineProperty(e,ji,{value:new Map}),Object.defineProperty(e,Fi,{value:new Map}))}function qi(...e){const t=function(...e){if(!e.length)throw new ho.a("observable-bind-to-parse-error",null);const t={to:[]};let o;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)o.properties.push(e);else{if("object"!=typeof e)throw new ho.a("observable-bind-to-parse-error",null);o={observable:e,properties:[]},t.to.push(o)}}),t}(...e),o=Array.from(this._bindings.keys()),i=o.length;if(!t.callback&&t.to.length>1)throw new ho.a("observable-bind-to-no-callback",this);if(i>1&&t.callback)throw new ho.a("observable-bind-to-extra-callback",this);var n;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==i)throw new ho.a("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(o[0]).callback=t.callback),n=this._observable,this._to.forEach(e=>{const t=n[ji];let o;t.get(e.observable)||n.listenTo(e.observable,"change",(i,r)=>{o=t.get(e.observable)[r],o&&o.forEach(e=>{Yi(n,e.property)})})}),function(e){let t;e._bindings.forEach((o,i)=>{e._to.forEach(n=>{t=n.properties[o.callback?0:e._bindProperties.indexOf(i)],o.to.push([n.observable,t]),function(e,t,o,i){const n=e[ji],r=n.get(o),s=r||{};s[i]||(s[i]=new Set);s[i].add(t),r||n.set(o,s)}(e._observable,o,n.observable,t)})})}(this),this._bindProperties.forEach(e=>{Yi(this._observable,e)})}function $i(e,t,o){if(this._bindings.size>1)throw new ho.a("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const o=e.map(e=>[e,t]);return Array.prototype.concat.apply([],o)}(e,t),o)}function Gi(e){return e.every(e=>"string"==typeof e)}function Yi(e,t){const o=e[Fi].get(t);let i;o.callback?i=o.callback.apply(e,o.to.map(e=>e[0][e[1]])):(i=o.to[0],i=i[0][i[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=i:e.set(t,i)}class Ki extends Li{constructor(e,t,o,i){super(e,t,o,i),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()}}xo(Ki,Ui);const Qi=Symbol("rootName");class Ji extends Ki{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(Qi)}set rootName(e){this._setCustomProperty(Qi,e)}set _name(e){this.name=e}}class Zi{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new ho.a("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new ho.a("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=Xi._createAt(e.startPosition):this.position=Xi._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,o,i;do{i=this.position,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this.position=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&e.offset===o.childCount)return{done:!0};if(o===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let i;if(o instanceof Vo){if(e.isAtEnd)return this.position=Xi._createAfter(o),this._next();i=o.data[e.offset]}else i=o.getChild(e.offset);if(i instanceof Oi)return this.shallow?e.offset++:e=new Xi(i,0),this.position=e,this._formatReturnValue("elementStart",i,t,e,1);if(i instanceof Vo){if(this.singleCharacters)return e=new Xi(i,0),this.position=e,this._next();{let o,n=i.data.length;return i==this._boundaryEndParent?(n=this.boundaries.end.offset,o=new Lo(i,0,n),e=Xi._createAfter(o)):(o=new Lo(i,0,i.data.length),e.offset++),this.position=e,this._formatReturnValue("text",o,t,e,n)}}if("string"==typeof i){let i;if(this.singleCharacters)i=1;else{i=(o===this._boundaryEndParent?this.boundaries.end.offset:o.data.length)-e.offset}const n=new Lo(o,e.offset,i);return e.offset+=i,this.position=e,this._formatReturnValue("text",n,t,e,i)}return e=Xi._createAfter(o),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",o,t,e)}_previous(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&0===e.offset)return{done:!0};if(o==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let i;if(o instanceof Vo){if(e.isAtStart)return this.position=Xi._createBefore(o),this._previous();i=o.data[e.offset-1]}else i=o.getChild(e.offset-1);if(i instanceof Oi)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",i,t,e,1)):(e=new Xi(i,i.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",i,t,e));if(i instanceof Vo){if(this.singleCharacters)return e=new Xi(i,i.data.length),this.position=e,this._previous();{let o,n=i.data.length;if(i==this._boundaryStartParent){const t=this.boundaries.start.offset;o=new Lo(i,t,i.data.length-t),n=o.data.length,e=Xi._createBefore(o)}else o=new Lo(i,0,i.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",o,t,e,n)}}if("string"==typeof i){let i;if(this.singleCharacters)i=1;else{const t=o===this._boundaryStartParent?this.boundaries.start.offset:0;i=e.offset-t}e.offset-=i;const n=new Lo(o,e.offset,i);return this.position=e,this._formatReturnValue("text",n,t,e,i)}return e=Xi._createBefore(o),this.position=e,this._formatReturnValue("elementStart",o,t,e,1)}_formatReturnValue(e,t,o,i,n){return t instanceof Lo&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?o=Xi._createAfter(t.textNode):(i=Xi._createAfter(t.textNode),this.position=i)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?o=Xi._createBefore(t.textNode):(i=Xi._createBefore(t.textNode),this.position=i))),{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:i,length:n}}}}class Xi{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 Ki);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=Xi._createAt(this),o=t.offset+e;return t.offset=o<0?0:o,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const o=new Zi(t);return o.skip(e),o.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),o=e.getAncestors();let i=0;for(;t[i]==o[i]&&t[i];)i++;return 0===i?null:t[i-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():[],o=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),o.push(e.offset);const i=No(t,o);switch(i){case"prefix":return"before";case"extension":return"after";default:return t[i]<o[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new Zi(e)}clone(){return new Xi(this.parent,this.offset)}static _createAt(e,t){if(e instanceof Xi)return new this(e.parent,e.offset);{const o=e;if("end"==t)t=o.is("$text")?o.data.length:o.childCount;else{if("before"==t)return this._createBefore(o);if("after"==t)return this._createAfter(o);if(0!==t&&!t)throw new ho.a("view-createpositionat-offset-required",o)}return new Xi(o,t)}}static _createAfter(e){if(e.is("$textProxy"))return new Xi(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new ho.a("view-position-after-root",e,{root:e});return new Xi(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new Xi(e.textNode,e.offsetInText);if(!e.parent)throw new ho.a("view-position-before-root",e,{root:e});return new Xi(e.parent,e.index)}}class en{constructor(e,t=null){this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Zi({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(tn,{direction:"backward"}),t=this.end.getLastMatchingPosition(tn);return e.parent.is("$text")&&e.isAtStart&&(e=Xi._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=Xi._createAfter(t.parent)),new en(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(tn);if(e.isAfter(this.end)||e.isEqual(this.end))return new en(e,e);let t=this.end.getLastMatchingPosition(tn,{direction:"backward"});const o=e.nodeAfter,i=t.nodeBefore;return o&&o.is("$text")&&(e=new Xi(o,0)),i&&i.is("$text")&&(t=new Xi(i,i.data.length)),new en(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 o=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return o&&i}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new en(this.start,e.start)),this.containsPosition(e.end)&&t.push(new en(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,o=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(o=e.end),new en(t,o)}return null}getWalker(e={}){return e.boundaries=this,new Zi(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 en(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Zi(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Zi(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,o,i){return new this(new Xi(e,t),new Xi(o,i))}static _createFromPositionAndShift(e,t){const o=e,i=e.getShiftedBy(t);return t>0?new this(o,i):new this(i,o)}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(Xi._createBefore(e),t)}}function tn(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function on(e){let t=0;for(const o of e)t++;return t}class nn{constructor(e=null,t,o){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,o)}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 o=!1;for(const i of e._ranges)if(t.isEqual(i)){o=!0;break}if(!o)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=on(this.getRanges());if(t!=on(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let o=!1;for(let i of e.getRanges())if(i=i.getTrimmed(),t.start.isEqual(i.start)&&t.end.isEqual(i.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,o){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof nn||e instanceof rn)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof en)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof Xi)this._setRanges([new en(e)]),this._setFakeOptions(t);else if(e instanceof Oo){const i=!!o&&!!o.backward;let n;if(void 0===t)throw new ho.a("view-selection-setto-required-second-parameter",this);n="in"==t?en._createIn(e):"on"==t?en._createOn(e):new en(Xi._createAt(e,t)),this._setRanges([n],i),this._setFakeOptions(o)}else{if(!yo(e))throw new ho.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 ho.a("view-selection-setfocus-no-ranges",this);const o=Xi._createAt(e,t);if("same"==o.compareWith(this.focus))return;const i=this.anchor;this._ranges.pop(),"before"==o.compareWith(i)?this._addRange(new en(o,i),!0):this._addRange(new en(i,o)),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 en))throw new ho.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 ho.a("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new en(e.start,e.end))}}xo(nn,go);class rn{constructor(e=null,t,o){this._selection=new nn,this._selection.delegate("change").to(this),this._selection.setTo(e,t,o)}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,o){this._selection.setTo(e,t,o)}_setFocus(e,t){this._selection.setFocus(e,t)}}xo(rn,go);class sn{constructor(e){this.selection=new rn,this.roots=new Co({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 o of this._postFixers)if(t=o(e),t)break}while(t)}}xo(sn,Ui);class an extends Oi{constructor(e,t,o,i){super(e,t,o,i),this.getFillerOffset=ln,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 ho.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 ln(){if(cn(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(cn(e)>1)return null;e=e.parent}return!e||cn(e)>1?null:this.childCount}function cn(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}an.DEFAULT_PRIORITY=10;class dn extends Oi{constructor(e,t,o,i){super(e,t,o,i),this.getFillerOffset=un}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 Oo||Array.from(t).length>0))throw new ho.a("view-emptyelement-cannot-add",[this,t])}}function un(){return null}const hn=navigator.userAgent.toLowerCase();var fn={isMac:function(e){return e.indexOf("macintosh")>-1}(hn),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(hn),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(hn),isAndroid:function(e){return e.indexOf("android")>-1}(hn),isBlink:function(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}(hn),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const mn={"⌘":"ctrl","⇧":"shift","⌥":"alt"},gn={ctrl:"⌘",shift:"⇧",alt:"⌥"},pn=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,cmd:1114112,shift:2228224,alt:4456448};for(let t=65;t<=90;t++){const o=String.fromCharCode(t);e[o.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;return e}();function bn(e){let t;if("string"==typeof e){if(t=pn[e.toLowerCase()],!t)throw new ho.a("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?pn.alt:0)+(e.ctrlKey?pn.ctrl:0)+(e.shiftKey?pn.shift:0);return t}function wn(e){return"string"==typeof e&&(e=xn(e)),e.map(e=>"string"==typeof e?bn(e):e).reduce((e,t)=>t+e,0)}function kn(e){return fn.isMac?xn(e).map(e=>gn[e.toLowerCase()]||e).reduce((e,t)=>e.slice(-1)in mn?e+t:e+"+"+t):e}function _n(e){return e==pn.arrowright||e==pn.arrowleft||e==pn.arrowup||e==pn.arrowdown}function vn(e,t){const o="ltr"===t;switch(e){case pn.arrowleft:return o?"left":"right";case pn.arrowright:return o?"right":"left";case pn.arrowup:return"up";case pn.arrowdown:return"down"}}function yn(e,t){const o=vn(e,t);return"down"===o||"right"===o}function xn(e){return e.split(/\s*\+\s*/)}class Cn extends Oi{constructor(e,t,o,i){super(e,t,o,i),this.getFillerOffset=Tn}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 Oo||Array.from(t).length>0))throw new ho.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 An(e){e.document.on("keydown",(t,o)=>function(e,t,o){if(t.keyCode==pn.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),i=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(i||t.shiftKey){const t=e.focusNode,n=e.focusOffset,r=o.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=o.viewPositionToDom(a);i?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,o,e.domConverter))}function Tn(){return null}class Sn extends Oi{constructor(e,t,o,i){super(e,t,o,i),this.getFillerOffset=En}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 Oo||Array.from(t).length>0))throw new ho.a("view-rawelement-cannot-add",[this,t])}}function En(){return null}class Pn{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 o=0;const i=function(e,t){if("string"==typeof t)return[new Vo(e,t)];yo(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Vo(e,t):t instanceof Lo?new Vo(e,t.data):t)}(this.document,t);for(const t of i)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o<e+t;o++)this._children[o].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}}xo(Pn,go);class Mn{constructor(e){this.document=e,this._cloneGroups=new Map}setSelection(e,t,o){this.document.selection._setTo(e,t,o)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createText(e){return new Vo(this.document,e)}createAttributeElement(e,t,o={}){const i=new an(this.document,e,t);return o.priority&&(i._priority=o.priority),o.id&&(i._id=o.id),i}createContainerElement(e,t){return new Li(this.document,e,t)}createEditableElement(e,t){const o=new Ki(this.document,e,t);return o._document=this.document,o}createEmptyElement(e,t){return new dn(this.document,e,t)}createUIElement(e,t,o){const i=new Cn(this.document,e,t);return o&&(i.render=o),i}createRawElement(e,t,o){const i=new Sn(this.document,e,t);return i.render=o||(()=>{}),i}setAttribute(e,t,o){o._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,o){y(e)&&void 0===o&&(o=t),o._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,o){o._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof Xi?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new ho.a("view-writer-break-non-container-element",this.document);if(!t.parent)throw new ho.a("view-writer-break-root",this.document);if(e.isAtStart)return Xi._createBefore(t);if(!e.isAtEnd){const o=t._clone(!1);this.insert(Xi._createAfter(t),o);const i=new en(e,Xi._createAt(t,"end")),n=new Xi(o,0);this.move(i,n)}return Xi._createAfter(t)}mergeAttributes(e){const t=e.offset,o=e.parent;if(o.is("$text"))return e;if(o.is("attributeElement")&&0===o.childCount){const e=o.parent,t=o.index;return o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new Xi(e,t))}const i=o.getChild(t-1),n=o.getChild(t);if(!i||!n)return e;if(i.is("$text")&&n.is("$text"))return Vn(i,n);if(i.is("attributeElement")&&n.is("attributeElement")&&i.isSimilar(n)){const e=i.childCount;return i._appendChild(n.getChildren()),n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new Xi(i,e))}return e}mergeContainers(e){const t=e.nodeBefore,o=e.nodeAfter;if(!(t&&o&&t.is("containerElement")&&o.is("containerElement")))throw new ho.a("view-writer-merge-containers-invalid-position",this.document);const i=t.getChild(t.childCount-1),n=i instanceof Vo?Xi._createAt(i,"end"):Xi._createAt(t,"end");return this.move(en._createIn(o),Xi._createAt(t,"end")),this.remove(en._createOn(o)),n}insert(e,t){(function e(t,o){for(const i of t){if(!Ln.some(e=>i instanceof e))throw new ho.a("view-writer-insert-invalid-node-type",o);i.is("$text")||e(i.getChildren(),o)}})(t=yo(t)?[...t]:[t],this.document);const o=In(e);if(!o)throw new ho.a("view-writer-invalid-position-container",this.document);const i=this._breakAttributes(e,!0),n=o._insertChild(i.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=i.getShiftedBy(n),s=this.mergeAttributes(i);if(0===n)return new en(s,s);{s.isEqual(i)||r.offset--;const e=this.mergeAttributes(r);return new en(s,e)}}remove(e){const t=e instanceof en?e:en._createOn(e);if(zn(t,this.document),t.isCollapsed)return new Pn(this.document);const{start:o,end:i}=this._breakAttributesRange(t,!0),n=o.parent,r=i.offset-o.offset,s=n._removeChildren(o.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(o);return t.start=a,t.end=a.clone(),new Pn(this.document,s)}clear(e,t){zn(e,this.document);const o=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const i of o){const o=i.item;let n;if(o.is("element")&&t.isSimilar(o))n=en._createOn(o);else if(!i.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const e=o.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(n=en._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 o;if(t.isAfter(e.end)){const i=(t=this._breakAttributes(t,!0)).parent,n=i.childCount;e=this._breakAttributesRange(e,!0),o=this.remove(e),t.offset+=i.childCount-n}else o=this.remove(e);return this.insert(t,o)}wrap(e,t){if(!(t instanceof an))throw new ho.a("view-writer-wrap-invalid-attribute",this.document);if(zn(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&(o=i.parent,!Array.from(o.getChildren()).some(e=>!e.is("uiElement")))&&(i=i.getLastMatchingPosition(e=>e.item.is("uiElement"))),i=this._wrapPosition(i,t);const n=this.document.selection;return n.isCollapsed&&n.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new en(i)}return this._wrapRange(e,t);var o}unwrap(e,t){if(!(t instanceof an))throw new ho.a("view-writer-unwrap-invalid-attribute",this.document);if(zn(e,this.document),e.isCollapsed)return e;const{start:o,end:i}=this._breakAttributesRange(e,!0),n=o.parent,r=this._unwrapChildren(n,o.offset,i.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new en(s,a)}rename(e,t){const o=new Li(this.document,e,t.getAttributes());return this.insert(Xi._createAfter(t),o),this.move(en._createIn(t),Xi._createAt(o,0)),this.remove(en._createOn(t)),o}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return Xi._createAt(e,t)}createPositionAfter(e){return Xi._createAfter(e)}createPositionBefore(e){return Xi._createBefore(e)}createRange(e,t){return new en(e,t)}createRangeOn(e){return en._createOn(e)}createRangeIn(e){return en._createIn(e)}createSelection(e,t,o){return new nn(e,t,o)}_wrapChildren(e,t,o,i){let n=t;const r=[];for(;n<o;){const t=e.getChild(n),o=t.is("$text"),s=t.is("attributeElement"),a=t.is("emptyElement"),l=t.is("uiElement"),c=t.is("rawElement");if(s&&this._wrapAttributeElement(i,t))r.push(new Xi(e,n));else if(o||a||l||c||s&&Nn(i,t)){const o=i._clone();t._remove(),o._appendChild(t),e._insertChild(n,o),this._addToClonedElementsGroup(o),r.push(new Xi(e,n))}else s&&this._wrapChildren(t,0,t.childCount,i);n++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t)continue;this.mergeAttributes(e).isEqual(e)||(s++,o--)}return en._createFromParentsAndOffsets(e,t,e,o)}_unwrapChildren(e,t,o,i){let n=t;const r=[];for(;n<o;){const t=e.getChild(n);if(t.is("attributeElement"))if(t.isSimilar(i)){const i=t.getChildren(),s=t.childCount;t._remove(),e._insertChild(n,i),this._removeFromClonedElementsGroup(t),r.push(new Xi(e,n),new Xi(e,n+s)),n+=s,o+=s-1}else this._unwrapAttributeElement(i,t)?(r.push(new Xi(e,n),new Xi(e,n+1)),n++):(this._unwrapChildren(t,0,t.childCount,i),n++);else n++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t||e.offset==o)continue;this.mergeAttributes(e).isEqual(e)||(s++,o--)}return en._createFromParentsAndOffsets(e,t,e,o)}_wrapRange(e,t){const{start:o,end:i}=this._breakAttributesRange(e,!0),n=o.parent,r=this._wrapChildren(n,o.offset,i.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new en(s,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Rn(e.clone());e.parent.is("$text")&&(e=On(e));const o=this.createAttributeElement();o._priority=Number.POSITIVE_INFINITY,o.isSimilar=()=>!1,e.parent._insertChild(e.offset,o);const i=new en(e,e.getShiftedBy(1));this.wrap(i,t);const n=new Xi(o.parent,o.index);o._remove();const r=n.nodeBefore,s=n.nodeAfter;return r instanceof Vo&&s instanceof Vo?Vn(r,s):Rn(n)}_wrapAttributeElement(e,t){if(!Bn(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&t.hasAttribute(o)&&t.getAttribute(o)!==e.getAttribute(o))return!1;for(const o of e.getStyleNames())if(t.hasStyle(o)&&t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&(t.hasAttribute(o)||this.setAttribute(o,e.getAttribute(o),t));for(const o of e.getStyleNames())t.hasStyle(o)||this.setStyle(o,e.getStyle(o),t);for(const o of e.getClassNames())t.hasClass(o)||this.addClass(o,t);return!0}_unwrapAttributeElement(e,t){if(!Bn(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&(!t.hasAttribute(o)||t.getAttribute(o)!==e.getAttribute(o)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const o of e.getStyleNames())if(!t.hasStyle(o)||t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&this.removeAttribute(o,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const o=e.start,i=e.end;if(zn(e,this.document),e.isCollapsed){const o=this._breakAttributes(e.start,t);return new en(o,o)}const n=this._breakAttributes(i,t),r=n.parent.childCount,s=this._breakAttributes(o,t);return n.offset+=n.parent.childCount-r,new en(s,n)}_breakAttributes(e,t=!1){const o=e.offset,i=e.parent;if(e.parent.is("emptyElement"))throw new ho.a("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new ho.a("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new ho.a("view-writer-cannot-break-raw-element",this.document);if(!t&&i.is("$text")&&Dn(i.parent))return e.clone();if(Dn(i))return e.clone();if(i.is("$text"))return this._breakAttributes(On(e),t);if(o==i.childCount){const e=new Xi(i.parent,i.index+1);return this._breakAttributes(e,t)}if(0===o){const e=new Xi(i.parent,i.index);return this._breakAttributes(e,t)}{const e=i.index+1,n=i._clone();i.parent._insertChild(e,n),this._addToClonedElementsGroup(n);const r=i.childCount-o,s=i._removeChildren(o,r);n._appendChild(s);const a=new Xi(i.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 o=this._cloneGroups.get(t);o||(o=new Set,this._cloneGroups.set(t,o)),o.add(e),e._clonesGroup=o}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const o=this._cloneGroups.get(t);o&&o.delete(e)}}function In(e){let t=e.parent;for(;!Dn(t);){if(!t)return;t=t.parent}return t}function Nn(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function Rn(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new Xi(t,t.data.length);const o=e.nodeAfter;return o&&o.is("$text")?new Xi(o,0):e}function On(e){if(e.offset==e.parent.data.length)return new Xi(e.parent.parent,e.parent.index+1);if(0===e.offset)return new Xi(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 Vo(e.root.document,t)),new Xi(e.parent.parent,e.parent.index+1)}function Vn(e,t){const o=e.data.length;return e._data+=t.data,t._remove(),new Xi(e,o)}const Ln=[Vo,an,Li,dn,Sn,Cn];function Dn(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function zn(e,t){const o=In(e.start),i=In(e.end);if(!o||!i||o!==i)throw new ho.a("view-writer-invalid-range-container",t)}function Bn(e,t){return null===e.id&&null===t.id}function jn(e){return"[object Text]"==Object.prototype.toString.call(e)}const Fn=e=>e.createTextNode(" "),Hn=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},Un=(()=>{let e="";for(let t=0;t<7;t++)e+="​";return e})();function Wn(e){return jn(e)&&e.data.substr(0,7)===Un}function qn(e){return 7==e.data.length&&Wn(e)}function $n(e){return Wn(e)?e.data.slice(7):e.data}function Gn(e,t){if(t.keyCode==pn.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,o=e.getRangeAt(0).startOffset;Wn(t)&&o<=7&&e.collapse(t,0)}}}function Yn(e,t,o,i=!1){o=o||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,o){const i=Kn(e,t,o);if(-1===i)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const n=Qn(e,i),r=Qn(t,i),s=Kn(n,r,o),a=e.length-s,l=t.length-s;return{firstIndex:i,lastIndexOld:a,lastIndexNew:l}}(e,t,o);return i?function(e,t){const{firstIndex:o,lastIndexOld:i,lastIndexNew:n}=e;if(-1===o)return Array(t).fill("equal");let r=[];o>0&&(r=r.concat(Array(o).fill("equal")));n-o>0&&(r=r.concat(Array(n-o).fill("insert")));i-o>0&&(r=r.concat(Array(i-o).fill("delete")));n<t&&(r=r.concat(Array(t-n).fill("equal")));return r}(n,t.length):function(e,t){const o=[],{firstIndex:i,lastIndexOld:n,lastIndexNew:r}=t;r-i>0&&o.push({index:i,type:"insert",values:e.slice(i,r)});n-i>0&&o.push({index:i+(r-i),type:"delete",howMany:n-i});return o}(t,n)}function Kn(e,t,o){for(let i=0;i<Math.max(e.length,t.length);i++)if(void 0===e[i]||void 0===t[i]||!o(e[i],t[i]))return i;return-1}function Qn(e,t){return e.slice(t).reverse()}function Jn(e,t,o){o=o||function(e,t){return e===t};const i=e.length,n=t.length;if(i>200||n>200||i+n>300)return Jn.fastDiff(e,t,o,!0);let r,s;if(n<i){const o=e;e=t,t=o,r="delete",s="insert"}else r="insert",s="delete";const a=e.length,l=t.length,c=l-a,d={},u={};function h(i){const n=(void 0!==u[i-1]?u[i-1]:-1)+1,c=void 0!==u[i+1]?u[i+1]:-1,h=n>c?-1:1;d[i+h]&&(d[i]=d[i+h].slice(0)),d[i]||(d[i]=[]),d[i].push(n>c?r:s);let f=Math.max(n,c),m=f-i;for(;m<a&&f<l&&o(e[m],t[f]);)m++,f++,d[i].push("equal");return f}let f,m=0;do{for(f=-m;f<c;f++)u[f]=h(f);for(f=c+m;f>c;f--)u[f]=h(f);u[c]=h(c),m++}while(u[c]!==l);return d[c].slice(1)}function Zn(e,t,o){e.insertBefore(o,e.childNodes[t]||null)}function Xn(e){const t=e.parentNode;t&&t.removeChild(e)}function er(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}Jn.fastDiff=Yn;class tr{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 ho.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),o=t.parent.ownerDocument;Wn(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=or(o,t.parent,t.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=this.domConverter.mapViewToDom(e).childNodes,i=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),n=this._diffNodeLists(o,i),r=this._findReplaceActions(n,o,i);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,o[r]),Xn(i[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")?Xi._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&&jn(t.parent)&&Wn(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Wn(e))throw new ho.a("view-renderer-filler-was-lost",this);qn(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,o=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(o===t.getFillerOffset())return!1;const i=e.nodeBefore,n=e.nodeAfter;return!(i instanceof Vo||n instanceof Vo)}_updateText(e,t){const o=this.domConverter.findCorrespondingDomText(e),i=this.domConverter.viewToDom(e,o.ownerDocument),n=o.data;let r=i.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=Un+r),n!=r){const e=Yn(n,r);for(const t of e)"insert"===t.type?o.insertData(t.index,t.values.join("")):o.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=Array.from(t.attributes).map(e=>e.name),i=e.getAttributeKeys();for(const o of i)t.setAttribute(o,e.getAttribute(o));for(const i of o)e.hasAttribute(i)||t.removeAttribute(i)}_updateChildren(e,t){const o=this.domConverter.mapViewToDom(e);if(!o)return;const i=t.inlineFillerPosition,n=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,o.ownerDocument,{bind:!0,inlineFillerPosition:i}));i&&i.parent===e&&or(o.ownerDocument,r,i.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]),Xn(n[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(Zn(o,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 Jn(e=function(e,t){const o=Array.from(e);if(0==o.length||!t)return o;o[o.length-1]==t&&o.pop();return o}(e,this._fakeSelectionContainer),t,nr.bind(null,this.domConverter))}_findReplaceActions(e,t,o){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let i=[],n=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(o[s.equal+s.insert]):"delete"===a?n.push(t[s.equal+s.delete]):(i=i.concat(Jn(n,r,ir).map(e=>"equal"===e?"replace":e)),i.push("equal"),n=[],r=[]),s[a]++;return i.concat(Jn(n,r,ir).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 o=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(o,this.selection),!this._fakeSelectionNeedsUpdate(e))return;o.parentElement&&o.parentElement==e||e.appendChild(o),o.textContent=this.selection.fakeSelectionLabel||" ";const i=t.getSelection(),n=t.createRange();i.removeAllRanges(),n.selectNodeContents(o),i.addRange(n)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const o=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),t.collapse(o.parent,o.offset),t.extend(i.parent,i.offset),fn.isGecko&&function(e,t){const o=e.parent;if(o.nodeType!=Node.ELEMENT_NODE||e.offset!=o.childNodes.length-1)return;const i=o.childNodes[e.offset];i&&"BR"==i.tagName&&t.addRange(t.getRangeAt(0))}(i,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,o=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(o.anchorNode!==t&&!t.contains(o.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,o=this.domConverter.mapDomToView(t);t&&o&&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 or(e,t,o){const i=t instanceof Array?t:t.childNodes,n=i[o];if(jn(n))return n.data=Un+n.data,n;{const n=e.createTextNode(Un);return Array.isArray(t)?i.splice(o,0,n):Zn(t,o,n),n}}function ir(e,t){return er(e)&&er(t)&&!jn(e)&&!jn(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function nr(e,t,o){return t===o||(jn(t)&&jn(o)?t.data===o.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(o)))}xo(tr,Ui);var rr={window:window,document:document};function sr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function ar(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const lr=Hn(document);class cr{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6","li","dd","dt","figcaption","td","th"],this._blockFiller="br"==this.blockFillerMode?Hn:Fn,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new zo,this._encounteredRawContentDomNodes=new WeakSet}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new nn(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,o={}){if(e.is("$text")){const o=this._processDataFromViewText(e);return t.createTextNode(o)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let i;if(e.is("documentFragment"))i=t.createDocumentFragment(),o.bind&&this.bindDocumentFragments(i,e);else{if(e.is("uiElement"))return i=e.render(t),o.bind&&this.bindElements(i,e),i;i=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(i),o.bind&&this.bindElements(i,e);for(const t of e.getAttributeKeys())i.setAttribute(t,e.getAttribute(t))}if(!1!==o.withChildren)for(const n of this.viewChildrenToDom(e,t,o))i.appendChild(n);return i}}*viewChildrenToDom(e,t,o={}){const i=e.getFillerOffset&&e.getFillerOffset();let n=0;for(const r of e.getChildren())i===n&&(yield this._blockFiller(t)),yield this.viewToDom(r,t,o),n++;i===n&&(yield this._blockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),o=this.viewPositionToDom(e.end),i=document.createRange();return i.setStart(t.parent,t.offset),i.setEnd(o.parent,o.offset),i}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const o=this.findCorrespondingDomText(t);if(!o)return null;let i=e.offset;return Wn(o)&&(i+=7),{parent:o,offset:i}}{let o,i,n;if(0===e.offset){if(o=this.mapViewToDom(t),!o)return null;n=o.childNodes[0]}else{const t=e.nodeBefore;if(i=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!i)return null;o=i.parentNode,n=i.nextSibling}if(jn(n)&&Wn(n))return{parent:n,offset:7};return{parent:o,offset:i?sr(i)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const o=this.getHostViewElement(e);if(o)return o;if(jn(e)){if(qn(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new Vo(this.document,t)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let o;if(this.isDocumentFragment(e))o=new Pn(this.document),t.bind&&this.bindDocumentFragments(e,o);else{const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();o=new Oi(this.document,i),t.bind&&this.bindElements(e,o);const n=e.attributes;for(let e=n.length-1;e>=0;e--)o._setAttribute(n[e].name,n[e].value);if(!1!==t.withChildren&&this._rawContentElementMatcher.match(o))return o._setCustomProperty("$rawContent",e.innerHTML),this._encounteredRawContentDomNodes.add(e),o}if(!1!==t.withChildren)for(const i of this.domChildrenToView(e,t))o._appendChild(i);return o}}*domChildrenToView(e,t={}){for(let o=0;o<e.childNodes.length;o++){const i=e.childNodes[o],n=this.domToView(i,t);null!==n&&(yield n)}}domSelectionToView(e){if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;jn(t)&&(t=t.parentNode);const o=this.fakeSelectionToView(t);if(o)return o}const t=this.isDomSelectionBackward(e),o=[];for(let t=0;t<e.rangeCount;t++){const i=e.getRangeAt(t),n=this.domRangeToView(i);n&&o.push(n)}return new nn(o,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),o=this.domPositionToView(e.endContainer,e.endOffset);return t&&o?new en(t,o):null}domPositionToView(e,t){if(this.isBlockFiller(e,this.blockFillerMode))return this.domPositionToView(e.parentNode,sr(e));const o=this.mapDomToView(e);if(o&&(o.is("uiElement")||o.is("rawElement")))return Xi._createBefore(o);if(jn(e)){if(qn(e))return this.domPositionToView(e.parentNode,sr(e));const o=this.findCorrespondingViewText(e);let i=t;return o?(Wn(e)&&(i-=7,i=i<0?0:i),new Xi(o,i)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new Xi(t,0)}else{const o=e.childNodes[t-1],i=jn(o)?this.findCorrespondingViewText(o):this.mapDomToView(o);if(i&&i.parent)return new Xi(i.parent,i.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(qn(e))return null;const t=this.getHostViewElement(e);if(t)return t;const o=e.previousSibling;if(o){if(!this.isElement(o))return null;const e=this.mapDomToView(o);if(e){return e.nextSibling instanceof Vo?e.nextSibling:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof Vo?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:o}=rr.window,i=[];ur(t,e=>{const{scrollLeft:t,scrollTop:o}=e;i.push([t,o])}),t.focus(),ur(t,e=>{const[t,o]=i.shift();e.scrollLeft=t,e.scrollTop=o}),rr.window.scrollTo(e,o)}}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(lr):!("BR"!==e.tagName||!hr(e,this.blockElements)||1!==e.parentNode.childNodes.length)||function(e,t){return jn(e)&&" "==e.data&&hr(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 o=t.collapsed;return t.detach(),o}getHostViewElement(e){const t=ar(e);for(t.pop();t.length;){const e=t.pop(),o=this._domToViewMapping.get(e);if(o&&(o.is("uiElement")||o.is("rawElement")))return o}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}_isDomSelectionPositionCorrect(e,t){if(jn(e)&&Wn(e)&&t<7)return!1;if(this.isElement(e)&&Wn(e.childNodes[t]))return!1;const o=this.mapDomToView(e);return!o||!o.is("uiElement")&&!o.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 o=this._getTouchingViewTextNode(e,!1);!(o&&this._nodeEndsWithSpace(o))&&o||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const o=this._getTouchingViewTextNode(e,!0);" "!=t.charAt(t.length-2)&&o&&" "!=o.data.charAt(0)||(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(dr(e,this.preElements))return $n(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const o=this._getTouchingInlineDomNode(e,!1),i=this._getTouchingInlineDomNode(e,!0),n=this._checkShouldLeftTrimDomText(e,o),r=this._checkShouldRightTrimDomText(e,i);return n&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=$n(new Text(t)),t=t.replace(/ \u00A0/g,"  "),(/( |\u00A0)\u00A0$/.test(t)||!i||i.data&&" "==i.data.charAt(0))&&(t=t.replace(/\u00A0$/," ")),n&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(!!oo(t)||!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!Wn(e)}_getTouchingViewTextNode(e,t){const o=new Zi({startPosition:t?Xi._createAfter(e):Xi._createBefore(e),direction:t?"forward":"backward"});for(const e of o){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 o=t?"nextNode":"previousNode",i=e.ownerDocument,n=ar(e)[0],r=i.createTreeWalker(n,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>jn(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});r.currentNode=e;const s=r[o]();if(null!==s){const t=function(e,t){const o=ar(e),i=ar(t);let n=0;for(;o[n]==i[n]&&o[n];)n++;return 0===n?null:o[n-1]}(e,s);if(t&&!dr(e,this.blockElements,t)&&!dr(s,this.blockElements,t))return s}return null}}function dr(e,t,o){let i=ar(e);return o&&(i=i.slice(i.indexOf(o)+1)),i.some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}function ur(e,t){for(;e&&e!=rr.document;)t(e),e=e.parentNode}function hr(e,t){const o=e.parentNode;return o&&o.tagName&&t.includes(o.tagName.toLowerCase())}function fr(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var mr=zi({},go,{listenTo(e,...t){if(er(e)||fr(e)){const o=this._getProxyEmitter(e)||new gr(e);o.attach(...t),e=o}go.listenTo.call(this,e,...t)},stopListening(e,t,o){if(er(e)||fr(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}go.stopListening.call(this,e,t,o),e instanceof gr&&e.detach(t)},_getProxyEmitter(e){return t=this,o=pr(e),t[fo]&&t[fo][o]?t[fo][o].emitter:null;var t,o}});class gr{constructor(e){po(this,pr(e)),this._domNode=e}}function pr(e){return e["data-ck-expando"]||(e["data-ck-expando"]=co())}zi(gr.prototype,go,{attach(e,t,o={}){if(this._domListeners&&this._domListeners[e])return;const i={capture:!!o.useCapture,passive:!!o.usePassive},n=this._createDomListener(e,i);this._domNode.addEventListener(e,n,i),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 o=t=>{this.fire(e,t)};return o.removeListener=()=>{this._domNode.removeEventListener(e,o,t),delete this._domListeners[e]},o}});class br{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] *")}}xo(br,mr);var wr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var kr=function(e){return this.__data__.has(e)};function _r(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new ke;++t<o;)this.add(e[t])}_r.prototype.add=_r.prototype.push=wr,_r.prototype.has=kr;var vr=_r;var yr=function(e,t){for(var o=-1,i=null==e?0:e.length;++o<i;)if(t(e[o],o,e))return!0;return!1};var xr=function(e,t){return e.has(t)};var Cr=function(e,t,o,i,n,r){var s=1&o,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 u=-1,h=!0,f=2&o?new vr:void 0;for(r.set(e,t),r.set(t,e);++u<a;){var m=e[u],g=t[u];if(i)var p=s?i(g,m,u,t,e,r):i(m,g,u,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(f){if(!yr(t,(function(e,t){if(!xr(f,t)&&(m===e||n(m,e,o,i,r)))return f.push(t)}))){h=!1;break}}else if(m!==g&&!n(m,g,o,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h};var Ar=function(e){var t=-1,o=Array(e.size);return e.forEach((function(e,i){o[++t]=[i,e]})),o};var Tr=function(e){var t=-1,o=Array(e.size);return e.forEach((function(e){o[++t]=e})),o},Sr=n?n.prototype:void 0,Er=Sr?Sr.valueOf:void 0;var Pr=function(e,t,o,i,n,r,s){switch(o){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 Ot(e),new Ot(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return C(+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=Ar;case"[object Set]":var l=1&i;if(a||(a=Tr),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;i|=2,s.set(e,t);var d=Cr(a(e),a(t),i,n,r,s);return s.delete(e),d;case"[object Symbol]":if(Er)return Er.call(e)==Er.call(t)}return!1},Mr=Object.prototype.hasOwnProperty;var Ir=function(e,t,o,i,n,r){var s=1&o,a=kt(e),l=a.length;if(l!=kt(t).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in t:Mr.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var f=!0;r.set(e,t),r.set(t,e);for(var m=s;++c<l;){var g=e[d=a[c]],p=t[d];if(i)var b=s?i(p,g,d,t,e,r):i(g,p,d,e,t,r);if(!(void 0===b?g===p||n(g,p,o,i,r):b)){f=!1;break}m||(m="constructor"==d)}if(f&&!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||(f=!1)}return r.delete(e),r.delete(t),f},Nr=Object.prototype.hasOwnProperty;var Rr=function(e,t,o,i,n,r){var s=Ve(e),a=Ve(t),l=s?"[object Array]":It(e),c=a?"[object Array]":It(t),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),u="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),h=l==c;if(h&&Object(Le.a)(e)){if(!Object(Le.a)(t))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new ye),s||qe(e)?Cr(e,t,o,i,n,r):Pr(e,t,l,o,i,n,r);if(!(1&o)){var f=d&&Nr.call(e,"__wrapped__"),m=u&&Nr.call(t,"__wrapped__");if(f||m){var g=f?e.value():e,p=m?t.value():t;return r||(r=new ye),n(g,p,o,i,r)}}return!!h&&(r||(r=new ye),Ir(e,t,o,i,n,r))};var Or=function e(t,o,i,n,r){return t===o||(null==t||null==o||!p(t)&&!p(o)?t!=t&&o!=o:Rr(t,o,i,n,e,r))};var Vr=function(e,t,o){var i=(o="function"==typeof o?o:void 0)?o(e,t):void 0;return void 0===i?Or(e,t,void 0,o):!!i};class Lr extends br{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,o=new Map,i=new Set;for(const o of e)if("childList"===o.type){const e=t.mapDomToView(o.target);if(e&&(e.is("uiElement")||e.is("rawElement")))continue;e&&!this._isBogusBrMutation(o)&&i.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&&!i.has(e.parent)?o.set(e,{type:"text",oldText:e.data,newText:$n(n.target),node:e}):!e&&Wn(n.target)&&i.add(t.mapDomToView(n.target.parentNode))}}const n=[];for(const e of o.values())this.renderer.markToSync("text",e.node),n.push(e);for(const e of i){const o=t.mapViewToDom(e),i=Array.from(e.getChildren()),r=Array.from(t.domChildrenToView(o,{withChildren:!1}));Vr(i,r,a)||(this.renderer.markToSync("children",e),n.push({type:"children",oldChildren:i,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),o=t.domPositionToView(r.focusNode,r.focusOffset);e&&o&&(s=new nn(e),s.setFocus(o))}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 Dr{constructor(e,t,o){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,zi(this,o)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class zr extends br{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,o){this.isEnabled&&this.document.fire(e,new Dr(this.view,t,o))}}class Br extends zr{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey,get keystroke(){return bn(this)}})}}var jr=function(){return i.a.Date.now()},Fr=/^\s+|\s+$/g,Hr=/^[-+]0x[0-9a-f]+$/i,Ur=/^0b[01]+$/i,Wr=/^0o[0-7]+$/i,qr=parseInt;var $r=function(e){if("number"==typeof e)return e;if(jo(e))return NaN;if(D(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=D(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Fr,"");var o=Ur.test(e);return o||Wr.test(e)?qr(e.slice(2),o?2:8):Hr.test(e)?NaN:+e},Gr=Math.max,Yr=Math.min;var Kr=function(e,t,o){var i,n,r,s,a,l,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var o=i,r=n;return i=n=void 0,c=t,s=e.apply(r,o)}function m(e){return c=e,a=setTimeout(p,t),d?f(e):s}function g(e){var o=e-l;return void 0===l||o>=t||o<0||u&&e-c>=r}function p(){var e=jr();if(g(e))return b(e);a=setTimeout(p,function(e){var o=t-(e-l);return u?Yr(o,r-(e-c)):o}(e))}function b(e){return a=void 0,h&&i?f(e):(i=n=void 0,s)}function w(){var e=jr(),o=g(e);if(i=arguments,n=this,l=e,o){if(void 0===a)return m(l);if(u)return clearTimeout(a),a=setTimeout(p,t),f(l)}return void 0===a&&(a=setTimeout(p,t)),s}return t=$r(t)||0,D(o)&&(d=!!o.leading,r=(u="maxWait"in o)?Gr($r(o.maxWait)||0,t):r,h="trailing"in o?!!o.trailing:h),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=n=a=void 0},w.flush=function(){return void 0===a?s:b(jr())},w};class Qr extends br{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Kr(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(t,o)=>{e.selection.isFake&&_n(o.keyCode)&&this.isEnabled&&(o.preventDefault(),this._handleSelectionMove(o.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,o=new nn(t.getRanges(),{backward:t.isBackward,fake:!1});e!=pn.arrowleft&&e!=pn.arrowup||o.setTo(o.getFirstPosition()),e!=pn.arrowright&&e!=pn.arrowdown||o.setTo(o.getLastPosition());const i={oldSelection:t,newSelection:o,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}class Jr extends br{constructor(e){super(e),this.mutationObserver=e.getObserver(Lr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Kr(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,o)=>{this._handleSelectionChange(o,t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e,t){if(!this.isEnabled)return;const o=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(o.anchorNode))return;this.mutationObserver.flush();const i=this.domConverter.domSelectionToView(o);if(0!=i.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(i)&&this.domConverter.isDomSelectionCorrect(o)||++this._loopbackCounter>60))if(this.selection.isSimilar(i))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:i,domSelection:o};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class Zr extends zr{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.forceRender(),50)}),t.on("blur",(o,i)=>{const n=t.selection.editableElement;null!==n&&n!==i.target||(t.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class Xr extends zr{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 es extends zr{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}function ts(e){return"[object Range]"==Object.prototype.toString.apply(e)}function os(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 is=["top","right","bottom","left","width","height"];class ns{constructor(e){const t=ts(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),oo(e)||t)if(t){const t=ns.getDomRangeRects(e);rs(this,ns.getBoundingRect(t))}else rs(this,e.getBoundingClientRect());else if(fr(e)){const{innerWidth:t,innerHeight:o}=e;rs(this,{top:0,right:t,bottom:o,left:0,width:t,height:o})}else rs(this,e)}clone(){return new ns(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 ns(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(!ss(e)){let o=e.parentNode||e.commonAncestorContainer;for(;o&&!ss(o);){const e=new ns(o),i=t.getIntersection(e);if(!i)return null;i.getArea()<t.getArea()&&(t=i),o=o.parentNode}}return t}isEqual(e){for(const t of is)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,o,i;if(fr(e))t=e.innerWidth-e.document.documentElement.clientWidth,o=e.innerHeight-e.document.documentElement.clientHeight,i=e.getComputedStyle(e.document.documentElement).direction;else{const n=os(this._source);t=e.offsetWidth-e.clientWidth-n.left-n.right,o=e.offsetHeight-e.clientHeight-n.top-n.bottom,i=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"===i?this.right-=t:this.left+=t,this.height-=o,this.bottom-=o,this}static getDomRangeRects(e){const t=[],o=Array.from(e.getClientRects());if(o.length)for(const e of o)t.push(new ns(e));else{let o=e.startContainer;jn(o)&&(o=o.parentNode);const i=new ns(o.getBoundingClientRect());i.right=i.left,i.width=0,t.push(i)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY};let o=0;for(const i of e)o++,t.left=Math.min(t.left,i.left),t.top=Math.min(t.top,i.top),t.right=Math.max(t.right,i.right),t.bottom=Math.max(t.bottom,i.bottom);return 0==o?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new ns(t))}}function rs(e,t){for(const o of is)e[o]=t[o]}function ss(e){return!!oo(e)&&e===e.ownerDocument.body}function as({target:e,viewportOffset:t=0}){const o=ms(e);let i=o,n=null;for(;i;){let r;r=gs(i==o?e:n),cs(r,()=>ps(e,i));const s=ps(e,i);if(ls(i,s,t),i.parent!=i){if(n=i.frameElement,i=i.parent,!n)return}else i=null}}function ls(e,t,o){const i=t.clone().moveBy(0,o),n=t.clone().moveBy(0,-o),r=new ns(e).excludeScrollbarsAndBorders();if(![n,i].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;us(n,r)?a-=r.top-t.top+o:ds(i,r)&&(a+=t.bottom-r.bottom+o),hs(t,r)?s-=r.left-t.left+o:fs(t,r)&&(s+=t.right-r.right+o),e.scrollTo(s,a)}}function cs(e,t){const o=ms(e);let i,n;for(;e!=o.document.body;)n=t(),i=new ns(e).excludeScrollbarsAndBorders(),i.contains(n)||(us(n,i)?e.scrollTop-=i.top-n.top:ds(n,i)&&(e.scrollTop+=n.bottom-i.bottom),hs(n,i)?e.scrollLeft-=i.left-n.left:fs(n,i)&&(e.scrollLeft+=n.right-i.right)),e=e.parentNode}function ds(e,t){return e.bottom>t.bottom}function us(e,t){return e.top<t.top}function hs(e,t){return e.left<t.left}function fs(e,t){return e.right>t.right}function ms(e){return ts(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function gs(e){if(ts(e)){let t=e.commonAncestorContainer;return jn(t)&&(t=t.parentNode),t}return e.parentNode}function ps(e,t){const o=ms(e),i=new ns(e);if(o===t)return i;{let e=o;for(;e!=t;){const t=e.frameElement,o=new ns(t).excludeScrollbarsAndBorders();i.moveBy(o.left,o.top),e=e.parent}}return i}Object.assign({},{scrollViewportToShowTarget:as,scrollAncestorsToShowTarget:function(e){cs(gs(e),()=>new ns(e))}});class bs{constructor(e){this.document=new sn(e),this.domConverter=new cr(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new tr(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 Mn(this.document),this.addObserver(Lr),this.addObserver(Jr),this.addObserver(Zr),this.addObserver(Br),this.addObserver(Qr),this.addObserver(Xr),fn.isAndroid&&this.addObserver(es),this.document.on("keydown",Gn),An(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const o=this.document.getRoot(t);o._name=e.tagName.toLowerCase();const i={};for(const{name:t,value:n}of Array.from(e.attributes))i[t]=n,"class"===t?this._writer.addClass(n.split(" "),o):this._writer.setAttribute(t,n,o);this._initialDomRootAttributes.set(e,i);const n=()=>{this._writer.setAttribute("contenteditable",!o.isReadOnly,o),o.isReadOnly?this._writer.addClass("ck-read-only",o):this._writer.removeClass("ck-read-only",o)};n(),this.domRoots.set(t,e),this.domConverter.bindElements(e,o),this._renderer.markToSync("children",o),this._renderer.markToSync("attributes",o),this._renderer.domDocuments.add(e.ownerDocument),o.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),o.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),o.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),o.on("change:isReadOnly",()=>this.change(n)),o.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const o=this._initialDomRootAttributes.get(t);for(const e in o)t.setAttribute(e,o[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,o]of this.domRoots)t.observe(o,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&&as({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 ho.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){ho.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 Xi._createAt(e,t)}createPositionAfter(e){return Xi._createAfter(e)}createPositionBefore(e){return Xi._createBefore(e)}createRange(e,t){return new en(e,t)}createRangeOn(e){return en._createOn(e)}createRangeIn(e){return en._createIn(e)}createSelection(e,t,o){return new nn(e,t,o)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}xo(bs,Ui);class ws{constructor(e){this.parent=null,this._attrs=Do(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new ho.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 ho.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 o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),i=e.getAncestors(t);let n=0;for(;o[n]==i[n]&&o[n];)n++;return 0===n?null:o[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),i=No(t,o);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<o[i]}}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 ws(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Do(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class ks extends ws{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 ks(this.data,this.getAttributes())}static fromJSON(e){return new ks(e.data,e.attributes)}}class _s{constructor(e,t,o){if(this.textNode=e,t<0||t>e.offsetSize)throw new ho.a("model-textproxy-wrong-offsetintext",this);if(o<0||t+o>e.offsetSize)throw new ho.a("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+o),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 o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.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 vs{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 ho.a("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const o of this._nodes){if(e>=t&&e<t+o.offsetSize)return this.getNodeIndex(o);t+=o.offsetSize}if(t!=e)throw new ho.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 ws))throw new ho.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 ys extends ws{constructor(e,t,o){super(t),this.name=e,this._children=new vs,o&&this._insertChild(0,o)}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 o of e)t=t.getChild(t.offsetToIndex(o));return t}findAncestor(e,t={includeSelf:!1}){let o=t.includeSelf?this:this.parent;for(;o;){if(o.name===e)return o;o=o.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 ys(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new ks(e)];yo(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ks(e):e instanceof _s?new ks(e.data,e.getAttributes()):e)}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}static fromJSON(e){let t=null;if(e.children){t=[];for(const o of e.children)o.name?t.push(ys.fromJSON(o)):t.push(ks.fromJSON(o))}return new ys(e.name,e.attributes,t)}}class xs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new ho.a("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new ho.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=As._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,o,i,n;do{i=this.position,n=this._visitedParent,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this.position=i,this._visitedParent=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),o=this._visitedParent;if(null===o.parent&&t.offset===o.maxOffset)return{done:!0};if(o===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const i=t.parent,n=Ts(t,i),r=n||Ss(t,i,n);if(r instanceof ys)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,Cs("elementStart",r,e,t,1);if(r instanceof ks){let i;if(this.singleCharacters)i=1;else{let e=r.endOffset;this._boundaryEndParent==o&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),i=e-t.offset}const n=t.offset-r.startOffset,s=new _s(r,n,i);return t.offset+=i,this.position=t,Cs("text",s,e,t,i)}return t.path.pop(),t.offset++,this.position=t,this._visitedParent=o.parent,this.ignoreElementEnd?this._next():Cs("elementEnd",o,e,t)}_previous(){const e=this.position,t=this.position.clone(),o=this._visitedParent;if(null===o.parent&&0===t.offset)return{done:!0};if(o==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};const i=t.parent,n=Ts(t,i),r=n||Es(t,i,n);if(r instanceof ys)return t.offset--,this.shallow?(this.position=t,Cs("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this.position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():Cs("elementEnd",r,e,t));if(r instanceof ks){let i;if(this.singleCharacters)i=1;else{let e=r.startOffset;this._boundaryStartParent==o&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),i=t.offset-e}const n=t.offset-r.startOffset,s=new _s(r,n-i,i);return t.offset-=i,this.position=t,Cs("text",s,e,t,i)}return t.path.pop(),this.position=t,this._visitedParent=o.parent,Cs("elementStart",o,e,t,1)}}function Cs(e,t,o,i,n){return{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:i,length:n}}}class As{constructor(e,t,o="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new ho.a("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new ho.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=o}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 ho.a("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new ho.a("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Ts(this,this.parent)}get nodeAfter(){const e=this.parent;return Ss(this,e,Ts(this,e))}get nodeBefore(){const e=this.parent;return Es(this,e,Ts(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=No(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 o=new xs(t);return o.skip(e),o.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=No(this.path,e.path),o="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,o)}getCommonAncestor(e){const t=this.getAncestors(),o=e.getAncestors();let i=0;for(;t[i]==o[i]&&t[i];)i++;return 0===i?null:t[i-1]}getShiftedBy(e){const t=this.clone(),o=t.offset+e;return t.offset=o<0?0:o,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,o=null;switch(this.compareWith(e)){case"same":return!0;case"before":t=As._createAt(this),o=As._createAt(e);break;case"after":t=As._createAt(e),o=As._createAt(this);break;default:return!1}let i=t.parent;for(;t.path.length+o.path.length;){if(t.isEqual(o))return!0;if(t.path.length>o.path.length){if(t.offset!==i.maxOffset)return!1;t.path=t.path.slice(0,-1),i=i.parent,t.offset++}else{if(0!==o.offset)return!1;o.path=o.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==No(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=As._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 o;return t.containsPosition(this)||t.start.isEqual(this)?(o=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(o=o._getTransformedByDeletion(e.deletionPosition,1))):o=this.isEqual(e.deletionPosition)?As._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),o}_getTransformedByDeletion(e,t){const o=As._createAt(this);if(this.root!=e.root)return o;if("same"==No(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;o.offset-=t}}else if("prefix"==No(e.getParentPath(),this.getParentPath())){const i=e.path.length-1;if(e.offset<=this.path[i]){if(e.offset+t>this.path[i])return null;o.path[i]-=t}}return o}_getTransformedByInsertion(e,t){const o=As._createAt(this);if(this.root!=e.root)return o;if("same"==No(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(o.offset+=t);else if("prefix"==No(e.getParentPath(),this.getParentPath())){const i=e.path.length-1;e.offset<=this.path[i]&&(o.path[i]+=t)}return o}_getTransformedByMove(e,t,o){if(t=t._getTransformedByDeletion(e,o),e.isEqual(t))return As._createAt(this);const i=this._getTransformedByDeletion(e,o);return null===i||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(o).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):i._getTransformedByInsertion(t,o)}_getCombined(e,t){const o=e.path.length-1,i=As._createAt(t);return i.stickiness=this.stickiness,i.offset=i.offset+this.path[o]-e.offset,i.path=[...i.path,...this.path.slice(o+1)],i}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,o="toNone"){if(e instanceof As)return new As(e.root,e.path,e.stickiness);{const i=e;if("end"==t)t=i.maxOffset;else{if("before"==t)return this._createBefore(i,o);if("after"==t)return this._createAfter(i,o);if(0!==t&&!t)throw new ho.a("model-createpositionat-offset-required",[this,e])}if(!i.is("element")&&!i.is("documentFragment"))throw new ho.a("model-position-parent-incorrect",[this,e]);const n=i.getPath();return n.push(t),new this(i.root,n,o)}}static _createAfter(e,t){if(!e.parent)throw new ho.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 ho.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 o=new As(t.graveyard,e.path);return o.stickiness=e.stickiness,o}if(!t.getRoot(e.root))throw new ho.a("model-position-fromjson-no-root",t,{rootName:e.root});return new As(t.getRoot(e.root),e.path,e.stickiness)}}function Ts(e,t){const o=t.getChild(t.offsetToIndex(e.offset));return o&&o.is("$text")&&o.startOffset<e.offset?o:null}function Ss(e,t,o){return null!==o?null:t.getChild(t.offsetToIndex(e.offset))}function Es(e,t,o){return null!==o?null:t.getChild(t.offsetToIndex(e.offset)-1)}class Ps{constructor(e,t=null){this.start=As._createAt(e),this.end=t?As._createAt(t):As._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new xs({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==No(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 o=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return o&&i}containsItem(e){const t=As._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 Ps(this.start,e.start)),this.containsPosition(e.end)&&t.push(new Ps(e.end,this.end))):t.push(new Ps(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,o=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(o=e.end),new Ps(t,o)}return null}getJoined(e,t=!1){let o=this.isIntersecting(e);if(o||(o=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)),!o)return null;let i=this.start,n=this.end;return e.start.isBefore(i)&&(i=e.start),e.end.isAfter(n)&&(n=e.end),new Ps(i,n)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,o=As._createAt(this.start);let i=o.parent;for(;o.path.length>t+1;){const t=i.maxOffset-o.offset;0!==t&&e.push(new Ps(o,o.getShiftedBy(t))),o.path=o.path.slice(0,-1),o.offset++,i=i.parent}for(;o.path.length<=this.end.path.length;){const t=this.end.path[o.path.length-1],i=t-o.offset;0!==i&&e.push(new Ps(o,o.getShiftedBy(i))),o.offset=t,o.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new xs(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new xs(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new xs(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 Ps(this.start,this.end)]}getTransformedByOperations(e){const t=[new Ps(this.start,this.end)];for(const o of e)for(let e=0;e<t.length;e++){const i=t[e].getTransformedByOperation(o);t.splice(e,1,...i),e+=i.length-1}for(let e=0;e<t.length;e++){const o=t[e];for(let i=e+1;i<t.length;i++){const e=t[i];(o.containsRange(e)||e.containsRange(o)||o.isEqual(e))&&t.splice(i,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 o=e.sourcePosition,i=e.howMany,n=e.targetPosition;return this._getTransformedByMove(o,n,i,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let o=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(o=this.end.getShiftedBy(1)),t.root!=o.root&&(o=this.end.getShiftedBy(-1)),new Ps(t,o)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new Ps(this.start);let t=this.start._getTransformedByMergeOperation(e),o=this.end._getTransformedByMergeOperation(e);return t.root!=o.root&&(o=this.end.getShiftedBy(-1)),t.isAfter(o)?(e.sourcePosition.isBefore(e.targetPosition)?(t=As._createAt(o),t.offset=0):(e.deletionPosition.isEqual(t)||(o=e.deletionPosition),t=e.targetPosition),new Ps(t,o)):new Ps(t,o)}_getTransformedByInsertion(e,t,o=!1){if(o&&this.containsPosition(e))return[new Ps(this.start,e),new Ps(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const o=new Ps(this.start,this.end);return o.start=o.start._getTransformedByInsertion(e,t),o.end=o.end._getTransformedByInsertion(e,t),[o]}}_getTransformedByMove(e,t,o,i=!1){if(this.isCollapsed){const i=this.start._getTransformedByMove(e,t,o);return[new Ps(i)]}const n=Ps._createFromPositionAndShift(e,o),r=t._getTransformedByDeletion(e,o);if(this.containsPosition(t)&&!i&&(n.containsPosition(this.start)||n.containsPosition(this.end))){const i=this.start._getTransformedByMove(e,t,o),n=this.end._getTransformedByMove(e,t,o);return[new Ps(i,n)]}let s;const a=this.getDifference(n);let l=null;const c=this.getIntersection(n);if(1==a.length?l=new Ps(a[0].start._getTransformedByDeletion(e,o),a[0].end._getTransformedByDeletion(e,o)):2==a.length&&(l=new Ps(this.start,this.end._getTransformedByDeletion(e,o))),s=l?l._getTransformedByInsertion(r,o,null!==c||i):[],c){const e=new Ps(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 o=this.start._getTransformedByDeletion(e,t),i=this.end._getTransformedByDeletion(e,t);return null==o&&null==i?null:(null==o&&(o=e),null==i&&(i=e),new Ps(o,i))}static _createFromPositionAndShift(e,t){const o=e,i=e.getShiftedBy(t);return t>0?new this(o,i):new this(i,o)}static _createIn(e){return new this(As._createAt(e,0),As._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(As._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new ho.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 o=e.indexOf(t),i=new this(t.start,t.end);if(o>0)for(let t=o-1;e[t].end.isEqual(i.start);t++)i.start=As._createAt(e[t].start);for(let t=o+1;t<e.length&&e[t].start.isEqual(i.end);t++)i.end=As._createAt(e[t].end);return i}static fromJSON(e,t){return new this(As.fromJSON(e.start,t),As.fromJSON(e.end,t))}}class Ms{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 o=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(o,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const o=this.findMappedViewAncestor(t.viewPosition),i=this._viewToModelMapping.get(o),n=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,o);t.modelPosition=As._createAt(i,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 o=this._markerNameToElements.get(t)||new Set;o.add(e);const i=this._elementToMarkerNames.get(e)||new Set;i.add(t),this._markerNameToElements.set(t,o),this._elementToMarkerNames.set(e,i)}unbindElementFromMarkerName(e,t){const o=this._markerNameToElements.get(t);o&&(o.delete(e),0==o.size&&this._markerNameToElements.delete(t));const i=this._elementToMarkerNames.get(e);i&&(i.delete(t),0==i.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 Ps(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new en(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 o={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",o),o.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const o=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())o.add(t);else o.add(e);return o}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,o){if(o!=e){return this._toModelOffset(e.parent,e.index,o)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let i=0;for(let o=0;o<t;o++)i+=this.getModelLength(e.getChild(o));return i}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 o of e.getChildren())t+=this.getModelLength(o);return t}}findPositionIn(e,t){let o,i=0,n=0,r=0;if(e.is("$text"))return new Xi(e,t);for(;n<t;)o=e.getChild(r),i=this.getModelLength(o),n+=i,r++;return n==t?this._moveViewPositionToTextNode(new Xi(e,r)):this.findPositionIn(o,t-(n-i))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,o=e.nodeAfter;return t instanceof Vo?new Xi(t,t.data.length):o instanceof Vo?new Xi(o,0):e}}xo(Ms,go);class Is{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Ns(t),e instanceof _s&&(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=Ns(t),e instanceof _s&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=Ns(t),e instanceof _s&&(e=this._getSymbolForTextProxy(e));const o=this._consumable.get(e);if(void 0===o)return null;const i=o.get(t);return void 0===i?null:i}revert(e,t){t=Ns(t),e instanceof _s&&(e=this._getSymbolForTextProxy(e));const o=this.test(e,t);return!1===o?(this._consumable.get(e).set(t,!0),!0):!0!==o&&null}_getSymbolForTextProxy(e){let t=null;const o=this._textProxyRegistry.get(e.startOffset);if(o){const i=o.get(e.endOffset);i&&(t=i.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e.startOffset,e.endOffset,e.parent)),t}_addSymbolForTextProxy(e,t,o){const i=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(o,i),i}}function Ns(e){const t=e.split(":");return t.length>1?t[0]+":"+t[1]:t[0]}class Rs{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e),this._reconversionEventsMapping=new Map}convertChanges(e,t,o){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,o);const i=this._mapChangesWithAutomaticReconversion(e);for(const e of i)"insert"===e.type?this.convertInsert(Ps._createFromPositionAndShift(e.position,e.length),o):"remove"===e.type?this.convertRemove(e.position,e.length,e.name,o):"reconvert"===e.type?this.reconvertElement(e.element,o):this.convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,o);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const i=t.get(e).getRange();this.convertMarkerRemove(e,i,o),this.convertMarkerAdd(e,i,o)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,o)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of Array.from(e).map(Vs))this._convertInsertWithAttributes(t);this._clearConversionApi()}convertRemove(e,t,o,i){this.conversionApi.writer=i,this.fire("remove:"+o,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,o,i,n){this.conversionApi.writer=n,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const n of e){const e={item:n.item,range:Ps._createFromPositionAndShift(n.previousPosition,n.length),attributeKey:t,attributeOldValue:o,attributeNewValue:i};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}reconvertElement(e,t){const o=Ps._createOn(e);this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(o);const i=this.conversionApi.mapper,n=i.toViewElement(e);t.remove(n),this._convertInsertWithAttributes({item:e,range:o});const r=i.toViewElement(e);for(const o of Ps._createIn(e)){const{item:e}=o,n=Ls(e,i);n?n.root!==r.root&&t.move(t.createRangeOn(n),i.toViewPosition(As._createBefore(e))):this._convertInsertWithAttributes(Vs(o))}i.unbindViewElement(n),this._clearConversionApi()}convertSelection(e,t,o){const i=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=o,this.conversionApi.consumable=this._createSelectionConsumable(e,i),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of i){const o=t.getRange();if(!Os(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const i={item:e,markerName:t.name,markerRange:o};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,i,this.conversionApi)}for(const t of e.getAttributeKeys()){const o={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+o.attributeKey)&&this.fire("attribute:"+o.attributeKey+":$text",o,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,t,o){if(!t.root.document||"$graveyard"==t.root.rootName)return;this.conversionApi.writer=o;const i="addMarker:"+e,n=new Is;if(n.add(t,i),this.conversionApi.consumable=n,this.fire(i,{markerName:e,markerRange:t},this.conversionApi),n.test(t,i)){this.conversionApi.consumable=this._createConsumableForRange(t,i);for(const o of t.getItems()){if(!this.conversionApi.consumable.test(o,i))continue;const n={item:o,range:Ps._createOn(o),markerName:e,markerRange:t};this.fire(i,n,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,t,o){t.root.document&&"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=o,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 Is;for(const o of e){const e=o.item;t.add(e,"insert");for(const o of e.getAttributeKeys())t.add(e,"attribute:"+o)}return t}_createConsumableForRange(e,t){const o=new Is;for(const i of e.getItems())o.add(i,t);return o}_createSelectionConsumable(e,t){const o=new Is;o.add(e,"selection");for(const i of t)o.add(e,"addMarker:"+i.name);for(const t of e.getAttributeKeys())o.add(e,"attribute:"+t);return o}_testAndFire(e,t){this.conversionApi.consumable.test(t.item,e)&&this.fire(function(e,t){const o=t.item.name||"$text";return`${e}:${o}`}(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,o=[];for(const i of e.getChanges()){const e=i.position||i.range.start,n=e.parent;if(Ts(e,n)){o.push(i);continue}const r="attribute"===i.type?Ss(e,n,null):n;if(r.is("$text")){o.push(i);continue}let s;if(s="attribute"===i.type?`attribute:${i.attributeKey}:${r.name}`:`${i.type}:${i.name}`,this._isReconvertTriggerEvent(s,r.name)){if(t.has(r))continue;t.add(r),o.push({type:"reconvert",element:r})}else o.push(i)}return o}_isReconvertTriggerEvent(e,t){return this._reconversionEventsMapping.get(e)===t}}function Os(e,t,o){const i=t.getRange(),n=Array.from(e.getAncestors());n.shift(),n.reverse();return!n.some(e=>{if(i.containsItem(e)){return!!o.toViewElement(e).getCustomProperty("addHighlight")}})}function Vs(e){return{item:e.item,range:Ps._createFromPositionAndShift(e.previousPosition,e.length)}}function Ls(e,t){if(e.is("textProxy")){const o=t.toViewPosition(As._createBefore(e)).parent;return o.is("$text")?o:null}return t.toViewElement(e)}xo(Rs,go);class Ds{constructor(e,t,o){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,o)}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 o=!1;for(const i of e._ranges)if(t.isEqual(i)){o=!0;break}if(!o)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new Ps(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 Ps(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 Ps(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,o){if(null===e)this._setRanges([]);else if(e instanceof Ds)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof Ps)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof As)this._setRanges([new Ps(e)]);else if(e instanceof ws){const i=!!o&&!!o.backward;let n;if("in"==t)n=Ps._createIn(e);else if("on"==t)n=Ps._createOn(e);else{if(void 0===t)throw new ho.a("model-selection-setto-required-second-parameter",[this,e]);n=new Ps(As._createAt(e,t))}this._setRanges([n],i)}else{if(!yo(e))throw new ho.a("model-selection-setto-not-selectable",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const o=(e=Array.from(e)).some(t=>{if(!(t instanceof Ps))throw new ho.a("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||o){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 ho.a("model-selection-setfocus-no-ranges",[this,e]);const o=As._createAt(e,t);if("same"==o.compareWith(this.focus))return;const i=this.anchor;this._ranges.length&&this._popRange(),"before"==o.compareWith(i)?(this._pushRange(new Ps(o,i)),this._lastRangeBackward=!0):(this._pushRange(new Ps(i,o)),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 o=js(t.start,e);o&&Fs(o,t)&&(yield o);for(const o of t.getWalker()){const i=o.item;"elementEnd"==o.type&&Bs(i,e,t)&&(yield i)}const i=js(t.end,e);i&&!t.end.isTouching(As._createAt(i,0))&&Fs(i,t)&&(yield i)}}containsEntireContent(e=this.anchor.root){const t=As._createAt(e,0),o=As._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&o.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new Ps(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new ho.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 zs(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function Bs(e,t,o){return zs(e,t)&&Fs(e,o)}function js(e,t){const o=e.parent.root.document.model.schema,i=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let n=!1;const r=i.find(e=>!n&&(n=o.isLimit(e),!n&&zs(e,t)));return i.forEach(e=>t.add(e)),r}function Fs(e,t){const o=function(e){const t=e.root.document.model.schema;let o=e.parent;for(;o;){if(t.isBlock(o))return o;o=o.parent}}(e);if(!o)return!0;return!t.containsRange(Ps._createOn(o),!0)}xo(Ds,go);class Hs extends Ps{constructor(e,t){super(e,t),Us.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new Ps(this.start,this.end)}static fromRange(e){return new Hs(e.start,e.end)}}function Us(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&Ws.call(this,o)},{priority:"low"})}function Ws(e){const t=this.getTransformedByOperation(e),o=Ps._createFromRanges(t),i=!o.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(i){"$graveyard"==o.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=o.start,this.end=o.end,this.fire("change:range",t,{deletionPosition:r})}else n&&this.fire("change:content",this.toRange(),{deletionPosition:r})}xo(Hs,go);class qs{constructor(e){this._selection=new $s(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,o){this._selection.setTo(e,t,o)}_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:")}}xo(qs,go);class $s extends Ds{constructor(e){super(),this.markers=new Co({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 o=t[0];o.isDocumentOperation&&"marker"!=o.type&&"rename"!=o.type&&"noop"!=o.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 ho.a("document-selection-wrong-position",this,{range:e})}),this.listenTo(this._model.markers,"update",(e,t,o,i)=>{this._updateMarker(t,i)}),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const o=e.document.differ;for(const i of o.getChanges()){if("insert"!=i.type)continue;const o=i.position.parent;i.length===o.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(o.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const i of t)e.removeAttribute(i,o)})}}(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,o){super.setTo(e,t,o),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=co();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new ho.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=Hs.fromRange(e);return t.on("change:range",(e,o,i)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=i.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 o=t.name.split(":",1)[0];if(!this._observedMarkers.has(o))continue;const i=t.getRange();for(const o of this.getRanges())i.containsRange(o,!o.isCollapsed)&&e.push(t)}const o=Array.from(this.markers);for(const o of e)this.markers.has(o)||(this.markers.add(o),t=!0);for(const o of Array.from(this.markers))e.includes(o)||(this.markers.remove(o),t=!0);t&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateMarker(e,t){const o=e.name.split(":",1)[0];if(!this._observedMarkers.has(o))return;let i=!1;const n=Array.from(this.markers),r=this.markers.has(e);if(t){let o=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){o=!0;break}o&&!r?(this.markers.add(e),i=!0):!o&&r&&(this.markers.remove(e),i=!0)}else r&&(this.markers.remove(e),i=!0);i&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){const t=Do(this._getSurroundingAttributes()),o=Do(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 i=[];for(const[e,t]of this.getAttributes())o.has(e)&&o.get(e)===t||i.push(e);for(const[e]of o)this.hasAttribute(e)||i.push(e);i.length>0&&this.fire("change:attribute",{attributeKeys:i,directChange:!1})}_setAttribute(e,t,o=!0){const i=o?"normal":"low";if("low"==i&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,i),!0)}_removeAttribute(e,t=!0){const o=t?"normal":"low";return("low"!=o||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,o),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,o]of this.getAttributes())e.get(t)!==o&&this._removeAttribute(t,!1);for(const[o,i]of e){this._setAttribute(o,i,!1)&&t.add(o)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const o=t.substr("selection:".length);yield[o,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let o=null;if(this.isCollapsed){const i=e.textNode?e.textNode:e.nodeBefore,n=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(o=Gs(i)),o||(o=Gs(n)),!this.isGravityOverridden&&!o){let e=i;for(;e&&!t.isInline(e)&&!o;)e=e.previousSibling,o=Gs(e)}if(!o){let e=n;for(;e&&!t.isInline(e)&&!o;)e=e.nextSibling,o=Gs(e)}o||(o=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const i of e){if(i.item.is("element")&&t.isObject(i.item))break;if("text"==i.type){o=i.item.getAttributes();break}}}return o}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Gs(e){return e instanceof _s||e instanceof ks?e.getAttributes():null}class Ys{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Ks=function(e){return eo(e,5)};class Qs extends Ys{elementToElement(e){return this.add(function(e){return(e=Ks(e)).view=Xs(e.view,"container"),t=>{var o;if(t.on("insert:"+e.model,(o=e.view,(e,t,i)=>{const n=o(t.item,i);if(!n)return;if(!i.consumable.consume(t.item,"insert"))return;const r=i.mapper.toViewPosition(t.range.start);i.mapper.bindElements(t.item,n),i.writer.insert(r,n)}),{priority:e.converterPriority||"normal"}),e.triggerBy){if(e.triggerBy.attributes)for(const o of e.triggerBy.attributes)t._mapReconversionTriggerEvent(e.model,`attribute:${o}:${e.model}`);if(e.triggerBy.children)for(const o of e.triggerBy.children)t._mapReconversionTriggerEvent(e.model,"insert:"+o),t._mapReconversionTriggerEvent(e.model,"remove:"+o)}}}(e))}attributeToElement(e){return this.add(function(e){e=Ks(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]=Xs(e.view[t],"attribute");else e.view=Xs(e.view,"attribute");const o=ea(e);return i=>{i.on(t,function(e){return(t,o,i)=>{const n=e(o.attributeOldValue,i),r=e(o.attributeNewValue,i);if(!n&&!r)return;if(!i.consumable.consume(o.item,t.name))return;const s=i.writer,a=s.document.selection;if(o.item instanceof Ds||o.item instanceof qs)s.wrap(a.getFirstRange(),r);else{let e=i.mapper.toViewRange(o.range);null!==o.attributeOldValue&&n&&(e=s.unwrap(e,n)),null!==o.attributeNewValue&&r&&s.wrap(e,r)}}}(o),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Ks(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]=ta(e.view[t]);else e.view=ta(e.view);const o=ea(e);return i=>{var n;i.on(t,(n=o,(e,t,o)=>{const i=n(t.attributeOldValue,o),r=n(t.attributeNewValue,o);if(!i&&!r)return;if(!o.consumable.consume(t.item,e.name))return;const s=o.mapper.toViewElement(t.item),a=o.writer;if(!s)throw new ho.a("conversion-attribute-to-attribute-on-text",[t,o]);if(null!==t.attributeOldValue&&i)if("class"==i.key){const e=To(i.value);for(const t of e)a.removeClass(t,s)}else if("style"==i.key){const e=Object.keys(i.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(i.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=Ks(e)).view=Xs(e.view,"ui"),t=>{var o;t.on("addMarker:"+e.model,(o=e.view,(e,t,i)=>{t.isOpening=!0;const n=o(t,i);t.isOpening=!1;const r=o(t,i);if(!n||!r)return;const s=t.markerRange;if(s.isCollapsed&&!i.consumable.consume(s,e.name))return;for(const t of s)if(!i.consumable.consume(t.item,e.name))return;const a=i.mapper,l=i.writer;l.insert(a.toViewPosition(s.start),n),i.mapper.bindElementToMarker(n,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),r),i.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,o)=>{const i=o.mapper.markerNameToElements(t.markerName);if(i){for(const e of i)o.mapper.unbindElementFromMarkerName(e,t.markerName),o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var o;t.on("addMarker:"+e.model,(o=e.view,(e,t,i)=>{if(!t.item)return;if(!(t.item instanceof Ds||t.item instanceof qs||t.item.is("$textProxy")))return;const n=oa(o,t,i);if(!n)return;if(!i.consumable.consume(t.item,e.name))return;const r=i.writer,s=Js(r,n),a=r.document.selection;if(t.item instanceof Ds||t.item instanceof qs)r.wrap(a.getFirstRange(),s,a);else{const e=i.mapper.toViewRange(t.range),o=r.wrap(e,s);for(const e of o.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){i.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,o,i)=>{if(!o.item)return;if(!(o.item instanceof ys))return;const n=oa(e,o,i);if(!n)return;if(!i.consumable.test(o.item,t.name))return;const r=i.mapper.toViewElement(o.item);if(r&&r.getCustomProperty("addHighlight")){i.consumable.consume(o.item,t.name);for(const e of Ps._createIn(o.item))i.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,n,i.writer),i.mapper.bindElementToMarker(r,o.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,o,i)=>{if(o.markerRange.isCollapsed)return;const n=oa(e,o,i);if(!n)return;const r=Js(i.writer,n),s=i.mapper.markerNameToElements(o.markerName);if(s){for(const e of s)i.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("attributeElement")?i.writer.unwrap(i.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,n.id,i.writer);i.writer.clearClonedElementsGroup(o.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=Ks(e)).model;e.view||(e.view=o=>({group:t,name:o.substr(e.model.length+1)}));return o=>{var i;o.on("addMarker:"+t,(i=e.view,(e,t,o)=>{const n=i(t.markerName,o);if(!n)return;const r=t.markerRange;o.consumable.consume(r,e.name)&&(Zs(r,!1,o,t,n),Zs(r,!0,o,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),o.on("removeMarker:"+t,function(e){return(t,o,i)=>{const n=e(o.markerName,i);if(!n)return;const r=i.mapper.markerNameToElements(o.markerName);if(r){for(const e of r)i.mapper.unbindElementFromMarkerName(e,o.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)):i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(o.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const o=new Set(t.getAttribute(e).split(","));o.delete(n.name),0==o.size?i.writer.removeAttribute(e,t):i.writer.setAttribute(e,Array.from(o).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Js(e,t){const o=e.createAttributeElement("span",t.attributes);return t.classes&&o._addClass(t.classes),t.priority&&(o._priority=t.priority),o._id=t.id,o}function Zs(e,t,o,i,n){const r=t?e.start:e.end;if(o.schema.checkChild(r,"$text")){!function(e,t,o,i,n){const r=`${n.group}-${t?"start":"end"}`,s=n.name?{name:n.name}:null,a=o.writer.createUIElement(r,s);o.writer.insert(e,a),o.mapper.bindElementToMarker(a,i.markerName)}(o.mapper.toViewPosition(r),t,o,i,n)}else{let e,s;t&&r.nodeAfter||!t&&!r.nodeBefore?(e=r.nodeAfter,s=!0):(e=r.nodeBefore,s=!1);!function(e,t,o,i,n,r){const s=`data-${r.group}-${t?"start":"end"}-${o?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),i.writer.setAttribute(s,a.join(","),e),i.mapper.bindElementToMarker(e,n.markerName)}(o.mapper.toViewElement(e),t,s,o,i,n)}}function Xs(e,t){return"function"==typeof e?e:(o,i)=>function(e,t,o){"string"==typeof e&&(e={name:e});let i;const n=t.writer,r=Object.assign({},e.attributes);if("container"==o)i=n.createContainerElement(e.name,r);else if("attribute"==o){const t={priority:e.priority||an.DEFAULT_PRIORITY};i=n.createAttributeElement(e.name,r,t)}else i=n.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const o of t)n.setStyle(o,e.styles[o],i)}if(e.classes){const t=e.classes;if("string"==typeof t)n.addClass(t,i);else for(const e of t)n.addClass(e,i)}return i}(e,i,t)}function ea(e){return e.model.values?(t,o)=>{const i=e.view[t];return i?i(t,o):null}:e.view}function ta(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function oa(e,t,o){const i="function"==typeof e?e(t,o):e;return i?(i.priority||(i.priority=10),i.id||(i.id=t.markerName),i):null}function ia(e){const{schema:t,document:o}=e.model;for(const i of o.getRootNames()){const n=o.getRoot(i);if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),!0}return!1}function na(e,t,o){const i=o.createContext(e);return!!o.checkChild(i,"paragraph")&&!!o.checkChild(i.push("paragraph"),t)}function ra(e,t){const o=t.createElement("paragraph");return t.insert(o,e),t.createPositionAt(o,0)}class sa extends Ys{elementToElement(e){return this.add(aa(e))}elementToAttribute(e){return this.add(function(e){da(e=Ks(e));const t=ua(e,!1),o=la(e.view),i=o?"element:"+o:"element";return o=>{o.on(i,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Ks(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 o;if("class"==t||"style"==t){o={["class"==t?"classes":"styles"]:e.view.value}}else{const i=void 0===e.view.value?/[\s\S]*/:e.view.value;o={attributes:{[t]:i}}}e.view.name&&(o.name=e.view.name);return e.view=o,t}(e));da(e,t);const o=ua(e,!0);return t=>{t.on("element",o,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return Object(ho.c)("upcast-helpers-element-to-marker-deprecated"),this.add(function(e){return function(e){const t=e.model;e.model=(e,o)=>{const i="string"==typeof t?t:t(e,o);return o.writer.createElement("$marker",{"data-name":i})}}(e=Ks(e)),aa(e)}(e))}dataToMarker(e){return this.add(function(e){(e=Ks(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=ca(ha(e,"start")),o=ca(ha(e,"end"));return i=>{i.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),i.on("element:"+e.view+"-end",o,{priority:e.converterPriority||"normal"});const n=uo.get("low"),r=uo.get("highest"),s=uo.get(e.converterPriority)/r;i.on("element",function(e){return(t,o,i)=>{const n="data-"+e.view;function r(t,n){for(const r of n){const n=e.model(r,i),s=i.writer.createElement("$marker",{"data-name":n});i.writer.insert(s,t),o.modelCursor.isEqual(t)?o.modelCursor=o.modelCursor.getShiftedBy(1):o.modelCursor=o.modelCursor._getTransformedByInsertion(t,1),o.modelRange=o.modelRange._getTransformedByInsertion(t,1)[0]}}o.modelRange||(o=Object.assign(o,i.convertChildren(o.viewItem,o.modelCursor))),i.consumable.consume(o.viewItem,{attributes:n+"-end-after"})&&r(o.modelRange.end,o.viewItem.getAttribute(n+"-end-after").split(",")),i.consumable.consume(o.viewItem,{attributes:n+"-start-after"})&&r(o.modelRange.end,o.viewItem.getAttribute(n+"-start-after").split(",")),i.consumable.consume(o.viewItem,{attributes:n+"-end-before"})&&r(o.modelRange.start,o.viewItem.getAttribute(n+"-end-before").split(",")),i.consumable.consume(o.viewItem,{attributes:n+"-start-before"})&&r(o.modelRange.start,o.viewItem.getAttribute(n+"-start-before").split(","))}}(e),{priority:n+s})}}(e))}}function aa(e){const t=ca(e=Ks(e)),o=la(e.view),i=o?"element:"+o:"element";return o=>{o.on(i,t,{priority:e.converterPriority||"normal"})}}function la(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function ca(e){const t=new zo(e.view);return(o,i,n)=>{const r=t.match(i.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!n.consumable.test(i.viewItem,s))return;const a=function(e,t,o){return e instanceof Function?e(t,o):o.writer.createElement(e)}(e.model,i.viewItem,n);a&&n.safeInsert(a,i.modelCursor)&&(n.consumable.consume(i.viewItem,s),n.convertChildren(i.viewItem,a),n.updateConversionResult(a,i))}}function da(e,t=null){const o=null===t||(e=>e.getAttribute(t)),i="object"!=typeof e.model?e.model:e.model.key,n="object"!=typeof e.model||void 0===e.model.value?o:e.model.value;e.model={key:i,value:n}}function ua(e,t){const o=new zo(e.view);return(i,n,r)=>{const s=o.match(n.viewItem);if(!s)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;if(!function(e,t){const o="function"==typeof e?e(t):e;if("object"==typeof o&&!la(o))return!1;return!o.classes&&!o.attributes&&!o.styles}(e.view,n.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(n.viewItem,s.match))return;n.modelRange||(n=Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor)));(function(e,t,o,i){let n=!1;for(const r of Array.from(e.getItems({shallow:o})))i.schema.checkAttribute(r,t.key)&&(i.writer.setAttribute(t.key,t.value,r),n=!0);return n})(n.modelRange,{key:a,value:l},t,r)&&r.consumable.consume(n.viewItem,s.match)}}function ha(e,t){const o={};return o.view=e.view+"-"+t,o.model=(t,o)=>{const i=t.getAttribute("name"),n=e.model(i,o);return o.writer.createElement("$marker",{"data-name":n})},o}class fa{constructor(e,t){this.model=e,this.view=new bs(t),this.mapper=new Ms,this.downcastDispatcher=new Rs({mapper:this.mapper,schema:e.schema});const o=this.model.document,i=o.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(o,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(o.differ,n,e),this.downcastDispatcher.convertSelection(i,n,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(o,i)=>{const n=i.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,o)=>{if(!o.consumable.consume(t.item,"insert"))return;const i=o.writer,n=o.mapper.toViewPosition(t.range.start),r=i.createText(t.item.data);i.insert(n,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,o)=>{const i=o.mapper.toViewPosition(t.position),n=t.position.getShiftedBy(t.length),r=o.mapper.toViewPosition(n,{isPhantom:!0}),s=o.writer.createRange(i,r),a=o.writer.remove(s.getTrimmed());for(const e of o.writer.createRangeIn(a).getItems())o.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const i=o.writer,n=i.document.selection;for(const e of n.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&o.writer.mergeAttributes(e.start);i.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const i=t.selection;if(i.isCollapsed)return;if(!o.consumable.consume(i,"selection"))return;const n=[];for(const e of i.getRanges()){const t=o.mapper.toViewRange(e);n.push(t)}o.writer.setSelection(n,{backward:i.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const i=t.selection;if(!i.isCollapsed)return;if(!o.consumable.consume(i,"selection"))return;const n=o.writer,r=i.getFirstPosition(),s=o.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 Ji(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}xo(fa,Ui);class ma{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const o=this.get(e);if(!o)throw new ho.a("commandcollection-command-not-found",this,{commandName:e});return o.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 ga{constructor(){this._consumables=new Map}add(e,t){let o;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?o=this._consumables.get(e):(o=new pa(e),this._consumables.set(e,o)),o.add(t))}test(e,t){const o=this._consumables.get(e);return void 0===o?null:e.is("$text")||e.is("documentFragment")?o:o.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 o=this._consumables.get(e);void 0!==o&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):o.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},o=e.getAttributeKeys();for(const e of o)"style"!=e&&"class"!=e&&t.attributes.push(e);const i=e.getClassNames();for(const e of i)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 ga(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,ga.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const o of e.getChildren())t=ga.createFrom(o,t);return t}}class pa{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 o=this._test(t,e[t]);if(!0!==o)return o}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 o=Ve(t)?t:[t],i=this._consumables[e];for(const t of o){if("attributes"===e&&("class"===t||"style"===t))throw new ho.a("viewconsumable-invalid-attribute",this);if(i.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))i.set(e,!0)}}_test(e,t){const o=Ve(t)?t:[t],i=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){const e=i.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",o=this._test(e,[...this._consumables[e].keys()]);if(!0!==o)return o}return!0}_consume(e,t){const o=Ve(t)?t:[t],i=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){if(i.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))i.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const o=Ve(t)?t:[t],i=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){!1===i.get(t)&&i.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class ba{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new wa(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new wa(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new ho.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 ho.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 o=this.getDefinition(e.last);return!!o&&o.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof As){const t=e.nodeBefore,o=e.nodeAfter;if(!(t instanceof ys))throw new ho.a("schema-check-merge-no-element-before",this);if(!(o instanceof ys))throw new ho.a("schema-check-merge-no-element-after",this);return this.checkMerge(t,o)}for(const o of t.getChildren())if(!this.checkChild(e,o))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[o,i])=>{if(!i)return;const n=e(o,i);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[o,i])=>{const n=e(o,i);"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 As)t=e.parent;else{t=(e instanceof Ps?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const o=t.getCommonAncestor();return e?e.getCommonAncestor(o,{includeSelf:!0}):o},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const o=[...e.getFirstPosition().getAncestors(),new ks("",e.getAttributes())];return this.checkAttribute(o,t)}{const o=e.getRanges();for(const e of o)for(const o of e)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const o of e)yield*this._getValidRangesForRange(o,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new Ps(e);let o,i;const n=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(o=new xs({boundaries:Ps._createIn(n),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(i=new xs({boundaries:Ps._createIn(n),startPosition:e}));for(const e of function*(e,t){let o=!1;for(;!o;){if(o=!0,e){const t=e.next();t.done||(o=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(o=!1,yield{walker:t,value:e.value})}}}(o,i)){const t=e.walker==o?"elementEnd":"elementStart",i=e.value;if(i.type==t&&this.isObject(i.item))return Ps._createOn(i.item);if(this.checkChild(i.nextPosition,"$text"))return new Ps(i.nextPosition)}return null}findAllowedParent(e,t){let o=e.parent;for(;o;){if(this.checkChild(o,t))return o;if(this.isLimit(o))return null;o=o.parent}return null}removeDisallowedAttributes(e,t){for(const o of e)if(o.is("$text"))Pa(this,o,t);else{const e=Ps._createIn(o).getPositions();for(const o of e){Pa(this,o.nodeBefore||o.parent,t)}}}createContext(e){return new wa(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,o=Object.keys(t);for(const i of o)e[i]=ka(t[i],i);for(const t of o)_a(e,t);for(const t of o)va(e,t);for(const t of o)ya(e,t),xa(e,t);for(const t of o)Ca(e,t),Aa(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,o=t.length-1){const i=t.getItem(o);if(e.allowIn.includes(i.name)){if(0==o)return!0;{const e=this.getDefinition(i);return this._checkContextMatch(e,t,o-1)}}return!1}*_getValidRangesForRange(e,t){let o=e.start,i=e.start;for(const n of e.getItems({shallow:!0}))n.is("element")&&(yield*this._getValidRangesForRange(Ps._createIn(n),t)),this.checkAttribute(n,t)||(o.isEqual(i)||(yield new Ps(o,i)),o=As._createAfter(n)),i=As._createAfter(n);o.isEqual(i)||(yield new Ps(o,i))}}xo(ba,Ui);class wa{constructor(e){if(e instanceof wa)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),e[0]&&"string"!=typeof e[0]&&e[0].is("documentFragment")&&e.shift(),this._items=e.map(Ea)}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 wa([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 ka(e,t){const o={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,t){for(const o of e){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const i of e)t[i]=o[i]}}(e,o),Ta(e,o,"allowIn"),Ta(e,o,"allowContentOf"),Ta(e,o,"allowWhere"),Ta(e,o,"allowAttributes"),Ta(e,o,"allowAttributesOf"),Ta(e,o,"inheritTypesFrom"),function(e,t){for(const o of e){const e=o.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,o),o}function _a(e,t){for(const o of e[t].allowContentOf)if(e[o]){Sa(e,o).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function va(e,t){for(const o of e[t].allowWhere){const i=e[o];if(i){const o=i.allowIn;e[t].allowIn.push(...o)}}delete e[t].allowWhere}function ya(e,t){for(const o of e[t].allowAttributesOf){const i=e[o];if(i){const o=i.allowAttributes;e[t].allowAttributes.push(...o)}}delete e[t].allowAttributesOf}function xa(e,t){const o=e[t];for(const t of o.inheritTypesFrom){const i=e[t];if(i){const e=Object.keys(i).filter(e=>e.startsWith("is"));for(const t of e)t in o||(o[t]=i[t])}}delete o.inheritTypesFrom}function Ca(e,t){const o=e[t],i=o.allowIn.filter(t=>e[t]);o.allowIn=Array.from(new Set(i))}function Aa(e,t){const o=e[t];o.allowAttributes=Array.from(new Set(o.allowAttributes))}function Ta(e,t,o){for(const i of e)"string"==typeof i[o]?t[o].push(i[o]):Array.isArray(i[o])&&t[o].push(...i[o])}function Sa(e,t){const o=e[t];return(i=e,Object.keys(i).map(e=>i[e])).filter(e=>e.allowIn.includes(o.name));var i}function Ea(e){return"string"==typeof e?{name:e,*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function Pa(e,t,o){for(const i of t.getAttributeKeys())e.checkAttribute(t,i)||o.removeAttribute(i,t)}class Ma{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,o=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let o;for(const i of new wa(e)){const e={};for(const t of i.getAttributeKeys())e[t]=i.getAttribute(t);const n=t.createElement(i.name,e);o&&t.append(n,o),o=As._createAt(n,0)}return o}(o,t),this.conversionApi.writer=t,this.conversionApi.consumable=ga.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),n=t.createDocumentFragment();if(i){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,n);n.markers=function(e,t){const o=new Set,i=new Map,n=Ps._createIn(e).getItems();for(const e of n)"$marker"==e.name&&o.add(e);for(const e of o){const o=e.getAttribute("data-name"),n=t.createPositionBefore(e);i.has(o)?i.get(o).end=n.clone():i.set(o,new Ps(n.clone())),t.remove(e)}return i}(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 o=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,o,this.conversionApi):e.is("$text")?this.fire("text",o,this.conversionApi):this.fire("documentFragment",o,this.conversionApi),o.modelRange&&!(o.modelRange instanceof Ps))throw new ho.a("view-conversion-dispatcher-incorrect-result",this);return{modelRange:o.modelRange,modelCursor:o.modelCursor}}_convertChildren(e,t){let o=t.is("position")?t:As._createAt(t,0);const i=new Ps(o);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,o);e.modelRange instanceof Ps&&(i.end=e.modelRange.end,o=e.modelCursor)}return{modelRange:i,modelCursor:o}}_safeInsert(e,t){const o=this._splitToAllowedParent(e,t);return!!o&&(this.conversionApi.writer.insert(e,o.position),!0)}_updateConversionResult(e,t){const o=this._getSplitParts(e),i=this.conversionApi.writer;t.modelRange||(t.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(o[o.length-1])));const n=this._cursorParents.get(e);t.modelCursor=n?i.createPositionAt(n,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:o,writer:i}=this.conversionApi;let n=o.findAllowedParent(t,e);if(n){if(n===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(n)&&(n=null)}if(!n)return na(t,e,o)?{position:ra(t,i)}: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(),o=e.item;this._registerSplitPair(t,o)}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 o=this._splitParts.get(e);this._splitParts.set(t,o),o.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()}}xo(Ma,go);class Ia{constructor(e,t){this.model=e,this.stylesProcessor=t,this.processor=void 0,this.mapper=new Ms,this.downcastDispatcher=new Rs({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,o)=>{if(!o.consumable.consume(t.item,"insert"))return;const i=o.writer,n=o.mapper.toViewPosition(t.range.start),r=i.createText(t.item.data);i.insert(n,r)},{priority:"lowest"}),this.upcastDispatcher=new Ma({schema:e.schema}),this.viewDocument=new sn(t),this._viewWriter=new Mn(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:o,consumable:i,writer:n})=>{let r=t.modelCursor;if(!i.test(t.viewItem))return;if(!o.checkChild(r,"$text")){if(!na(r,"$text",o))return;r=ra(r,n)}i.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,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:i}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=i}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:i}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=i}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",ia)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:o="empty"}=e;if(!this._checkIfRootsExists([t]))throw new ho.a("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(t);return"empty"!==o||this.model.hasContent(i,{ignoreWhitespaces:!0})?this.stringify(i,e):""}stringify(e,t){const o=this.toView(e,t);return this.processor.toData(o)}toView(e,t){const o=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const n=Ps._createIn(e),r=new Pn(o);if(this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(n,i),!e.is("documentFragment")){const t=function(e){const t=[],o=e.root.document;if(!o)return[];const i=Ps._createIn(e);for(const e of o.model.markers){const o=i.getIntersection(e.getRange());o&&t.push([e.name,o])}return t}(e);for(const[e,o]of t)this.downcastDispatcher.convertMarkerAdd(e,o,i)}return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new ho.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 ho.a("datacontroller-init-non-existent-root",this);return this.model.enqueueChange("transparent",e=>{for(const o of Object.keys(t)){const i=this.model.document.getRoot(o);e.insert(this.parse(t[o],i),i,0)}}),Promise.resolve()}set(e){let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new ho.a("datacontroller-set-non-existent-root",this);this.model.enqueueChange("transparent",e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(t)){const i=this.model.document.getRoot(o);e.remove(e.createRangeIn(i)),e.insert(this.parse(t[o],i),i,0)}})}parse(e,t="$root"){const o=this.processor.toView(e);return this.toModel(o,t)}toModel(e,t="$root"){return this.model.change(o=>this.upcastDispatcher.convert(e,o,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}xo(Ia,Ui);class Na{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 o=this._downcast.includes(t);if(!this._upcast.includes(t)&&!o)throw new ho.a("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:o})}for(e){if(!this._helpers.has(e))throw new ho.a("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:o}of Ra(e))this.for("upcast").elementToElement({model:t,view:o,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:o}of Ra(e))this.for("upcast").elementToAttribute({view:o,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:o}of Ra(e))this.for("upcast").attributeToAttribute({view:o,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:o}){if(this._helpers.has(e))throw new ho.a("conversion-group-exists",this);const i=o?new Qs(t):new sa(t);this._helpers.set(e,i)}}function*Ra(e){if(e.model.values)for(const t of e.model.values){const o={key:e.model.key,value:t},i=e.view[t],n=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Oa(o,i,n)}else yield*Oa(e.model,e.view,e.upcastAlso)}function*Oa(e,t,o){if(yield{model:e,view:t},o)for(const t of To(o))yield{model:e,view:t}}class Va{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 La{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 Da{constructor(e){this.markers=new Map,this._children=new vs,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 o of e)t=t.getChild(t.offsetToIndex(o));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 o of e)o.name?t.push(ys.fromJSON(o)):t.push(ks.fromJSON(o));return new Da(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new ks(e)];yo(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ks(e):e instanceof _s?new ks(e.data,e.getAttributes()):e)}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}}function za(e,t){const o=(t=Fa(t)).reduce((e,t)=>e+t.offsetSize,0),i=e.parent;Ua(e);const n=e.index;return i._insertChild(n,t),Ha(i,n+t.length),Ha(i,n),new Ps(e,e.getShiftedBy(o))}function Ba(e){if(!e.isFlat)throw new ho.a("operation-utils-remove-range-not-flat",this);const t=e.start.parent;Ua(e.start),Ua(e.end);const o=t._removeChildren(e.start.index,e.end.index-e.start.index);return Ha(t,e.start.index),o}function ja(e,t){if(!e.isFlat)throw new ho.a("operation-utils-move-range-not-flat",this);const o=Ba(e);return za(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),o)}function Fa(e){const t=[];e instanceof Array||(e=[e]);for(let o=0;o<e.length;o++)if("string"==typeof e[o])t.push(new ks(e[o]));else if(e[o]instanceof _s)t.push(new ks(e[o].data,e[o].getAttributes()));else if(e[o]instanceof Da||e[o]instanceof vs)for(const i of e[o])t.push(i);else e[o]instanceof ws&&t.push(e[o]);for(let e=1;e<t.length;e++){const o=t[e],i=t[e-1];o instanceof ks&&i instanceof ks&&Wa(o,i)&&(t.splice(e-1,2,new ks(i.data+o.data,i.getAttributes())),e--)}return t}function Ha(e,t){const o=e.getChild(t-1),i=e.getChild(t);if(o&&i&&o.is("$text")&&i.is("$text")&&Wa(o,i)){const n=new ks(o.data+i.data,o.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,n)}}function Ua(e){const t=e.textNode,o=e.parent;if(t){const i=e.offset-t.startOffset,n=t.index;o._removeChildren(n,1);const r=new ks(t.data.substr(0,i),t.getAttributes()),s=new ks(t.data.substr(i),t.getAttributes());o._insertChild(n,[r,s])}}function Wa(e,t){const o=e.getAttributes(),i=t.getAttributes();for(const e of o){if(e[1]!==t.getAttribute(e[0]))return!1;i.next()}return i.next().done}var qa=function(e,t){return Or(e,t)};class $a extends La{constructor(e,t,o,i,n){super(n),this.range=e.clone(),this.key=t,this.oldValue=void 0===o?null:o,this.newValue=void 0===i?null:i}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}clone(){return new $a(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new $a(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 ho.a("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!qa(e.getAttribute(this.key),this.oldValue))throw new ho.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 ho.a("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){qa(this.oldValue,this.newValue)||function(e,t,o){Ua(e.start),Ua(e.end);for(const i of e.getItems({shallow:!0})){const e=i.is("$textProxy")?i.textNode:i;null!==o?e._setAttribute(t,o):e._removeAttribute(t),Ha(e.parent,e.index)}Ha(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new $a(Ps.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Ga extends La{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 ho.a("detach-operation-on-document-node",this)}_execute(){Ba(Ps._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Ya extends La{constructor(e,t,o,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=o.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,o=this.sourcePosition.offset,i=this.targetPosition.offset;if(o+this.howMany>e.maxOffset)throw new ho.a("move-operation-nodes-do-not-exist",this);if(e===t&&o<i&&i<o+this.howMany)throw new ho.a("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==No(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=o&&this.targetPosition.path[e]<o+this.howMany)throw new ho.a("move-operation-node-into-itself",this)}}_execute(){ja(Ps._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 o=As.fromJSON(e.sourcePosition,t),i=As.fromJSON(e.targetPosition,t);return new this(o,e.howMany,i,e.baseVersion)}}class Ka extends La{constructor(e,t,o){super(o),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new vs(Fa(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}clone(){const e=new vs([...this.nodes].map(e=>e._clone(!0))),t=new Ka(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new As(e,[0]);return new Ya(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new ho.a("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new vs([...e].map(e=>e._clone(!0))),za(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 o=[];for(const t of e.nodes)t.name?o.push(ys.fromJSON(t)):o.push(ks.fromJSON(t));const i=new Ka(As.fromJSON(e.position,t),o,e.baseVersion);return i.shouldReceiveAttributes=e.shouldReceiveAttributes,i}}class Qa extends La{constructor(e,t,o,i,n,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=o?o.clone():null,this.affectsData=n,this._markers=i}get type(){return"marker"}clone(){return new Qa(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Qa(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 Qa(e.name,e.oldRange?Ps.fromJSON(e.oldRange,t):null,e.newRange?Ps.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Ja extends La{constructor(e,t,o,i){super(i),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=o}get type(){return"rename"}clone(){return new Ja(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ja(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof ys))throw new ho.a("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new ho.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 Ja(As.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Za extends La{constructor(e,t,o,i,n){super(n),this.root=e,this.key=t,this.oldValue=o,this.newValue=i}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Za(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Za(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new ho.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 ho.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 ho.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 ho.a("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Za(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Xa extends La{constructor(e,t,o,i,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=o.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=i.clone()}get type(){return"merge"}get deletionPosition(){return new As(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Ps(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),o=new As(this.sourcePosition.root,t)._getTransformedByMergeOperation(this),i=new el(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return i.insertionPosition=o,i}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new ho.a("merge-operation-source-position-invalid",this);if(!t.parent)throw new ho.a("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new ho.a("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;ja(Ps._createIn(e),this.targetPosition),ja(Ps._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 o=As.fromJSON(e.sourcePosition,t),i=As.fromJSON(e.targetPosition,t),n=As.fromJSON(e.graveyardPosition,t);return new this(o,e.howMany,i,n,e.baseVersion)}}class el extends La{constructor(e,t,o,i){super(i),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=el.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",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 As(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Ps(this.splitPosition,e)}clone(){const e=new this.constructor(this.splitPosition,this.howMany,this.graveyardPosition,this.baseVersion);return e.insertionPosition=this.insertionPosition,e}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new As(e,[0]);return new Xa(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 ho.a("split-operation-position-invalid",this);if(!e.parent)throw new ho.a("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new ho.a("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new ho.a("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)ja(Ps._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();za(this.insertionPosition,t)}ja(new Ps(As._createAt(e,this.splitPosition.offset),As._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 As(e.root,t)}static fromJSON(e,t){const o=As.fromJSON(e.splitPosition,t),i=As.fromJSON(e.insertionPosition,t),n=e.graveyardPosition?As.fromJSON(e.graveyardPosition,t):null,r=new this(o,e.howMany,n,e.baseVersion);return r.insertionPosition=i,r}}class tl extends ys{constructor(e,t,o="main"){super(t),this._document=e,this.rootName=o}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 ol{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new ks(e,t)}createElement(e,t){return new ys(e,t)}createDocumentFragment(){return new Da}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,o=0){if(this._assertWriterUsedCorrectly(),e instanceof ks&&""==e.data)return;const i=As._createAt(t,o);if(e.parent){if(al(e.root,i.root))return void this.move(Ps._createOn(e),i);if(e.root.document)throw new ho.a("model-writer-insert-forbidden-move",this);this.remove(e)}const n=i.root.document?i.root.document.version:null,r=new Ka(i,e,n);if(e instanceof ks&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof Da)for(const[t,o]of e.markers){const e=As._createAt(o.root,0),n={range:new Ps(o.start._getCombined(e,i),o.end._getCombined(e,i)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,n):this.addMarker(t,n)}}insertText(e,t,o,i){t instanceof Da||t instanceof ys||t instanceof As?this.insert(this.createText(e),t,o):this.insert(this.createText(e,t),o,i)}insertElement(e,t,o,i){t instanceof Da||t instanceof ys||t instanceof As?this.insert(this.createElement(e),t,o):this.insert(this.createElement(e,t),o,i)}append(e,t){this.insert(e,t,"end")}appendText(e,t,o){t instanceof Da||t instanceof ys?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),o,"end")}appendElement(e,t,o){t instanceof Da||t instanceof ys?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),o,"end")}setAttribute(e,t,o){if(this._assertWriterUsedCorrectly(),o instanceof Ps){const i=o.getMinimalFlatRanges();for(const o of i)il(this,e,t,o)}else nl(this,e,t,o)}setAttributes(e,t){for(const[o,i]of Do(e))this.setAttribute(o,i,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof Ps){const o=t.getMinimalFlatRanges();for(const t of o)il(this,e,null,t)}else nl(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof Ps)for(const o of e.getItems())t(o);else t(e)}move(e,t,o){if(this._assertWriterUsedCorrectly(),!(e instanceof Ps))throw new ho.a("writer-move-invalid-range",this);if(!e.isFlat)throw new ho.a("writer-move-range-not-flat",this);const i=As._createAt(t,o);if(i.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!al(e.root,i.root))throw new ho.a("writer-move-different-document",this);const n=e.root.document?e.root.document.version:null,r=new Ya(e.start,e.end.offset-e.start.offset,i,n);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof Ps?e:Ps._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),sl(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,o=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof ys))throw new ho.a("writer-merge-no-element-before",this);if(!(o instanceof ys))throw new ho.a("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,o){return this.model.createPositionFromPath(e,t,o)}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,o){return this.model.createSelection(e,t,o)}_mergeDetached(e){const t=e.nodeBefore,o=e.nodeAfter;this.move(Ps._createIn(o),As._createAt(t,"end")),this.remove(o)}_merge(e){const t=As._createAt(e.nodeBefore,"end"),o=As._createAt(e.nodeAfter,0),i=e.root.document.graveyard,n=new As(i,[0]),r=e.root.document.version,s=new Xa(o,e.nodeAfter.maxOffset,t,n,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof ys))throw new ho.a("writer-rename-not-element-instance",this);const o=e.root.document?e.root.document.version:null,i=new Ja(As._createBefore(e),e.name,t,o);this.batch.addOperation(i),this.model.applyOperation(i)}split(e,t){this._assertWriterUsedCorrectly();let o,i,n=e.parent;if(!n.parent)throw new ho.a("writer-split-element-no-parent",this);if(t||(t=n.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new ho.a("writer-split-invalid-limit-element",this);do{const t=n.root.document?n.root.document.version:null,r=n.maxOffset-e.offset,s=new el(e,r,null,t);this.batch.addOperation(s),this.model.applyOperation(s),o||i||(o=n,i=e.parent.nextSibling),n=(e=this.createPositionAfter(e.parent)).parent}while(n!==t);return{position:e,range:new Ps(As._createAt(o,"end"),As._createAt(i,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new ho.a("writer-wrap-range-not-flat",this);const o=t instanceof ys?t:new ys(t);if(o.childCount>0)throw new ho.a("writer-wrap-element-not-empty",this);if(null!==o.parent)throw new ho.a("writer-wrap-element-attached",this);this.insert(o,e.start);const i=new Ps(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(i,As._createAt(o,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new ho.a("writer-unwrap-element-no-parent",this);this.move(Ps._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new ho.a("writer-addmarker-no-usingoperation",this);const o=t.usingOperation,i=t.range,n=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new ho.a("writer-addmarker-marker-exists",this);if(!i)throw new ho.a("writer-addmarker-no-range",this);return o?(rl(this,e,null,i,n),this.model.markers.get(e)):this.model.markers._set(e,i,o,n)}updateMarker(e,t){this._assertWriterUsedCorrectly();const o="string"==typeof e?e:e.name,i=this.model.markers.get(o);if(!i)throw new ho.a("writer-updatemarker-marker-not-exists",this);if(!t)return void this.model.markers._refresh(i);const n="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:i.affectsData;if(!n&&!t.range&&!r)throw new ho.a("writer-updatemarker-wrong-options",this);const a=i.getRange(),l=t.range?t.range:a;n&&t.usingOperation!==i.managedUsingOperations?t.usingOperation?rl(this,o,null,l,s):(rl(this,o,a,null,s),this.model.markers._set(o,l,void 0,s)):i.managedUsingOperations?rl(this,o,a,l,s):this.model.markers._set(o,l,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new ho.a("writer-removemarker-no-marker",this);const o=this.model.markers.get(t);if(!o.managedUsingOperations)return void this.model.markers._remove(t);rl(this,t,o.getRange(),null,o.affectsData)}setSelection(e,t,o){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,o)}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,o]of Do(e))this._setSelectionAttribute(t,o)}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 o=this.model.document.selection;if(o.isCollapsed&&o.anchor.parent.isEmpty){const i=qs._getStoreAttributeKey(e);this.setAttribute(i,t,o.anchor.parent)}o._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const o=qs._getStoreAttributeKey(e);this.removeAttribute(o,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new ho.a("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const o of this.model.markers){if(!o.managedUsingOperations)continue;const i=o.getRange();let n=!1;if("move"===e)n=t.containsPosition(i.start)||t.start.isEqual(i.start)||t.containsPosition(i.end)||t.end.isEqual(i.end);else{const e=t.nodeBefore,o=t.nodeAfter,r=i.start.parent==e&&i.start.isAtEnd,s=i.end.parent==o&&0==i.end.offset,a=i.end.nodeAfter==o,l=i.start.nodeAfter==o;n=r||s||a||l}n&&this.updateMarker(o.name,{range:i})}}}function il(e,t,o,i){const n=e.model,r=n.document;let s,a,l,c=i.start;for(const e of i.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=o&&d(),c=s),s=e.nextPosition,a=l;function d(){const i=new Ps(c,s),l=i.root.document?r.version:null,d=new $a(i,t,a,o,l);e.batch.addOperation(d),n.applyOperation(d)}s instanceof As&&s!=c&&a!=o&&d()}function nl(e,t,o,i){const n=e.model,r=n.document,s=i.getAttribute(t);let a,l;if(s!=o){if(i.root===i){const e=i.document?r.version:null;l=new Za(i,t,s,o,e)}else{a=new Ps(As._createBefore(i),e.createPositionAfter(i));const n=a.root.document?r.version:null;l=new $a(a,t,s,o,n)}e.batch.addOperation(l),n.applyOperation(l)}}function rl(e,t,o,i,n){const r=e.model,s=r.document,a=new Qa(t,o,i,r.markers,n,s.version);e.batch.addOperation(a),r.applyOperation(a)}function sl(e,t,o,i){let n;if(e.root.document){const o=i.document,r=new As(o.graveyard,[0]);n=new Ya(e,t,r,o.version)}else n=new Ga(e,t);o.addOperation(n),i.applyOperation(n)}function al(e,t){return e===t||e instanceof tl&&t instanceof tl}class ll{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=Ps._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),o=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),o||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=Ps._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 o=e.graveyardPosition.parent;this._markInsert(o,e.graveyardPosition.offset,1);const i=e.targetPosition.parent;this._isInInsertedElement(i)||this._markInsert(i,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,o,i){const n=this._changedMarkers.get(e);n?(n.newRange=o,n.affectsData=i,null==n.oldRange&&null==n.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:o,affectsData:i})}getMarkersToRemove(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.oldRange&&e.push({name:t,range:o.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.newRange&&e.push({name:t,range:o.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();const t=[];for(const e of this._changesInElement.keys()){const o=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),i=this._elementSnapshots.get(e),n=cl(e.getChildren()),r=dl(i.length,o);let s=0,a=0;for(const o of r)if("i"===o)t.push(this._getInsertDiff(e,s,n[s].name)),s++;else if("r"===o)t.push(this._getRemoveDiff(e,s,i[a].name)),a++;else if("a"===o){const o=n[s].attributes,r=i[a].attributes;let l;if("$text"==n[s].name)l=new Ps(As._createAt(e,s),As._createAt(e,s+1));else{const t=e.offsetToIndex(s);l=new Ps(As._createAt(e,s),As._createAt(e.getChild(t),0))}t.push(...this._getAttributesDiff(l,r,o)),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;e<t.length;e++){const o=t[e-1],i=t[e],n="remove"==o.type&&"remove"==i.type&&"$text"==o.name&&"$text"==i.name&&o.position.isEqual(i.position),r="insert"==o.type&&"insert"==i.type&&"$text"==o.name&&"$text"==i.name&&o.position.parent==i.position.parent&&o.position.offset+o.length==i.position.offset,s="attribute"==o.type&&"attribute"==i.type&&o.position.parent==i.position.parent&&o.range.isFlat&&i.range.isFlat&&o.position.offset+o.length==i.position.offset&&o.attributeKey==i.attributeKey&&o.attributeOldValue==i.attributeOldValue&&o.attributeNewValue==i.attributeNewValue;(n||r||s)&&(t[e-1].length++,s&&(t[e-1].range.end=t[e-1].range.end.getShiftedBy(1)),t.splice(e,1),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.slice().filter(ul),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard:this._cachedChanges}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._cachedChanges=null}_markInsert(e,t,o){const i={type:"insert",offset:t,howMany:o,count:this._changeCount++};this._markChange(e,i)}_markRemove(e,t,o){const i={type:"remove",offset:t,howMany:o,count:this._changeCount++};this._markChange(e,i),this._removeAllNestedChanges(e,t,o)}_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 o=this._getChangesForElement(e);this._handleChange(t,o),o.push(t);for(let e=0;e<o.length;e++)o[e].howMany<1&&(o.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,cl(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const o of t){const i=e.offset+e.howMany,n=o.offset+o.howMany;if("insert"==e.type&&("insert"==o.type&&(e.offset<=o.offset?o.offset+=e.howMany:e.offset<n&&(o.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==o.type&&e.offset<o.offset&&(o.offset+=e.howMany),"attribute"==o.type))if(e.offset<=o.offset)o.offset+=e.howMany;else if(e.offset<n){const n=o.howMany;o.howMany=e.offset-o.offset,t.unshift({type:"attribute",offset:i,howMany:n-o.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==o.type)if(i<=o.offset)o.offset-=e.howMany;else if(i<=n)if(e.offset<o.offset){const t=i-o.offset;o.offset=e.offset,o.howMany-=t,e.nodesToHandle-=t}else o.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=o.offset)e.nodesToHandle-=o.howMany,o.howMany=0;else if(e.offset<n){const t=n-e.offset;o.howMany-=t,e.nodesToHandle-=t}if("remove"==o.type&&(i<=o.offset?o.offset-=e.howMany:e.offset<o.offset&&(e.nodesToHandle+=o.howMany,o.howMany=0)),"attribute"==o.type)if(i<=o.offset)o.offset-=e.howMany;else if(e.offset<o.offset){const t=i-o.offset;o.offset=e.offset,o.howMany-=t}else if(e.offset<n)if(i<=n){const i=o.howMany;o.howMany=e.offset-o.offset;const n=i-o.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:n,count:this._changeCount++})}else o.howMany-=n-e.offset}if("attribute"==e.type){if("insert"==o.type)if(e.offset<o.offset&&i>o.offset){if(i>n){const e={type:"attribute",offset:n,howMany:i-n,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=o.offset&&e.offset<n&&(i>n?(e.nodesToHandle=i-n,e.offset=n):e.nodesToHandle=0);if("remove"==o.type&&e.offset<o.offset&&i>o.offset){const n={type:"attribute",offset:o.offset,howMany:i-o.offset,count:this._changeCount++};this._handleChange(n,t),t.push(n),e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==o.type&&(e.offset>=o.offset&&i<=n?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=o.offset&&i>=n&&(o.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,o){return{type:"insert",position:As._createAt(e,t),name:o,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,o){return{type:"remove",position:As._createAt(e,t),name:o,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,o){const i=[];o=new Map(o);for(const[n,r]of t){const t=o.has(n)?o.get(n):null;t!==r&&i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:n,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),o.delete(n)}for(const[t,n]of o)i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:n,changeCount:this._changeCount++});return i}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const o=this._changesInElement.get(t),i=e.startOffset;if(o)for(const e of o)if("insert"==e.type&&i>=e.offset&&i<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,o){const i=new Ps(As._createAt(e,t),As._createAt(e,t+o));for(const e of i.getItems({shallow:!0}))e.is("element")&&(this._elementSnapshots.delete(e),this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}function cl(e){const t=[];for(const o of e)if(o.is("$text"))for(let e=0;e<o.data.length;e++)t.push({name:"$text",attributes:new Map(o.getAttributes())});else t.push({name:o.name,attributes:new Map(o.getAttributes())});return t}function dl(e,t){const o=[];let i=0,n=0;for(const e of t){if(e.offset>i){for(let t=0;t<e.offset-i;t++)o.push("e");n+=e.offset-i}if("insert"==e.type){for(let t=0;t<e.howMany;t++)o.push("i");i=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)o.push("r");i=e.offset,n+=e.howMany}else o.push(..."a".repeat(e.howMany).split("")),i=e.offset+e.howMany,n+=e.howMany}if(n<e)for(let t=0;t<e-n-i;t++)o.push("e");return o}function ul(e){const t=e.position&&"$graveyard"==e.position.root.rootName,o=e.range&&"$graveyard"==e.range.root.rootName;return!t&&!o}class hl{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 o=[];for(const i of this._operations)i.baseVersion>=e&&i.baseVersion<t&&o.push(i);return o}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 fl(e,t){return!!(o=e.charAt(t-1))&&1==o.length&&/[\ud800-\udbff]/.test(o)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var o}function ml(e,t){return!!(o=e.charAt(t))&&1==o.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(o);var o}class gl{constructor(e){this.model=e,this.version=0,this.history=new hl(this),this.selection=new qs(this),this.roots=new Co({idProperty:"rootName"}),this.differ=new ll(e.markers),this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root","$graveyard"),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];if(o.isDocumentOperation&&o.baseVersion!==this.version)throw new ho.a("model-document-applyoperation-wrong-version",this,{operation:o})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&this.differ.bufferOperation(o)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&(this.version++,this.history.addOperation(o))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,o,i)=>{this.differ.bufferMarkerChange(t.name,o,i,t.affectsData),null===o&&t.on("change",(e,o)=>{this.differ.bufferMarkerChange(t.name,o,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new ho.a("model-document-createroot-name-exists",this,{name:t});const o=new tl(this,e,t);return this.roots.add(o),o}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=Ro(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,o=t.schema,i=t.createPositionFromPath(e,[0]);return o.getNearestSelectionRange(i)||t.createRange(i)}_validateSelectionRange(e){return pl(e.start)&&pl(e.end)}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(this.selection.refresh(),t=o(e),t)break}while(t)}}function pl(e){const t=e.textNode;if(t){const o=t.data,i=e.offset-t.startOffset;return!fl(o,i)&&!ml(o,i)}return!0}xo(gl,go);class bl{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){return this._markers.has(e)}get(e){return this._markers.get(e)||null}_set(e,t,o=!1,i=!1){const n=e instanceof wl?e.name:e;if(n.includes(","))throw new ho.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(Hs.fromRange(t)),s=!0),o!=r.managedUsingOperations&&(r._managedUsingOperations=o,s=!0),"boolean"==typeof i&&i!=r.affectsData&&(r._affectsData=i,s=!0),s&&this.fire("update:"+n,r,e,t),r}const s=Hs.fromRange(t),a=new wl(n,s,o,i);return this._markers.set(n,a),this.fire("update:"+n,a,null,t),a}_remove(e){const t=e instanceof wl?e.name:e,o=this._markers.get(t);return!!o&&(this._markers.delete(t),this.fire("update:"+t,o,o.getRange(),null),this._destroyMarker(o),!0)}_refresh(e){const t=e instanceof wl?e.name:e,o=this._markers.get(t);if(!o)throw new ho.a("markercollection-refresh-marker-not-exists",this);const i=o.getRange();this.fire("update:"+t,o,i,i,o.managedUsingOperations,o.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()}}xo(bl,go);class wl{constructor(e,t,o,i){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=o,this._affectsData=i}get managedUsingOperations(){if(!this._liveRange)throw new ho.a("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new ho.a("marker-destroyed",this);return this._affectsData}getStart(){if(!this._liveRange)throw new ho.a("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new ho.a("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new ho.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}}xo(wl,go);class kl extends La{get type(){return"noop"}clone(){return new kl(this.baseVersion)}getReversed(){return new kl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const _l={};_l[$a.className]=$a,_l[Ka.className]=Ka,_l[Qa.className]=Qa,_l[Ya.className]=Ya,_l[kl.className]=kl,_l[La.className]=La,_l[Ja.className]=Ja,_l[Za.className]=Za,_l[el.className]=el,_l[Xa.className]=Xa;class vl extends As{constructor(e,t,o="toNone"){if(super(e,t,o),!this.root.is("rootElement"))throw new ho.a("model-liveposition-root-not-rootelement",e);yl.call(this)}detach(){this.stopListening()}is(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e}toPosition(){return new As(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function yl(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&xl.call(this,o)},{priority:"low"})}function xl(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)}}xo(vl,go);class Cl{constructor(e,t,o){this.model=e,this.writer=t,this.position=o,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e,t){e=Array.from(e);for(let o=0;o<e.length;o++){const i=e[o];this._handleNode(i,{isFirst:0===o&&t.isFirst,isLast:o===e.length-1&&t.isLast})}this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}getSelectionRange(){return this.nodeToSelect?Ps._createOn(this.nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new Ps(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e,t){if(this.schema.isObject(e))return void this._handleObject(e,t);this._checkAndSplitToAllowedPosition(e,t)?(this._insert(e),this._mergeSiblingsOf(e,t)):this._handleDisallowedNode(e,t)}_handleObject(e,t){this._checkAndSplitToAllowedPosition(e)?this._insert(e):this._tryAutoparagraphing(e,t)}_handleDisallowedNode(e,t){e.is("element")?this.handleNodes(e.getChildren(),t):this._tryAutoparagraphing(e,t)}_insert(e){if(!this.schema.checkChild(this.position,e))throw new ho.a("insertcontent-wrong-position",this,{node:e,position:this.position});const t=vl.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this.writer.insert(e,this.position),this.position=t.toPosition(),t.detach(),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=vl.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=vl.fromPosition(e,"toNext"))}_mergeSiblingsOf(e,t){if(!(e instanceof ys))return;const o=this._canMergeLeft(e,t),i=this._canMergeRight(e,t),n=vl._createBefore(e);n.stickiness="toNext";const r=vl._createAfter(e);if(r.stickiness="toNext",o){const e=vl.fromPosition(this.position);e.stickiness="toNext",this._affectedStart.isEqual(n)&&(this._affectedStart.detach(),this._affectedStart=vl._createAt(n.nodeBefore,"end","toPrevious")),this.writer.merge(n),n.isEqual(this._affectedEnd)&&t.isLast&&(this._affectedEnd.detach(),this._affectedEnd=vl._createAt(n.nodeBefore,"end","toNext")),this.position=e.toPosition(),e.detach()}if(i){if(!this.position.isEqual(r))throw new ho.a("insertcontent-invalid-insertion-position",this);this.position=As._createAt(r.nodeBefore,"end");const e=vl.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(r)&&(this._affectedEnd.detach(),this._affectedEnd=vl._createAt(r.nodeBefore,"end","toNext")),this.writer.merge(r),r.getShiftedBy(-1).isEqual(this._affectedStart)&&t.isFirst&&(this._affectedStart.detach(),this._affectedStart=vl._createAt(r.nodeBefore,0,"toPrevious")),this.position=e.toPosition(),e.detach()}(o||i)&&this._filterAttributesOf.push(this.position.parent),n.detach(),r.detach()}_canMergeLeft(e,t){const o=e.previousSibling;return t.isFirst&&o instanceof ys&&this.canMergeWith.has(o)&&this.model.schema.checkMerge(o,e)}_canMergeRight(e,t){const o=e.nextSibling;return t.isLast&&o instanceof ys&&this.canMergeWith.has(o)&&this.model.schema.checkMerge(e,o)}_tryAutoparagraphing(e,t){const o=this.writer.createElement("paragraph");this._getAllowedIn(o,this.position.parent)&&this.schema.checkChild(o,e)&&(o._appendChild(e),this._handleNode(o,t))}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(e,this.position.parent);if(!t)return!1;for(;t!=this.position.parent;){if(this.schema.isLimit(this.position.parent))return!1;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(t,e)?t:t.parent?this._getAllowedIn(e,t.parent):null}}function Al(e,t,o={}){if(t.isCollapsed)return;const i=t.getFirstRange();if("$graveyard"==i.root.rootName)return;const n=e.schema;e.change(e=>{if(!o.doNotResetEntireContent&&function(e,t){const o=e.getLimitElement(t);if(!t.containsEntireContent(o))return!1;const i=t.getFirstRange();if(i.start.parent==i.end.parent)return!1;return e.checkChild(o,"paragraph")}(n,t))return void function(e,t){const o=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(o)),Sl(e,e.createPositionAt(o,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,o=e.start;let i=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const o=function(e){const t=e.parent,o=t.root.document.model.schema,i=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of i){if(o.isLimit(e))return null;if(o.isBlock(e))return e}}(i);if(o&&i.isTouching(t.createPositionAt(o,0))){const o=t.createSelection(e);t.modifySelection(o,{direction:"backward"}),i=o.getLastPosition()}}return[vl.fromPosition(o,"toPrevious"),vl.fromPosition(i,"toNext")]}(i);r.isTouching(s)||e.remove(e.createRange(r,s)),o.leaveUnmerged||(!function(e,t,o){const i=e.model;if(!Tl(e.model.schema,t,o))return;const[n,r]=function(e,t){const o=e.getAncestors(),i=t.getAncestors();let n=0;for(;o[n]&&o[n]==i[n];)n++;return[o[n],i[n]]}(t,o);if(!n||!r)return;!i.hasContent(n,{ignoreMarkers:!0})&&i.hasContent(r,{ignoreMarkers:!0})?function e(t,o,i,n){const r=o.parent,s=i.parent;if(r==n||s==n)return;o=t.createPositionAfter(r),(i=t.createPositionBefore(s)).isEqual(o)||t.insert(r,i);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(i=t.createPositionBefore(s),function(e,t){const o=t.nodeBefore,i=t.nodeAfter;o.name!=i.name&&e.rename(o,i.name);e.clearAttributes(o),e.setAttributes(Object.fromEntries(i.getAttributes()),o),e.merge(t)}(t,i),!Tl(t.model.schema,o,i))return;e(t,o,i,n)}(e,t,o,n.parent):function e(t,o,i,n){const r=o.parent,s=i.parent;if(r==n||s==n)return;o=t.createPositionAfter(r),(i=t.createPositionBefore(s)).isEqual(o)||t.insert(s,o);t.merge(o);for(;i.parent.isEmpty;){const e=i.parent;i=t.createPositionBefore(e),t.remove(e)}if(!Tl(t.model.schema,o,i))return;e(t,o,i,n)}(e,t,o,n.parent)}(e,r,s),n.removeDisallowedAttributes(r.parent.getChildren(),e)),El(e,t,r),!o.doNotAutoparagraph&&function(e,t){const o=e.checkChild(t,"$text"),i=e.checkChild(t,"paragraph");return!o&&i}(n,r)&&Sl(e,r,t),r.detach(),s.detach()})}function Tl(e,t,o){const i=t.parent,n=o.parent;return i!=n&&(!e.isLimit(i)&&!e.isLimit(n)&&function(e,t,o){const i=new Ps(e,t);for(const e of i.getWalker())if(o.isLimit(e.item))return!1;return!0}(t,o,e))}function Sl(e,t,o){const i=e.createElement("paragraph");e.insert(i,t),El(e,o,e.createPositionAt(i,0))}function El(e,t,o){t instanceof qs?e.setSelection(o):t.setTo(o)}function Pl(e,t){const{isForward:o,walker:i,unit:n,schema:r}=e,{type:s,item:a,nextPosition:l}=t;if("text"==s)return"word"===e.unit?function(e,t){let o=e.position.textNode;if(o){let i=e.position.offset-o.startOffset;for(;!Il(o.data,i,t)&&!Nl(o,i,t);){e.next();const n=t?e.position.nodeAfter:e.position.nodeBefore;if(n&&n.is("$text")){const i=n.data.charAt(t?0:n.data.length-1);' ,.?!:;"-()'.includes(i)||(e.next(),o=e.position.textNode)}i=e.position.offset-o.startOffset}}return e.position}(i,o):function(e,t){const o=e.position.textNode;if(o){const i=o.data;let n=e.position.offset-o.startOffset;for(;fl(i,n)||"character"==t&&ml(i,n);)e.next(),n=e.position.offset-o.startOffset}return e.position}(i,n);if(s==(o?"elementStart":"elementEnd")){if(r.isSelectable(a))return As._createAt(a,o?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(a))return void i.skip(()=>!0);if(r.checkChild(l,"$text"))return l}}function Ml(e,t){const o=e.root,i=As._createAt(o,t?"end":0);return t?new Ps(e,i):new Ps(i,e)}function Il(e,t,o){const i=t+(o?0:-1);return' ,.?!:;"-()'.includes(e.charAt(i))}function Nl(e,t,o){return t===(o?e.endOffset:0)}function Rl(e,t){const o=[];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=>{o.push(e.start.parent),t.remove(e)}),o.forEach(e=>{let o=e;for(;o.parent&&o.isEmpty;){const e=t.createRangeOn(o);o=o.parent,t.remove(e)}})}function Ol(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.selection,i=t.schema,n=[];let r=!1;for(const e of o.getRanges()){const t=Vl(e,i);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 o of e){const e=t.pop();if(o.isEqual(e))t.push(e);else if(o.isIntersecting(e)){const i=e.start.isAfter(o.start)?o.start:e.start,n=e.end.isAfter(o.end)?e.end:o.end,r=new Ps(i,n);t.push(r)}else t.push(e),t.push(o)}return t}(n),{backward:o.isBackward})}(t,e))}function Vl(e,t){return e.isCollapsed?function(e,t){const o=e.start,i=t.getNearestSelectionRange(o);if(!i)return null;if(!i.isCollapsed)return i;const n=i.start;if(o.isEqual(n))return null;return new Ps(n)}(e,t):function(e,t){const{start:o,end:i}=e,n=t.checkChild(o,"$text"),r=t.checkChild(i,"$text"),s=t.getLimitElement(o),a=t.getLimitElement(i);if(s===a){if(n&&r)return null;if(function(e,t,o){const i=e.nodeAfter&&!o.isLimit(e.nodeAfter)||o.checkChild(e,"$text"),n=t.nodeBefore&&!o.isLimit(t.nodeBefore)||o.checkChild(t,"$text");return i||n}(o,i,t)){const e=o.nodeAfter&&t.isSelectable(o.nodeAfter)?null:t.getNearestSelectionRange(o,"forward"),n=i.nodeBefore&&t.isSelectable(i.nodeBefore)?null:t.getNearestSelectionRange(i,"backward"),r=e?e.start:o,s=n?n.end:i;return new Ps(r,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=o.nodeAfter&&i.nodeBefore&&o.nodeAfter.parent===i.nodeBefore.parent,n=l&&(!e||!Dl(o.nodeAfter,t)),r=c&&(!e||!Dl(i.nodeBefore,t));let d=o,u=i;return n&&(d=As._createBefore(Ll(s,t))),r&&(u=As._createAfter(Ll(a,t))),new Ps(d,u)}return null}(e,t)}function Ll(e,t){let o=e,i=o;for(;t.isLimit(i)&&i.parent;)o=i,i=i.parent;return o}function Dl(e,t){return e&&t.isSelectable(e)}class zl{constructor(){this.markers=new bl,this.document=new gl(this),this.schema=new ba,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",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),Ol(this),this.document.registerPostFixer(ia)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Va,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){ho.a.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new Va(e):"function"==typeof e&&(t=e,e=new Va),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){ho.a.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,o){return function(e,t,o,i){return e.change(n=>{let r;r=o?o instanceof Ds||o instanceof qs?o:n.createSelection(o,i):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new Cl(e,n,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a,{isFirst:!0,isLast:!0});const l=s.getSelectionRange();l&&(r instanceof qs?n.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c})}(this,e,t,o)}deleteContent(e,t){Al(this,e,t)}modifySelection(e,t){!function(e,t,o={}){const i=e.schema,n="backward"!=o.direction,r=o.unit?o.unit:"character",s=t.focus,a=new xs({boundaries:Ml(s,n),singleCharacters:!0,direction:n?"forward":"backward"}),l={walker:a,schema:i,isForward:n,unit:r};let c;for(;c=a.next();){if(c.done)return;const o=Pl(l,c.value);if(o)return void(t instanceof qs?e.change(e=>{e.setSelectionFocus(o)}):t.setFocus(o))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const o=e.createDocumentFragment(),i=t.getFirstRange();if(!i||i.isCollapsed)return o;const n=i.start.root,r=i.start.getCommonPath(i.end),s=n.getNodeByPath(r);let a;a=i.start.parent==i.end.parent?i:e.createRange(e.createPositionAt(s,i.start.path[r.length]),e.createPositionAt(s,i.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(),o):e.append(e.cloneElement(t,!0),o);if(a!=i){const t=i._getTransformedByMove(a.start,e.createPositionAt(o,0),l)[0],n=e.createRange(e.createPositionAt(o,0),t.start);Rl(e.createRange(t.end,e.createPositionAt(o,"end")),e),Rl(n,e)}return o})}(this,e)}hasContent(e,t={}){const o=e instanceof ys?Ps._createIn(e):e;if(o.isCollapsed)return!1;const{ignoreWhitespaces:i=!1,ignoreMarkers:n=!1}=t;if(!n)for(const e of this.markers.getMarkersIntersectingRange(o))if(e.affectsData)return!0;for(const e of o.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!i)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}createPositionFromPath(e,t,o){return new As(e,t,o)}createPositionAt(e,t){return As._createAt(e,t)}createPositionAfter(e){return As._createAfter(e)}createPositionBefore(e){return As._createBefore(e)}createRange(e,t){return new Ps(e,t)}createRangeIn(e){return Ps._createIn(e)}createRangeOn(e){return Ps._createOn(e)}createSelection(e,t,o){return new Ds(e,t,o)}createBatch(e){return new Va(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return _l[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 ol(this,t);const o=this._pendingChanges[0].callback(this._currentWriter);e.push(o),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}xo(zl,Ui);class Bl{constructor(){this._listener=Object.create(mr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+bn(t),t)})}set(e,t,o={}){const i=wn(e),n=o.priority;this._listener.listenTo(this._listener,"_keydown:"+i,(e,o)=>{t(o,()=>{o.preventDefault(),o.stopPropagation(),e.stop()}),e.return=!0},{priority:n})}press(e){return!!this._listener.fire("_keydown:"+bn(e),e)}destroy(){this._listener.stopListening()}}class jl extends Bl{constructor(e){super(),this.editor=e}set(e,t,o={}){if("string"==typeof t){const e=t;t=(t,o)=>{this.editor.execute(e),o()}}super.set(e,t,o)}}class Fl{constructor(e={}){this._context=e.context||new Io({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new io(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new Ao(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new ma,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 zl;const o=new Ii;this.data=new Ia(this.model,o),this.editing=new fa(this.model,o),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Na([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 jl(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),o=e.get("removePlugins")||[],i=e.get("extraPlugins")||[];return this.plugins.init(t.concat(i),o)}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){ho.a.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}}xo(Fl,Ui);var Hl={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};var Ul={updateSourceElement(){if(!this.sourceElement)throw new ho.a("editor-missing-sourceelement",this);var e,t;e=this.sourceElement,t=this.data.get(),e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}};class Wl{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class ql{constructor(e){this._domParser=new DOMParser,this._domConverter=new cr(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new Wl}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)}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),o=t.createDocumentFragment(),i=t.body.childNodes;for(;i.length>0;)o.appendChild(i[0]);return o}}class $l{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(Gl(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new ho.a("componentfactory-item-missing",this,{name:e});return this._components.get(Gl(e)).callback(this.editor.locale)}has(e){return this._components.has(Gl(e))}}function Gl(e){return String(e).toLowerCase()}class Yl{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 ho.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)}}xo(Yl,mr),xo(Yl,Ui);class Kl{constructor(e){this.editor=e,this.componentFactory=new $l(e),this.focusTracker=new Yl,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}}xo(Kl,go);o(16);const Ql=new WeakMap;function Jl(e){const{view:t,element:o,text:i,isDirectHost:n=!0}=e,r=t.document;Ql.has(r)||(Ql.set(r,new Map),r.registerPostFixer(e=>Xl(r,e))),Ql.get(r).set(o,{text:i,isDirectHost:n}),t.change(e=>Xl(r,e))}function Zl(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function Xl(e,t){const o=Ql.get(e);let i=!1;for(const[e,n]of o)ec(t,e,n)&&(i=!0);return i}function ec(e,t,o){const{text:i,isDirectHost:n}=o,r=n?t:function(e){if(1===e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}(t);let s=!1;return!!r&&(o.hostElement=r,r.getAttribute("data-placeholder")!==i&&(e.setAttribute("data-placeholder",i,r),s=!0),!function(e){if(!e.isAttached())return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement")),o=e.document;if(!o.isFocused&&t)return!0;const i=o.selection.anchor;return!(!t||!i||i.parent===e)}(r)?Zl(e,r)&&(s=!0):function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0),s)}class tc{constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach(({element:e,newElement:t})=>{e.style.display="",t&&t.remove()}),this._replacedElements=[]}}class oc extends Kl{constructor(e,t){var o;super(e),this.view=t,this._toolbarConfig=(o=e.config.get("toolbar"),Array.isArray(o)?{items:o}:o?Object.assign({items:[]},o):{items:[]}),this._elementReplacer=new tc}get element(){return this.view.element}init(e){const t=this.editor,o=this.view,i=t.editing.view,n=o.editable,r=i.document.getRoot();n.name=r.rootName,o.render();const s=n.element;this.setEditableElement(n.name,s),this.focusTracker.add(s),o.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(s),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initToolbar(){const e=this.editor,t=this.view,o=e.editing.view;t.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),t.stickyPanel.limiterElement=t.element,this._toolbarConfig.viewportTopOffset&&(t.stickyPanel.viewportTopOffset=this._toolbarConfig.viewportTopOffset),t.toolbar.fillFromConfig(this._toolbarConfig.items,this.componentFactory),function({origin:e,originKeystrokeHandler:t,originFocusTracker:o,toolbar:i,beforeFocus:n,afterBlur:r}){o.add(i.element),t.set("Alt+F10",(e,t)=>{o.isFocused&&!i.focusTracker.isFocused&&(n&&n(),i.focus(),t())}),i.keystrokes.set("Esc",(t,o)=>{i.focusTracker.isFocused&&(e.focus(),r&&r(),o())})}({origin:o,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:t.toolbar})}_initPlaceholder(){const e=this.editor,t=e.editing.view,o=t.document.getRoot(),i=e.sourceElement,n=e.config.get("placeholder")||i&&"textarea"===i.tagName.toLowerCase()&&i.getAttribute("placeholder");n&&Jl({view:t,element:o,text:n,isDirectHost:!1})}}class ic extends Co{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,o)=>{this._renderViewIntoCollectionParent(t,o)}),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 ho.a("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const o of this)for(const i of e)o.delegate(i).to(t);this.on("add",(o,i)=>{for(const o of e)i.delegate(o).to(t)}),this.on("remove",(o,i)=>{for(const o of e)i.stopDelegating(o,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}class nc{constructor(e){Object.assign(this,mc(fc(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 ho.a("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const o of t.children)kc(o)?yield o:_c(o)&&(yield*e(o))}(this)}static bind(e,t){return{to:(o,i)=>new sc({eventNameOrFunction:o,attribute:o,observable:e,emitter:t,callback:i}),if:(o,i,n)=>new ac({observable:e,emitter:t,attribute:o,valueIfTrue:i,callback:n})}}static extend(e,t){if(e._isRendered)throw new ho.a("template-extend-render",[this,e]);!function e(t,o){o.attributes&&(t.attributes||(t.attributes={}),bc(t.attributes,o.attributes));o.eventListeners&&(t.eventListeners||(t.eventListeners={}),bc(t.eventListeners,o.eventListeners));o.text&&t.text.push(...o.text);if(o.children&&o.children.length){if(t.children.length!=o.children.length)throw new ho.a("ui-template-extend-children-mismatch",t);let i=0;for(const n of o.children)e(t.children[i++],n)}}(e,mc(fc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new ho.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(""),lc(this.text)?this._bindToObservable({schema:this.text,updater:dc(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,o,i,n;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(i=r.getAttribute(t),o=this.attributes[t],s&&(s.attributes[t]=i),n=D(o[0])&&o[0].ns?o[0].ns:null,lc(o)){const a=n?o[0].value:o;s&&yc(t)&&a.unshift(i),this._bindToObservable({schema:a,updater:uc(r,t,n),data:e})}else"style"==t&&"string"!=typeof o[0]?this._renderStyleAttribute(o[0],e):(s&&i&&yc(t)&&o.unshift(i),o=o.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(pc,""),wc(o)||r.setAttributeNS(n,t,o))}_renderStyleAttribute(e,t){const o=t.node;for(const i in e){const n=e[i];lc(n)?this._bindToObservable({schema:[n],updater:hc(o,i),data:t}):o.style[i]=n}}_renderElementChildren(e){const t=e.node,o=e.intoFragment?document.createDocumentFragment():t,i=e.isApplying;let n=0;for(const r of this.children)if(vc(r)){if(!i){r.setParent(t);for(const e of r)o.appendChild(e.element)}}else if(kc(r))i||(r.isRendered||r.render(),o.appendChild(r.element));else if(er(r))o.appendChild(r);else if(i){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:o.childNodes[n++],isApplying:!0,revertData:t})}else o.appendChild(r.render());e.intoFragment&&t.appendChild(o)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const o=this.eventListeners[t].map(o=>{const[i,n]=t.split("@");return o.activateDomEventListener(i,n,e)});e.revertData&&e.revertData.bindings.push(o)}}_bindToObservable({schema:e,updater:t,data:o}){const i=o.revertData;cc(e,t,o);const n=e.filter(e=>!wc(e)).filter(e=>e.observable).map(i=>i.activateAttributeListener(e,t,o));i&&i.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 o in t.attributes){const i=t.attributes[o];null===i?e.removeAttribute(o):e.setAttribute(o,i)}for(let o=0;o<t.children.length;++o)this._revertTemplateFromNode(e.childNodes[o],t.children[o])}}}xo(nc,go);class rc{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,o){const i=()=>cc(e,t,o);return this.emitter.listenTo(this.observable,"change:"+this.attribute,i),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,i)}}}class sc extends rc{activateDomEventListener(e,t,o){const i=(e,o)=>{t&&!o.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(o):this.observable.fire(this.eventNameOrFunction,o))};return this.emitter.listenTo(o.node,e,i),()=>{this.emitter.stopListening(o.node,e,i)}}}class ac extends rc{getValue(e){return!wc(super.getValue(e))&&(this.valueIfTrue||!0)}}function lc(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(lc):e instanceof rc)}function cc(e,t,{node:o}){let i=function(e,t){return e.map(e=>e instanceof rc?e.getValue(t):e)}(e,o);i=1==e.length&&e[0]instanceof ac?i[0]:i.reduce(pc,""),wc(i)?t.remove():t.set(i)}function dc(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function uc(e,t,o){return{set(i){e.setAttributeNS(o,t,i)},remove(){e.removeAttributeNS(o,t)}}}function hc(e,t){return{set(o){e.style[t]=o},remove(){e.style[t]=null}}}function fc(e){return to(e,e=>{if(e&&(e instanceof rc||_c(e)||kc(e)||vc(e)))return e})}function mc(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(vc(e.children))t.push(e.children);else for(const o of e.children)_c(o)||kc(o)||er(o)?t.push(o):t.push(new nc(o));e.children=t}return e}function gc(e,t){e[t]=To(e[t])}function pc(e,t){return wc(t)?e:wc(e)?t:`${e} ${t}`}function bc(e,t){for(const o in t)e[o]?e[o].push(...t[o]):e[o]=t[o]}function wc(e){return!e&&0!==e}function kc(e){return e instanceof xc}function _c(e){return e instanceof nc}function vc(e){return e instanceof ic}function yc(e){return"class"==e||"style"==e}o(18);class xc{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Co,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,o)=>{o.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=nc.bind(this,this)}createCollection(e){const t=new ic(e);return this._viewCollections.add(t),t}registerChild(e){yo(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){yo(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 ho.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)}}xo(xc,mr),xo(xc,Ui);var Cc=function(e){return"string"==typeof e||!Ve(e)&&p(e)&&"[object String]"==f(e)};class Ac extends ic{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=function(e,t,o={},i=[]){const n=o&&o.xmlns,r=n?e.createElementNS(n,t):e.createElement(t);for(const e in o)r.setAttribute(e,o[e]);!Cc(i)&&yo(i)||(i=[i]);for(let t of i)Cc(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}(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()}}o(20);class Tc extends xc{constructor(e){super(e),this.body=new Ac(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}o(22);class Sc extends xc{constructor(e){super(e),this.set("text"),this.set("for"),this.id="ck-editor__label_"+co();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 Ec extends Tc{constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new Sc;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class Pc extends xc{constructor(e,t,o){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=o,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(o=>{const i=e.document.getRoot(t.name);o.addClass(t.isFocused?"ck-focused":"ck-blurred",i),o.removeClass(t.isFocused?"ck-blurred":"ck-focused",i)})}e.isRenderingInProgress?function o(i){e.once("change:isRenderingInProgress",(e,n,r)=>{r?o(i):t(i)})}(this):t(this)}}class Mc extends Pc{constructor(e,t,o){super(e,t,o),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(o=>{const i=e.document.getRoot(this.name);o.setAttribute("aria-label",t("Rich Text Editor, %0",this.name),i)})}}function Ic(e){return t=>t+e}o(24);const Nc=Ic("px");class Rc extends xc{constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheLimiter",!1),this.set("_hasViewportTopOffset",!1),this.content=this.createCollection(),this._contentPanelPlaceholder=new nc({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",e=>e?"block":"none"),height:t.to("isSticky",e=>e?Nc(this._panelRect.height):null)}}}).render(),this._contentPanel=new nc({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",e=>e?Nc(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_hasViewportTopOffset",e=>e?Nc(this.viewportTopOffset):null),bottom:t.to("_isStickyToTheLimiter",e=>e?Nc(this.limiterBottomOffset):null),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this._contentPanel]})}render(){super.render(),this._checkIfShouldBeSticky(),this.listenTo(rr.window,"scroll",()=>{this._checkIfShouldBeSticky()}),this.listenTo(this,"change:isActive",()=>{this._checkIfShouldBeSticky()})}_checkIfShouldBeSticky(){const e=this._panelRect=this._contentPanel.getBoundingClientRect();let t;this.limiterElement?(t=this._limiterRect=this.limiterElement.getBoundingClientRect(),this.isSticky=this.isActive&&t.top<this.viewportTopOffset&&this._panelRect.height+this.limiterBottomOffset<t.height):this.isSticky=!1,this.isSticky?(this._isStickyToTheLimiter=t.bottom<e.height+this.limiterBottomOffset+this.viewportTopOffset,this._hasViewportTopOffset=!this._isStickyToTheLimiter&&!!this.viewportTopOffset,this._marginLeft=this._isStickyToTheLimiter?null:Nc(-rr.window.scrollX)):(this._isStickyToTheLimiter=!1,this._hasViewportTopOffset=!1,this._marginLeft=null)}}class Oc{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let o=e.actions[t];"string"==typeof o&&(o=[o]);for(const i of o)e.keystrokeHandler.set(i,(e,o)=>{this[t](),o()})}}get first(){return this.focusables.find(Vc)||null}get last(){return this.focusables.filter(Vc).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,o)=>{const i=t.element===this.focusTracker.focusedElement;return i&&(e=o),i}),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,o=this.focusables.length;if(!o)return null;if(null===t)return this[1===e?"first":"last"];let i=(t+o+e)%o;do{const t=this.focusables.get(i);if(Vc(t))return t;i=(i+o+e)%o}while(i!==t);return null}}function Vc(e){return!(!e.focus||"none"==rr.window.getComputedStyle(e.element).display)}class Lc extends xc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Dc extends xc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}class zc{constructor(e,t){zc._observerInstance||zc._createObserver(),this._element=e,this._callback=t,zc._addElementCallback(e,t),zc._observerInstance.observe(e)}destroy(){zc._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){zc._elementCallbacks||(zc._elementCallbacks=new Map);let o=zc._elementCallbacks.get(e);o||(o=new Set,zc._elementCallbacks.set(e,o)),o.add(t)}static _deleteElementCallback(e,t){const o=zc._getElementCallbacks(e);o&&(o.delete(t),o.size||(zc._elementCallbacks.delete(e),zc._observerInstance.unobserve(e))),zc._elementCallbacks&&!zc._elementCallbacks.size&&(zc._observerInstance=null,zc._elementCallbacks=null)}static _getElementCallbacks(e){return zc._elementCallbacks?zc._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof rr.window.ResizeObserver?rr.window.ResizeObserver:Bc,zc._observerInstance=new e(e=>{for(const t of e){const e=zc._getElementCallbacks(t.target);if(e)for(const o of e)o(t)}})}}zc._observerInstance=null,zc._elementCallbacks=null;class Bc{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(rr.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 ns(e),o=this._previousRects.get(e),i=!o||!o.isEqual(t);return this._previousRects.set(e,t),i}}xo(Bc,mr);class jc extends xc{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()}}}o(26);function Fc({element:e,target:t,positions:o,limiter:i,fitInViewport:n}){B(t)&&(t=t()),B(i)&&(i=i());const r=function(e){return e&&e.parentNode?e.offsetParent===rr.document.body?null:e.offsetParent:null}(e),s=new ns(e),a=new ns(t);let l,c;if(i||n){const e=function(e,t){const{elementRect:o,viewportRect:i}=t,n=o.getArea(),r=function(e,{targetRect:t,elementRect:o,limiterRect:i,viewportRect:n}){const r=[],s=o.getArea();for(const a of e){const e=Hc(a,t,o);if(!e)continue;const[l,c]=e;let d=0,u=0;if(i)if(n){const e=i.getIntersection(n);e&&(d=e.getIntersectionArea(c))}else d=i.getIntersectionArea(c);n&&(u=n.getIntersectionArea(c));const h={positionName:l,positionRect:c,limiterIntersectArea:d,viewportIntersectArea:u};if(d===s)return[h];r.push(h)}return r}(e,t);if(i){const e=Uc(r.filter(({viewportIntersectArea:e})=>e===n),n);if(e)return e}return Uc(r,n)}(o,{targetRect:a,elementRect:s,limiterRect:i&&new ns(i).getVisible(),viewportRect:n&&new ns(rr.window)});[c,l]=e||Hc(o[0],a,s)}else[c,l]=Hc(o[0],a,s);let d=Wc(l);return r&&(d=function({left:e,top:t},o){const i=Wc(new ns(o)),n=os(o);return e-=i.left,t-=i.top,e+=o.scrollLeft,t+=o.scrollTop,e-=n.left,t-=n.top,{left:e,top:t}}(d,r)),{left:d.left,top:d.top,name:c}}function Hc(e,t,o){const i=e(t,o);if(!i)return null;const{left:n,top:r,name:s}=i;return[s,o.clone().moveTo(n,r)]}function Uc(e,t){let o,i,n=0;for(const{positionName:r,positionRect:s,limiterIntersectArea:a,viewportIntersectArea:l}of e){if(a===t)return[r,s];const e=l**2+a**2;e>n&&(n=e,o=s,i=r)}return o?[i,o]:null}function Wc({left:e,top:t}){const{scrollX:o,scrollY:i}=rr.window;return{left:e+o,top:t+i}}class qc extends xc{constructor(e,t,o){super(e);const i=this.bindTemplate;this.buttonView=t,this.panelView=o,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Bl,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",i.to("class"),i.if("isEnabled","ck-disabled",e=>!e)],id:i.to("id"),"aria-describedby":i.to("ariaDescribedById")},children:[t,o]}),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=qc._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{southEast:e,southWest:t,northEast:o,northWest:i}=qc.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,t,o,i]:[t,e,i,o]}}qc.defaultPanelPositions={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"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.bottom-t.height,left:e.left-t.width+e.width,name:"nw"})},qc._getOptimalPosition=Fc;o(28);class $c extends xc{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})}}o(30);class Gc extends xc{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")}]}]})}}o(32);class Yc extends xc{constructor(e){super(e);const t=this.bindTemplate,o=co();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(o),this.iconView=new $c,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_"+o,"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.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new Gc;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new xc,o=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:o.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new xc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>kn(e))}]}),e}_getTooltipString(e,t,o){return e?"string"==typeof e?e:(o&&(o=kn(o)),e instanceof Function?e(t,o):`${t}${o?` (${o})`:""}`):""}}var Kc='<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 Qc extends Yc{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 $c;return e.content=Kc,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}o(34);class Jc extends xc{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Yl,this.keystrokes=new Bl,this._focusCycler=new Oc({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 Zc extends xc{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 Xc extends xc{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}o(36);class ed extends Yc{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 xc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function td({emitter:e,activator:t,callback:o,contextElements:i}){e.listenTo(document,"mousedown",(e,n)=>{if(!t())return;const r="function"==typeof n.composedPath?n.composedPath():[];for(const e of i)if(e.contains(n.target)||r.includes(e))return;o()})}o(38),o(40);function od(e,t=Qc){const o=new t(e),i=new jc(e),n=new qc(e,o,i);return o.bind("isEnabled").to(n),o instanceof Qc?o.bind("isOn").to(n,"isOpen"):o.arrowView.bind("isOn").to(n,"isOpen"),function(e){(function(e){e.on("render",()=>{td({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof ed||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,o)=>{e.isOpen&&(e.panelView.focus(),o())}),e.keystrokes.set("arrowup",(t,o)=>{e.isOpen&&(e.panelView.focusLast(),o())})}(e)}(n),n}function id(e,t){const o=e.locale,i=o.t,n=e.toolbarView=new rd(o);n.set("ariaLabel",i("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 nd(e,t){const o=e.locale,i=e.listView=new Jc(o);i.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Xc(o);if("button"===e||"switchbutton"===e){const i=new Zc(o);let n;return n="button"===e?new Yc(o):new ed(o),n.bind(...Object.keys(t)).to(t),n.delegate("execute").to(i),i.children.add(n),i}}),e.panelView.children.add(i),i.items.delegate("execute").to(e)}o(42);class rd extends xc{constructor(e,t){super(e);const o=this.bindTemplate,i=this.t;this.options=t||{},this.set("ariaLabel",i("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Yl,this.keystrokes=new Bl,this.set("class"),this.set("isCompact",!1),this.itemsView=new sd(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new Oc({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}});const n=["ck","ck-toolbar",o.to("class"),o.if("isCompact","ck-toolbar_compact")];var r;this.options.shouldGroupWhenFull&&this.options.isFloating&&n.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:n,role:"toolbar","aria-label":o.to("ariaLabel"),style:{maxWidth:o.to("maxWidth")}},children:this.children,on:{mousedown:(r=this,r.bindTemplate.to(e=>{e.target===r.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new ld(this):new ad(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){this.items.addMany(e.map(o=>"|"==o?new Lc:"-"==o?(this.options.shouldGroupWhenFull&&Object(ho.c)("toolbarview-line-break-ignored-when-grouping-items",e),new Dc):t.has(o)?t.create(o):void Object(ho.c)("toolbarview-item-unavailable",{name:o})).filter(e=>void 0!==e))}}class sd extends xc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class ad{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 ld{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 o=t.index;for(const e of t.removed)o>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=o;e<o+t.added.length;e++){const i=t.added[e-o];e>this.ungroupedItems.length?this.groupedItems.add(i,e-this.ungroupedItems.length):this.ungroupedItems.add(i,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,o=new ns(e.lastChild),i=new ns(e);if(!this.cachedPadding){const o=rr.window.getComputedStyle(e),i="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[i])}return"ltr"===t?o.right>i.right-this.cachedPadding:o.left<i.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new zc(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 Lc),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,o=od(e);return o.class="ck-toolbar__grouped-dropdown",o.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",id(o,[]),o.buttonView.set({label:t("Show more items"),tooltip:!0,icon:'<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>'}),o.toolbarView.items.bindTo(this.groupedItems).using(e=>e),o}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}o(44);class cd extends Ec{constructor(e,t,o={}){super(e),this.stickyPanel=new Rc(e),this.toolbar=new rd(e,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),this.editable=new Mc(e,t)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class dd extends Fl{constructor(e,t){super(t),oo(e)&&(this.sourceElement=e),this.data.processor=new ql(this.data.viewDocument),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=new cd(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:o});this.ui=new oc(this,i),function(e){if(!B(e.updateSourceElement))throw new ho.a("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(t&&"textarea"===t.tagName.toLowerCase()&&t.form){let o;const i=t.form,n=()=>e.updateSourceElement();B(i.submit)&&(o=i.submit,i.submit=()=>{n(),o.apply(i)}),i.addEventListener("submit",n),e.on("destroy",()=>{i.removeEventListener("submit",n),o&&(i.submit=o)})}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(o=>{const i=new this(e,t);o(i.initPlugins().then(()=>i.ui.init(oo(e)?e:null)).then(()=>{if(!oo(e)&&t.initialData)throw new ho.a("editor-create-initial-data",null);const o=t.initialData||function(e){return oo(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}(e);return i.data.init(o)}).then(()=>i.fire("ready")).then(()=>i))})}}xo(dd,Hl),xo(dd,Ul);class ud{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",hd,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",hd),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function hd(e){e.return=!1,e.stop()}xo(ud,Ui);class fd{constructor(e){this.files=function(e){const t=e.files?Array.from(e.files):[],o=e.items?Array.from(e.items):[];if(t.length)return t;return o.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)}}class md extends zr{constructor(e){super(e);const t=this.document;function o(e,o){o.preventDefault();const i=o.dropRange?[o.dropRange]:Array.from(t.selection.getRanges()),n=new ao(t,"clipboardInput");t.fire(n,{dataTransfer:o.dataTransfer,targetRanges:i}),n.stop.called&&o.stopPropagation()}this.domEventType=["paste","copy","cut","drop","dragover"],this.listenTo(t,"paste",o,{priority:"low"}),this.listenTo(t,"drop",o,{priority:"low"})}onDomEvent(e){const t={dataTransfer:new fd(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"==e.type&&(t.dropRange=function(e,t){const o=t.target.ownerDocument,i=t.clientX,n=t.clientY;let r;o.caretRangeFromPoint&&o.caretRangeFromPoint(i,n)?r=o.caretRangeFromPoint(i,n):t.rangeParent&&(r=o.createRange(),r.setStart(t.rangeParent,t.rangeOffset),r.collapse(!0));return r?e.domConverter.domRangeToView(r):e.document.selection.getFirstRange()}(this.view,e)),this.fire(e.type,e,t)}}class gd extends ud{static get pluginName(){return"PastePlainText"}init(){const e=this.editor.editing.view,t=e.document;let o=!1;e.addObserver(md),this.listenTo(t,"keydown",(e,t)=>{o=t.shiftKey}),this.listenTo(t,"clipboardInput",(e,t)=>{o&&(t.asPlainText=!0)},{priority:"high"})}}const pd=["figcaption","li"];class bd extends ud{static get pluginName(){return"Clipboard"}static get requires(){return[gd]}init(){const e=this.editor,t=e.model.document,o=e.editing.view,i=o.document;function n(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._htmlDataProcessor=new ql(i),o.addObserver(md),this.listenTo(i,"clipboardInput",t=>{e.isReadOnly&&t.stop()},{priority:"highest"}),this.listenTo(i,"clipboardInput",(e,t)=>{const i=t.dataTransfer;let n="";var r;i.getData("text/html")?n=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t)}(i.getData("text/html")):i.getData("text/plain")&&(((r=(r=i.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>")||r.includes("<br>"))&&(r=`<p>${r}</p>`),n=r),n=this._htmlDataProcessor.toView(n);const s=new ao(this,"inputTransformation");this.fire(s,{content:n,dataTransfer:i,asPlainText:t.asPlainText}),s.stop.called&&e.stop(),o.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,t)=>{if(!t.content.isEmpty){const o=this.editor.data,i=this.editor.model,n=o.toModel(t.content,"$clipboardHolder");if(0==n.childCount)return;i.change(e=>{const o=i.document.selection;if(t.asPlainText||function(e,t){if(e.childCount>1)return!1;const o=e.getChild(0);if(t.isObject(o))return!1;return 0==[...o.getAttributeKeys()].length}(n,i.schema)){const t=Array.from(o.getAttributes()).filter(([e])=>i.schema.getAttributeProperties(e).isFormatting);o.isCollapsed||i.deleteContent(o,{doNotAutoparagraph:!0}),t.push(...o.getAttributes());const r=e.createRangeIn(n);for(const o of r.getItems())(o.is("$text")||o.is("$textProxy"))&&e.setAttributes(t,o)}i.insertContent(n)}),e.stop()}},{priority:"low"}),this.listenTo(i,"copy",n,{priority:"low"}),this.listenTo(i,"cut",(t,o)=>{e.isReadOnly?o.preventDefault():n(t,o)},{priority:"low"}),this.listenTo(i,"clipboardOutput",(o,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",function e(t){let o="";if(t.is("$text")||t.is("$textProxy"))o=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))o=t.getAttribute("alt");else if(t.is("element","br"))o="\n";else{let i=null;for(const n of t.getChildren()){const t=e(n);i&&(i.is("containerElement")||n.is("containerElement"))&&(pd.includes(i.name)||pd.includes(n.name)?o+="\n":o+="\n\n"),o+=t,i=n}}return o}(i.content))),"cut"==i.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}class wd{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,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",kd,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",kd),this.refresh())}execute(){}destroy(){this.stopListening()}}function kd(e){e.return=!1,e.stop()}function*_d(e,t){for(const o of t)o&&e.getAttributeProperties(o[0]).copyOnEnter&&(yield o)}xo(wd,Ui);class vd extends wd{execute(){const e=this.editor.model,t=e.document;e.change(o=>{!function(e,t,o,i){const n=o.isCollapsed,r=o.getFirstRange(),s=r.start.parent,a=r.end.parent;if(i.isLimit(s)||i.isLimit(a))return void(n||s!=a||e.deleteContent(o));if(n){const e=_d(t.model.schema,o.getAttributes());yd(t,r.start),t.setSelectionAttribute(e)}else{const i=!(r.start.isAtStart&&r.end.isAtEnd),n=s==a;e.deleteContent(o,{leaveUnmerged:i}),i&&(n?yd(t,o.focus):t.setSelection(a,0))}}(this.editor.model,o,t.selection,e.schema),this.fire("afterExecute",{writer:o})})}}function yd(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}class xd extends br{constructor(e){super(e);const t=this.document;t.on("keydown",(e,o)=>{if(this.isEnabled&&o.keyCode==pn.enter){let i;t.once("enter",e=>i=e,{priority:"highest"}),t.fire("enter",new Dr(t,o.domEvent,{isSoft:o.shiftKey})),i&&i.stop.called&&e.stop()}})}observe(){}}class Cd extends ud{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,o=t.document;t.addObserver(xd),e.commands.add("enter",new vd(e)),this.listenTo(o,"enter",(o,i)=>{i.preventDefault(),i.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class Ad extends wd{execute(){const e=this.editor.model,t=e.document;e.change(o=>{!function(e,t,o){const i=o.isCollapsed,n=o.getFirstRange(),r=n.start.parent,s=n.end.parent,a=r==s;if(i){const i=_d(e.schema,o.getAttributes());Td(e,t,n.end),t.removeSelectionAttribute(o.getAttributeKeys()),t.setSelectionAttribute(i)}else{const i=!(n.start.isAtStart&&n.end.isAtEnd);e.deleteContent(o,{leaveUnmerged:i}),a?Td(e,t,o.focus):i&&t.setSelection(s,0)}}(e,o,t.selection),this.fire("afterExecute",{writer:o})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const o=t.anchor;if(!o||!e.checkChild(o,"softBreak"))return!1;const i=t.getFirstRange(),n=i.start.parent,r=i.end.parent;if((Sd(n,e)||Sd(r,e))&&n!==r)return!1;return!0}(e.schema,t.selection)}}function Td(e,t,o){const i=t.createElement("softBreak");e.insertContent(i,o),t.setSelection(i,"after")}function Sd(e,t){return!e.is("rootElement")&&(t.isLimit(e)||Sd(e.parent,t))}class Ed extends ud{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,o=e.conversion,i=e.editing.view,n=i.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),o.for("upcast").elementToElement({model:"softBreak",view:"br"}),o.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),i.addObserver(xd),e.commands.add("shiftEnter",new Ad(e)),this.listenTo(n,"enter",(t,o)=>{o.preventDefault(),o.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"})}}class Pd extends wd{execute(){const e=this.editor.model,t=e.document.selection;let o=e.schema.getLimitElement(t);if(t.containsEntireContent(o)||!Md(e.schema,o))do{if(o=o.parent,!o)return}while(!Md(e.schema,o));e.change(e=>{e.setSelection(o,"in")})}}function Md(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const Id=wn("Ctrl+A");class Nd extends ud{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new Pd(e)),this.listenTo(t,"keydown",(t,o)=>{bn(o)===Id&&(e.execute("selectAll"),o.preventDefault())})}}class Rd extends ud{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const o=e.commands.get("selectAll"),i=new Yc(t),n=t.t;return i.set({label:n("Select all"),icon:'<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><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}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),i})}}class Od extends ud{static get requires(){return[Nd,Rd]}static get pluginName(){return"SelectAll"}}class Vd{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 Ld extends wd{constructor(e,t){super(e),this._buffer=new Vd(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,o=t.document,i=e.text||"",n=i.length,r=e.range?t.createSelection(e.range):o.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),this._batches.add(this._buffer.batch),t.deleteContent(r),i&&t.insertContent(e.createText(i,o.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(n)})}}const Dd=[bn("arrowUp"),bn("arrowRight"),bn("arrowDown"),bn("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++)Dd.push(e);function zd(e){return!!e.ctrlKey||Dd.includes(e.keyCode)}function Bd(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const o=[];let i,n=0;return e.forEach(e=>{"equal"==e?(r(),n++):"insert"==e?(s("insert")?i.values.push(t[n]):(r(),i={type:"insert",index:n,values:[t[n]]}),n++):s("delete")?i.howMany++:(r(),i={type:"delete",index:n,howMany:1})}),r(),o;function r(){i&&(o.push(i),i=null)}function s(e){return i&&i.type==e}}(Jn(e.oldChildren,e.newChildren,jd),e.newChildren);if(t.length>1)return;const o=t[0];return o.values[0]&&o.values[0].is("$text")?o:void 0}function jd(e,t){return e&&e.is("$text")&&t&&t.is("$text")?e.data===t.data:e===t}class Fd{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&&!Bd(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const o of e)this._handleTextMutation(o,t),this._handleTextNodeInsertion(o)}_handleContainerChildrenMutations(e,t){const o=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(!o)return;const i=this.editor.editing.view.domConverter.mapViewToDom(o),n=new cr(this.editor.editing.view.document),r=this.editor.data.toModel(n.domToView(i)).getChild(0),s=this.editor.editing.mapper.toModelElement(o);if(!s)return;const a=Array.from(r.getChildren()),l=Array.from(s.getChildren()),c=a[a.length-1],d=l[l.length-1],u=c&&c.is("element","softBreak"),h=d&&!d.is("element","softBreak");u&&h&&a.pop();const f=this.editor.model.schema;if(!Hd(a,f)||!Hd(l,f))return;const m=a.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," "),g=l.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," ");if(g===m)return;const p=Jn(g,m),{firstChangeAt:b,insertions:w,deletions:k}=Ud(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 o=e.newText.replace(/\u00A0/g," "),i=e.oldText.replace(/\u00A0/g," ");if(i===o)return;const n=Jn(i,o),{firstChangeAt:r,insertions:s,deletions:a}=Ud(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),u=this.editor.model.createRange(d,d.getShiftedBy(a)),h=o.substr(r,s);this.editor.execute("input",{text:h,range:u,resultRange:l})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=Bd(e),o=this.editing.view.createPositionAt(e.node,t.index),i=this.editing.mapper.toModelPosition(o),n=t.values[0].data;this.editor.execute("input",{text:n.replace(/\u00A0/g," "),range:this.editor.model.createRange(i)})}}function Hd(e,t){return e.every(e=>t.isInline(e))}function Ud(e){let t=null,o=null;for(let i=0;i<e.length;i++){"equal"!=e[i]&&(t=null===t?i:t,o=i)}let i=0,n=0;for(let r=t;r<=o;r++)"insert"!=e[r]&&i++,"delete"!=e[r]&&n++;return{insertions:n,deletions:i,firstChangeAt:t}}class Wd extends ud{static get pluginName(){return"Input"}init(){const e=this.editor,t=new Ld(e,e.config.get("typing.undoStep")||20);e.commands.add("input",t),function(e){let t=null;const o=e.model,i=e.editing.view,n=e.commands.get("input");function r(e){const r=o.document,a=i.document.isComposing,l=t&&t.isEqual(r.selection);t=null,n.isEnabled&&(zd(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),o.enqueueChange(t,()=>{o.deleteContent(o.document.selection)}),e.unlock()}fn.isAndroid?i.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):i.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),i.document.on("compositionstart",(function(){const e=o.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),i.document.on("compositionend",()=>{t=o.createSelection(o.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(t,o,i)=>{new Fd(e).handle(o,i)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class qd extends wd{constructor(e,t){super(e),this.direction=t,this._buffer=new Vd(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,o=t.document;t.enqueueChange(this._buffer.batch,i=>{this._buffer.lock();const n=i.createSelection(e.selection||o.selection),r=n.isCollapsed;if(n.isCollapsed&&t.modifySelection(n,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(e.sequence||1))return void this._replaceEntireContentWithParagraph(i);if(n.isCollapsed)return;let s=0;n.getFirstRange().getMinimalFlatRanges().forEach(e=>{s+=on(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(n,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(s),i.setSelection(n),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,o=t.document.selection,i=t.schema.getLimitElement(o);if(!(o.isCollapsed&&o.containsEntireContent(i)))return!1;if(!t.schema.checkChild(i,"paragraph"))return!1;const n=i.getChild(0);return!n||"paragraph"!==n.name}_replaceEntireContentWithParagraph(e){const t=this.editor.model,o=t.document.selection,i=t.schema.getLimitElement(o),n=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(n,i),e.setSelection(n,0)}}class $d extends br{constructor(e){super(e);const t=e.document;let o=0;function i(e,o,i){let n;t.once("delete",e=>n=e,{priority:Number.POSITIVE_INFINITY}),t.fire("delete",new Dr(t,o,i)),n&&n.stop.called&&e.stop()}t.on("keyup",(e,t)=>{t.keyCode!=pn.delete&&t.keyCode!=pn.backspace||(o=0)}),t.on("keydown",(e,t)=>{const n={};if(t.keyCode==pn.delete)n.direction="forward",n.unit="character";else{if(t.keyCode!=pn.backspace)return;n.direction="backward",n.unit="codePoint"}const r=fn.isMac?t.altKey:t.ctrlKey;n.unit=r?"word":n.unit,n.sequence=++o,i(e,t.domEvent,n)}),fn.isAndroid&&t.on("beforeinput",(t,o)=>{if("deleteContentBackward"!=o.domEvent.inputType)return;const n={unit:"codepoint",direction:"backward",sequence:1},r=o.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(n.selectionToRemove=e.domConverter.domSelectionToView(r)),i(t,o.domEvent,n)})}observe(){}}class Gd extends ud{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,o=t.document;if(t.addObserver($d),e.commands.add("forwardDelete",new qd(e,"forward")),e.commands.add("delete",new qd(e,"backward")),this.listenTo(o,"delete",(o,i)=>{const n={unit:i.unit,sequence:i.sequence};if(i.selectionToRemove){const t=e.model.createSelection(),o=[];for(const t of i.selectionToRemove.getRanges())o.push(e.editing.mapper.toModelRange(t));t.setTo(o),n.selection=t}e.execute("forward"==i.direction?"forwardDelete":"delete",n),i.preventDefault(),t.scrollToTheSelection()}),fn.isAndroid){let e=null;this.listenTo(o,"delete",(t,o)=>{const i=o.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}},{priority:"lowest"}),this.listenTo(o,"keyup",(t,o)=>{if(e){const t=o.domTarget.ownerDocument.defaultView.getSelection();t.collapse(e.anchorNode,e.anchorOffset),t.extend(e.focusNode,e.focusOffset),e=null}})}}}class Yd extends ud{static get requires(){return[Wd,Gd]}static get pluginName(){return"Typing"}}const Kd=new Map;function Qd(e,t,o){let i=Kd.get(e);i||(i=new Map,Kd.set(e,i)),i.set(t,o)}function Jd(e){return[e]}function Zd(e,t,o={}){const i=function(e,t){const o=Kd.get(e);return o&&o.has(t)?o.get(t):Jd}(e.constructor,t.constructor);try{return i(e=e.clone(),t,o)}catch(e){throw e}}function Xd(e,t,o){e=e.slice(),t=t.slice();const i=new eu(o.document,o.useRelations,o.forceWeakRemove);i.setOriginalOperations(e),i.setOriginalOperations(t);const n=i.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 o=e[a],n=r.get(o);if(n==t.length){a++;continue}const s=t[n],l=Zd(o,s,i.getContext(o,s,!0)),c=Zd(s,o,i.getContext(s,o,!1));i.updateRelation(o,s),i.setOriginalOperations(l,o),i.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(o.padWithNoOps){const o=e.length-s.originalOperationsACount,i=t.length-s.originalOperationsBCount;ou(e,i-o),ou(t,o-i)}return tu(e,s.nextBaseVersionB),tu(t,s.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:n}}class eu{constructor(e,t,o=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!o,this._relations=new Map}setOriginalOperations(e,t=null){const o=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,o||t)}updateRelation(e,t){switch(e.constructor){case Ya:switch(t.constructor){case Xa: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 Ya:e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter")}break;case el:switch(t.constructor){case Xa:e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");break;case Ya:(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))&&this._setRelation(e,t,"splitBefore")}break;case Xa:switch(t.constructor){case Xa: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 el:e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource")}break;case Qa:{const o=e.newRange;if(!o)return;switch(t.constructor){case Ya:{const i=Ps._createFromPositionAndShift(t.sourcePosition,t.howMany),n=i.containsPosition(o.start)||i.start.isEqual(o.start),r=i.containsPosition(o.end)||i.end.isEqual(o.end);!n&&!r||i.containsRange(o)||this._setRelation(e,t,{side:n?"left":"right",path:n?o.start.path.slice():o.end.path.slice()});break}case Xa:{const i=o.start.isEqual(t.targetPosition),n=o.start.isEqual(t.deletionPosition),r=o.end.isEqual(t.deletionPosition),s=o.end.isEqual(t.sourcePosition);(i||n||r||s)&&this._setRelation(e,t,{wasInLeftElement:i,wasStartBeforeMergedElement:n,wasEndBeforeMergedElement:r,wasInRightElement:s});break}}break}}}getContext(e,t,o){return{aIsStrong:o,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 o=this.originalOperations.get(t),i=this._history.getUndoneOperation(o);if(!i)return null;const n=this.originalOperations.get(e),r=this._relations.get(n);return r&&r.get(i)||null}_setRelation(e,t,o){const i=this.originalOperations.get(e),n=this.originalOperations.get(t);let r=this._relations.get(i);r||(r=new Map,this._relations.set(i,r)),r.set(n,o)}}function tu(e,t){for(const o of e)o.baseVersion=t++}function ou(e,t){for(let o=0;o<t;o++)e.push(new kl(0))}function iu(e,t,o){const i=e.nodes.getNode(0).getAttribute(t);if(i==o)return null;const n=new Ps(e.position,e.position.getShiftedBy(e.howMany));return new $a(n,t,i,o,0)}function nu(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function ru(e,t){const o=[];for(let i=0;i<e.length;i++){const n=e[i],r=new Ya(n.start,n.end.offset-n.start.offset,t,0);o.push(r);for(let t=i+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 o}Qd($a,$a,(e,t,o)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const i=e.range.getDifference(t.range).map(t=>new $a(t,e.key,e.oldValue,e.newValue,0)),n=e.range.getIntersection(t.range);return n&&o.aIsStrong&&i.push(new $a(n,t.key,t.newValue,e.newValue,0)),0==i.length?[new kl(0)]:i}return[e]}),Qd($a,Ka,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const o=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new $a(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const i=iu(t,e.key,e.oldValue);i&&o.unshift(i)}return o}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),Qd($a,Xa,(e,t)=>{const o=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&o.push(Ps._createFromPositionAndShift(t.graveyardPosition,1));const i=e.range._getTransformedByMergeOperation(t);return i.isCollapsed||o.push(i),o.map(t=>new $a(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),Qd($a,Ya,(e,t)=>function(e,t){const o=Ps._createFromPositionAndShift(t.sourcePosition,t.howMany);let i=null,n=[];o.containsRange(e,!0)?i=e:e.start.hasSameParentAs(o.start)?(n=e.getDifference(o),i=e.getIntersection(o)):n=[e];const r=[];for(let e of n){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const o=t.getMovedRangeStart(),i=e.start.hasSameParentAs(o);e=e._getTransformedByInsertion(o,t.howMany,i),r.push(...e)}i&&r.push(i._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return r}(e.range,t).map(t=>new $a(t,e.key,e.oldValue,e.newValue,e.baseVersion))),Qd($a,el,(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 o=e.clone();return o.range=new Ps(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,o]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),Qd(Ka,$a,(e,t)=>{const o=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const i=iu(e,t.key,t.newValue);i&&o.push(i)}return o}),Qd(Ka,Ka,(e,t,o)=>(e.position.isEqual(t.position)&&o.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),Qd(Ka,Ya,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),Qd(Ka,el,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),Qd(Ka,Xa,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),Qd(Qa,Ka,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),Qd(Qa,Qa,(e,t,o)=>{if(e.name==t.name){if(!o.aIsStrong)return[new kl(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),Qd(Qa,Xa,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),Qd(Qa,Ya,(e,t,o)=>{if(e.oldRange&&(e.oldRange=Ps._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(o.abRelation){const i=Ps._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==o.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=o.abRelation.path,e.newRange.end=i.end,[e];if("right"==o.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=i.start,e.newRange.end.path=o.abRelation.path,[e]}e.newRange=Ps._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]}),Qd(Qa,el,(e,t,o)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(o.abRelation){const i=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&o.abRelation.wasStartBeforeMergedElement?e.newRange.start=As._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!o.abRelation.wasInLeftElement&&(e.newRange.start=As._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&o.abRelation.wasInRightElement?e.newRange.end=As._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&o.abRelation.wasEndBeforeMergedElement?e.newRange.end=As._createAt(t.insertionPosition):e.newRange.end=i.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),Qd(Xa,Ka,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),Qd(Xa,Xa,(e,t,o)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(o.bWasUndone){const o=t.graveyardPosition.path.slice();return o.push(0),e.sourcePosition=new As(t.graveyardPosition.root,o),e.howMany=0,[e]}return[new kl(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!o.bWasUndone&&"splitAtSource"!=o.abRelation){const i="$graveyard"==e.targetPosition.root.rootName,n="$graveyard"==t.targetPosition.root.rootName,r=i&&!n;if(n&&!i||!r&&o.aIsStrong){const o=t.targetPosition._getTransformedByMergeOperation(t),i=e.targetPosition._getTransformedByMergeOperation(t);return[new Ya(o,e.howMany,i,0)]}return[new kl(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)&&o.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),Qd(Xa,Ya,(e,t,o)=>{const i=Ps._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!o.bWasUndone&&!o.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.sourcePosition)?[new kl(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])}),Qd(Xa,el,(e,t,o)=>{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 i=0!=t.howMany,n=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(i||n||"mergeTargetNotMoved"==o.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==o.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==o.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]}),Qd(Ya,Ka,(e,t)=>{const o=Ps._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=o.start,e.howMany=o.end.offset-o.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),Qd(Ya,Ya,(e,t,o)=>{const i=Ps._createFromPositionAndShift(e.sourcePosition,e.howMany),n=Ps._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,s=o.aIsStrong,a=!o.aIsStrong;if("insertBefore"==o.abRelation||"insertAfter"==o.baRelation?a=!0:"insertAfter"!=o.abRelation&&"insertBefore"!=o.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),nu(e,t)&&nu(t,e))return[t.getReversed()];if(i.containsPosition(t.targetPosition)&&i.containsRange(n,!0))return i.start=i.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),i.end=i.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),ru([i],r);if(n.containsPosition(e.targetPosition)&&n.containsRange(i,!0))return i.start=i.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),i.end=i.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),ru([i],r);const l=No(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return i.start=i.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),i.end=i.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),ru([i],r);"remove"!=e.type||"remove"==t.type||o.aWasUndone||o.forceWeakRemove?"remove"==e.type||"remove"!=t.type||o.bWasUndone||o.forceWeakRemove||(s=!1):s=!0;const c=[],d=i.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 o="same"==No(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),i=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,o);c.push(...i)}const u=i.getIntersection(n);return null!==u&&s&&(u.start=u.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),u.end=u.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(u):1==c.length?n.start.isBefore(i.start)||n.start.isEqual(i.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),0===c.length?[new kl(e.baseVersion)]:ru(c,r)}),Qd(Ya,el,(e,t,o)=>{let i=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=o.abRelation||(i=e.targetPosition._getTransformedBySplitOperation(t));const n=Ps._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=i,[e];if(n.start.hasSameParentAs(t.splitPosition)&&n.containsPosition(t.splitPosition)){let e=new Ps(t.splitPosition,n.end);e=e._getTransformedBySplitOperation(t);return ru([new Ps(n.start,t.splitPosition),e],i)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==o.abRelation&&(i=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==o.abRelation&&(i=e.targetPosition);const r=[n._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const i=n.start.isEqual(t.graveyardPosition)||n.containsPosition(t.graveyardPosition);e.howMany>1&&i&&!o.aWasUndone&&r.push(Ps._createFromPositionAndShift(t.insertionPosition,1))}return ru(r,i)}),Qd(Ya,Xa,(e,t,o)=>{const i=Ps._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(t.sourcePosition))if("remove"!=e.type||o.forceWeakRemove){if(1==e.howMany)return o.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new kl(0)]}else if(!o.aWasUndone){const o=[];let i=t.graveyardPosition.clone(),n=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(o.push(new Ya(e.sourcePosition,e.howMany-1,e.targetPosition,0)),i=i._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 Ya(i,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const l=new As(s.targetPosition.root,a);n=n._getTransformedByMove(i,r,1);const c=new Ya(n,t.howMany,l,0);return o.push(s),o.push(c),o}const n=Ps._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]}),Qd(Ja,Ka,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),Qd(Ja,Xa,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),Qd(Ja,Ya,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),Qd(Ja,Ja,(e,t,o)=>{if(e.position.isEqual(t.position)){if(!o.aIsStrong)return[new kl(0)];e.oldName=t.newName}return[e]}),Qd(Ja,el,(e,t)=>{if("same"==No(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new Ja(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),Qd(Za,Za,(e,t,o)=>{if(e.root===t.root&&e.key===t.key){if(!o.aIsStrong||e.newValue===t.newValue)return[new kl(0)];e.oldValue=t.newValue}return[e]}),Qd(el,Ka,(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=el.getInsertionPosition(e.splitPosition),[e])),Qd(el,Xa,(e,t,o)=>{if(!e.graveyardPosition&&!o.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const o=t.graveyardPosition.path.slice();o.push(0);const i=new As(t.graveyardPosition.root,o),n=el.getInsertionPosition(new As(t.graveyardPosition.root,o)),r=new el(i,0,null,0);return r.insertionPosition=n,e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=el.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=el.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),Qd(el,Ya,(e,t,o)=>{const i=Ps._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const n=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);if(!o.bWasUndone&&n){const o=e.splitPosition._getTransformedByMoveOperation(t),i=e.graveyardPosition._getTransformedByMoveOperation(t),n=i.path.slice();n.push(0);const r=new As(i.root,n);return[new Ya(o,e.howMany,r,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const o=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=o,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=el.getInsertionPosition(e.splitPosition),[e]}return!e.splitPosition.isEqual(t.targetPosition)||"insertAtSource"!=o.baRelation&&"splitBefore"!=o.abRelation?(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=el.getInsertionPosition(e.splitPosition),[e]):(e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=el.getInsertionPosition(e.splitPosition),[e])}),Qd(el,el,(e,t,o)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new kl(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new kl(0)];if("splitBefore"==o.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const i="$graveyard"==e.splitPosition.root.rootName,n="$graveyard"==t.splitPosition.root.rootName,r=i&&!n;if(n&&!i||!r&&o.aIsStrong){const o=[];return t.howMany&&o.push(new Ya(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&o.push(new Ya(e.splitPosition,e.howMany,e.moveTargetPosition,0)),o}return[new kl(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==o.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==o.baRelation){const o=t.insertionPosition.path.slice();o.push(0);const i=new As(t.insertionPosition.root,o);return[e,new Ya(e.insertionPosition,1,i,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=el.getInsertionPosition(e.splitPosition),[e]});class su extends wd{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(e.data,"set",()=>this.clearStack())}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,o={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:o}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,o){const i=this.editor.model,n=i.document,r=[],s=e.map(e=>e.getTransformedByOperations(o)),a=s.flat();for(const e of s){const t=e.filter(e=>e.root!=n.graveyard).filter(e=>!lu(e,a));t.length&&(au(t),r.push(t[0]))}r.length&&i.change(e=>{e.setSelection(r,{backward:t})})}_undo(e,t){const o=this.editor.model,i=o.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(i.history.getOperations(n)),s=Xd([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const n of s)t.addOperation(n),o.applyOperation(n),i.history.setOperationAsUndone(e,n)}}}function au(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){const o=e[t-1].getJoined(e[t],!0);o&&(t--,e.splice(t,2,o))}}function lu(e,t){return t.some(t=>t!==e&&t.containsRange(e,!0))}class cu extends su{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,o=this._stack.splice(t,1)[0],i=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(i,()=>{this._undo(o.batch,i);const e=this.editor.model.document.history.getOperations(o.batch.baseVersion);this._restoreSelection(o.selection.ranges,o.selection.isBackward,e),this.fire("revert",o.batch,i)}),this.refresh()}}class du extends su{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(t,()=>{const o=e.batch.operations[e.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(o);this._restoreSelection(e.selection.ranges,e.selection.isBackward,i),this._undo(e.batch,t)}),this.refresh()}}class uu extends ud{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new cu(e),this._redoCommand=new du(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const o=t[0];if(!o.isDocumentOperation)return;const i=o.batch,n=this._redoCommand._createdBatches.has(i),r=this._undoCommand._createdBatches.has(i);this._batchRegistry.has(i)||"transparent"==i.type&&!n&&!r||(n?this._undoCommand.addBatch(i):r||(this._undoCommand.addBatch(i),this._redoCommand.clearStack()),this._batchRegistry.add(i))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,o)=>{this._redoCommand.addBatch(o)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var hu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.042 9.367l2.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>',fu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M14.958 9.367l-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 mu extends ud{init(){const e=this.editor,t=e.locale,o=e.t,i="ltr"==t.uiLanguageDirection?hu:fu,n="ltr"==t.uiLanguageDirection?fu:hu;this._addButton("undo",o("Undo"),"CTRL+Z",i),this._addButton("redo",o("Redo"),"CTRL+Y",n)}_addButton(e,t,o,i){const n=this.editor;n.ui.componentFactory.add(e,r=>{const s=n.commands.get(e),a=new Yc(r);return a.set({label:t,icon:i,keystroke:o,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{n.execute(e),n.editing.view.focus()}),a})}}class gu extends ud{static get requires(){return[uu,mu]}static get pluginName(){return"Undo"}}class pu{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}xo(pu,Ui);class bu extends pu{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Co({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new ho.a("pendingactions-add-invalid-message",this);const t=Object.create(Ui);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]()}}class wu{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((o,i)=>{t.onload=()=>{const e=t.result;this._data=e,o(e)},t.onerror=()=>{i("error")},t.onabort=()=>{i("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}xo(wu,Ui);class ku extends ud{static get pluginName(){return"FileRepository"}static get requires(){return[bu]}init(){this.loaders=new Co,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(ho.c)("filerepository-no-upload-adapter"),null;const t=new _u(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 _u?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,o)=>{e===t&&this._loadersMap.delete(o)})}_updatePendingAction(){const e=this.editor.plugins.get(bu);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,o=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(o(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",o)}}else e.remove(this._pendingAction),this._pendingAction=null}}xo(ku,Ui);class _u{constructor(e,t){this.id=co(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new wu,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 ho.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 ho.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((o,i)=>{t.rejecter=i,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,o(e)}).catch(e=>{t.isFulfilled=!0,i(e)})}),t}}xo(_u,Ui);function vu(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const o of t){const t=o.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,o;return e&&40==e.length||(e=function(e){let t="";const o=new Uint8Array(e);window.crypto.getRandomValues(o);for(let e=0;e<o.length;e++){const i="abcdefghijklmnopqrstuvwxyz0123456789".charAt(o[e]%"abcdefghijklmnopqrstuvwxyz0123456789".length);t+=Math.random()>.5?i.toUpperCase():i}return t}(40),t="ckCsrfToken",o=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(o)+";path=/"),e}class yu extends ud{static get requires(){return[ku]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(ku).createUploadAdapter=t=>new xu(t,e,this.editor.t))}}class xu{constructor(e,t,o){this.loader=e,this.url=t,this.t=o}upload(){return this.loader.file.then(e=>new Promise((t,o)=>{this._initRequest(),this._initListeners(t,o,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,o){const i=this.xhr,n=this.loader,r=(0,this.t)("Cannot upload file:")+` ${o.name}.`;i.addEventListener("error",()=>t(r)),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:r);e({default:o.url})}),i.upload&&i.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",vu()),this.xhr.send(t)}}function Cu(e){const t=e.next();return t.done?null:t.value}function Au(e,t,o,i){let n,r=null;"function"==typeof i?n=i:(r=e.commands.get(i),n=()=>{e.execute(i)}),e.model.document.on("change:data",(i,s)=>{if(r&&!r.isEnabled||!t.isEnabled)return;const a=Cu(e.model.document.selection.getRanges());if(!a.isCollapsed)return;if("transparent"==s.type)return;const l=Array.from(e.model.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=c.position.parent;if(d.is("element","codeBlock"))return;if(r&&!0===r.value)return;const u=d.getChild(0),h=e.model.createRangeOn(u);if(!h.containsRange(a)&&!a.end.isEqual(h.end))return;const f=o.exec(u.data.substr(0,a.end.offset));f&&e.model.enqueueChange(e=>{const t=e.createPositionAt(d,0),o=e.createPositionAt(d,f[0].length),i=new Hs(t,o);!1!==n({match:f})&&e.remove(i),i.detach()})})}function Tu(e,t,o,i){let n,r;o instanceof RegExp?n=o:r=o,r=r||(e=>{let t;const o=[],i=[];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];o.push(l),o.push(c),i.push([e+n.length,e+n.length+r.length])}return{remove:o,format:i}}),e.model.document.on("change:data",(o,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,u=d.parent,{text:h,range:f}=function(e,t){let o=e.start;return{text:Array.from(e.getItems()).reduce((e,i)=>!i.is("$text")&&!i.is("$textProxy")||i.getAttribute("code")?(o=t.createPositionAfter(i),""):e+i.data,""),range:t.createRange(o,e.end)}}(s.createRange(s.createPositionAt(u,0),d),s),m=r(h),g=Su(f.start,m.format,s),p=Su(f.start,m.remove,s);g.length&&p.length&&s.enqueueChange(e=>{if(!1!==i(e,g))for(const t of p.reverse())e.remove(t)})})}function Su(e,t,o){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>o.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}function Eu(e,t){return(o,i)=>{if(!e.commands.get(t).isEnabled)return!1;const n=e.model.schema.getValidRanges(i,t);for(const e of n)o.setAttribute(t,!0,e);o.removeSelectionAttribute(t)}}class Pu extends wd{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,o=t.document.selection,i=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(o.isCollapsed)i?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const t of n)i?e.setAttribute(this.attributeKey,i,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,o=e.document.selection;if(o.isCollapsed)return o.hasAttribute(this.attributeKey);for(const e of o.getRanges())for(const o of e.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}}class Mu extends ud{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 Pu(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class Iu extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",o=>{const i=e.commands.get("bold"),n=new Yc(o);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(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),n})}}class Nu extends ud{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 Pu(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class Ru extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",o=>{const i=e.commands.get("italic"),n=new Yc(o);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.633l.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(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),n})}}class Ou extends wd{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,o=t.schema,i=t.document.selection,n=Array.from(i.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=n.filter(e=>Vu(e)||Du(o,e));this._applyQuote(e,t)}else this._removeQuote(e,n.filter(Vu))})}_getValue(){const e=Cu(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Vu(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=Cu(e.getSelectedBlocks());return!!o&&Du(t,o)}_removeQuote(e,t){Lu(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const o=e.createPositionBefore(t.start.parent);return void e.move(t,o)}t.end.isAtEnd||e.split(t.end);const o=e.createPositionAfter(t.end.parent);e.move(t,o)})}_applyQuote(e,t){const o=[];Lu(e,t).reverse().forEach(t=>{let i=Vu(t.start);i||(i=e.createElement("blockQuote"),e.wrap(t,i)),o.push(i)}),o.reverse().reduce((t,o)=>t.nextSibling==o?(e.merge(e.createPositionAfter(t)),t):o)}}function Vu(e){return"blockQuote"==e.parent.name?e.parent:null}function Lu(e,t){let o,i=0;const n=[];for(;i<t.length;){const r=t[i],s=t[i+1];o||(o=e.createPositionBefore(r)),s&&r.nextSibling==s||(n.push(e.createRange(o,e.createPositionAfter(r))),o=null),i++}return n}function Du(e,t){const o=e.checkChild(t.parent,"blockQuote"),i=e.checkChild(["$root","blockQuote"],t);return o&&i}class zu extends ud{static get pluginName(){return"BlockQuoteEditing"}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new Ou(e)),t.register("blockQuote",{allowWhere:"$block",allowContentOf:"$root"}),t.addChildCheck((e,t)=>{if(e.endsWith("blockQuote")&&"blockQuote"==t.name)return!1}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(o=>{const i=e.model.document.differ.getChanges();for(const e of i)if("insert"==e.type){const i=e.position.nodeAfter;if(!i)continue;if(i.is("element","blockQuote")&&i.isEmpty)return o.remove(i),!0;if(i.is("element","blockQuote")&&!t.checkChild(e.position,i))return o.unwrap(i),!0;if(i.is("element")){const e=o.createRangeIn(i);for(const i of e.getItems())if(i.is("element","blockQuote")&&!t.checkChild(o.createPositionBefore(i),i))return o.unwrap(i),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return o.remove(t),!0}return!1})}afterInit(){const e=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(t,o)=>{const i=this.editor.model.document,n=i.selection.getLastPosition().parent;i.selection.isCollapsed&&n.isEmpty&&e.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),o.preventDefault(),t.stop())})}}o(46);class Bu extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",o=>{const i=e.commands.get("blockQuote"),n=new Yc(o);return n.set({label:t("Block quote"),icon:'<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>',tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),n})}}class ju extends ud{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,t=e.ui.componentFactory,o=e.t;t.add("ckfinder",t=>{const i=e.commands.get("ckfinder"),n=new Yc(t);return n.set({label:o("Insert image or file"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',tooltip:!0}),n.bind("isEnabled").to(i),n.on("execute",()=>{e.execute("ckfinder"),e.editing.view.focus()}),n})}}class Fu extends br{observe(e){this.listenTo(e,"load",(e,t)=>{const o=t.target;this.checkShouldIgnoreEventFromTarget(o)||"IMG"==o.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class Hu{constructor(){this._stack=[]}add(e,t){const o=this._stack,i=o[0];this._insertDescriptor(e);const n=o[0];i===n||Uu(i,n)||this.fire("change:top",{oldDescriptor:i,newDescriptor:n,writer:t})}remove(e,t){const o=this._stack,i=o[0];this._removeDescriptor(e);const n=o[0];i===n||Uu(i,n)||this.fire("change:top",{oldDescriptor:i,newDescriptor:n,writer:t})}_insertDescriptor(e){const t=this._stack,o=t.findIndex(t=>t.id===e.id);if(Uu(e,t[o]))return;o>-1&&t.splice(o,1);let i=0;for(;t[i]&&Wu(t[i],e);)i++;t.splice(i,0,e)}_removeDescriptor(e){const t=this._stack,o=t.findIndex(t=>t.id===e);o>-1&&t.splice(o,1)}}function Uu(e,t){return e&&t&&e.priority==t.priority&&qu(e.classes)==qu(t.classes)}function Wu(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&qu(e.classes)>qu(t.classes)}function qu(e){return Array.isArray(e)?e.sort().join(","):e}xo(Hu,go);o(48);const $u=Ic("px"),Gu=rr.document.body;class Yu extends xc{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",$u),left:t.to("left",$u)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=Yu.defaultPositions,o=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],limiter:Gu,fitInViewport:!0},e),i=Yu._getOptimalPosition(o),n=parseInt(i.left),r=parseInt(i.top),s=i.name;Object.assign(this,{top:r,left:n,position:s})}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=Ku(e.target),o=e.limiter?Ku(e.limiter):Gu;this.listenTo(rr.document,"scroll",(i,n)=>{const r=n.target,s=t&&r.contains(t),a=o&&r.contains(o);!s&&!a&&t&&o||this.attachTo(e)},{useCapture:!0}),this.listenTo(rr.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(rr.document,"scroll"),this.stopListening(rr.window,"resize")}}function Ku(e){return oo(e)?e:ts(e)?e.commonAncestorContainer:"function"==typeof e?Ku(e()):null}function Qu(e,t){return e.top-t.height-Yu.arrowVerticalOffset}function Ju(e){return e.bottom+Yu.arrowVerticalOffset}Yu.arrowHorizontalOffset=25,Yu.arrowVerticalOffset=10,Yu._getOptimalPosition=Fc,Yu.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:Qu(e,t),left:e.left-Yu.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:Qu(e,t),left:e.left-.25*t.width-Yu.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:Qu(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:Qu(e,t),left:e.left-.75*t.width+Yu.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:Qu(e,t),left:e.left-t.width+Yu.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:Qu(e,t),left:e.left+e.width/2-Yu.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:Qu(e,t),left:e.left+e.width/2-.25*t.width-Yu.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:Qu(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:Qu(e,t),left:e.left+e.width/2-.75*t.width+Yu.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:Qu(e,t),left:e.left+e.width/2-t.width+Yu.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:Qu(e,t),left:e.right-Yu.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:Qu(e,t),left:e.right-.25*t.width-Yu.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:Qu(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:Qu(e,t),left:e.right-.75*t.width+Yu.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:Qu(e,t),left:e.right-t.width+Yu.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:Ju(e),left:e.left-Yu.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:Ju(e),left:e.left-.25*t.width-Yu.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:Ju(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:Ju(e),left:e.left-.75*t.width+Yu.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:Ju(e),left:e.left-t.width+Yu.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:Ju(e),left:e.left+e.width/2-Yu.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:Ju(e),left:e.left+e.width/2-.25*t.width-Yu.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:Ju(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:Ju(e),left:e.left+e.width/2-.75*t.width+Yu.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:Ju(e),left:e.left+e.width/2-t.width+Yu.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:Ju(e),left:e.right-Yu.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:Ju(e),left:e.right-.25*t.width-Yu.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:Ju(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:Ju(e),left:e.right-.75*t.width+Yu.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:Ju(e),left:e.right-t.width+Yu.arrowHorizontalOffset,name:"arrow_ne"})};function Zu(e,t,o){return e&&eh(e)&&!o.isInline(t)}function Xu(e){return e.getAttribute("widget-type-around")}function eh(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function th(e,t,o={}){if(!e.is("containerElement"))throw new ho.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=ah,o.label&&function(e,t,o){o.setCustomProperty("widgetLabel",t,e)}(e,o.label,t),o.hasSelectionHandle&&function(e,t){const o=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),o=new $c;return o.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>'),o.render(),t.appendChild(o.element),t}));t.insert(t.createPositionAt(e,0),o),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),oh(e,t,(e,t,o)=>o.addClass(To(t.classes),e),(e,t,o)=>o.removeClass(To(t.classes),e)),e}function oh(e,t,o,i){const n=new Hu;n.on("change:top",(t,n)=>{n.oldDescriptor&&i(e,n.oldDescriptor,n.writer),n.newDescriptor&&o(e,n.newDescriptor,n.writer)}),t.setCustomProperty("addHighlight",(e,t,o)=>n.add(t,o),e),t.setCustomProperty("removeHighlight",(e,t,o)=>n.remove(t,o),e)}function ih(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function nh(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",(o,i,n)=>{t.setAttribute("contenteditable",n?"false":"true",e)}),e.on("change:isFocused",(o,i,n)=>{n?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),e}function rh(e,t){const o=e.getSelectedElement();if(o){const i=Xu(e);if(i)return t.createPositionAt(o,i);if(t.schema.isBlock(o))return t.createPositionAfter(o)}const i=e.getSelectedBlocks().next().value;if(i){if(i.isEmpty)return t.createPositionAt(i,0);const o=t.createPositionAfter(i);return e.focus.isTouching(o)?o:t.createPositionBefore(i)}return e.focus}function sh(e,t){const o=new ns(rr.window),i=o.getIntersection(e),n=t.height+Yu.arrowVerticalOffset;if(e.top-n>o.top||e.bottom+n<o.bottom)return null;const r=i||e,s=r.left+r.width/2-t.width/2;return{top:Math.max(e.top,0)+Yu.arrowVerticalOffset,left:s,name:"arrow_n"}}function ah(){return null}function lh(e){const t=e.getSelectedElement();return t&&function(e){return!!e.getCustomProperty("image")&&eh(e)}(t)?t:null}function ch(e){return!!e&&e.is("element","image")}function dh(e,t={},o=null){e.change(i=>{const n=i.createElement("image",t),r=o||rh(e.document.selection,e);e.insertContent(n,r),n.parent&&i.setSelection(n,"on")})}function uh(e){const t=e.schema,o=e.document.selection;return function(e,t,o){const i=function(e,t){const o=rh(e,t).parent;if(o.isEmpty&&!o.is("element","$root"))return o.parent;return o}(e,o);return t.checkChild(i,"image")}(o,t,e)&&!function(e,t){const o=e.getSelectedElement();return o&&t.isObject(o)}(o,t)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("element","image"))}(o)}function hh(e){const t=[];for(const o of e.getChildren())t.push(o),o.is("element")&&t.push(...o.getChildren());return t.find(e=>e.is("element","img"))}function fh(e){return o=>{o.on(`attribute:${e}:image`,t)};function t(e,t,o){if(!o.consumable.consume(t.item,e.name))return;const i=o.writer,n=hh(o.mapper.toViewElement(t.item));i.setAttribute(t.attributeKey,t.attributeNewValue||"",n)}}class mh extends wd{refresh(){this.isEnabled=uh(this.editor.model)}execute(e){const t=this.editor.model;for(const o of To(e.source))dh(t,{src:o})}}class gh extends ud{static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.model.schema,o=e.t,i=e.conversion;e.editing.view.addObserver(Fu),t.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),i.for("dataDowncast").elementToElement({model:"image",view:(e,{writer:t})=>ph(t)}),i.for("editingDowncast").elementToElement({model:"image",view:(e,{writer:t})=>function(e,t,o){return t.setCustomProperty("image",!0,e),th(e,t,{label:function(){const t=hh(e).getAttribute("alt");return t?`${t} ${o}`:o}})}(ph(t),t,o("image widget"))}),i.for("downcast").add(fh("src")).add(fh("alt")).add(function(){return t=>{t.on("attribute:srcset:image",e)};function e(e,t,o){if(!o.consumable.consume(t.item,e.name))return;const i=o.writer,n=hh(o.mapper.toViewElement(t.item));if(null===t.attributeNewValue){const e=t.attributeOldValue;e.data&&(i.removeAttribute("srcset",n),i.removeAttribute("sizes",n),e.width&&i.removeAttribute("width",n))}else{const e=t.attributeNewValue;e.data&&(i.setAttribute("srcset",e.data,n),i.setAttribute("sizes","100vw",n),e.width&&i.setAttribute("width",e.width,n))}}}()),i.for("upcast").elementToElement({view:{name:"img",attributes:{src:!0}},model:(e,{writer:t})=>t.createElement("image",{src:e.getAttribute("src")})}).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}}}).add(function(){return t=>{t.on("element:figure",e)};function e(e,t,o){if(!o.consumable.test(t.viewItem,{name:!0,classes:"image"}))return;const i=hh(t.viewItem);if(!i||!i.hasAttribute("src")||!o.consumable.test(i,{name:!0}))return;const n=Cu(o.convertItem(i,t.modelCursor).modelRange.getItems());n&&(o.convertChildren(t.viewItem,n),o.updateConversionResult(n,t))}}()),e.commands.add("imageInsert",new mh(e))}}function ph(e){const t=e.createEmptyElement("img"),o=e.createContainerElement("figure",{class:"image"});return e.insert(e.createPositionAt(o,0),t),o}class bh extends zr{constructor(e){super(e),this.domEventType="mousedown"}onDomEvent(e){this.fire(e.type,e)}}class wh extends ud{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,o=e.editing.view,i=e.locale,n=t.document.selection;this.listenTo(o.document,"keydown",(e,t)=>{if(!n.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const o=t.keyCode==pn.arrowright,r=t.keyCode==pn.arrowleft;if(!o&&!r)return;const s=i.contentLanguageDirection;let a=!1;a="ltr"===s&&o||"rtl"===s&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{priority:uo.get("high")+1}),this._isNextGravityRestorationSkipped=!1,this.listenTo(n,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&yh(n.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,o=this.editor.model.document.selection,i=o.getFirstPosition();return!this._isGravityOverridden&&((!i.isAtStart||!kh(o,t))&&(yh(i,t)?(vh(e),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(e){const t=this.attributes,o=this.editor.model,i=o.document.selection,n=i.getFirstPosition();return this._isGravityOverridden?(vh(e),this._restoreGravity(),_h(o,t,n),!0):n.isAtStart?!!kh(i,t)&&(vh(e),_h(o,t,n),!0):function(e,t){return yh(e.getShiftedBy(-1),t)}(n,t)?n.isAtEnd&&!kh(i,t)&&yh(n,t)?(vh(e),_h(o,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 kh(e,t){for(const o of t)if(e.hasAttribute(o))return!0;return!1}function _h(e,t,o){const i=o.nodeBefore;e.change(e=>{i?e.setSelectionAttribute(i.getAttributes()):e.removeSelectionAttribute(t)})}function vh(e){e.preventDefault()}function yh(e,t){const{nodeBefore:o,nodeAfter:i}=e;for(const e of t){const t=o?o.getAttribute(e):void 0;if((i?i.getAttribute(e):void 0)!==t)return!0}return!1}function xh(e,t,o,i){return i.createRange(Ch(e,t,o,!0,i),Ch(e,t,o,!1,i))}function Ch(e,t,o,i,n){let r=e.textNode||(i?e.nodeBefore:e.nodeAfter),s=null;for(;r&&r.getAttribute(t)==o;)s=r,r=i?r.previousSibling:r.nextSibling;return s?n.createPositionAt(s,i?"before":"after"):e}class Ah{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,o)=>{if(!o.consumable.test(t.item,"attribute:linkHref"))return;const i=o.writer,n=i.document.selection;for(const e of this._definitions){const r=i.createAttributeElement("a",e.attributes,{priority:5});i.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?i.wrap(n.getFirstRange(),r):i.wrap(o.mapper.toViewRange(t.range),r):i.unwrap(o.mapper.toViewRange(t.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:image",(e,t,o)=>{const i=o.mapper.toViewElement(t.item),n=Array.from(i.getChildren()).find(e=>"a"===e.name);for(const e of this._definitions){const i=Do(e.attributes);if(e.callback(t.attributeNewValue))for(const[e,t]of i)"class"===e?o.writer.addClass(t,n):o.writer.setAttribute(e,t,n);else for(const[e,t]of i)"class"===e?o.writer.removeClass(t,n):o.writer.removeAttribute(e,n)}})}}}var Th=function(e,t,o){var i=e.length;return o=void 0===o?i:o,!t&&o>=i?e:ni(e,t,o)},Sh=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Eh=function(e){return Sh.test(e)};var Ph=function(e){return e.split("")},Mh="[\\ud800-\\udfff]",Ih="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Nh="\\ud83c[\\udffb-\\udfff]",Rh="[^\\ud800-\\udfff]",Oh="(?:\\ud83c[\\udde6-\\uddff]){2}",Vh="[\\ud800-\\udbff][\\udc00-\\udfff]",Lh="(?:"+Ih+"|"+Nh+")"+"?",Dh="[\\ufe0e\\ufe0f]?"+Lh+("(?:\\u200d(?:"+[Rh,Oh,Vh].join("|")+")[\\ufe0e\\ufe0f]?"+Lh+")*"),zh="(?:"+[Rh+Ih+"?",Ih,Oh,Vh,Mh].join("|")+")",Bh=RegExp(Nh+"(?="+Nh+")|"+zh+Dh,"g");var jh=function(e){return e.match(Bh)||[]};var Fh=function(e){return Eh(e)?jh(e):Ph(e)};var Hh=function(e){return function(t){t=Xo(t);var o=Eh(t)?Fh(t):void 0,i=o?o[0]:t.charAt(0),n=o?Th(o,1).join(""):t.slice(1);return i[e]()+n}}("toUpperCase");const Uh=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Wh=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,qh=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,$h=/^((\w+:(\/{2,})?)|(\W))/i;function Gh(e,{writer:t}){const o=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,o),o}function Yh(e){return function(e){return e.replace(Uh,"").match(Wh)}(e=String(e))?e:"#"}function Kh(e,t){return!!e&&(e.is("element","image")&&t.checkAttribute("image","linkHref"))}function Qh(e,t){const o=(i=e,qh.test(i)?"mailto:":t);var i;const n=!!o&&!$h.test(e);return e&&n?o+e:e}class Jh extends wd{constructor(e){super(e),this.manualDecorators=new Co,this.automaticDecorators=new Ah}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document,o=Cu(t.selection.getSelectedBlocks());Kh(o,e.schema)?(this.value=o.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(o,"linkHref")):(this.value=t.selection.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const o=this.editor.model,i=o.document.selection,n=[],r=[];for(const e in t)t[e]?n.push(e):r.push(e);o.change(t=>{if(i.isCollapsed){const s=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=xh(s,"linkHref",i.getAttribute("linkHref"),o);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=Do(i.getAttributes());r.set("linkHref",e),n.forEach(e=>{r.set(e,!0)});const{end:a}=o.insertContent(t.createText(e,r),s);t.setSelection(a)}["linkHref",...n,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=o.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const e of i.getSelectedBlocks())o.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 o of l)t.setAttribute("linkHref",e,o),n.forEach(e=>{t.setAttribute(e,!0,o)}),r.forEach(e=>{t.removeAttribute(e,o)})}})}_getDecoratorStateFromModel(e){const t=this.editor.model,o=t.document,i=Cu(o.selection.getSelectedBlocks());return Kh(i,t.schema)?i.getAttribute(e):o.selection.getAttribute(e)}_isRangeToUpdate(e,t){for(const o of t)if(o.containsRange(e))return!1;return!0}}class Zh extends wd{refresh(){const e=this.editor.model,t=e.document,o=Cu(t.selection.getSelectedBlocks());Kh(o,e.schema)?this.isEnabled=e.schema.checkAttribute(o,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref")}execute(){const e=this.editor,t=this.editor.model,o=t.document.selection,i=e.commands.get("link");t.change(e=>{const n=o.isCollapsed?[xh(o.getFirstPosition(),"linkHref",o.getAttribute("linkHref"),t)]:t.schema.getValidRanges(o.getRanges(),"linkHref");for(const t of n)if(e.removeAttribute("linkHref",t),i)for(const o of i.manualDecorators)e.removeAttribute(o.id,t)})}}class Xh{constructor({id:e,label:t,attributes:o,defaultValue:i}){this.id=e,this.set("value"),this.defaultValue=i,this.label=t,this.attributes=o}}xo(Xh,Ui);o(50);const ef=/^(https?:)?\/\//;class tf extends ud{static get pluginName(){return"LinkEditing"}static get requires(){return[wh,Wd,bd]}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:Gh}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>Gh(Yh(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 Jh(e)),e.commands.add("unlink",new Zh(e));const t=function(e,t){const o={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>(e.label&&o[e.label]&&(e.label=o[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[o,i]of Object.entries(e)){const e=Object.assign({},i,{id:"link"+Hh(o)});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(wh).registerAttribute("linkHref"),function(e,t,o,i){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=xh(s.getFirstPosition(),t,s.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",o)&&!e.hasClass(i)&&(n.addClass(i,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(i,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"})})}(e,"linkHref","a","ck-link_selected"),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor,o=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&o.add({id:"linkIsExternal",mode:"automatic",callback:e=>ef.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),o.add(e),o.length&&t.conversion.for("downcast").add(o.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,o=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),o.add(new Xh(e)),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,{writer:i})=>{if(t){const t=o.get(e.id).attributes,n=i.createAttributeElement("a",t,{priority:5});return i.setCustomProperty("link",!0,n),n}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:o.get(e.id).attributes},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor,t=e.model,o=t.document.selection,i=e.commands.get("link");this.listenTo(t,"insertContent",()=>{const e=o.anchor.nodeBefore,n=o.anchor.nodeAfter;o.hasAttribute("linkHref")&&e&&e.hasAttribute("linkHref")&&(n&&n.hasAttribute("linkHref")||t.change(e=>{of(e,i.manualDecorators)}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.commands.get("link");e.editing.view.addObserver(bh);let o=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{o=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!o)return;o=!1;const i=e.model.document.selection;if(!i.isCollapsed)return;if(!i.hasAttribute("linkHref"))return;const n=i.getFirstPosition(),r=xh(n,"linkHref",i.getAttribute("linkHref"),e.model);(n.isTouching(r.start)||n.isTouching(r.end))&&e.model.change(e=>{of(e,t.manualDecorators)})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let o,i;this.listenTo(t.document,"delete",()=>{i=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const t=e.model.document.selection;t.isCollapsed||(i?i=!1:nf(e)&&function(e){const t=e.document.selection,o=t.getFirstPosition(),i=t.getLastPosition(),n=o.nodeAfter;if(!n)return!1;if(!n.is("$text"))return!1;if(!n.hasAttribute("linkHref"))return!1;const r=i.textNode||i.nodeBefore;if(n===r)return!0;return xh(o,"linkHref",n.getAttribute("linkHref"),e).containsRange(e.createRange(o,i),!0)}(e.model)&&(o=t.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(t,[n])=>{i=!1,nf(e)&&o&&(e.model.change(e=>{for(const[t,i]of o)e.setAttribute(t,i,n)}),o=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,o=t.document.selection,i=e.editing.view,n=e.commands.get("link");let r=!1,s=!1;this.listenTo(i.document,"delete",(e,t)=>{s=t.domEvent.keyCode===pn.backspace},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const e=o.getFirstPosition(),i=o.getAttribute("linkHref");if(!i)return;const n=xh(e,"linkHref",i,t);r=n.containsPosition(e)||n.end.isEqual(e)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,r||e.model.enqueueChange(e=>{of(e,n.manualDecorators)}))},{priority:"low"})}}function of(e,t){e.removeSelectionAttribute("linkHref");for(const o of t)e.removeSelectionAttribute(o.id)}function nf(e){return e.plugins.get("Input").isInput(e.model.change(e=>e.batch))}class rf extends pu{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 sf extends wd{constructor(e){super(e),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const e=this.editor.commands.get("imageInsert"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=t&&"modal"!=t)throw new ho.a("ckfinder-unknown-openermethod",e);const o=this.editor.config.get("ckfinder.options")||{};o.chooseFiles=!0;const i=o.onInit;o.language||(o.language=e.locale.uiLanguage),o.onInit=t=>{i&&i(t),t.on("files:choose",o=>{const i=o.data.files.toArray(),n=i.filter(e=>!e.isImage()),r=i.filter(e=>e.isImage());for(const t of n)e.execute("link",t.getUrl());const s=[];for(const e of r){const o=e.getUrl();s.push(o||t.request("file:getProxyUrl",{file:e}))}s.length&&af(e,s)}),t.on("file:choose:resizedImage",t=>{const o=t.data.resizedUrl;if(o)af(e,[o]);else{const t=e.plugins.get("Notification"),o=e.locale.t;t.showWarning(o("Could not obtain resized image URL."),{title:o("Selecting resized image failed"),namespace:"ckfinder"})}})},window.CKFinder[t](o)}}function af(e,t){if(e.commands.get("imageInsert").isEnabled)e.execute("imageInsert",{source:t});else{const t=e.plugins.get("Notification"),o=e.locale.t;t.showWarning(o("Could not insert image at the current position."),{title:o("Inserting image failed"),namespace:"ckfinder"})}}class lf extends ud{static get pluginName(){return"CKFinderEditing"}static get requires(){return[rf,gh,tf]}init(){const e=this.editor;e.commands.add("ckfinder",new sf(e))}}const cf=/^data:(\S*?);base64,/;class df{constructor(e,t,o){if(!e)throw new ho.a("fileuploader-missing-file",null);if(!t)throw new ho.a("fileuploader-missing-token",null);if(!o)throw new ho.a("fileuploader-missing-api-address",null);this.file=function(e){if("string"!=typeof e)return!1;const t=e.match(cf);return!(!t||!t.length)}(e)?function(e,t=512){try{const o=e.match(cf)[1],i=atob(e.replace(cf,"")),n=[];for(let e=0;e<i.length;e+=t){const o=i.slice(e,e+t),r=new Array(o.length);for(let e=0;e<o.length;e++)r[e]=o.charCodeAt(e);n.push(new Uint8Array(r))}return new Blob(n,{type:o})}catch(e){throw new ho.a("fileuploader-decoding-image-data-error",null)}}(e):e,this._token=t,this._apiAddress=o}onProgress(e){return this.on("progress",(t,o)=>e(o)),this}onError(e){return this.once("error",(t,o)=>e(o)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this,t=this.xhr;function o(t){return()=>e.fire("error",t)}t.addEventListener("error",o("Network Error")),t.addEventListener("abort",o("Abort")),t.upload&&t.upload.addEventListener("progress",e=>{e.lengthComputable&&this.fire("progress",{total:e.total,uploaded:e.loaded})}),t.addEventListener("load",()=>{const e=t.status,o=t.response;if(e<200||e>299)return this.fire("error",o.message||o.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((o,i)=>{t.addEventListener("load",()=>{const e=t.status,n=t.response;return e<200||e>299?n.message?i(new ho.a("fileuploader-uploading-data-failed",this,{message:n.message})):i(n.error):o(n)}),t.addEventListener("error",()=>i(new Error("Network Error"))),t.addEventListener("abort",()=>i(new Error("Abort"))),t.send(e)})}}xo(df,go);const uf={autoRefresh:!0};class hf{constructor(e,t=uf){if(!e)throw new ho.a("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),this._refresh="function"==typeof e?e:()=>{return t=e,new Promise((e,o)=>{const i=new XMLHttpRequest;i.open("GET",t),i.addEventListener("load",()=>{const t=i.status,n=i.response;return t<200||t>299?o(new ho.a("token-cannot-download-new-token",null)):e(n)}),i.addEventListener("error",()=>o(new Error("Network Error"))),i.addEventListener("abort",()=>o(new Error("Abort"))),i.send()});var t},this._options=Object.assign({},uf,t)}init(){return new Promise((e,t)=>{this.value?(this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)):this.refreshToken().then(e).catch(t)})}refreshToken(){return this._refresh().then(e=>{this._validateTokenValue(e),this.set("value",e),this._options.autoRefresh&&this._registerRefreshTokenTimeout()}).then(()=>this)}destroy(){clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t="string"==typeof e,o=!/^".*"$/.test(e),i=t&&3===e.split(".").length;if(!o||!i)throw new ho.a("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(){const e=this._getTokenRefreshTimeoutTime();clearTimeout(this._tokenRefreshTimeout),this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},e)}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));if(!t)return 36e5;return Math.floor((1e3*t-Date.now())/2)}catch(e){return 36e5}}static create(e,t=uf){return new hf(e,t).init()}}xo(hf,Ui);var ff=hf;class mf extends pu{static get pluginName(){return"CloudServices"}init(){const e=this.context.config.get("cloudServices")||{};for(const t in e)this[t]=e[t];if(this._tokens=new Map,this.tokenUrl)return this.token=new mf.Token(this.tokenUrl),this._tokens.set(this.tokenUrl,this.token),this.token.init();this.token=null}registerTokenUrl(e){if(this._tokens.has(e))return Promise.resolve(this.getTokenFor(e));const t=new mf.Token(e);return this._tokens.set(e,t),t.init()}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new ho.a("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy()}}mf.Token=ff;class gf extends ud{static get requires(){return[ku,mf]}init(){const e=this.editor,t=e.plugins.get(mf),o=t.token,i=t.uploadUrl;o&&(this._uploadGateway=new gf._UploadGateway(o,i),e.plugins.get(ku).createUploadAdapter=e=>new pf(this._uploadGateway,e))}}class pf{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(e,t)=>{this.loader.uploadTotal=t.total,this.loader.uploaded=t.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}gf._UploadGateway=class{constructor(e,t){if(!e)throw new ho.a("uploadgateway-missing-token",null);if(!t)throw new ho.a("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new df(e,this._token,this._apiAddress)}};o(52);const bf=["before","after"],wf=(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 2l2 2.038"/></svg>',"image/svg+xml").firstChild;class kf extends ud{static get pluginName(){return"WidgetTypeAround"}constructor(e){super(e),this._currentFakeCaretModelElement=null}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(o,i,n)=>{t.change(e=>{for(const o of t.document.roots)n?e.removeClass("ck-widget__type-around_disabled",o):e.addClass("ck-widget__type-around_disabled",o)}),n||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const o=this.editor,i=o.editing.view;o.execute("insertParagraph",{position:o.model.createPositionAt(e,t)}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(e,t,o,i){this.listenTo(e,t,(...e)=>{this.isEnabled&&o(...e)},i)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Xu(e);if(!t)return!1;const o=e.getSelectedElement();return this._insertParagraph(o,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,o=e.locale.t,i={before:o("Insert paragraph before block"),after:o("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,o,n)=>{const r=n.mapper.toViewElement(o.item);Zu(r,o.item,t)&&function(e,t,o){const i=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const o=this.toDomElement(e);return function(e,t){for(const o of bf){const i=new nc({tag:"div",attributes:{class:["ck","ck-widget__type-around__button","ck-widget__type-around__button_"+o],title:t[o]},children:[e.ownerDocument.importNode(wf,!0)]});e.appendChild(i.render())}}(o,t),function(e){const t=new nc({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(o),o}));e.insert(e.createPositionAt(o,"end"),i)}(n.writer,i,r)},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,o=t.document.selection,i=t.schema,n=e.editing.view;function r(e){return"ck-widget_type-around_show-fake-caret_"+e}this._listenToIfEnabled(n.document,"keydown",(e,t)=>{_n(t.keyCode)&&this._handleArrowKeyPress(e,t)},{priority:uo.get("high")+10}),this._listenToIfEnabled(o,"change:range",(t,o)=>{o.directChange&&e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=o.getSelectedElement();if(t){if(Zu(e.editing.mapper.toViewElement(t),t,i))return}e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,o)=>{const n=o.writer;if(this._currentFakeCaretModelElement){const e=o.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(n.removeClass(bf.map(r),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=o.mapper.toViewElement(s);if(!Zu(a,s,i))return;const l=Xu(t.selection);l&&(n.addClass(r(l),a),this._currentFakeCaretModelElement=s)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,o,i)=>{i||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})})}_handleArrowKeyPress(e,t){const o=this.editor,i=o.model,n=i.document.selection,r=i.schema,s=o.editing.view,a=yn(t.keyCode,o.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;Zu(l,o.editing.mapper.toModelElement(l),r)?c=this._handleArrowKeyPressOnSelectedWidget(a):n.isCollapsed&&(c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,o=Xu(t.document.selection);return t.change(t=>{if(!o)return t.setSelectionAttribute("widget-type-around",e?"after":"before"),!0;if(!(o===(e?"after":"before")))return t.removeSelectionAttribute("widget-type-around"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,o=t.model,i=o.schema,n=t.plugins.get("Widget"),r=n._getObjectElementNextToSelection(e);return!!Zu(t.editing.mapper.toViewElement(r),r,i)&&(o.change(t=>{n._setSelectionOverElement(r),t.setSelectionAttribute("widget-type-around",e?"before":"after")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(o,i)=>{const n=i.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 o=e.closest(".ck-widget");return t.mapDomToView(o)}(n,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,r),i.preventDefault(),o.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"enter",(o,i)=>{const n=t.document.selection.getSelectedElement(),r=e.editing.mapper.toModelElement(n),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Zu(n,r,s)&&(this._insertParagraph(r,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),o.stop())})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view,t=[pn.enter,pn.delete,pn.backspace];this._listenToIfEnabled(e.document,"keydown",(e,o)=>{t.includes(o.keyCode)||zd(o)||this._insertParagraphAccordingToFakeCaretPosition()},{priority:uo.get("high")+1})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,o=e.model,i=o.schema;this._listenToIfEnabled(t.document,"delete",(t,n)=>{const r=Xu(o.document.selection);if(!r)return;const s=n.direction,a=o.document.selection.getSelectedElement(),l="forward"==s;if("before"===r===l)e.execute("delete",{selection:o.createSelection(a,"on")});else{const t=i.getNearestSelectionRange(o.createPositionAt(a,r),s);if(t)if(t.isCollapsed){const n=o.createSelection(t.start);if(o.modifySelection(n,{direction:s}),n.focus.isEqual(t.start)){const e=function(e,t){let o=t;for(const i of t.getAncestors({parentFirst:!0})){if(i.childCount>1||e.isLimit(i))break;o=i}return o}(i,t.start.parent);o.deleteContent(o.createSelection(e,"on"),{doNotAutoparagraph:!0})}else o.change(o=>{o.setSelection(t),e.execute(l?"forwardDelete":"delete")})}else o.change(o=>{o.setSelection(t),e.execute(l?"forwardDelete":"delete")})}n.preventDefault(),t.stop()},{priority:uo.get("high")+1})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,o=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[i,n])=>{if(n&&!n.is("documentSelection"))return;const r=Xu(o);return r?(e.stop(),t.change(e=>{const n=o.getSelectedElement(),s=t.createPositionAt(n,r),a=e.createSelection(s),l=t.insertContent(i,a);return e.setSelection(a),l})):void 0},{priority:"high"})}}o(54);function _f(e){const t=e.model;return(o,i)=>{const n=i.keyCode==pn.arrowup,r=i.keyCode==pn.arrowdown,s=i.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,o){const i=e.model;if(o){const e=t.isCollapsed?t.focus:t.getLastPosition(),o=vf(i,e,"forward");if(!o)return null;const n=i.createRange(e,o),r=yf(i.schema,n,"backward");return r&&e.isBefore(r)?i.createRange(e,r):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),o=vf(i,e,"backward");if(!o)return null;const n=i.createRange(o,e),r=yf(i.schema,n,"forward");return r&&e.isAfter(r)?i.createRange(r,e):null}}(e,a,l);c&&!c.isCollapsed&&function(e,t,o){const i=e.model,n=e.view.domConverter;if(o){const e=i.createSelection(t.start);i.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=i.createRange(e.focus,t.end))}const r=e.mapper.toViewRange(t),s=n.viewRangeToDom(r),a=ns.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 o=l?c.end:c.start;if(s){const i=t.createSelection(a.anchor);i.setFocus(o),e.setSelection(i)}else e.setSelection(o)}),o.stop(),i.preventDefault(),i.stopPropagation())}}function vf(e,t,o){const i=e.schema,n=e.createRangeIn(t.root),r="forward"==o?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of n.getWalker({startPosition:t,direction:o})){if(i.isLimit(s)&&!i.isInline(s))return e;if(a==r&&i.isBlock(s))return null}return null}function yf(e,t,o){const i="backward"==o?t.end:t.start;if(e.checkChild(i,"$text"))return i;for(const{nextPosition:i}of t.getWalker({direction:o}))if(e.checkChild(i,"$text"))return i}class xf extends ud{static get pluginName(){return"Widget"}static get requires(){return[kf]}init(){const e=this.editor.editing.view,t=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(e,t,o)=>{this._clearPreviouslySelectedWidgets(o.writer);const i=o.writer,n=i.document.selection,r=n.getSelectedElement();let s=null;for(const e of n.getRanges())for(const t of e){const e=t.item;eh(e)&&!Cf(e,s)&&(i.addClass("ck-widget_selected",e),this._previouslySelected.add(e),s=e,e==r&&i.setSelection(n.getRanges(),{fake:!0,label:ih(r)}))}},{priority:"low"}),e.addObserver(bh),this.listenTo(t,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(t,"keydown",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{priority:"high"}),this.listenTo(t,"keydown",(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{priority:uo.get("high")-20}),this.listenTo(t,"keydown",_f(this.editor.editing)),this.listenTo(t,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{priority:"high"})}_onMousedown(e,t){const o=this.editor,i=o.editing.view,n=i.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(eh(e))return!1;e=e.parent}return!1}(r)){if((fn.isSafari||fn.isGecko)&&t.domEvent.detail>=3){const e=o.editing.mapper,i=r.is("attributeElement")?r.findAncestor(e=>!e.is("attributeElement")):r,n=e.toModelElement(i);t.preventDefault(),this.editor.model.change(e=>{e.setSelection(n,"in")})}return}if(!eh(r)&&(r=r.findAncestor(eh),!r))return;t.preventDefault(),n.isFocused||i.focus();const s=o.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(e,t){const o=t.keyCode;if(!_n(o))return;const i=this.editor.model,n=i.schema,r=i.document.selection,s=r.getSelectedElement(),a=yn(o,this.editor.locale.contentLanguageDirection);if(s&&n.isObject(s)){const o=a?r.getLastPosition():r.getFirstPosition(),s=n.getNearestSelectionRange(o,a?"forward":"backward");return void(s&&(i.change(e=>{e.setSelection(s)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed)return;const l=this._getObjectElementNextToSelection(a);l&&n.isObject(l)&&(this._setSelectionOverElement(l),t.preventDefault(),e.stop())}_preventDefaultOnArrowKeyPress(e,t){if(!_n(t.keyCode))return;const o=this.editor.model,i=o.schema,n=o.document.selection.getSelectedElement();n&&i.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 o=this._getObjectElementNextToSelection(e);return o?(this.editor.model.change(e=>{let i=t.anchor.parent;for(;i.isEmpty;){const t=i;i=t.parent,e.remove(t)}this._setSelectionOverElement(o)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,o=t.schema,i=t.document.selection,n=t.createSelection(i);t.modifySelection(n,{direction:e?"forward":"backward"});const r=e?n.focus.nodeBefore:n.focus.nodeAfter;return r&&o.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function Cf(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class Af extends wd{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=ch(e),ch(e)&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor.model,o=t.document.selection.getSelectedElement();t.change(t=>{t.setAttribute("alt",e.newValue,o)})}}class Tf extends ud{static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Af(this.editor))}}o(56);class Sf extends xc{constructor(e,t){super(e);const o="ck-labeled-field-view-"+co(),i="ck-labeled-field-view-status-"+co();this.fieldView=t(this,o,i),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(o),this.statusView=this._createStatusView(i),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 Sc(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new xc(this.locale),o=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",o.if("errorText","ck-labeled-field-view__status_error"),o.if("_statusText","ck-hidden",e=>!e)],id:e,role:o.if("errorText","alert")},children:[{text:o.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}o(58);class Ef extends xc{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 Yl,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,o)=>{this._setDomElementValue(o),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:""}}function Pf(e,t,o){const i=new Ef(e.locale);return i.set({id:t,ariaDescribedById:o}),i.bind("isReadOnly").to(e,"isEnabled",e=>!e),i.bind("hasError").to(e,"errorText",e=>!!e),i.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused","placeholder").to(i),i}function Mf(e,t,o){const i=od(e.locale);return i.set({id:t,ariaDescribedById:o}),i.bind("isEnabled").to(e),i}function If(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 Nf({view:e}){e.listenTo(e.element,"submit",(t,o)=>{o.preventDefault(),e.fire("submit")},{useCapture:!0})}var Rf='<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>',Of='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.591 10.177l4.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>';o(60),o(7);class Vf extends xc{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new Yl,this.keystrokes=new Bl,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Rf,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Of,"ck-button-cancel","cancel"),this._focusables=new ic,this._focusCycler=new Oc({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]}),If(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Nf({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,o,i){const n=new Yc(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:o}}),i&&n.delegate("execute").to(this,i),n}_createLabeledInputView(){const e=this.locale.t,t=new Sf(this.locale,Pf);return t.label=e("Text alternative"),t}}o(63),o(65);const Lf=Ic("px");class Df extends ud{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 Yu(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 ho.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 o=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),o.set(e.view,e),this._viewToStack.set(e.view,o),o===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new ho.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 ho.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 zf(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,o)=>{if(o<2)return"";const i=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[i,o])}),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 Bf(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:o=!0,singleViewMode:i=!1}){this.view.class=t,this.view.withArrow=o,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),i&&(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}}class zf extends xc{constructor(e){super(e);const t=e.t,o=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Yl,this.buttonPrevView=this._createButtonView(t("Previous"),'<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>'),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",o.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:o.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 o=new Yc(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o}}class Bf extends xc{constructor(e,t){super(e);const o=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",o.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:o.to("top",Lf),left:o.to("left",Lf),width:o.to("width",Lf),height:o.to("height",Lf)}},children:this.content}),this.on("change:numberOfPanels",(e,t,o,i)=>{o>i?this._addPanels(o-i):this._removePanels(i-o),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new xc;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:o,height:i}=new ns(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:o,height:i})}}}function jf(e){const t=e.editing.view,o=Yu.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast]}}class Ff extends ud{static get requires(){return[Df]}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",o=>{const i=e.commands.get("imageTextAlternative"),n=new Yc(o);return n.set({label:t("Change image text alternative"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22L2.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.21l-.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>',tooltip:!0}),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",()=>{this._showForm()}),n})}_createForm(){const e=this.editor,t=e.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Vf(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",()=>{lh(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(lh(e.editing.view.document.selection)){const o=jf(e);t.updatePosition(o)}}(e):this._hideForm(!0)}),td({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"),o=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:jf(e)}),o.fieldView.value=o.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 Hf extends ud{static get requires(){return[Tf,Ff]}static get pluginName(){return"ImageTextAlternative"}}o(67);class Uf extends ud{static get requires(){return[gh,xf,Hf]}static get pluginName(){return"Image"}}class Wf extends xc{constructor(e){super(e),this.buttonView=new Yc(e),this._fileInputView=new qf(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 qf extends xc{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 $f(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}class Gf extends ud{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageUpload",o=>{const i=new Wf(o),n=e.commands.get("imageUpload"),r=e.config.get("image.upload.types"),s=$f(r);return i.set({acceptedType:r.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),i.buttonView.set({label:t("Insert image"),icon:'<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>',tooltip:!0}),i.buttonView.bind("isEnabled").to(n),i.on("done",(t,o)=>{const i=Array.from(o).filter(e=>s.test(e.type));i.length&&e.execute("imageUpload",{file:i})}),i})}}o(69),o(71),o(73);class Yf extends ud{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(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,o){const i=this.editor,n=t.item,r=n.getAttribute("uploadId");if(!o.consumable.consume(t.item,e.name))return;const s=i.plugins.get(ku),a=r?t.attributeNewValue:null,l=this.placeholder,c=i.editing.mapper.toViewElement(n),d=o.writer;if("reading"==a)return Kf(c,d),void Qf(l,c,d);if("uploading"==a){const e=s.loaders.get(r);return Kf(c,d),void(e?(Jf(c,d),function(e,t,o,i){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),o.on("change:uploadedPercent",(e,t,o)=>{i.change(e=>{e.setStyle("width",o+"%",n)})})}(c,d,e,i.editing.view),function(e,t,o){if(o.data){const i=hh(e);t.setAttribute("src",o.data,i)}}(c,d,e)):Qf(l,c,d))}"complete"==a&&s.loaders.get(r)&&function(e,t,o){const i=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),i),setTimeout(()=>{o.change(e=>e.remove(e.createRangeOn(i)))},3e3)}(c,d,i.editing.view),function(e,t){Xf(e,t,"progressBar")}(c,d),Jf(c,d),function(e,t){t.removeClass("ck-appear",e)}(c,d)}}function Kf(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function Qf(e,t,o){t.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",t);const i=hh(t);i.getAttribute("src")!==e&&o.setAttribute("src",e,i),Zf(t,"placeholder")||o.insert(o.createPositionAfter(i),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(o))}function Jf(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Xf(e,t,"placeholder")}function Zf(e,t){for(const o of e.getChildren())if(o.getCustomProperty(t))return o}function Xf(e,t,o){const i=Zf(e,o);i&&t.remove(t.createRangeOn(i))}class em{constructor(e){this.document=e}createDocumentFragment(e){return new Pn(this.document,e)}createElement(e,t,o){return new Oi(this.document,e,t,o)}createText(e){return new Vo(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,o){return o._insertChild(e,t)}removeChildren(e,t,o){return o._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const o=e.parent;if(o){const i=o.getChildIndex(e);return this.removeChildren(i,1,o),this.insertChild(i,t,o),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const o=t.getChildIndex(e);this.remove(e),this.insertChild(o,e.getChildren(),t)}}rename(e,t){const o=new Oi(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,o)?o:null}setAttribute(e,t,o){o._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,o){y(e)&&void 0===o&&(o=t),o._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,o){o._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return Xi._createAt(e,t)}createPositionAfter(e){return Xi._createAfter(e)}createPositionBefore(e){return Xi._createBefore(e)}createRange(e,t){return new en(e,t)}createRangeOn(e){return en._createOn(e)}createRangeIn(e){return en._createIn(e)}createSelection(e,t,o){return new nn(e,t,o)}}class tm extends wd{refresh(){const e=this.editor.model.document.selection.getSelectedElement(),t=e&&"image"===e.name||!1;this.isEnabled=uh(this.editor.model)||t}execute(e){const t=this.editor,o=t.model,i=t.plugins.get(ku);for(const t of To(e.file))om(o,i,t)}}function om(e,t,o){const i=t.createLoader(o);i&&dh(e,{uploadId:i.id})}class im extends ud{static get requires(){return[ku,rf,bd]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}})}init(){const e=this.editor,t=e.model.document,o=e.model.schema,i=e.conversion,n=e.plugins.get(ku),r=$f(e.config.get("image.upload.types"));o.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),e.commands.add("imageUpload",new tm(e)),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,o)=>{if(i=o.dataTransfer,Array.from(i.types).includes("text/html")&&""!==i.getData("text/html"))return;var i;const n=Array.from(o.dataTransfer.files).filter(e=>!!e&&r.test(e.type)),s=o.targetRanges.map(t=>e.editing.mapper.toModelRange(t));e.model.change(o=>{o.setSelection(s),n.length&&(t.stop(),e.model.enqueueChange("default",()=>{e.execute("imageUpload",{file:n})}))})}),this.listenTo(e.plugins.get(bd),"inputTransformation",(t,o)=>{const i=Array.from(e.editing.view.createRangeIn(o.content)).filter(e=>{return!(!(t=e.item).is("element","img")||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))&&!e.item.getAttribute("uploadProcessed");var t}).map(e=>{return{promise:(t=e.item,new Promise((e,o)=>{const i=t.getAttribute("src");fetch(i).then(e=>e.blob()).then(t=>{const o=function(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}(t,i),n=o.replace("image/",""),r=new File([t],"image."+n,{type:o});e(r)}).catch(o)})),imageElement:e.item};var t});if(!i.length)return;const r=new em(e.editing.view.document);for(const e of i){r.setAttribute("uploadProcessed",!0,e.imageElement);const t=n.createLoader(e.promise);t&&(r.setAttribute("src","",e.imageElement),r.setAttribute("uploadId",t.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault()}),t.on("change",()=>{const o=t.differ.getChanges({includeChangesInGraveyard:!0});for(const t of o)if("insert"==t.type&&"$text"!=t.name){const o=t.position.nodeAfter,i="$graveyard"==t.position.root.rootName;for(const t of nm(e,o)){const e=t.getAttribute("uploadId");if(!e)continue;const o=n.loaders.get(e);o&&(i?o.abort():"idle"==o.status&&this._readAndUpload(o,t))}}})}_readAndUpload(e,t){const o=this.editor,i=o.model,n=o.locale.t,r=o.plugins.get(ku),s=o.plugins.get(rf);return i.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","reading",t)}),e.read().then(()=>{const n=e.upload();if(fn.isSafari){const e=hh(o.editing.mapper.toViewElement(t));o.editing.view.once("render",()=>{if(!e.parent)return;const t=o.editing.view.domConverter.mapViewToDom(e.parent);if(!t)return;const i=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=i})}return i.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",t)}),n}).then(e=>{i.enqueueChange("transparent",o=>{o.setAttributes({uploadStatus:"complete",src:e.default},t),this._parseAndSetSrcsetAttributeOnImage(e,t,o)}),a()}).catch(o=>{if("error"!==e.status&&"aborted"!==e.status)throw o;"error"==e.status&&o&&s.showWarning(o,{title:n("Upload failed"),namespace:"upload"}),a(),i.enqueueChange("transparent",e=>{e.remove(t)})});function a(){i.enqueueChange("transparent",e=>{e.removeAttribute("uploadId",t),e.removeAttribute("uploadStatus",t)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,o){let i=0;const n=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return i=Math.max(i,t),!0}).map(t=>`${e[t]} ${t}w`).join(", ");""!=n&&o.setAttribute("srcset",{data:n,width:i},t)}}function nm(e,t){return Array.from(e.model.createRangeOn(t)).filter(e=>e.item.is("element","image")).map(e=>e.item)}class rm extends ud{static get pluginName(){return"ImageUpload"}static get requires(){return[im,Gf,Yf]}}class sm extends wd{refresh(){const e=this.editor.model,t=Cu(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&am(t,e.schema)}execute(e={}){const t=this.editor.model,o=t.document;t.change(i=>{const n=(e.selection||o.selection).getSelectedBlocks();for(const e of n)!e.is("element","paragraph")&&am(e,t.schema)&&i.rename(e,"paragraph")})}}function am(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class lm extends wd{execute(e){const t=this.editor.model;let o=e.position;t.change(e=>{const i=e.createElement("paragraph");if(!t.schema.checkChild(o.parent,i)){const n=t.schema.findAllowedParent(o,i);if(!n)return;o=e.split(o,n).position}t.insertContent(i,o),e.setSelection(i,"in")})}}class cm extends ud{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new sm(e)),e.commands.add("insertParagraph",new lm(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>cm.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}cm.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class dm extends wd{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=Cu(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>um(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,o=t.document,i=e.value;t.change(e=>{const n=Array.from(o.selection.getSelectedBlocks()).filter(e=>um(e,i,t.schema));for(const t of n)t.is("element",i)||e.rename(t,i)})}}function um(e,t,o){return o.checkChild(e.parent,t)&&!o.isObject(e)}class hm extends ud{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[cm]}init(){const e=this.editor,t=e.config.get("heading.options"),o=[];for(const i of t)"paragraph"!==i.model&&(e.model.schema.register(i.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(i),o.push(i.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new dm(e,o))}afterInit(){const e=this.editor,t=e.commands.get("enter"),o=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,i)=>{const n=e.model.document.selection.getFirstPosition().parent;o.some(e=>n.is("element",e.model))&&!n.is("element","paragraph")&&0===n.childCount&&i.writer.rename(n,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:uo.get("low")+1})}}class fm{constructor(e,t){t&&zi(this,t),e&&this.set(e)}}xo(fm,Ui);o(12);class mm extends ud{init(){const e=this.editor,t=e.t,o=function(e){const t=e.t,o={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=o[e.title];return t&&t!=e.title&&(e.title=t),e})}(e),i=t("Choose heading"),n=t("Heading");e.ui.componentFactory.add("heading",t=>{const r={},s=new Co,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of o){const t={type:"button",model:new fm({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=od(t);return nd(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 o=e||t&&"paragraph";return r[o]?r[o]:i}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}function gm(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}function pm(e){const t=e.parent;return"figcaption"==e.name&&t&&"figure"==t.name&&t.hasClass("image")?{name:!0}:null}class bm extends ud{static get pluginName(){return"ImageCaptionEditing"}init(){const e=this.editor,t=e.editing.view,o=e.model.schema,i=e.data,n=e.editing,r=e.t;o.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),e.model.document.registerPostFixer(e=>this._insertMissingModelCaptionElement(e)),e.conversion.for("upcast").elementToElement({view:pm,model:"caption"});i.downcastDispatcher.on("insert:caption",wm(e=>e.createContainerElement("figcaption"),!1));const s=function(e,t){return o=>{const i=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,i),Jl({view:e,element:i,text:t}),nh(i,o)}}(t,r("Enter image caption"));n.downcastDispatcher.on("insert:caption",wm(s)),n.downcastDispatcher.on("insert",this._fixCaptionVisibility(e=>e.item),{priority:"high"}),n.downcastDispatcher.on("remove",this._fixCaptionVisibility(e=>e.position.parent),{priority:"high"}),t.document.registerPostFixer(e=>this._updateCaptionVisibility(e))}_updateCaptionVisibility(e){const t=this.editor.editing.mapper,o=this._lastSelectedCaption;let i;const n=this.editor.model.document.selection,r=n.getSelectedElement();if(r&&r.is("element","image")){const e=gm(r);i=t.toViewElement(e)}const s=km(n.getFirstPosition().parent);if(s&&(i=t.toViewElement(s)),i)return o?(o===i||(_m(o,e),this._lastSelectedCaption=i),vm(i,e)):(this._lastSelectedCaption=i,vm(i,e));if(o){const t=_m(o,e);return this._lastSelectedCaption=null,t}return!1}_fixCaptionVisibility(e){return(t,o,i)=>{const n=km(e(o)),r=this.editor.editing.mapper,s=i.writer;if(n){const e=r.toViewElement(n);e&&(n.childCount?s.removeClass("ck-hidden",e):s.addClass("ck-hidden",e))}}}_insertMissingModelCaptionElement(e){const t=this.editor.model,o=t.document.differ.getChanges(),i=[];for(const e of o)if("insert"==e.type&&"$text"!=e.name){const o=e.position.nodeAfter;if(o.is("element","image")&&!gm(o)&&i.push(o),!o.is("element","image")&&o.childCount)for(const e of t.createRangeIn(o).getItems())e.is("element","image")&&!gm(e)&&i.push(e)}for(const t of i)e.appendElement("caption",t);return!!i.length}}function wm(e,t=!0){return(o,i,n)=>{const r=i.item;if((r.childCount||t)&&ch(r.parent)){if(!n.consumable.consume(i.item,"insert"))return;const t=n.mapper.toViewElement(i.range.start.parent),o=e(n.writer),s=n.writer;r.childCount||s.addClass("ck-hidden",o),function(e,t,o,i){const n=i.writer.createPositionAt(o,"end");i.writer.insert(n,e),i.mapper.bindElements(t,e)}(o,i.item,t,n)}}}function km(e){const t=e.getAncestors({includeSelf:!0}).find(e=>"caption"==e.name);return t&&t.parent&&"image"==t.parent.name?t:null}function _m(e,t){return!e.childCount&&!e.hasClass("ck-hidden")&&(t.addClass("ck-hidden",e),!0)}function vm(e,t){return!!e.hasClass("ck-hidden")&&(t.removeClass("ck-hidden",e),!0)}o(76);class ym extends wd{constructor(e,t){super(e),this.defaultStyle=!1,this.styles=t.reduce((e,t)=>(e[t.name]=t,t.isDefault&&(this.defaultStyle=t.name),e),{})}refresh(){const e=this.editor.model.document.selection.getSelectedElement();if(this.isEnabled=ch(e),e)if(e.hasAttribute("imageStyle")){const t=e.getAttribute("imageStyle");this.value=!!this.styles[t]&&t}else this.value=this.defaultStyle;else this.value=!1}execute(e){const t=e.value,o=this.editor.model,i=o.document.selection.getSelectedElement();o.change(e=>{this.styles[t].isDefault?e.removeAttribute("imageStyle",i):e.setAttribute("imageStyle",t,i)})}}function xm(e,t){for(const o of t)if(o.name===e)return o}var Cm='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm2.5 3V12h11V7.5h-11zM4.061 6H15.94c.586 0 1.061.407 1.061.91v5.68c0 .503-.475.91-1.061.91H4.06c-.585 0-1.06-.407-1.06-.91V6.91C3 6.406 3.475 6 4.061 6zM2 16.5V15h16v1.5z"/></svg>',Am='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M18 4.5V3H2v1.5h16zm0 3V6h-5.674v1.5H18zm0 3V9h-5.674v1.5H18zm0 3V12h-5.674v1.5H18zm-8.5-6V12h-6V7.5h6zm.818-1.5H2.682C2.305 6 2 6.407 2 6.91v5.68c0 .503.305.91.682.91h7.636c.377 0 .682-.407.682-.91V6.91c0-.503-.305-.91-.682-.91zM18 16.5V15H2v1.5h16z"/></svg>',Tm='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm4.5 3V12h7V7.5h-7zM5.758 6h8.484c.419 0 .758.407.758.91v5.681c0 .502-.34.909-.758.909H5.758c-.419 0-.758-.407-.758-.91V6.91c0-.503.34-.91.758-.91zM2 16.5V15h16v1.5z"/></svg>',Sm='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm0 3V6h5.674v1.5zm0 3V9h5.674v1.5zm0 3V12h5.674v1.5zm8.5-6V12h6V7.5h-6zM9.682 6h7.636c.377 0 .682.407.682.91v5.68c0 .503-.305.91-.682.91H9.682c-.377 0-.682-.407-.682-.91V6.91c0-.503.305-.91.682-.91zM2 16.5V15h16v1.5z"/></svg>';const Em={full:{name:"full",title:"Full size image",icon:Cm,isDefault:!0},side:{name:"side",title:"Side image",icon:Sm,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:Am,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:Tm,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:Sm,className:"image-style-align-right"}},Pm={full:Cm,left:Am,right:Sm,center:Tm};function Mm(e=[]){return e.map(Im)}function Im(e){if("string"==typeof e){const t=e;Em[t]?e=Object.assign({},Em[t]):(Object(ho.c)("image-style-not-found",{name:t}),e={name:t})}else if(Em[e.name]){const t=Em[e.name],o=Object.assign({},e);for(const i in t)Object.prototype.hasOwnProperty.call(e,i)||(o[i]=t[i]);e=o}return"string"==typeof e.icon&&Pm[e.icon]&&(e.icon=Pm[e.icon]),e}class Nm extends ud{static get pluginName(){return"ImageStyleEditing"}init(){const e=this.editor,t=e.model.schema,o=e.data,i=e.editing;e.config.define("image.styles",["full","side"]);const n=Mm(e.config.get("image.styles"));t.extend("image",{allowAttributes:"imageStyle"});const r=function(e){return(t,o,i)=>{if(!i.consumable.consume(o.item,t.name))return;const n=xm(o.attributeNewValue,e),r=xm(o.attributeOldValue,e),s=i.mapper.toViewElement(o.item),a=i.writer;r&&a.removeClass(r.className,s),n&&a.addClass(n.className,s)}}(n);i.downcastDispatcher.on("attribute:imageStyle:image",r),o.downcastDispatcher.on("attribute:imageStyle:image",r),o.upcastDispatcher.on("element:figure",function(e){const t=e.filter(e=>!e.isDefault);return(e,o,i)=>{if(!o.modelRange)return;const n=o.viewItem,r=Cu(o.modelRange.getItems());if(i.schema.checkAttribute(r,"imageStyle"))for(const e of t)i.consumable.consume(n,{classes:e.className})&&i.writer.setAttribute("imageStyle",e.name,r)}}(n),{priority:"low"}),e.commands.add("imageStyle",new ym(e,n))}}o(78);class Rm extends ud{static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"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=function(e,t){for(const o of e)t[o.title]&&(o.title=t[o.title]);return e}(Mm(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const t of e)this._createButton(t)}_createButton(e){const t=this.editor,o="imageStyle:"+e.name;t.ui.componentFactory.add(o,o=>{const i=t.commands.get("imageStyle"),n=new Yc(o);return n.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(i,"isEnabled"),n.bind("isOn").to(i,"value",t=>t===e.name),this.listenTo(n,"execute",()=>{t.execute("imageStyle",{value:e.name}),t.editing.view.focus()}),n})}}class Om extends ud{static get requires(){return[Df]}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||!eh(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:o,getRelatedElement:i,balloonClassName:n="ck-toolbar-container"}){if(!o.length)return void Object(ho.c)("widget-toolbar-no-items",{toolbarId:e});const r=this.editor,s=r.t,a=new rd(r.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new ho.a("widget-toolbar-duplicated",this,{toolbarId:e});a.fillFromConfig(o,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:i,balloonClassName:n})}_updateToolbarsVisibility(){let e=0,t=null,o=null;for(const i of this._toolbarDefinitions.values()){const n=i.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,o=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}o&&this._showToolbar(o,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Vm(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:Lm(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);Vm(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Vm(e,t){const o=e.plugins.get("ContextualBalloon"),i=Lm(e,t);o.updatePosition(i)}function Lm(e,t){const o=e.editing.view,i=Yu.defaultPositions;return{target:o.domConverter.mapViewToDom(t),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,sh]}}class Dm extends wd{constructor(e){super(e),this._childCommands=[]}refresh(){}execute(...e){return this._getFirstEnabledCommand().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)}}class zm extends ud{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Dm(e)),e.commands.add("outdent",new Dm(e))}}var Bm='<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.95L5.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>',jm='<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 Fm extends ud{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,o=e.t,i="ltr"==t.uiLanguageDirection?Bm:jm,n="ltr"==t.uiLanguageDirection?jm:Bm;this._defineButton("indent",o("Increase indent"),i),this._defineButton("outdent",o("Decrease indent"),n)}_defineButton(e,t,o){const i=this.editor;i.ui.componentFactory.add(e,n=>{const r=i.commands.get(e),s=new Yc(n);return s.set({label:t,icon:o,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",()=>{i.execute(e),i.editing.view.focus()}),s})}}class Hm extends zr{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}o(80);class Um extends xc{constructor(e,t){super(e);const o=e.t;this.focusTracker=new Yl,this.keystrokes=new Bl,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(o("Save"),Rf,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),Of,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusables=new ic,this._focusCycler=new Oc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children}),If(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),Nf({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 Sf(this.locale,Pf);return t.label=e("Link URL"),t}_createButton(e,t,o,i){const n=new Yc(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:o}}),i&&n.delegate("execute").to(this,i),n}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const o of e.manualDecorators){const i=new ed(this.locale);i.set({name:o.id,label:o.label,withText:!0}),i.bind("isOn").toMany([o,e],"value",(e,t)=>void 0===t&&void 0===e?o.defaultValue:e),i.on("execute",()=>{o.set("value",!i.isOn)}),t.add(i)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new xc;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}}o(82);class Wm extends xc{constructor(e){super(e);const t=e.t;this.focusTracker=new Yl,this.keystrokes=new Bl,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 15l.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.562l-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"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.3 17.37l-.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.506L13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5L9.375 17H19v1.5H8z"/></svg>',"edit"),this.set("href"),this._focusables=new ic,this._focusCycler=new Oc({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,o){const i=new Yc(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,o),i}_createPreviewButton(){const e=new Yc(this.locale),t=this.bindTemplate,o=this.t;return e.set({withText:!0,tooltip:o("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&Yh(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||o("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}class qm extends ud{static get requires(){return[Df]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(Hm),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(Df),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 Wm(e.locale),o=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(o,"value"),t.editButtonView.bind("isEnabled").to(o),t.unlinkButtonView.bind("isEnabled").to(i),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"),o=e.config.get("link.defaultProtocol"),i=new Um(e.locale,t);return i.urlInputView.fieldView.bind("value").to(t,"value"),i.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),i.saveButtonView.bind("isEnabled").to(t),this.listenTo(i,"submit",()=>{const{value:t}=i.urlInputView.fieldView.element,n=Qh(t,o);e.execute("link",n,i.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(i,"cancel",()=>{this._closeFormView()}),i.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),i}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),o=e.t;e.keystrokes.set("Ctrl+K",(e,o)=>{o(),t.isEnabled&&this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const i=new Yc(e);return i.isEnabled=!0,i.label=o("Link"),i.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.077 15l.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>',i.keystroke="Ctrl+K",i.tooltip=!0,i.isToggleable=!0,i.bind("isEnabled").to(t,"isEnabled"),i.bind("isOn").to(t,"value",e=>!!e),this.listenTo(i,"execute",()=>this._showUI(!0)),i})}_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())}),td({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 o=this._getSelectedLinkElement(),i=r();const n=()=>{const e=this._getSelectedLinkElement(),t=r();o&&!e||!o&&t!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),o=e,i=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,o=e.document;let i=null;if(t.markers.has("link-ui")){const t=Array.from(this.editor.editing.mapper.markerNameToElements("link-ui")),o=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));i=e.domConverter.viewRangeToDom(o)}else{const t=this._getSelectedLinkElement(),n=o.selection.getFirstRange();i=t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(n)}return{target:i}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection;if(t.isCollapsed)return $m(t.getFirstPosition());{const o=t.getFirstRange().getTrimmed(),i=$m(o.start),n=$m(o.end);return i&&i==n&&e.createRangeIn(i).getTrimmed().isEqual(o)?i:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const o=e.document.selection.getFirstRange();if(e.markers.has("link-ui"))t.updateMarker("link-ui",{range:o});else if(o.start.isAtEnd){const i=function e(t,o,i){const n=[t.start.path[0]+1,0],r=i.createPositionFromPath(t.start.root,n,"toNext"),s=i.createRange(r,t.end);if(s.start.path[0]>t.end.path[0])return i.createRange(o);if(r.isAtStart&&r.isAtEnd)return e(s,o,i);return s}(o,e.document.selection.focus,t);t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:i})}else t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:o})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has("link-ui")&&e.change(e=>{e.removeMarker("link-ui")})}}function $m(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}function Gm(e,t){let o=e.start;return{text:Array.from(e.getItems()).reduce((e,i)=>i.is("$text")||i.is("$textProxy")?e+i.data:(o=t.createPositionAfter(i),""),""),range:t.createRange(o,e.end)}}class Ym{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:o})=>{o&&(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 o=this.model,i=o.document.selection,n=o.createRange(o.createPositionAt(i.focus.parent,0),i.focus),{text:r,range:s}=Gm(n,o),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const o=Object.assign(t,{text:r,range:s});"object"==typeof a&&Object.assign(o,a),this.fire("matched:"+e,o)}}}xo(Ym,Ui);const Km=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.))+(?:[a-z\\u00a1-\\uffff]{2,})))$","i");class Qm extends ud{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 Ym(e.model,e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=Jm(e.substr(0,e.length-1));return t?{url:t}:void 0}),o=e.plugins.get("Input");t.on("matched:data",(t,i)=>{const{batch:n,range:r,url:s}=i;if(!o.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,o=e.commands.get("enter");o&&o.on("execute",()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const o=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(o)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,o=e.commands.get("shiftEnter");o&&o.on("execute",()=>{const e=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(o)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:o,range:i}=Gm(e,t),n=Jm(o);if(n){const e=t.createRange(i.end.getShiftedBy(-n.length),i.end);this._applyAutoLink(n,e)}}_applyAutoLink(e,t){const o=this.editor.model;this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,o)&&o.enqueueChange(o=>{const i=this.editor.config.get("link.defaultProtocol"),n=Qh(e,i);o.setAttribute("linkHref",n,t)})}}function Jm(e){const t=Km.exec(e);return t?t[2]:null}class Zm extends wd{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document,o=Array.from(t.selection.getSelectedBlocks()).filter(t=>eg(t,e.schema)),i=!0===this.value;e.change(e=>{if(i){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(!i){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,Xm(o,!0,e),Xm(o,!1,e)}for(const t of o.reverse())i&&"listItem"==t.name?e.rename(t,"paragraph"):i||"listItem"==t.name?i||"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=Cu(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,o=Cu(e.getSelectedBlocks());return!!o&&eg(o,t)}}function Xm(e,t,o){const i=t?e[0]:e[e.length-1];if(i.is("element","listItem")){let n=i[t?"previousSibling":"nextSibling"],r=i.getAttribute("listIndent");for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=o;)r>n.getAttribute("listIndent")&&(r=n.getAttribute("listIndent")),n.getAttribute("listIndent")==r&&e[t?"unshift":"push"](n),n=n[t?"previousSibling":"nextSibling"]}}function eg(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class tg extends wd{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 o=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=o[o.length-1];let i=t.nextSibling;for(;i&&"listItem"==i.name&&i.getAttribute("listIndent")>t.getAttribute("listIndent");)o.push(i),i=i.nextSibling;this._indentBy<0&&(o=o.reverse());for(const t of o){const o=t.getAttribute("listIndent")+this._indentBy;o<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",o,t)}this.fire("_executeCleanup",o)})}_checkEnabled(){const e=Cu(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),o=e.getAttribute("listType");let i=e.previousSibling;for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=t;){if(i.getAttribute("listIndent")==t)return i.getAttribute("listType")==o;i=i.previousSibling}return!1}return!0}}function og(e,t){const o=t.mapper,i=t.writer,n="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=lg,t}(i),s=i.createContainerElement(n,null);return i.insert(i.createPositionAt(s,0),r),o.bindElements(e,r),r}function ig(e,t,o,i){const n=t.parent,r=o.mapper,s=o.writer;let a=r.toViewPosition(i.createPositionBefore(e));const l=sg(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(i.createPositionAt(c,"end"));const e=r.findMappedViewAncestor(a),t=function(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}(e);a=t?s.createPositionBefore(t):s.createPositionAt(e,"end")}else a=r.toViewPosition(i.createPositionBefore(e));if(a=rg(a),s.insert(a,n),c&&"listItem"==c.name){const e=r.toViewElement(c),o=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of o)if(e.item.is("element","li")){const i=s.breakContainer(s.createPositionBefore(e.item)),n=e.item.parent,r=s.createPositionAt(t,"end");ng(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(n),r),o.position=i}}else{const o=n.nextSibling;if(o&&(o.is("element","ul")||o.is("element","ol"))){let i=null;for(const t of o.getChildren()){const o=r.toModelElement(t);if(!(o&&o.getAttribute("listIndent")>e.getAttribute("listIndent")))break;i=t}i&&(s.breakContainer(s.createPositionAfter(i)),s.move(s.createRangeOn(i.parent),s.createPositionAt(t,"end")))}}ng(s,n,n.nextSibling),ng(s,n.previousSibling,n)}function ng(e,t,o){return!t||!o||"ul"!=t.name&&"ol"!=t.name||t.name!=o.name||t.getAttribute("class")!==o.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function rg(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function sg(e,t){const o=!!t.sameIndent,i=!!t.smallerIndent,n=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(o&&n==e||i&&n>e)return r;r="forward"===t.direction?r.nextSibling:r.previousSibling}return null}function ag(e,t,o,i){e.ui.componentFactory.add(t,n=>{const r=e.commands.get(t),s=new Yc(n);return s.set({label:o,icon:i,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function lg(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Di.call(this)}function cg(e){return(t,o,i)=>{const n=i.consumable;if(!n.test(o.item,"insert")||!n.test(o.item,"attribute:listType")||!n.test(o.item,"attribute:listIndent"))return;n.consume(o.item,"insert"),n.consume(o.item,"attribute:listType"),n.consume(o.item,"attribute:listIndent");const r=o.item;ig(r,og(r,i),i,e)}}function dg(e,t,o){if(!o.consumable.consume(t.item,"attribute:listType"))return;const i=o.mapper.toViewElement(t.item),n=o.writer;n.breakContainer(n.createPositionBefore(i)),n.breakContainer(n.createPositionAfter(i));const r=i.parent,s="numbered"==t.attributeNewValue?"ol":"ul";n.rename(s,r)}function ug(e,t,o){const i=o.mapper.toViewElement(t.item).parent,n=o.writer;ng(n,i,i.nextSibling),ng(n,i.previousSibling,i);for(const e of t.item.getChildren())o.consumable.consume(e,"insert")}function hg(e,t,o){if("listItem"!=t.item.name){let e=o.mapper.toViewPosition(t.range.start);const i=o.writer,n=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=i.breakContainer(e),"li"==e.parent.name);){const t=e,o=i.createPositionAt(e.parent,"end");if(!t.isEqual(o)){const e=i.remove(i.createRange(t,o));n.push(e)}e=i.createPositionAfter(e.parent)}if(n.length>0){for(let t=0;t<n.length;t++){const o=e.nodeBefore;if(e=i.insert(e,n[t]).end,t>0){const t=ng(i,o,o.nextSibling);t&&t.parent==o&&e.offset--}}ng(i,e.nodeBefore,e.nodeAfter)}}}function fg(e,t,o){const i=o.mapper.toViewPosition(t.position),n=i.nodeBefore,r=i.nodeAfter;ng(o.writer,n,r)}function mg(e,t,o){if(o.consumable.consume(t.viewItem,{name:!0})){const e=o.writer,i=e.createElement("listItem"),n=function(e){let t=0,o=e.parent;for(;o;){if(o.is("element","li"))t++;else{const e=o.previousSibling;e&&e.is("element","li")&&t++}o=o.parent}return t}(t.viewItem);e.setAttribute("listIndent",n,i);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",r,i),!o.safeInsert(i,t.modelCursor))return;const s=function(e,t,o){const{writer:i,schema:n}=o;let r=i.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=o.convertItem(s,r).modelCursor;else{const t=o.convertItem(s,i.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:kg(t.modelCursor),r=i.createPositionAfter(e))}return r}(i,t.viewItem.getChildren(),o);t.modelRange=e.createRange(t.modelCursor,s),o.updateConversionResult(i,t)}}function gg(e,t,o){if(o.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||vg(t))&&t._remove()}}}function pg(e,t,o){if(o.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let o=!1,i=!0;for(const t of e)o&&!vg(t)&&t._remove(),t.is("$text")?(i&&(t._data=t.data.replace(/^\s+/,"")),t.nextSibling&&!vg(t.nextSibling)||(t._data=t.data.replace(/\s+$/,""))):vg(t)&&(o=!0),i=!1}}function bg(e){return(t,o)=>{if(o.isPhantom)return;const i=o.modelPosition.nodeBefore;if(i&&i.is("element","listItem")){const t=o.mapper.toViewElement(i),n=t.getAncestors().find(vg),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("element","li")){o.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==n){o.viewPosition=e.nextPosition;break}}}}}function wg(e,[t,o]){let i,n=t.is("documentFragment")?t.getChild(0):t;if(i=o?this.createSelection(o):this.document.selection,n&&n.is("element","listItem")){const e=i.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 kg(e){const t=new xs({startPosition:e});let o;do{o=t.next()}while(!o.value.item.is("element","listItem"));return o.value.item}function _g(e,t,o,i,n,r){const s=sg(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=o;d=rg(d);for(const e of[...i.getChildren()])vg(e)&&(d=l.move(l.createRangeOn(e),d).end,ng(l,e,e.nextSibling),ng(l,e.previousSibling,e))}function vg(e){return e.is("element","ol")||e.is("element","ul")}class yg extends ud{static get pluginName(){return"ListEditing"}static get requires(){return[cm]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,o=e.editing;var i;e.model.document.registerPostFixer(t=>function(e,t){const o=e.document.differ.getChanges(),i=new Map;let n=!1;for(const i of o)if("insert"==i.type&&"listItem"==i.name)r(i.position);else if("insert"==i.type&&"listItem"!=i.name){if("$text"!=i.name){const o=i.position.nodeAfter;o.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",o),n=!0),o.hasAttribute("listType")&&(t.removeAttribute("listType",o),n=!0),o.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",o),n=!0);for(const t of Array.from(e.createRangeIn(o)).filter(e=>e.item.is("element","listItem")))r(t.previousPosition)}r(i.position.getShiftedBy(i.length))}else"remove"==i.type&&"listItem"==i.name?r(i.position):("attribute"==i.type&&"listIndent"==i.attributeKey||"attribute"==i.type&&"listType"==i.attributeKey)&&r(i.range.start);for(const e of i.values())s(e),a(e);return n;function r(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(i.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,i.has(e))return;i.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&i.set(t,t)}}function s(e){let o=0,i=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(r>o){let s;null===i?(i=r-o,s=o):(i>r&&(i=r),s=r-i),t.setAttribute("listIndent",s,e),n=!0}else i=null,o=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let o=[],i=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(i&&i.getAttribute("listIndent")>r&&(o=o.slice(0,r+1)),0!=r)if(o[r]){const i=o[r];e.getAttribute("listType")!=i&&(t.setAttribute("listType",i,e),n=!0)}else o[r]=e.getAttribute("listType");i=e,e=e.nextSibling}}}(e.model,t)),o.mapper.registerViewToModelLength("li",xg),t.mapper.registerViewToModelLength("li",xg),o.mapper.on("modelToViewPosition",bg(o.view)),o.mapper.on("viewToModelPosition",(i=e.model,(e,t)=>{const o=t.viewPosition,n=o.parent,r=t.mapper;if("ul"==n.name||"ol"==n.name){if(o.isAtEnd){const e=r.toModelElement(o.nodeBefore),n=r.getModelLength(o.nodeBefore);t.modelPosition=i.createPositionBefore(e).getShiftedBy(n)}else{const e=r.toModelElement(o.nodeAfter);t.modelPosition=i.createPositionBefore(e)}e.stop()}else if("li"==n.name&&o.nodeBefore&&("ul"==o.nodeBefore.name||"ol"==o.nodeBefore.name)){const s=r.toModelElement(n);let a=1,l=o.nodeBefore;for(;l&&vg(l);)a+=r.getModelLength(l),l=l.previousSibling;t.modelPosition=i.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",bg(o.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",hg,{priority:"high"}),t.on("insert:listItem",cg(e.model)),t.on("attribute:listType:listItem",dg,{priority:"high"}),t.on("attribute:listType:listItem",ug,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,o,i)=>{if(!i.consumable.consume(o.item,"attribute:listIndent"))return;const n=i.mapper.toViewElement(o.item),r=i.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&&ng(r,a,a.nextSibling),_g(o.attributeOldValue+1,o.range.start,l.start,n,i,e),ig(o.item,n,i,e);for(const e of o.item.getChildren())i.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,o,i)=>{const n=i.mapper.toViewPosition(o.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,r=i.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&&ng(r,a,a.nextSibling);_g(i.mapper.toModelElement(n).getAttribute("listIndent")+1,o.position,l.start,n,i,e);for(const e of r.createRangeIn(c).getItems())i.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",fg,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",hg,{priority:"high"}),t.on("insert:listItem",cg(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",gg,{priority:"high"}),e.on("element:ol",gg,{priority:"high"}),e.on("element:li",pg,{priority:"high"}),e.on("element:li",mg)}),e.model.on("insertContent",wg,{priority:"high"}),e.commands.add("numberedList",new Zm(e,"numbered")),e.commands.add("bulletedList",new Zm(e,"bulleted")),e.commands.add("indentList",new tg(e,"forward")),e.commands.add("outdentList",new tg(e,"backward"));const n=o.view.document;this.listenTo(n,"enter",(e,t)=>{const o=this.editor.model.document,i=o.selection.getLastPosition().parent;o.selection.isCollapsed&&"listItem"==i.name&&i.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),this.listenTo(n,"delete",(e,t)=>{if("backward"!==t.direction)return;const o=this.editor.model.document.selection;if(!o.isCollapsed)return;const i=o.getFirstPosition();if(!i.isAtStart)return;const n=i.parent;if("listItem"!==n.name)return;n.previousSibling&&"listItem"===n.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{priority:"high"});const r=e=>(t,o)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),o())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),o=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),o&&o.registerChildCommand(e.get("outdentList"))}}function xg(e){let t=1;for(const o of e.getChildren())if("ul"==o.name||"ol"==o.name)for(const e of o.getChildren())t+=xg(e);return t}class Cg extends ud{init(){const e=this.editor.t;ag(this.editor,"numberedList",e("Numbered List"),'<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>'),ag(this.editor,"bulletedList",e("Bulleted List"),'<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>')}}function Ag(e,t){return e=>{e.on("attribute:url:media",o)};function o(o,i,n){if(!n.consumable.consume(i.item,o.name))return;const r=i.attributeNewValue,s=n.writer,a=n.mapper.toViewElement(i.item),l=[...a.getChildren()].find(e=>e.getCustomProperty("media-content"));s.remove(l);const c=e.getMediaViewElement(s,r,t);s.insert(s.createPositionAt(a,0),c)}}function Tg(e,t,o,i){const n=e.createContainerElement("figure",{class:"media"});return e.insert(e.createPositionAt(n,0),t.getMediaViewElement(e,o,i)),n}function Sg(e){const t=e.getSelectedElement();return t&&t.is("element","media")?t:null}function Eg(e,t,o){e.change(i=>{const n=i.createElement("media",{url:t});e.insertContent(n,o),i.setSelection(n,"on")})}class Pg extends wd{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema,i=rh(t,e),n=Sg(t);let r=i.parent;r.isEmpty&&!e.schema.isLimit(r)&&(r=r.parent),this.value=n?n.getAttribute("url"):null,this.isEnabled=o.checkChild(r,"media")}execute(e){const t=this.editor.model,o=t.document.selection,i=Sg(o);if(i)t.change(t=>{t.setAttribute("url",e,i)});else{const i=rh(o,t);Eg(t,e,i)}}}class Mg{constructor(e,t){const o=t.providers,i=t.extraProviders||[],n=new Set(t.removeProviders),r=o.concat(i).filter(e=>{const t=e.name;return t?!n.has(t):(Object(ho.c)("media-embed-no-provider-name",{provider:e}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,o){return this._getMedia(t).getViewElement(e,o)}_getMedia(e){if(!e)return new Ig(this.locale);e=e.trim();for(const t of this.providerDefinitions){const o=t.html,i=To(t.url);for(const t of i){const i=this._getUrlMatches(e,t);if(i)return new Ig(this.locale,e,i,o)}}return null}_getUrlMatches(e,t){let o=e.match(t);if(o)return o;let i=e.replace(/^https?:\/\//,"");return o=i.match(t),o||(i=i.replace(/^www\./,""),o=i.match(t),o||null)}}class Ig{constructor(e,t,o,i){this.url=this._getValidUrl(t),this._t=e.t,this._match=o,this._previewRenderer=i}getViewElement(e,t){const o={};let i;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(o["data-oembed-url"]=this.url),t.renderForEditingView&&(o.class="ck-media__wrapper");const n=this._getPreviewHtml(t);i=e.createRawElement("div",o,(function(e){e.innerHTML=n}))}else this.url&&(o.url=this.url),i=e.createEmptyElement("oembed",o);return e.setCustomProperty("media-content",!0,i),i}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new Gc,t=new $c;e.text=this._t("Open media in new tab"),t.content='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>',t.viewBox="0 0 64 42";return new nc({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[t]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},e]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}o(84);class Ng extends ud{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:/^google\.com\/maps/},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new Mg(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,o=e.t,i=e.conversion,n=e.config.get("mediaEmbed.previewsInData"),r=this.registry;e.commands.add("mediaEmbed",new Pg(e)),t.register("media",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["url"]}),i.for("dataDowncast").elementToElement({model:"media",view:(e,{writer:t})=>{const o=e.getAttribute("url");return Tg(t,r,o,{renderMediaPreview:o&&n})}}),i.for("dataDowncast").add(Ag(r,{renderMediaPreview:n})),i.for("editingDowncast").elementToElement({model:"media",view:(e,{writer:t})=>{const i=e.getAttribute("url");return function(e,t,o){return t.setCustomProperty("media",!0,e),th(e,t,{label:o})}(Tg(t,r,i,{renderForEditingView:!0}),t,o("media widget"))}}),i.for("editingDowncast").add(Ag(r,{renderForEditingView:!0})),i.for("upcast").elementToElement({view:{name:"oembed",attributes:{url:!0}},model:(e,{writer:t})=>{const o=e.getAttribute("url");if(r.hasMedia(o))return t.createElement("media",{url:o})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(e,{writer:t})=>{const o=e.getAttribute("data-oembed-url");if(r.hasMedia(o))return t.createElement("media",{url:o})}})}}const Rg=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/;class Og extends ud{static get requires(){return[bd,gu]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document;this.listenTo(e.plugins.get(bd),"inputTransformation",()=>{const e=t.selection.getFirstRange(),o=vl.fromPosition(e.start);o.stickiness="toPrevious";const i=vl.fromPosition(e.end);i.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(o,i),o.detach(),i.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(rr.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const o=this.editor,i=o.plugins.get(Ng).registry,n=new Hs(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(),!s.match(Rg))return void n.detach();if(!i.hasMedia(s))return void n.detach();o.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=vl.fromPosition(e),this._timeoutId=rr.window.setTimeout(()=>{o.model.change(e=>{let t;this._timeoutId=null,e.remove(n),n.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert),Eg(o.model,s,t),this._positionToInsert.detach(),this._positionToInsert=null})},100)):n.detach()}}o(86);class Vg extends xc{constructor(e,t){super(t);const o=t.t;this.focusTracker=new Yl,this.keystrokes=new Bl,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(o("Save"),Rf,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",e=>!!e),this.cancelButtonView=this._createButton(o("Cancel"),Of,"ck-button-cancel","cancel"),this._focusables=new ic,this._focusCycler=new Oc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),If(this)}render(){super.render(),Nf({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e),this.listenTo(this.urlInputView.element,"selectstart",(e,t)=>{t.stopPropagation()},{priority:"high"})}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new Sf(this.locale,Pf),o=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,o.on("input",()=>{t.infoText=o.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=o.element.value.trim()}),t}_createButton(e,t,o,i){const n=new Yc(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:o}}),i&&n.delegate("execute").to(this,i),n}}class Lg extends ud{static get requires(){return[Ng]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed"),o=e.plugins.get(Ng).registry;e.ui.componentFactory.add("mediaEmbed",i=>{const n=od(i),r=new Vg(function(e,t){return[t=>{if(!t.url.length)return e("The URL must not be empty.")},o=>{if(!t.hasMedia(o.url))return e("This media URL is not supported.")}]}(e.t,o),e.locale);return this._setUpDropdown(n,r,t,e),this._setUpForm(n,r,t),n})}_setUpDropdown(e,t,o){const i=this.editor,n=i.t,r=e.buttonView;function s(){i.editing.view.focus(),e.isOpen=!1}e.bind("isEnabled").to(o),e.panelView.children.add(t),r.set({label:n("Insert media"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M18.68 3.03c.6 0 .59-.03.59.55v12.84c0 .59.01.56-.59.56H1.29c-.6 0-.59.03-.59-.56V3.58c0-.58-.01-.55.6-.55h17.38zM15.77 15V5H4.2v10h11.57zM2 4v1h1V4H2zm0 2v1h1V6H2zm0 2v1h1V8H2zm0 2v1h1v-1H2zm0 2v1h1v-1H2zm0 2v1h1v-1H2zM17 4v1h1V4h-1zm0 2v1h1V6h-1zm0 2v1h1V8h-1zm0 2v1h1v-1h-1zm0 2v1h1v-1h-1zm0 2v1h1v-1h-1zM7.5 7.177a.4.4 0 0 1 .593-.351l5.133 2.824a.4.4 0 0 1 0 .7l-5.133 2.824a.4.4 0 0 1-.593-.35V7.176v.001z"/></svg>',tooltip:!0}),r.on("open",()=>{t.disableCssTransitions(),t.url=o.value||"",t.urlInputView.fieldView.select(),t.focus(),t.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{t.isValid()&&(i.execute("mediaEmbed",t.url),s())}),e.on("change:isOpen",()=>t.resetFormStatus()),e.on("cancel",()=>s())}_setUpForm(e,t,o){t.delegate("submit","cancel").to(e),t.urlInputView.bind("value").to(o,"value"),t.urlInputView.bind("isReadOnly").to(o,"isEnabled",e=>!e)}}o(88);function Dg(e,t){if(!e.childCount)return;const o=new em(e.document),i=function(e,t){const o=t.createRangeIn(e),i=new zo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),n=[];for(const e of o)if("elementStart"===e.type&&i.match(e.item)){const t=jg(e.item);n.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return n}(e,o);if(!i.length)return;let n=null,r=1;i.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return t.indent-e.indent!=1;const o=t.element.previousSibling;if(!o)return!0;return i=o,!(i.is("element","ol")||i.is("element","ul"));var i}(i[s-1],e),l=a?null:i[s-1],c=(u=e,(d=l)?u.indent-d.indent:u.indent-1);var d,u;if(a&&(n=null,r=1),!n||0!==c){const i=function(e,t){const o=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),i=/mso-level-number-format:([^;]*);/gi,n=o.exec(t);let r="decimal",s="ol";if(n&&n[1]){const t=i.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;const t=e.getChild(0).getChild(0);if(t.is("$text"))return t;return t.getChild(0)}(e);if(!t)return null;const o=t._data;if("o"===o)return"circle";if("·"===o)return"disc";if("§"===o)return"square";return null}(e.element);t&&(r=t)}}return{type:s,style:zg(r)}}(e,t);if(n){if(e.indent>r){const e=n.getChild(n.childCount-1),t=e.getChild(e.childCount-1);n=Bg(i,t,o),r+=1}else if(e.indent<r){const t=r-e.indent;n=function(e,t){const o=e.getAncestors({parentFirst:!0});let i=null,n=0;for(const e of o)if("ul"!==e.name&&"ol"!==e.name||n++,n===t){i=e;break}return i}(n,t),r=parseInt(e.indent)}}else n=Bg(i,e.element,o);e.indent<=r&&(n.is("element",i.type)||(n=o.rename(i.type,n)))}const h=function(e,t){return function(e,t){const o=new zo({name:"span",styles:{"mso-list":"Ignore"}}),i=t.createRangeIn(e);for(const e of i)"elementStart"===e.type&&o.match(e.item)&&t.remove(e.item)}(e,t),t.rename("li",e)}(e.element,o);o.appendChild(h,n)})}function zg(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 Bg(e,t,o){const i=t.parent,n=o.createElement(e.type),r=i.getChildIndex(t)+1;return o.insertChild(r,n,i),e.style&&o.setStyle("list-style-type",e.style,n),n}function jg(e){const t={},o=e.getStyle("mso-list");if(o){const e=o.match(/(^|\s+)l(\d+)/i),i=o.match(/\s*lfo(\d+)/i),n=o.match(/\s*level(\d+)/i);e&&i&&n&&(t.id=e[2],t.order=i[1],t.indent=n[1])}return t}const Fg=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Hg{constructor(e){this.document=e}isActive(e){return Fg.test(e)}execute(e){const t=new em(this.document);!function(e,t){for(const o of e.getChildren())if(o.is("element","b")&&"normal"===o.getStyle("font-weight")){const i=e.getChildIndex(o);t.remove(o),t.insertChild(i,o.getChildren(),e)}}(e.content,t),function(e,t){for(const o of t.createRangeIn(e)){const e=o.item;if(e.is("element","li")){const o=e.getChild(0);o&&o.is("element","p")&&t.unwrapElement(o)}}}(e.content,t)}}function Ug(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 Wg(e,t){const o=new DOMParser,i=function(e){return Ug(Ug(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[\s]*?)[\r\n]+(\s*<\/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]\s*)</g,"><")}(function(e){const t=e.match(/<\/body>(.*?)(<\/html>|$)/);t&&t[1]&&(e=e.slice(0,t.index)+e.slice(t.index).replace(t[1],""));return e}(e=e.replace(/<!--\[if gte vml 1]>/g,""))),n=o.parseFromString(i,"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 o=new sn(t),i=new cr(o,{blockFillerMode:"nbsp"}),n=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)n.appendChild(r[0]);return i.domToView(n)}(n,t),a=function(e){const t=[],o=[],i=Array.from(e.getElementsByTagName("style"));for(const e of i)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),o.push(e.innerHTML));return{styles:t,stylesString:o.join(" ")}}(n);return{body:s,bodyString:r,styles:a.styles,stylesString:a.stylesString}}function qg(e,t){if(!e.childCount)return;const o=new em;!function(e,t,o){const i=o.createRangeIn(t),n=new zo({name:"img"}),r=[];for(const t of i)if(n.match(t.item)){const o=t.item,i=o.getAttribute("v:shapes")?o.getAttribute("v:shapes").split(" "):[];i.length&&i.every(t=>e.indexOf(t)>-1)?r.push(o):o.getAttribute("src")||r.push(o)}for(const e of r)o.remove(e)}(function(e,t){const o=t.createRangeIn(e),i=new zo({name:/v:(.+)/}),n=[];for(const e of o){const t=e.item,o=t.previousSibling&&t.previousSibling.name||null;i.match(t)&&t.getAttribute("o:gfxdata")&&"v:shapetype"!==o&&n.push(e.item.getAttribute("id"))}return n}(e,o),e,o),function(e,t){const o=t.createRangeIn(e),i=new zo({name:/v:(.+)/}),n=[];for(const e of o)i.match(e.item)&&n.push(e.item);for(const e of n)t.remove(e)}(e,o);const i=function(e,t){const o=t.createRangeIn(e),i=new zo({name:"img"}),n=[];for(const e of o)i.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&n.push(e.item);return n}(e,o);i.length&&function(e,t,o){if(e.length===t.length)for(let n=0;n<e.length;n++){const r=`data:${t[n].type};base64,${i=t[n].hex,btoa(i.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}`;o.setAttribute("src",r,e[n])}var i}(i,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,o=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),i=e.match(o),n=[];if(i)for(const e of i){let o=!1;e.includes("\\pngblip")?o="image/png":e.includes("\\jpegblip")&&(o="image/jpeg"),o&&n.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:o})}return n}(t),o)}const $g=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,Gg=/xmlns:o="urn:schemas-microsoft-com/i;class Yg{constructor(e){this.document=e}isActive(e){return $g.test(e)||Gg.test(e)}execute(e){const{body:t,stylesString:o}=Wg(e.dataTransfer.getData("text/html"),this.document.stylesProcessor);Dg(t,o),qg(t,e.dataTransfer.getData("text/rtf")),e.content=t}}function Kg(e,t,o,i,n=1){t>n?i.setAttribute(e,t,o):i.removeAttribute(e,o)}function Qg(e,t,o={}){const i=e.createElement("tableCell",o);return e.insertElement("paragraph",i),e.insert(i,t),i}function Jg(e,t){const o=t.parent.parent,i=parseInt(o.getAttribute("headingColumns")||0),{column:n}=e.getCellLocation(t);return!!i&&n<i}function Zg(){return e=>{e.on("element:table",(e,t,o)=>{const i=t.viewItem;if(!o.consumable.test(i,{name:!0}))return;const{rows:n,headingRows:r,headingColumns:s}=function(e){const t={headingRows:0,headingColumns:0},o=[],i=[];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++,o.push(r);else{i.push(r);const e=Xg(r);e>t.headingColumns&&(t.headingColumns=e)}}return t.rows=[...o,...i],t}(i),a={};s&&(a.headingColumns=s),r&&(a.headingRows=r);const l=o.writer.createElement("table",a);if(o.safeInsert(l,t.modelCursor)){if(o.consumable.consume(i,{name:!0}),n.forEach(e=>o.convertItem(e,o.writer.createPositionAt(l,"end"))),l.isEmpty){const e=o.writer.createElement("tableRow");o.writer.insert(e,o.writer.createPositionAt(l,"end")),Qg(o.writer,o.writer.createPositionAt(e,"end"))}o.updateConversionResult(l,t)}})}}function Xg(e){let t=0,o=0;const i=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;o<i.length&&"th"===i[o].name;){const e=i[o];t+=parseInt(e.getAttribute("colspan")||1),o++}return t}class ep{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._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this._table.getChild(this._row);if(!e||this._isOverEndRow())return{done:!0};if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const o=this._getSpanned();if(o)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(o.cell,o.row,o.column));else{const o=e.getChild(this._cellIndex);if(!o)return this._advanceToNextRow();const i=parseInt(o.getAttribute("colspan")||1),n=parseInt(o.getAttribute("rowspan")||1);(i>1||n>1)&&this._recordSpans(o,n,i),this._shouldSkipSlot()||(t=this._formatOutValue(o)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,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,o=this._column){return{done:!1,value:new tp(this,e,t,o)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,o=this._column<this._startColumn,i=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||o||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){const i={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+o;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,i)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,o)}}class tp{constructor(e,t,o,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=i,this._cellIndex=e._cellIndex,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)}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function op(e={}){return t=>t.on("insert:table",(t,o,i)=>{const n=o.item;if(!i.consumable.consume(n,"insert"))return;i.consumable.consume(n,"attribute:headingRows:table"),i.consumable.consume(n,"attribute:headingColumns:table");const r=e&&e.asWidget,s=i.writer.createContainerElement("figure",{class:"table"}),a=i.writer.createContainerElement("table");let l;var c,d;i.writer.insert(i.writer.createPositionAt(s,0),a),r&&(c=s,(d=i.writer).setCustomProperty("table",!0,c),l=th(c,d,{hasSelectionHandle:!0}));const u=new ep(n),h={headingRows:n.getAttribute("headingRows")||0,headingColumns:n.getAttribute("headingColumns")||0},f=new Map;for(const t of u){const{row:o,cell:r}=t,s=n.getChild(o),l=f.get(o)||ap(a,s,o,h,i);f.set(o,l),i.consumable.consume(r,"insert");sp(t,h,i.writer.createPositionAt(l,"end"),i,e)}for(const e of n.getChildren()){const t=e.index;f.has(t)||f.set(t,ap(a,e,t,h,i))}const m=i.mapper.toViewPosition(o.range.start);i.mapper.bindElements(n,r?l:s),i.writer.insert(m,r?l:s)})}function ip(e,t){const{writer:o}=t;if(e.parent.is("element","tableCell"))return np(e)?o.createContainerElement("span",{style:"display:inline-block"}):o.createContainerElement("p")}function np(e){return 1===e.parent.childCount&&!up(e)}function rp(e,t,o){const{cell:i}=e,n=lp(e,t),r=o.mapper.toViewElement(i);r&&r.name!==n&&function(e,t,o){const i=o.writer,n=o.mapper.toViewElement(e),r=nh(i.createEditableElement(t,n.getAttributes()),i);oh(r,i,(e,t,o)=>o.addClass(To(t.classes),e),(e,t,o)=>o.removeClass(To(t.classes),e)),i.insert(i.createPositionAfter(n),r),i.move(i.createRangeIn(n),i.createPositionAt(r,0)),i.remove(i.createRangeOn(n)),o.mapper.unbindViewElement(n),o.mapper.bindElements(e,r)}(i,n,o)}function sp(e,t,o,i,n){const r=n&&n.asWidget,s=lp(e,t),a=r?nh(i.writer.createEditableElement(s),i.writer):i.writer.createContainerElement(s);r&&oh(a,i.writer,(e,t,o)=>o.addClass(To(t.classes),e),(e,t,o)=>o.removeClass(To(t.classes),e));const l=e.cell,c=l.getChild(0),d=1===l.childCount&&"paragraph"===c.name;if(i.writer.insert(o,a),i.mapper.bindElements(l,a),!r&&!up(c)&&d){const e=l.getChild(0);i.consumable.consume(e,"insert"),i.mapper.bindElements(e,a)}}function ap(e,t,o,i,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=i.headingRows,a=function(e,t,o){const i=cp(e,t);return i||function(e,t,o){const i=o.writer.createContainerElement(e),n=o.writer.createPositionAt(t,"tbody"==e?"end":0);return o.writer.insert(n,i),i}(e,t,o)}(function(e,t){return e<t.headingRows?"thead":"tbody"}(o,i),e,n),l=s>0&&o>=s?o-s:o,c=n.writer.createPositionAt(a,l);return n.writer.insert(c,r),r}function lp(e,t){const{row:o,column:i}=e,{headingColumns:n,headingRows:r}=t;if(r&&r>o)return"th";return n&&n>i?"th":"td"}function cp(e,t){for(const o of t.getChildren())if(o.name==e)return o}function dp(e,t,o){const i=cp(e,t);i&&0===i.childCount&&o.writer.remove(o.writer.createRangeOn(i))}function up(e){return!![...e.getAttributeKeys()].length}class hp extends wd{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema,i=function(e){const t=e.parent;return t===t.root?t:t.parent}(t.getFirstPosition());this.isEnabled=o.checkChild(i,"table")}execute(e={}){const t=this.editor.model,o=t.document.selection,i=this.editor.plugins.get("TableUtils"),n=rh(o,t);t.change(o=>{const r=i.createTable(o,e);t.insertContent(r,n),o.setSelection(o.createPositionAt(r.getNodeByPath([0,0,0]),0))})}}function fp(e){const t=[];for(const o of kp(e.getRanges())){const e=o.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}function mp(e){const t=[];for(const o of e.getRanges()){const e=o.start.findAncestor("tableCell");e&&t.push(e)}return t}function gp(e){const t=fp(e);return t.length?t:mp(e)}function pp(e){return _p(e.map(e=>e.parent.index))}function bp(e){const t=e[0].findAncestor("table");return _p([...new ep(t)].filter(t=>e.includes(t.cell)).map(e=>e.column))}function wp(e,t){if(e.length<2||!function(e){const t=e[0].findAncestor("table"),o=pp(e),i=parseInt(t.getAttribute("headingRows")||0);if(!yp(o,i))return!1;const n=parseInt(t.getAttribute("headingColumns")||0);return yp(bp(e),n)}(e))return!1;const o=new Set,i=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);o.add(e),i.add(s),a>1&&o.add(e+a-1),l>1&&i.add(s+l-1),n+=a*l}return function(e,t){const o=Array.from(e.values()),i=Array.from(t.values()),n=Math.max(...o),r=Math.min(...o),s=Math.max(...i),a=Math.min(...i);return(n-r+1)*(s-a+1)}(o,i)==n}function kp(e){return Array.from(e).sort(vp)}function _p(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}function vp(e,t){const o=e.start,i=t.start;return o.isBefore(i)?-1:1}function yp({first:e,last:t},o){return e<o===t<o}class xp extends wd{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i="above"===this.order,n=gp(t),r=pp(n),s=i?r.first:r.last,a=n[0].findAncestor("table");o.insertRows(a,{at:i?s:s+1,copyStructureFromAbove:!i})}}class Cp extends wd{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),i="left"===this.order,n=gp(t),r=bp(n),s=i?r.first:r.last,a=n[0].findAncestor("table");o.insertColumns(a,{columns:1,at:i?s:s+1})}}class Ap extends wd{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=gp(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=gp(this.editor.model.document.selection)[0],t="horizontally"===this.direction,o=this.editor.plugins.get("TableUtils");t?o.splitCellHorizontally(e,2):o.splitCellVertically(e,2)}}function Tp(e,t,o){const{startRow:i,startColumn:n,endRow:r,endColumn:s}=t,a=o.createElement("table"),l=r-i+1;for(let e=0;e<l;e++)o.insertElement("tableRow",a,"end");const c=[...new ep(e,{startRow:i,endRow:r,startColumn:n,endColumn:s,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:u,cellAnchorColumn:h}of c){const c=e-i,f=a.getChild(c);if(d){const i=o.cloneElement(l);o.append(i,f),Ip(i,e,t,r,s,o)}else(u<i||h<n)&&Qg(o,o.createPositionAt(f,"end"))}return function(e,t,o,i,n){const r=parseInt(t.getAttribute("headingRows")||0);if(r>0){Kg("headingRows",r-o,e,n,0)}const s=parseInt(t.getAttribute("headingColumns")||0);if(s>0){Kg("headingColumns",s-i,e,n,0)}}(a,e,i,n,o),a}function Sp(e,t,o=0){const i=[],n=new ep(e,{startRow:o,endRow:t-1});for(const e of n){const{row:o,cellHeight:n}=e,r=o+n-1;o<t&&t<=r&&i.push(e)}return i}function Ep(e,t,o){const i=e.parent,n=i.parent,r=i.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,u=[...new ep(n,{startRow:r,endRow:d,includeAllSlots:!0})];let h,f=null;for(const t of u){const{row:i,column:n,cell:r}=t;r===e&&void 0===h&&(h=n),void 0!==h&&h===n&&i===d&&(f=Qg(o,t.getPositionBefore(),a))}return Kg("rowspan",s,e,o),f}function Pp(e,t){const o=[],i=new ep(e);for(const e of i){const{column:i,cellWidth:n}=e,r=i+n-1;i<t&&t<=r&&o.push(e)}return o}function Mp(e,t,o,i){const n=o-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=Qg(i,i.createPositionAfter(e),r);return Kg("colspan",n,e,i),l}function Ip(e,t,o,i,n,r){const s=parseInt(e.getAttribute("colspan")||1),a=parseInt(e.getAttribute("rowspan")||1);if(o+s-1>n){Kg("colspan",n-o+1,e,r,1)}if(t+a-1>i){Kg("rowspan",i-t+1,e,r,1)}}function Np(e,t){const o=t.getColumns(e),i=new Array(o).fill(0);for(const{column:t}of new ep(e))i[t]++;const n=i.reduce((e,t,o)=>t?e:[...e,o],[]);if(n.length>0){const o=n[n.length-1];return t.removeColumns(e,{at:o}),!0}return!1}function Rp(e,t){const o=[];for(let t=0;t<e.childCount;t++){e.getChild(t).isEmpty&&o.push(t)}if(o.length>0){const i=o[o.length-1];return t.removeRows(e,{at:i}),!0}return!1}function Op(e,t){Np(e,t)||Rp(e,t)}function Vp(e,t){const o=Array.from(new ep(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(o.every(({cellHeight:e})=>1===e))return t.lastRow;const i=o[0].cellHeight-1;return t.lastRow+i}function Lp(e,t){const o=Array.from(new ep(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(o.every(({cellWidth:e})=>1===e))return t.lastColumn;const i=o[0].cellWidth-1;return t.lastColumn+i}class Dp extends wd{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=mp(e.document.selection)[0],o=this.value,i=this.direction;e.change(e=>{const n="right"==i||"down"==i,r=n?t:o,s=n?o:t,a=s.parent;!function(e,t,o){zp(e)||(zp(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end")));o.remove(e)}(s,r,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(t.getAttribute(l)||1),d=parseInt(o.getAttribute(l)||1);e.setAttribute(l,c+d,r),e.setSelection(e.createRangeIn(r));const u=this.editor.plugins.get("TableUtils");Op(a.findAncestor("table"),u)})}_getMergeableCell(){const e=mp(this.editor.model.document.selection)[0];if(!e)return;const t=this.editor.plugins.get("TableUtils"),o=this.isHorizontal?function(e,t,o){const i=e.parent.parent,n="right"==t?e.nextSibling:e.previousSibling,r=(i.getAttribute("headingColumns")||0)>0;if(!n)return;const s="right"==t?e:n,a="right"==t?n:e,{column:l}=o.getCellLocation(s),{column:c}=o.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||1),u=Jg(o,s),h=Jg(o,a);if(r&&u!=h)return;return l+d===c?n:void 0}(e,this.direction,t):function(e,t){const o=e.parent,i=o.parent,n=i.getChildIndex(o);if("down"==t&&n===i.childCount-1||"up"==t&&0===n)return;const r=parseInt(e.getAttribute("rowspan")||1),s=i.getAttribute("headingRows")||0,a="down"==t&&n+r===s,l="up"==t&&n===s;if(s&&(a||l))return;const c=parseInt(e.getAttribute("rowspan")||1),d="down"==t?n+c:n,u=[...new ep(i,{endRow:d})],h=u.find(t=>t.cell===e).column,f=u.find(({row:e,cellHeight:o,column:i})=>i===h&&("down"==t?e===d:d===e+o));return f&&f.cell}(e,this.direction);if(!o)return;const i=this.isHorizontal?"rowspan":"colspan",n=parseInt(e.getAttribute(i)||1);return parseInt(o.getAttribute(i)||1)===n?o:void 0}}function zp(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}class Bp extends wd{refresh(){const e=gp(this.editor.model.document.selection),t=e[0];if(t){const o=t.findAncestor("table"),i=this.editor.plugins.get("TableUtils").getRows(o)-1,n=pp(e),r=0===n.first&&n.last===i;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=gp(e.document.selection),o=pp(t),i=t[0],n=i.findAncestor("table"),r=this.editor.plugins.get("TableUtils").getCellLocation(i).column;e.change(e=>{const t=o.last-o.first+1;this.editor.plugins.get("TableUtils").removeRows(n,{at:o.first,rows:t});const i=function(e,t,o){const i=e.getChild(t)||e.getChild(e.childCount-1);let n=i.getChild(0),r=0;for(const e of i.getChildren()){if(r>o)return n;n=e,r+=parseInt(e.getAttribute("colspan")||1)}return n}(n,o.first,r);e.setSelection(e.createPositionAt(i,0))})}}class jp extends wd{refresh(){const e=gp(this.editor.model.document.selection),t=e[0];if(t){const o=t.findAncestor("table"),i=this.editor.plugins.get("TableUtils").getColumns(o),{first:n,last:r}=bp(e);this.isEnabled=r-n<i-1}else this.isEnabled=!1}execute(){const[e,t]=function(e){const t=gp(e),o=t[0],i=t.pop(),n=[o,i];return o.isBefore(i)?n:n.reverse()}(this.editor.model.document.selection),o=e.parent.parent,i=[...new ep(o)],n={first:i.find(t=>t.cell===e).column,last:i.find(e=>e.cell===t).column},r=function(e,t,o,i){return parseInt(o.getAttribute("colspan")||1)>1?o:t.previousSibling||o.nextSibling?o.nextSibling||t.previousSibling:i.first?e.reverse().find(({column:e})=>e<i.first).cell:e.reverse().find(({column:e})=>e>i.last).cell}(i,e,t,n);this.editor.model.change(e=>{const t=n.last-n.first+1;this.editor.plugins.get("TableUtils").removeColumns(o,{at:n.first,columns:t}),e.setSelection(e.createPositionAt(r,0))})}}class Fp extends wd{refresh(){const e=gp(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,o=gp(t.document.selection),i=o[0].findAncestor("table"),{first:n,last:r}=pp(o),s=this.value?n:r+1,a=i.getAttribute("headingRows")||0;t.change(e=>{if(s){const t=Sp(i,s,s>a?a:0);for(const{cell:o}of t)Ep(o,s,e)}Kg("headingRows",s,i,e,0)})}_isInHeading(e,t){const o=parseInt(t.getAttribute("headingRows")||0);return!!o&&e.parent.index<o}}class Hp extends wd{refresh(){const e=gp(this.editor.model.document.selection),t=this.editor.plugins.get("TableUtils"),o=e.length>0;this.isEnabled=o,this.value=o&&e.every(e=>Jg(t,e))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,o=gp(t.document.selection),i=o[0].findAncestor("table"),{first:n,last:r}=bp(o),s=this.value?n:r+1;t.change(e=>{if(s){const t=Pp(i,s);for(const{cell:o,column:i}of t)Mp(o,i,s,e)}Kg("headingColumns",s,i,e,0)})}}class Up extends ud{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,o=t.parent,i=o.getChildIndex(t),n=new ep(o,{row:i});for(const{cell:t,row:o,column:i}of n)if(t===e)return{row:o,column:i}}createTable(e,t){const o=e.createElement("table");return Wp(e,o,0,parseInt(t.rows)||2,parseInt(t.columns)||2),t.headingRows&&Kg("headingRows",t.headingRows,o,e,0),t.headingColumns&&Kg("headingColumns",t.headingColumns,o,e,0),o}insertRows(e,t={}){const o=this.editor.model,i=t.at||0,n=t.rows||1,r=void 0!==t.copyStructureFromAbove,s=t.copyStructureFromAbove?i-1:i,a=this.getRows(e),l=this.getColumns(e);o.change(t=>{const o=e.getAttribute("headingRows")||0;if(o>i&&Kg("headingRows",o+n,e,t,0),!r&&(0===i||i===a))return void Wp(t,e,i,n,l);const c=r?Math.max(i,s):i,d=new ep(e,{endRow:c}),u=new Array(l).fill(1);for(const{row:e,column:o,cellHeight:a,cellWidth:l,cell:c}of d){const d=e+a-1,h=e<=s&&s<=d;e<i&&i<=d?(t.setAttribute("rowspan",a+n,c),u[o]=-l):r&&h&&(u[o]=l)}for(let o=0;o<n;o++){const o=t.createElement("tableRow");t.insert(o,e,i);for(let e=0;e<u.length;e++){const i=u[e],n=t.createPositionAt(o,"end");i>0&&Qg(t,n,i>1?{colspan:i}:null),e+=Math.abs(i)-1}}})}insertColumns(e,t={}){const o=this.editor.model,i=t.at||0,n=t.columns||1;o.change(t=>{const o=e.getAttribute("headingColumns");i<o&&t.setAttribute("headingColumns",o+n,e);const r=this.getColumns(e);if(0===i||r===i){for(const o of e.getChildren())qp(n,t,t.createPositionAt(o,i?"end":0));return}const s=new ep(e,{column:i,includeAllSlots:!0});for(const e of s){const{row:o,cell:r,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<i){t.setAttribute("colspan",c+n,r);const e=l+d-1;for(let t=o;t<=e;t++)s.skipRow(t)}else qp(n,t,e.getPositionBefore())}})}removeRows(e,t){const o=this.editor.model,i=t.rows||1,n=t.at,r=n+i-1;o.change(t=>{const{cellsToMove:o,cellsToTrim:i}=function(e,t,o){const i=new Map,n=[];for(const{row:r,column:s,cellHeight:a,cell:l}of new ep(e,{endRow:o})){const e=r+a-1;if(r>=t&&r<=o&&e>o){const e=a-(o-r+1);i.set(s,{cell:l,rowspan:e})}if(r<t&&e>=t){let i;i=e>=o?o-t+1:e-t+1,n.push({cell:l,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:n}}(e,n,r);if(o.size){!function(e,t,o,i){const n=[...new ep(e,{includeAllSlots:!0,row:t})],r=e.getChild(t);let s;for(const{column:e,cell:t,isAnchor:a}of n)if(o.has(e)){const{cell:t,rowspan:n}=o.get(e),a=s?i.createPositionAfter(s):i.createPositionAt(r,0);i.move(i.createRangeOn(t),a),Kg("rowspan",n,t,i),s=t}else a&&(s=t)}(e,r+1,o,t)}for(let o=r;o>=n;o--)t.remove(e.getChild(o));for(const{rowspan:e,cell:o}of i)Kg("rowspan",e,o,t);!function(e,t,o,i){const n=e.getAttribute("headingRows")||0;if(t<n){Kg("headingRows",o<n?n-(o-t+1):t,e,i,0)}}(e,n,r,t),Np(e,this)||Rp(e,this)})}removeColumns(e,t){const o=this.editor.model,i=t.at,n=t.columns||1,r=t.at+n-1;o.change(t=>{!function(e,t,o){const i=e.getAttribute("headingColumns")||0;if(i&&t.first<i){const n=Math.min(i-1,t.last)-t.first+1;o.setAttribute("headingColumns",i-n,e)}}(e,{first:i,last:r},t);for(let o=r;o>=i;o--)for(const{cell:i,column:n,cellWidth:r}of[...new ep(e)])n<=o&&r>1&&n+r>o?Kg("colspan",r-1,i,t):n===o&&t.remove(i);Rp(e,this)||Np(e,this)})}splitCellVertically(e,t=2){const o=this.editor.model,i=e.parent.parent,n=parseInt(e.getAttribute("rowspan")||1),r=parseInt(e.getAttribute("colspan")||1);o.change(o=>{if(r>1){const{newCellsSpan:i,updatedSpan:s}=$p(r,t);Kg("colspan",s,e,o);const a={};i>1&&(a.colspan=i),n>1&&(a.rowspan=n);qp(r>t?t-1:r-1,o,o.createPositionAfter(e),a)}if(r<t){const s=t-r,a=[...new ep(i)],{column:l}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:o,column:i})=>t!==e&&i===l||i<l&&i+o>l);for(const{cell:e,cellWidth:t}of c)o.setAttribute("colspan",t+s,e);const d={};n>1&&(d.rowspan=n),qp(s,o,o.createPositionAfter(e),d);const u=i.getAttribute("headingColumns")||0;u>l&&Kg("headingColumns",u+s,i,o)}})}splitCellHorizontally(e,t=2){const o=this.editor.model,i=e.parent,n=i.parent,r=n.getChildIndex(i),s=parseInt(e.getAttribute("rowspan")||1),a=parseInt(e.getAttribute("colspan")||1);o.change(o=>{if(s>1){const i=[...new ep(n,{startRow:r,endRow:r+s-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=$p(s,t);Kg("rowspan",c,e,o);const{column:d}=i.find(({cell:t})=>t===e),u={};l>1&&(u.rowspan=l),a>1&&(u.colspan=a);for(const e of i){const{column:t,row:i}=e,n=t===d,s=(i+r+c)%l==0;i>=r+c&&n&&s&&qp(1,o,e.getPositionBefore(),u)}}if(s<t){const i=t-s,l=[...new ep(n,{startRow:0,endRow:r})];for(const{cell:t,cellHeight:n,row:s}of l)if(t!==e&&s+n>r){const e=n+i;o.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),Wp(o,n,r+1,i,1,c);const d=n.getAttribute("headingRows")||0;d>r&&Kg("headingRows",d+i,n,o)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||1),0)}getRows(e){return e.childCount}}function Wp(e,t,o,i,n,r={}){for(let s=0;s<i;s++){const i=e.createElement("tableRow");e.insert(i,t,o),qp(n,e,e.createPositionAt(i,"end"),r)}}function qp(e,t,o,i={}){for(let n=0;n<e;n++)Qg(t,o,i)}function $p(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const o=Math.floor(e/t);return{newCellsSpan:o,updatedSpan:e-o*t+o}}class Gp extends wd{refresh(){const e=fp(this.editor.model.document.selection);this.isEnabled=wp(e,this.editor.plugins.get(Up))}execute(){const e=this.editor.model,t=this.editor.plugins.get(Up);e.change(o=>{const i=fp(e.document.selection),n=i.shift(),{mergeWidth:r,mergeHeight:s}=function(e,t,o){let i=0,n=0;for(const e of t){const{row:t,column:r}=o.getCellLocation(e);i=Qp(e,r,i,"colspan"),n=Qp(e,t,n,"rowspan")}const{row:r,column:s}=o.getCellLocation(e);return{mergeWidth:i-s,mergeHeight:n-r}}(n,i,t);Kg("colspan",r,n,o),Kg("rowspan",s,n,o);for(const e of i)Yp(e,n,o);Op(n.findAncestor("table"),t),o.setSelection(n,"in")})}}function Yp(e,t,o){Kp(e)||(Kp(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end"))),o.remove(e)}function Kp(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}function Qp(e,t,o,i){const n=parseInt(e.getAttribute(i)||1);return Math.max(o,t+n)}class Jp extends wd{refresh(){const e=gp(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=gp(e.document.selection),o=pp(t),i=t[0].findAncestor("table"),n=[];for(let t=o.first;t<=o.last;t++)for(const o of i.getChild(t).getChildren())n.push(e.createRangeOn(o));e.change(e=>{e.setSelection(n)})}}class Zp extends wd{refresh(){const e=gp(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=gp(e.document.selection),o=t[0],i=t.pop(),n=o.findAncestor("table"),r=this.editor.plugins.get("TableUtils"),s=r.getCellLocation(o),a=r.getCellLocation(i),l=Math.min(s.column,a.column),c=Math.max(s.column,a.column),d=[];for(const t of new ep(n,{startColumn:l,endColumn:c}))d.push(e.createRangeOn(t.cell));e.change(e=>{e.setSelection(d)})}}function Xp(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;const n=new Set;for(const t of o){let o;"table"==t.name&&"insert"==t.type&&(o=t.position.nodeAfter),"tableRow"!=t.name&&"tableCell"!=t.name||(o=t.position.findAncestor("table")),ob(t)&&(o=t.range.start.findAncestor("table")),o&&!n.has(o)&&(i=eb(o,e)||i,i=tb(o,e)||i,n.add(o))}return i}(t,e))}function eb(e,t){let o=!1;const i=function(e){const t=parseInt(e.getAttribute("headingRows")||0),o=e.childCount,i=[];for(const{row:n,cell:r,cellHeight:s}of new ep(e)){if(s<2)continue;const e=n<t?t:o;if(n+s>e){const t=e-n;i.push({cell:r,rowspan:t})}}return i}(e);if(i.length){o=!0;for(const e of i)Kg("rowspan",e.rowspan,e.cell,t,1)}return o}function tb(e,t){let o=!1;const i=function(e){const t=new Array(e.childCount).fill(0);for(const{row:o}of new ep(e,{includeAllSlots:!0}))t[o]++;return t}(e),n=[];for(const[e,t]of i.entries())t||n.push(e);if(n.length){o=!0;for(const o of n.reverse())t.remove(e.getChild(o)),i.splice(o,1)}const r=i[0];if(!i.every(e=>e===r)){const n=i.reduce((e,t)=>t>e?t:e,0);for(const[r,s]of i.entries()){const i=n-s;if(i){for(let o=0;o<i;o++)Qg(t,t.createPositionAt(e.getChild(r),"end"));o=!0}}}return o}function ob(e){const t="attribute"===e.type,o=e.attributeKey;return t&&("headingRows"===o||"colspan"===o||"rowspan"===o)}function ib(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let i=!1;for(const t of o)"insert"==t.type&&"table"==t.name&&(i=nb(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableRow"==t.name&&(i=rb(t.position.nodeAfter,e)||i),"insert"==t.type&&"tableCell"==t.name&&(i=sb(t.position.nodeAfter,e)||i),ab(t)&&(i=sb(t.position.parent,e)||i);return i}(t,e))}function nb(e,t){let o=!1;for(const i of e.getChildren())o=rb(i,t)||o;return o}function rb(e,t){let o=!1;for(const i of e.getChildren())o=sb(i,t)||o;return o}function sb(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const o=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of o)t.wrap(t.createRangeOn(e),"paragraph");return!!o.length}function ab(e){return!(!e.position||!e.position.parent.is("element","tableCell"))&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function lb(e,t){e.document.registerPostFixer(()=>function(e,t){const o=new Set;for(const t of e.getChanges()){const e="attribute"==t.type?t.range.start.parent:t.position.parent;e.is("element","tableCell")&&o.add(e)}for(const i of o.values())for(const o of[...i.getChildren()].filter(e=>cb(e,t)))e.refreshItem(o);return!1}(e.document.differ,t))}function cb(e,t){if(!e.is("element","paragraph"))return!1;const o=t.toViewElement(e);return!!o&&np(e)!==o.is("element","span")}function db(e){e.document.registerPostFixer(()=>function(e){const t=e.document.differ,o=new Set;for(const e of t.getChanges()){if("attribute"!=e.type)continue;const t=e.range.start.nodeAfter;t&&t.is("element","table")&&"headingRows"==e.attributeKey&&o.add(t)}if(o.size){for(const e of o.values())t.refreshItem(e);return!0}return!1}(e))}o(90);class ub extends ud{static get pluginName(){return"TableEditing"}init(){const e=this.editor,t=e.model,o=t.schema,i=e.conversion;o.register("table",{allowWhere:"$block",allowAttributes:["headingRows","headingColumns"],isObject:!0,isBlock:!0}),o.register("tableRow",{allowIn:"table",isLimit:!0}),o.register("tableCell",{allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),o.extend("$block",{allowIn:"tableCell"}),o.addChildCheck((e,t)=>{if("table"==t.name&&Array.from(e.getNames()).includes("table"))return!1}),i.for("upcast").add(Zg()),i.for("editingDowncast").add(op({asWidget:!0})),i.for("dataDowncast").add(op()),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),i.for("editingDowncast").add(e=>e.on("insert:tableRow",(e,t,o)=>{const i=t.item;if(!o.consumable.consume(i,"insert"))return;const n=i.parent,r=function(e){for(const t of e.getChildren())if("table"===t.name)return t}(o.mapper.toViewElement(n)),s=n.getChildIndex(i),a=new ep(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)||ap(r,i,s,l,o);c.set(s,t),o.consumable.consume(e.cell,"insert"),sp(e,l,o.writer.createPositionAt(t,"end"),o,{asWidget:!0})}})),i.for("editingDowncast").add(e=>e.on("remove:tableRow",(e,t,o)=>{e.stop();const i=o.writer,n=o.mapper,r=n.toViewPosition(t.position).getLastMatchingPosition(e=>!e.item.is("element","tr")).nodeAfter,s=r.parent.parent,a=i.createRangeOn(r),l=i.remove(a);for(const e of i.createRangeIn(l).getItems())n.unbindViewElement(e);dp("thead",s,o),dp("tbody",s,o)},{priority:"higher"})),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("editingDowncast").add(e=>e.on("insert:tableCell",(e,t,o)=>{const i=t.item;if(!o.consumable.consume(i,"insert"))return;const n=i.parent,r=n.parent,s=r.getChildIndex(n),a=new ep(r,{row:s}),l={headingRows:r.getAttribute("headingRows")||0,headingColumns:r.getAttribute("headingColumns")||0};for(const e of a)if(e.cell===i){const t=o.mapper.toViewElement(n);return void sp(e,l,o.writer.createPositionAt(t,n.getChildIndex(i)),o,{asWidget:!0})}})),e.conversion.for("editingDowncast").elementToElement({model:"paragraph",view:ip,converterPriority:"high"}),i.attributeToAttribute({model:"colspan",view:"colspan"}),i.attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("editingDowncast").add(e=>e.on("attribute:headingColumns:table",(e,t,o)=>{const i=t.item;if(!o.consumable.consume(t.item,e.name))return;const n={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},r=t.attributeOldValue,s=t.attributeNewValue,a=(r>s?r:s)-1;for(const e of new ep(i,{endColumn:a}))rp(e,n,o)})),e.commands.add("insertTable",new hp(e)),e.commands.add("insertTableRowAbove",new xp(e,{order:"above"})),e.commands.add("insertTableRowBelow",new xp(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Cp(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Cp(e,{order:"right"})),e.commands.add("removeTableRow",new Bp(e)),e.commands.add("removeTableColumn",new jp(e)),e.commands.add("splitTableCellVertically",new Ap(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Ap(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Gp(e)),e.commands.add("mergeTableCellRight",new Dp(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Dp(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Dp(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Dp(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new Hp(e)),e.commands.add("setTableRowHeader",new Fp(e)),e.commands.add("selectTableRow",new Jp(e)),e.commands.add("selectTableColumn",new Zp(e)),db(t),Xp(t),lb(t,e.editing.mapper),ib(t)}static get requires(){return[Up]}}o(92);class hb extends xc{constructor(e){super(e);const t=this.bindTemplate;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 Bl,this.focusTracker=new Yl,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",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 Yc;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 Yc,t=e.bindTemplate;return e.icon=Kc,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}}o(94);class fb extends xc{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:o,column:i}=t.target.dataset;this.set({rows:parseInt(o),columns:parseInt(i)})}),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((o,i)=>{const n=Math.floor(i/10)<e&&i%10<t;o.set("isOn",n)})}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const o=Math.floor(t/10),i=t%10;e.push(new mb(this.locale,o+1,i+1))}return this.createCollection(e)}}class mb extends xc{constructor(e,t,o){super(e);const i=this.bindTemplate;this.set("isOn",!1),this.setTemplate({tag:"div",attributes:{class:["ck-insert-table-dropdown-grid-box",i.if("isOn","ck-on")],"data-row":t,"data-column":o}})}}class gb extends ud{init(){const e=this.editor,t=this.editor.t,o="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",o=>{const i=e.commands.get("insertTable"),n=od(o);let r;return n.bind("isEnabled").to(i),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 fb(o),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 i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"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>',i,e)}),e.ui.componentFactory.add("tableRow",e=>{const o=[{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>',o,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"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>',i,e)})}_prepareDropdown(e,t,o,i){const n=this.editor,r=od(i),s=this._fillDropdownWithListOptions(r,o);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,o,i){const n=this.editor,r=od(i,hb);return this._fillDropdownWithListOptions(r,o),r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),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 o=this.editor,i=[],n=new Co;for(const e of t)pb(e,o,i,n);return nd(e,n,o.ui.componentFactory),i}}function pb(e,t,o,i){const n=e.model=new fm(e.model),{commandName:r,bindIsOn:s}=e.model;if("button"===e.type||"switchbutton"===e.type){const e=t.commands.get(r);o.push(e),n.set({commandName:r}),n.bind("isEnabled").to(e),s&&n.bind("isOn").to(e,"value")}n.set({withText:!0}),i.add(e)}o(96);class bb extends ud{static get pluginName(){return"TableSelection"}static get requires(){return[Up]}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=fp(this.editor.model.document.selection);return 0==e.length?null:e}getSelectionAsFragment(){const e=this.getSelectedTableCells();return e?this.editor.model.change(t=>{const o=t.createDocumentFragment(),i=this.editor.plugins.get("TableUtils"),{first:n,last:r}=bp(e),{first:s,last:a}=pp(e),l=e[0].findAncestor("table");let c=a,d=r;if(wp(e,i)){const e={firstColumn:n,lastColumn:r,firstRow:s,lastRow:a};c=Vp(l,e),d=Lp(l,e)}const u=Tp(l,{startRow:s,startColumn:n,endRow:c,endColumn:d},t);return t.insert(u,o,0),o}):null}setCellSelection(e,t){const o=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(o.cells.map(t=>e.createRangeOn(t)),{backward:o.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=Cu(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,o,i)=>{const n=i.writer;!function(e){for(const o of t)e.removeClass("ck-editor__editable_selected",o);t.clear()}(n);const r=this.getSelectedTableCells();if(!r)return;for(const e of r){const o=i.mapper.toViewElement(e);n.addClass("ck-editor__editable_selected",o),t.add(o)}const s=i.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(o=>{const i=o.createPositionAt(t[0],0),n=e.model.schema.getNearestSelectionRange(i);o.setSelection(n)})}})}_handleDeleteContent(e,t){const[o,i]=t,n=this.editor.model,r=!i||"backward"==i.direction,s=fp(o);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 i=n.schema.getNearestSelectionRange(e.createPositionAt(t,0));o.is("documentSelection")?e.setSelection(i):o.setTo(i)}))}_getCellsToSelect(e,t){const o=this.editor.plugins.get("TableUtils"),i=o.getCellLocation(e),n=o.getCellLocation(t),r=Math.min(i.row,n.row),s=Math.max(i.row,n.row),a=Math.min(i.column,n.column),l=Math.max(i.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:o}of new ep(e.findAncestor("table"),d))c[t-r].push(o);const u=n.row<i.row,h=n.column<i.column;return u&&c.reverse(),h&&c.forEach(e=>e.reverse()),{cells:c.flat(),backward:u||h}}}class wb extends ud{static get pluginName(){return"TableClipboard"}static get requires(){return[bb,Up]}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 o=this.editor.plugins.get(bb);if(!o.getSelectedTableCells())return;if("cut"==e.name&&this.editor.isReadOnly)return;t.preventDefault(),e.stop();const i=this.editor.data,n=this.editor.editing.view.document,r=i.toView(o.getSelectionAsFragment());n.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;const i=this.editor.model,n=this.editor.plugins.get(Up);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 o=t.createRangeIn(e);for(const e of o.getItems())if(e.is("element","table")){const i=t.createRange(o.start,t.createPositionBefore(e));if(t.hasContent(i,{ignoreWhitespaces:!0}))return null;const n=t.createRange(t.createPositionAfter(e),o.end);return t.hasContent(n,{ignoreWhitespaces:!0})?null:e}return null}(t,i);if(!r)return;const s=gp(i.document.selection);s.length?(e.stop(),i.change(e=>{const t={width:n.getColumns(r),height:n.getRows(r)},o=function(e,t,o,i){const n=e[0].findAncestor("table"),r=bp(e),s=pp(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,o,i){const n=i.getColumns(e),r=i.getRows(e);o>n&&i.insertColumns(e,{at:n,columns:o-n});t>r&&i.insertRows(e,{at:r,rows:t-r})}(n,a.lastRow+1,a.lastColumn+1,i));l||!wp(e,i)?function(e,t,o){const{firstRow:i,lastRow:n,firstColumn:r,lastColumn:s}=t,a={first:i,last:n},l={first:r,last:s};_b(e,r,a,o),_b(e,s+1,a,o),kb(e,i,l,o),kb(e,n+1,l,o,i)}(n,a,o):(a.lastRow=Vp(n,a),a.lastColumn=Lp(n,a));return a}(s,t,e,n),i=o.lastRow-o.firstRow+1,a=o.lastColumn-o.firstColumn+1,l={startRow:0,startColumn:0,endRow:Math.min(i,t.height)-1,endColumn:Math.min(a,t.width)-1};r=Tp(r,l,e);const c=s[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(r,t,c,o,e);if(this.editor.plugins.get("TableSelection").isEnabled){const t=kp(d.map(t=>e.createRangeOn(t)));e.setSelection(t)}else e.setSelection(d[0],0)})):Op(r,n)}_replaceSelectedCellsWithPasted(e,t,o,i,n){const{width:r,height:s}=t,a=function(e,t,o){const i=new Array(o).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:o,cell:n}of new ep(e))i[o][t]=n;return i}(e,r,s),l=[...new ep(o,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of l){const{row:t,column:o}=e;o===i.firstColumn&&(d=e.getPositionBefore());const l=t-i.firstRow,u=o-i.firstColumn,h=a[l%s][u%r],f=h?n.cloneElement(h):null,m=this._replaceTableSlotCell(e,f,d,n);m&&(Ip(m,t,o,i.lastRow,i.lastColumn,n),c.push(m),d=n.createPositionAfter(m))}const u=parseInt(o.getAttribute("headingRows")||0),h=parseInt(o.getAttribute("headingColumns")||0),f=i.firstRow<u&&u<=i.lastRow,m=i.firstColumn<h&&h<=i.lastColumn;if(f){const e=kb(o,u,{first:i.firstColumn,last:i.lastColumn},n,i.firstRow);c.push(...e)}if(m){const e=_b(o,h,{first:i.firstRow,last:i.lastRow},n);c.push(...e)}return c}_replaceTableSlotCell(e,t,o,i){const{cell:n,isAnchor:r}=e;return r&&i.remove(n),t?(i.insert(t,o),t):null}}function kb(e,t,o,i,n=0){if(t<1)return;return Sp(e,t,n).filter(({column:e,cellWidth:t})=>vb(e,t,o)).map(({cell:e})=>Ep(e,t,i))}function _b(e,t,o,i){if(t<1)return;return Pp(e,t).filter(({row:e,cellHeight:t})=>vb(e,t,o)).map(({cell:e,column:o})=>Mp(e,o,t,i))}function vb(e,t,o){const i=e+t-1,{first:n,last:r}=o;return e>=n&&e<=r||e<n&&i>=n}class yb extends ud{static get pluginName(){return"TableKeyboard"}static get requires(){return[bb]}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,"keydown",(...e)=>this._onKeydown(...e),{priority:uo.get("high")-10})}_handleTabOnSelectedTable(e,t){const o=this.editor,i=o.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t(),o.model.change(e=>{e.setSelection(e.createRangeIn(i.getChild(0).getChild(0)))}))}_getTabHandler(e){const t=this.editor;return(o,i)=>{let n=mp(t.model.document.selection)[0];if(n||(n=this.editor.plugins.get("TableSelection").getFocusCell()),!n)return;i();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=l===r.childCount-1,u=a===s.childCount-1;if(e&&u&&d&&(t.execute("insertTableRowBelow"),a===s.childCount-1))return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});let h;if(e&&d){const e=s.getChild(a+1);h=e.getChild(0)}else if(!e&&c){const e=s.getChild(a-1);h=e.getChild(e.childCount-1)}else h=r.getChild(l+(e?1:-1));t.model.change(e=>{e.setSelection(e.createRangeIn(h))})}}_onKeydown(e,t){const o=this.editor,i=t.keyCode;if(!_n(i))return;const n=vn(i,o.locale.contentLanguageDirection);this._handleArrowKeys(n,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const o=this.editor.model.document.selection,i=["right","down"].includes(e),n=fp(o);if(n.length){let o;return o=t?this.editor.plugins.get("TableSelection").getFocusCell():i?n[n.length-1]:n[0],this._navigateFromCellInDirection(o,e,t),!0}const r=o.focus.findAncestor("tableCell");return!!r&&(!(t&&!o.isCollapsed&&o.isBackward==i)&&(!!this._isSelectionAtCellEdge(o,r,i)&&(this._navigateFromCellInDirection(r,e,t),!0)))}_isSelectionAtCellEdge(e,t,o){const i=this.editor.model,n=this.editor.model.schema,r=o?e.getLastPosition():e.getFirstPosition();if(!n.getLimitElement(r).is("element","tableCell")){return i.createPositionAt(t,o?"end":0).isTouching(r)}const s=i.createSelection(r);return i.modifySelection(s,{direction:o?"forward":"backward"}),r.isEqual(s.focus)}_navigateFromCellInDirection(e,t,o=!1){const i=this.editor.model,n=e.findAncestor("table"),r=[...new ep(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 i.change(e=>{e.setSelection(e.createRangeOn(n))});d<0?(d=o?0:a,c--):d>a&&(d=o?a:0,c++);const u=r.find(e=>e.row==c&&e.column==d).cell,h=["right","down"].includes(t),f=this.editor.plugins.get("TableSelection");if(o&&f.isEnabled){const t=f.getAnchorCell()||e;f.setCellSelection(t,u)}else{const e=i.createPositionAt(u,h?0:"end");i.change(t=>{t.setSelection(e)})}}}class xb extends zr{constructor(e){super(e),this.domEventType=["mousemove","mouseup","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class Cb extends ud{static get pluginName(){return"TableMouse"}static get requires(){return[bb]}init(){this.editor.editing.view.addObserver(xb),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor;let t=!1;const o=e.plugins.get(bb);this.listenTo(e.editing.view.document,"mousedown",(i,n)=>{if(!this.isEnabled||!o.isEnabled)return;if(!n.domEvent.shiftKey)return;const r=o.getAnchorCell()||mp(e.model.document.selection)[0];if(!r)return;const s=this._getModelTableCellFromDomEvent(n);s&&Ab(r,s)&&(t=!0,o.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,o,i=!1,n=!1;const r=e.plugins.get(bb);this.listenTo(e.editing.view.document,"mousedown",(e,o)=>{this.isEnabled&&r.isEnabled&&(o.domEvent.shiftKey||o.domEvent.ctrlKey||o.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(o)))}),this.listenTo(e.editing.view.document,"mousemove",(e,s)=>{if(!s.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(s);a&&Ab(t,a)&&(o=a,i||o==t||(i=!0)),i&&(n=!0,r.setCellSelection(t,o),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1,n=!1,t=null,o=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{n&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,o=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function Ab(e,t){return e.parent.parent==t.parent.parent}o(98);function Tb(e){const t=e.getSelectedElement();return t&&Eb(t)?t:null}function Sb(e){const t=function(e,t){let o=t.parent;for(;o;){if(o.name===e)return o;o=o.parent}}("table",e.getFirstPosition());return t&&Eb(t.parent)?t.parent:null}function Eb(e){return!!e.getCustomProperty("table")&&eh(e)}var Pb=/[\\^$.*+?()[\]{}|]/g,Mb=RegExp(Pb.source);var Ib=function(e){return(e=Xo(e))&&Mb.test(e)?e.replace(Pb,"\\$&"):e};const Nb={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:"1/2",to:"½"},oneThird:{from:"1/3",to:"⅓"},twoThirds:{from:"2/3",to:"⅔"},oneForth:{from:"1/4",to:"¼"},threeQuarters:{from:"3/4",to:"¾"},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:zb('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:zb("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:zb("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:zb('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:zb('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:zb("'"),to:[null,"‚",null,"’"]}},Rb={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Ob=["symbols","mathematical","typography","quotes"];function Vb(e){return"string"==typeof e?new RegExp(`(${Ib(e)})$`):e}function Lb(e){return"string"==typeof e?()=>[e]:e instanceof Array?()=>e:e}function Db(e){return(e.textNode?e.textNode:e.nodeAfter).getAttributes()}function zb(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}const Bb=["left","right","center","justify"];function jb(e){return Bb.includes(e)}function Fb(e,t){return"rtl"==t.contentLanguageDirection?"right"===e:"left"===e}class Hb extends wd{refresh(){const e=this.editor.locale,t=Cu(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!t&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value="rtl"===e.contentLanguageDirection?"right":"left"}execute(e={}){const t=this.editor,o=t.locale,i=t.model,n=i.document,r=e.value;i.change(e=>{const t=Array.from(n.selection.getSelectedBlocks()).filter(e=>this._canBeAligned(e)),i=t[0].getAttribute("alignment");Fb(r,o)||i===r||!r?function(e,t){for(const o of e)t.removeAttribute("alignment",o)}(t,e):function(e,t,o){for(const i of e)t.setAttribute("alignment",o,i)}(t,e,r)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,"alignment")}}class Ub extends ud{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:[...Bb]})}init(){const e=this.editor,t=e.locale,o=e.model.schema,i=e.config.get("alignment.options").filter(jb);o.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0});const n=function(e){const t={model:{key:"alignment",values:e.slice()},view:{}};for(const o of e)t.view[o]={key:"style",value:{"text-align":o}};return t}(i.filter(e=>!Fb(e,t)));e.conversion.attributeToAttribute(n),e.commands.add("alignment",new Hb(e))}}var Wb='<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>',qb='<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>',$b='<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>',Gb='<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>';const Yb=new Map([["left",Wb],["right",qb],["center",$b],["justify",Gb]]);class Kb extends ud{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=this.editor,t=e.ui.componentFactory,o=e.t,i=e.config.get("alignment.options");i.filter(jb).forEach(e=>this._addButton(e)),t.add("alignment",e=>{const n=od(e),r=i.map(e=>t.create("alignment:"+e));id(n,r),n.buttonView.set({label:o("Text alignment"),tooltip:!0}),n.toolbarView.isVertical=!0,n.toolbarView.ariaLabel=o("Text alignment toolbar"),n.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const s="rtl"===e.contentLanguageDirection?qb:Wb;return n.buttonView.bind("icon").toMany(r,"isOn",(...e)=>{const t=e.findIndex(e=>e);return t<0?s:r[t].icon}),n.bind("isEnabled").toMany(r,"isEnabled",(...e)=>e.some(e=>e)),n})}_addButton(e){const t=this.editor;t.ui.componentFactory.add("alignment:"+e,o=>{const i=t.commands.get("alignment"),n=new Yc(o);return n.set({label:this.localizedOptionTitles[e],icon:Yb.get(e),tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(i),n.bind("isOn").to(i,"value",t=>t===e),this.listenTo(n,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),n})}}class Qb extends ud{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("removeFormat",o=>{const i=e.commands.get("removeFormat"),n=new Yc(o);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(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("removeFormat"),e.editing.view.focus()}),n})}}class Jb extends wd{refresh(){const e=this.editor.model;this.isEnabled=!!Cu(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(o=>{for(const i of this._getFormattingItems(e.document.selection,t))if(i.is("selection"))for(const e of this._getFormattingAttributes(i,t))o.removeSelectionAttribute(e);else{const e=o.createRangeOn(i);for(const n of this._getFormattingAttributes(i,t))o.removeAttribute(n,e)}})}*_getFormattingItems(e,t){const o=e=>!!Cu(this._getFormattingAttributes(e,t));for(const i of e.getRanges())for(const e of i.getItems())!t.isBlock(e)&&o(e)&&(yield e);for(const t of e.getSelectedBlocks())o(t)&&(yield t);o(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[o]of e.getAttributes()){const e=t.getAttributeProperties(o);e&&e.isFormatting&&(yield o)}}}class Zb extends ud{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new Jb(e))}}class Xb extends wd{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,o=t.document.selection,i=e.value;t.change(e=>{if(o.isCollapsed)i?e.setSelectionAttribute(this.attributeKey,i):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const t of n)i?e.setAttribute(this.attributeKey,i,t):e.removeAttribute(this.attributeKey,t)}})}}class ew extends Yc{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.035L8.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%)"}}o(100);class tw extends xc{constructor(e,t){super(e);const o=t&&t.colorDefinitions||[],i={};t&&t.columns&&(i.gridTemplateColumns=`repeat( ${t.columns}, 1fr)`),this.set("selectedColor"),this.items=this.createCollection(),this.focusTracker=new Yl,this.keystrokes=new Bl,this._focusCycler=new Oc({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}),o.forEach(e=>{const t=new ew;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:i}}),this.on("change:selectedColor",(e,t,o)=>{for(const e of this.items)e.isOn=e.color===o})}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)}}class ow extends Co{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)}}xo(ow,Ui);var iw='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.636 9.531l-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>';o(102);class nw extends xc{constructor(e,{colors:t,columns:o,removeButtonLabel:i,documentColorsLabel:n,documentColorsCount:r}){super(e),this.items=this.createCollection(),this.colorDefinitions=t,this.focusTracker=new Yl,this.keystrokes=new Bl,this.set("selectedColor"),this.removeButtonLabel=i,this.columns=o,this.documentColors=new ow,this.documentColorsCount=r,this._focusCycler=new Oc({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 o=e.document,i=this.documentColorsCount;this.documentColors.clear();for(const n of o.getRootNames()){const r=o.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>=i))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,o=this.selectedColor;t.selectedColor=o,e&&(e.selectedColor=o)}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 Sc(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 Yc;return e.set({withText:!0,icon:iw,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 tw(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 tw(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 ew;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,o,i)=>{i&&(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 rw(e,t){const o={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)o.model.values.push(e.model),o.view[e.model]=e.view,e.upcastAlso&&(o.upcastAlso[e.model]=e.upcastAlso);return o}function sw(e){return t=>t.getStyle(e).replace(/\s/g,"")}function aw(e){return(t,{writer:o})=>o.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class lw extends Xb{constructor(e){super(e,"fontBackgroundColor")}}const cw=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,dw=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,uw=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,hw=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,fw=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,mw=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","rebeccapurple","currentcolor","transparent"]);function gw(e){return e.startsWith("#")?cw.test(e):e.startsWith("rgb")?dw.test(e)||uw.test(e):e.startsWith("hsl")?hw.test(e)||fw.test(e):mw.has(e.toLowerCase())}const pw=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function bw(e){return pw.includes(e)}const ww=/^([+-]?[0-9]*[.]?[0-9]+(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function kw(e){return ww.test(e)}const _w=/^[+-]?[0-9]*[.]?[0-9]+%$/;const vw=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const yw=["center","top","bottom","left","right"];function xw(e){return yw.includes(e)}const Cw=["fixed","scroll","local"];function Aw(e){return Cw.includes(e)}const Tw=/^url\(/;function Sw(e){return Tw.test(e)}function Ew(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Iw(e),o=t[0],i=t[2]||o,n=t[1]||o;return{top:o,bottom:i,right:n,left:t[3]||n}}function Pw(e){return t=>{const{top:o,right:i,bottom:n,left:r}=t,s=[];return[o,i,r,n].every(e=>!!e)?s.push([e,Mw(t)]):(o&&s.push([e+"-top",o]),i&&s.push([e+"-right",i]),n&&s.push([e+"-bottom",n]),r&&s.push([e+"-left",r])),s}}function Mw({top:e,right:t,bottom:o,left:i}){const n=[];return i!==t?n.push(e,t,o,i):o!==e?n.push(e,t,o):t!==e?n.push(e,t):n.push(e),n.join(" ")}function Iw(e){return e.replace(/, /g,",").split(" ").map(e=>e.replace(/,/g,", "))}function Nw(e){e.setNormalizer("background",Rw),e.setNormalizer("background-color",e=>({path:"background.color",value:e})),e.setReducer("background",e=>{const t=[];return t.push(["background-color",e.color]),t})}function Rw(e){const t={},o=Iw(e);for(const e of o)i=e,vw.includes(i)?(t.repeat=t.repeat||[],t.repeat.push(e)):xw(e)?(t.position=t.position||[],t.position.push(e)):Aw(e)?t.attachment=e:gw(e)?t.color=e:Sw(e)&&(t.image=e);var i;return{path:"background",value:t}}class Ow extends ud{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(Nw),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:"fontBackgroundColor",value:sw("background-color")}}),e.conversion.for("downcast").attributeToElement({model:"fontBackgroundColor",view:aw("background-color")}),e.commands.add("fontBackgroundColor",new lw(e)),e.model.schema.extend("$text",{allowAttributes:"fontBackgroundColor"}),e.model.schema.setAttributeProperties("fontBackgroundColor",{isFormatting:!0,copyOnEnter:!0})}}function Vw(e,t){const o=e.t,i={Black:o("Black"),"Dim grey":o("Dim grey"),Grey:o("Grey"),"Light grey":o("Light grey"),White:o("White"),Red:o("Red"),Orange:o("Orange"),Yellow:o("Yellow"),"Light green":o("Light green"),Green:o("Green"),Aquamarine:o("Aquamarine"),Turquoise:o("Turquoise"),"Light blue":o("Light blue"),Blue:o("Blue"),Purple:o("Purple")};return t.map(e=>{const t=i[e.label];return t&&t!=e.label&&(e.label=t),e})}function Lw(e){return e.map(Dw).filter(e=>!!e)}function Dw(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 zw extends ud{constructor(e,{commandName:t,icon:o,componentName:i,dropdownLabel:n}){super(e),this.commandName=t,this.componentName=i,this.icon=o,this.dropdownLabel=n,this.columns=e.config.get(this.componentName+".columns"),this.colorTableView=void 0}init(){const e=this.editor,t=e.locale,o=t.t,i=e.commands.get(this.commandName),n=Vw(t,Lw(e.config.get(this.componentName).colors)),r=e.config.get(this.componentName+".documentColors");e.ui.componentFactory.add(this.componentName,t=>{const s=od(t);return this.colorTableView=function({dropdownView:e,colors:t,columns:o,removeButtonLabel:i,documentColorsLabel:n,documentColorsCount:r}){const s=e.locale,a=new nw(s,{colors:t,columns:o,removeButtonLabel:i,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:o("Remove color"),documentColorsLabel:0!==r?o("Document colors"):void 0,documentColorsCount:void 0===r?this.columns:r}),this.colorTableView.bind("selectedColor").to(i,"value"),s.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),s.bind("isEnabled").to(i),s.on("execute",(t,o)=>{e.execute(this.commandName,o),e.editing.view.focus()}),s.on("change:isOpen",(t,o,i)=>{s.colorTableView.appendGrids(),i&&(0!==r&&this.colorTableView.updateDocumentColors(e.model,this.componentName),this.colorTableView.updateSelectedColors())}),s})}}class Bw extends zw{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 jw extends Xb{constructor(e){super(e,"fontSize")}}function Fw(e){return e.map(e=>function(e){if(t=e,"object"==typeof t&&t.title&&t.model&&t.view)return Uw(e);var t;const o=function(e){return Hw[e]||Hw[e.model]}(e);if(o)return Uw(o);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new ho.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}},Uw(e)}(e)}(e)).filter(e=>!!e)}const Hw={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 Uw(e){return e.view.priority||(e.view.priority=7),e}class Ww extends ud{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"),o=rw("fontSize",Fw(this.editor.config.get("fontSize.options")).filter(e=>e.model));t?this._prepareAnyValueConverters(o):e.conversion.attributeToElement(o),e.commands.add("fontSize",new jw(e))}_prepareAnyValueConverters(e){const t=this.editor,o=e.model.values.filter(e=>!String(e).match(/[\d.]+[\w%]+/));if(o.length)throw new ho.a("font-size-invalid-use-of-named-presets",null,{presets:o});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").attributeToAttribute({model:{key:"fontSize",value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}}o(104);class qw extends ud{init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),i=e.commands.get("fontSize");e.ui.componentFactory.add("fontSize",n=>{const r=od(n);return nd(r,function(e,t){const o=new Co;for(const i of e){const e={type:"button",model:new fm({commandName:"fontSize",commandParam:i.model,label:i.title,class:"ck-fontsize-option",withText:!0})};i.view&&i.view.styles&&e.model.set("labelStyle","font-size:"+i.view.styles["font-size"]),i.view&&i.view.classes&&e.model.set("class",`${e.model.class} ${i.view.classes}`),e.model.bind("isOn").to(t,"value",e=>e===i.model),o.add(e)}return o}(o,i)),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.5L7.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.279l.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(i),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,o={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return Fw(e.config.get("fontSize").options).map(e=>{const t=o[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class $w extends Xb{constructor(e){super(e,"fontColor")}}class Gw extends ud{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:sw("color")}}),e.conversion.for("downcast").attributeToElement({model:"fontColor",view:aw("color")}),e.commands.add("fontColor",new $w(e)),e.model.schema.extend("$text",{allowAttributes:"fontColor"}),e.model.schema.setAttributeProperties("fontColor",{isFormatting:!0,copyOnEnter:!0})}}class Yw extends zw{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.3L10 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 Kw extends Xb{constructor(e){super(e,"fontFamily")}}function Qw(e){return e.map(Jw).filter(e=>!!e)}function Jw(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),o=t[0],i=t.map(Zw).join(", ");return{title:o,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}(e):void 0}function Zw(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class Xw extends ud{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=rw("fontFamily",Qw(e.config.get("fontFamily.options")).filter(e=>e.model));e.config.get("fontFamily.supportAllValues")?this._prepareAnyValueConverters():e.conversion.attributeToElement(t),e.commands.add("fontFamily",new Kw(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").attributeToAttribute({model:{key:"fontFamily",value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}}class ek extends ud{init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),i=e.commands.get("fontFamily");e.ui.componentFactory.add("fontFamily",n=>{const r=od(n);return nd(r,function(e,t){const o=new Co;for(const i of e){const e={type:"button",model:new fm({commandName:"fontFamily",commandParam:i.model,label:i.title,withText:!0})};e.model.bind("isOn").to(t,"value",e=>e===i.model||!(!e||!i.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase()),i.view&&i.view.styles&&e.model.set("labelStyle","font-family: "+i.view.styles["font-family"]),o.add(e)}return o}(o,i)),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(i),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 Qw(e.config.get("fontFamily").options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class tk extends wd{refresh(){this.isEnabled=function(e){const t=e.schema,o=e.document.selection;return function(e,t,o){const i=function(e,t){const o=rh(e,t).parent;if(o.isEmpty&&!o.is("element","$root"))return o.parent;return o}(e,o);return t.checkChild(i,"pageBreak")}(o,t,e)&&!function(e,t){const o=e.getSelectedElement();return o&&t.isObject(o)}(o,t)}(this.editor.model)}execute(){const e=this.editor.model;e.change(t=>{const o=t.createElement("pageBreak");e.insertContent(o);let i=o.nextSibling;!(i&&e.schema.checkChild(i,"$text"))&&e.schema.checkChild(o.parent,"paragraph")&&(i=t.createElement("paragraph"),e.insertContent(i,t.createPositionAfter(o))),i&&t.setSelection(i,0)})}}o(106);class ok extends ud{static get pluginName(){return"PageBreakEditing"}init(){const e=this.editor,t=e.model.schema,o=e.t,i=e.conversion;t.register("pageBreak",{isObject:!0,allowWhere:"$block"}),i.for("dataDowncast").elementToElement({model:"pageBreak",view:(e,{writer:t})=>{const o=t.createContainerElement("div",{class:"page-break",style:"page-break-after: always"}),i=t.createContainerElement("span",{style:"display: none"});return t.insert(t.createPositionAt(o,0),i),o}}),i.for("editingDowncast").elementToElement({model:"pageBreak",view:(e,{writer:t})=>{const i=o("Page break"),n=t.createContainerElement("div"),r=t.createContainerElement("span"),s=t.createText(o("Page break"));return t.addClass("page-break",n),t.setCustomProperty("pageBreak",!0,n),t.addClass("page-break__label",r),t.insert(t.createPositionAt(n,0),r),t.insert(t.createPositionAt(r,0),s),function(e,t,o){return t.setCustomProperty("pageBreak",!0,e),th(e,t,{label:o})}(n,t,i)}}),i.for("upcast").elementToElement({view:e=>{const t="always"==e.getStyle("page-break-before"),o="always"==e.getStyle("page-break-after");if(t||o){if(1==e.childCount){const t=e.getChild(0);if(!t.is("element","span")||"none"!=t.getStyle("display")||1!=t.childCount)return;const o=t.getChild(0);if(!o.is("$text")||" "!==o.data)return}else if(e.childCount>1)return;return{name:!0}}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new tk(e))}}class ik extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("pageBreak",o=>{const i=e.commands.get("pageBreak"),n=new Yc(o);return n.set({label:t("Page break"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z"/><path d="M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z"/><path d="M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z"/></svg>',tooltip:!0}),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",()=>{e.execute("pageBreak"),e.editing.view.focus()}),n})}}class nk extends wd{refresh(){this.isEnabled=function(e){const t=e.schema,o=e.document.selection;return function(e,t,o){const i=function(e,t){const o=rh(e,t).parent;if(o.isEmpty&&!o.is("element","$root"))return o.parent;return o}(e,o);return t.checkChild(i,"horizontalLine")}(o,t,e)&&!function(e,t){const o=e.getSelectedElement();return o&&t.isObject(o)}(o,t)}(this.editor.model)}execute(){const e=this.editor.model;e.change(t=>{const o=t.createElement("horizontalLine");e.insertContent(o);let i=o.nextSibling;!(i&&e.schema.checkChild(i,"$text"))&&e.schema.checkChild(o.parent,"paragraph")&&(i=t.createElement("paragraph"),e.insertContent(i,t.createPositionAfter(o))),i&&t.setSelection(i,0)})}}o(108);class rk extends ud{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,o=e.t,i=e.conversion;t.register("horizontalLine",{isObject:!0,allowWhere:"$block"}),i.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),i.for("editingDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>{const i=o("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,o){return t.setCustomProperty("horizontalLine",!0,e),th(e,t,{label:o})}(n,t,i)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new nk(e))}}class sk extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("horizontalLine",o=>{const i=e.commands.get("horizontalLine"),n=new Yc(o);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(i,"isEnabled"),this.listenTo(n,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),n})}}class ak extends ud{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 Pu(e,"underline")),e.keystrokes.set("CTRL+U","underline")}}class lk extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("underline",o=>{const i=e.commands.get("underline"),n=new Yc(o);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(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("underline"),e.editing.view.focus()}),n})}}class ck extends ud{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 Pu(e,"subscript"))}}class dk extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("subscript",o=>{const i=e.commands.get("subscript"),n=new Yc(o);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.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.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(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("subscript"),e.editing.view.focus()}),n})}}class uk extends ud{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 Pu(e,"superscript"))}}class hk extends ud{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("superscript",o=>{const i=e.commands.get("superscript"),n=new Yc(o);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(i,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("superscript"),e.editing.view.focus()}),n})}}o(110);class fk extends xc{constructor(e,t){super(e);const o=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(e),this._inputView=this._createInputTextView(e),this._stillTyping=!1,this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color",o.if("hasError","ck-error")],id:o.to("id"),"aria-invalid":o.if("hasError",!0),"aria-describedby":o.to("ariaDescribedById")},children:[this._dropdownView,this._inputView]}),this.on("change:value",(e,t,o)=>this._setInputValue(o))}focus(){this._inputView.focus()}_createDropdownView(){const e=this.locale,t=e.t,o=this.bindTemplate,i=this._createColorGrid(e),n=od(e),r=new xc,s=this._createRemoveColorButton(e);return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:o.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",o.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(i),n.bind("isEnabled").to(this,"isReadOnly",e=>!e),n}_createInputTextView(){const e=this.locale,t=new Ef(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,o=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=o&&o.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,o=new Yc(e);return o.class="ck-input-color__remove-color",o.withText=!0,o.icon=iw,o.label=t("Remove color"),o.on("execute",()=>{this.value="",this._dropdownView.isOpen=!1,this.fire("input")}),o}_createColorGrid(e){const t=new tw(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=mk(e),o=this.options.colorDefinitions.find(e=>t===mk(e.color));this._inputView.value=o?o.label:e||""}}}function mk(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const gk=e=>""===e;function pk(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 bk(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function wk(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function kk(e){return e=e.trim(),gk(e)||gw(e)}function _k(e){return e=e.trim(),gk(e)||Tk(e)||kw(e)||(t=e,_w.test(t));var t}function vk(e){return e=e.trim(),gk(e)||Tk(e)||kw(e)}function yk(e){const t=new Co,o=pk(e.t);for(const i in o){const n={type:"button",model:new fm({_borderStyleValue:"none"===i?"":i,label:o[i],withText:!0})};"none"===i?n.model.bind("isOn").to(e,"borderStyle",e=>!e):n.model.bind("isOn").to(e,"borderStyle",e=>e===i),t.add(n)}return t}function xk({view:e,icons:t,toolbar:o,labels:i,propertyName:n,nameToValue:r}){for(const s in i){const a=new Yc(e.locale);a.set({label:i[s],icon:t[s],tooltip:i[s]}),a.bind("isOn").to(e,n,e=>e===r(s)),a.on("execute",()=>{e[n]=r(s)}),o.items.add(a)}}const Ck=[{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 Ak(e){return(t,o,i)=>{const n=new fk(t.locale,{colorDefinitions:(r=e.colorConfig,r.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns});var r;return n.set({id:o,ariaDescribedById:i}),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 Tk(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}o(112);class Sk extends xc{constructor(e,t={}){super(e);const o=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",o.to("class")],role:o.to("_role"),"aria-labelledby":o.to("_ariaLabelledBy")},children:this.children})}}o(114);class Ek extends xc{constructor(e,t={}){super(e);const o=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",o.to("class")]},children:this.children});const i=new xc(e);i.setTemplate({tag:"span",attributes:{class:["ck","ck-form__header__label"]},children:[{text:o.to("label")}]}),this.children.add(i)}}o(13),o(14),o(118);const Pk={left:Wb,center:$b,right:qb,justify:Gb,top:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.261 7.062l2.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>',middle:'<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>',bottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.239 13.938l-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>'};class Mk extends xc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:f,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new Yl,this.keystrokes=new Bl,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=f;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new ic,this._focusCycler=new Oc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Ek(e,{label:this.t("Cell properties")})),this.children.add(new Sk(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new Sk(e,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new Sk(e,{children:[new Sk(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new Sk(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new Sk(e,{labelView:m,children:[m,h,f],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new Sk(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(),Nf({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=Ak({colorConfig:this.options.borderColors,columns:5}),t=this.locale,o=this.t,i=new Sc(t);i.text=o("Border");const n=pk(o),r=new Sf(t,Mf);r.set({label:o("Style"),class:"ck-table-form__border-style"}),r.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:o("Style")}),r.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>n[e||"none"]),r.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),r.bind("isEmpty").to(this,"borderStyle",e=>!e),nd(r.fieldView,yk(this));const s=new Sf(t,Pf);s.set({label:o("Width"),class:"ck-table-form__border-width"}),s.fieldView.bind("value").to(this,"borderWidth"),s.bind("isEnabled").to(this,"borderStyle",Ik),s.fieldView.on("input",()=>{this.borderWidth=s.fieldView.element.value});const a=new Sf(t,e);return a.set({label:o("Color"),class:"ck-table-form__border-color"}),a.fieldView.bind("value").to(this,"borderColor"),a.bind("isEnabled").to(this,"borderStyle",Ik),a.fieldView.on("input",()=>{this.borderColor=a.fieldView.value}),this.on("change:borderStyle",(e,t,o)=>{Ik(o)||(this.borderColor="",this.borderWidth="")}),{borderRowLabel:i,borderStyleDropdown:r,borderColorInput:a,borderWidthInput:s}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new Sc(e);o.text=t("Background");const i=Ak({colorConfig:this.options.backgroundColors,columns:5}),n=new Sf(e,i);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:o,backgroundInput:n}}_createDimensionFields(){const e=this.locale,t=this.t,o=new Sc(e);o.text=t("Dimensions");const i=new Sf(e,Pf);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const n=new xc(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Sf(e,Pf);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:o,widthInput:i,operatorLabel:n,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,o=new Sf(e,Pf);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",()=>{this.padding=o.fieldView.element.value}),o}_createAlignmentFields(){const e=this.locale,t=this.t,o=new Sc(e);o.text=t("Table cell text alignment");const i=new rd(e),n="rtl"===this.locale.contentLanguageDirection;i.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),xk({view:this,icons:Pk,toolbar:i,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>e===(n?"right":"left")?"":e});const r=new rd(e);return r.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),xk({view:this,icons:Pk,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",nameToValue:e=>"middle"===e?"":e}),{horizontalAlignmentToolbar:i,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const e=this.locale,t=this.t,o=new Yc(e),i=new Yc(e),n=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),icon:Rf,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(n,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),icon:Of,class:"ck-button-cancel",type:"cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),i=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:i,left:o,justify:r}:{left:o,center:i,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 Ik(e){return!!e}const Nk=Yu.defaultPositions,Rk=[Nk.northArrowSouth,Nk.northArrowSouthWest,Nk.northArrowSouthEast,Nk.southArrowNorth,Nk.southArrowNorthWest,Nk.southArrowNorthEast],Ok=[...Rk,sh];function Vk(e,t){const o=e.plugins.get("ContextualBalloon");if(Sb(e.editing.view.document.selection)){let i;i="cell"===t?Dk(e):Lk(e),o.updatePosition(i)}}function Lk(e){const t=e.model.document.selection.getFirstPosition().findAncestor("table"),o=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.viewToDom(o),positions:Ok}}function Dk(e){const t=e.editing.mapper,o=e.editing.view.domConverter,i=e.model.document.selection;if(i.rangeCount>1)return{target:()=>function(e,t){const o=t.editing.mapper,i=t.editing.view.domConverter,n=Array.from(e).map(e=>{const t=zk(e.start),n=o.toViewElement(t);return new ns(i.viewToDom(n))});return ns.getBoundingRect(n)}(i.getRanges(),e),positions:Rk};const n=zk(i.getFirstPosition()),r=t.toViewElement(n);return{target:o.viewToDom(r),positions:Rk}}function zk(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const Bk={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",width:"tableCellWidth",height:"tableCellHeight",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class jk extends ud{static get requires(){return[Df]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:Ck,backgroundColors:Ck})}init(){const e=this.editor,t=e.t;this._balloon=e.plugins.get(Df),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableCellProperties",o=>{const i=new Yc(o);i.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.105 18l-.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.5l1.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(i,"execute",()=>this._showView());const n=Object.values(Bk).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,o=e.config.get("table.tableCellProperties"),i=Lw(o.borderColors),n=Vw(e.locale,i),r=Lw(o.backgroundColors),s=Vw(e.locale,r),a=new Mk(e.locale,{borderColors:n,backgroundColors:s}),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",()=>{Sb(t.selection)?this._isViewVisible&&Vk(e,"cell"):this._hideView()}),td({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=bk(l),d=wk(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:kk})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:vk})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:_k})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:_k})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:_k})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:kk})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands;Object.entries(Bk).map(([t,o])=>[t,e.get(o).value||""]).forEach(([e,t])=>this.view.set(e,t))}_showView(){const e=this.editor;this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Dk(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){return(t,o,i)=>{this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback({commandName:e,viewField:t,validator:o,errorText:i}){const n=Kr(()=>{t.errorText=i},500);return(i,r,s)=>{n.cancel(),o(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),t.errorText=null):n()}}}function Fk(e){e.setNormalizer("border",Hk),e.setNormalizer("border-top",Uk("top")),e.setNormalizer("border-right",Uk("right")),e.setNormalizer("border-bottom",Uk("bottom")),e.setNormalizer("border-left",Uk("left")),e.setNormalizer("border-color",Wk("color")),e.setNormalizer("border-width",Wk("width")),e.setNormalizer("border-style",Wk("style")),e.setNormalizer("border-top-color",$k("color","top")),e.setNormalizer("border-top-style",$k("style","top")),e.setNormalizer("border-top-width",$k("width","top")),e.setNormalizer("border-right-color",$k("color","right")),e.setNormalizer("border-right-style",$k("style","right")),e.setNormalizer("border-right-width",$k("width","right")),e.setNormalizer("border-bottom-color",$k("color","bottom")),e.setNormalizer("border-bottom-style",$k("style","bottom")),e.setNormalizer("border-bottom-width",$k("width","bottom")),e.setNormalizer("border-left-color",$k("color","left")),e.setNormalizer("border-left-style",$k("style","left")),e.setNormalizer("border-left-width",$k("width","left")),e.setExtractor("border-top",Gk("top")),e.setExtractor("border-right",Gk("right")),e.setExtractor("border-bottom",Gk("bottom")),e.setExtractor("border-left",Gk("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",Pw("border-color")),e.setReducer("border-style",Pw("border-style")),e.setReducer("border-width",Pw("border-width")),e.setReducer("border-top",Jk("top")),e.setReducer("border-right",Jk("right")),e.setReducer("border-bottom",Jk("bottom")),e.setReducer("border-left",Jk("left")),e.setReducer("border",Qk),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 Hk(e){const{color:t,style:o,width:i}=Kk(e);return{path:"border",value:{color:Ew(t),style:Ew(o),width:Ew(i)}}}function Uk(e){return t=>{const{color:o,style:i,width:n}=Kk(t),r={};return void 0!==o&&(r.color={[e]:o}),void 0!==i&&(r.style={[e]:i}),void 0!==n&&(r.width={[e]:n}),{path:"border",value:r}}}function Wk(e){return t=>({path:"border",value:qk(t,e)})}function qk(e,t){return{[t]:Ew(e)}}function $k(e,t){return o=>({path:"border",value:{[e]:{[t]:o}}})}function Gk(e){return(t,o)=>{if(o.border)return Yk(o.border,e)}}function Yk(e,t){const o={};return e.width&&e.width[t]&&(o.width=e.width[t]),e.style&&e.style[t]&&(o.style=e.style[t]),e.color&&e.color[t]&&(o.color=e.color[t]),o}function Kk(e){const t={},o=Iw(e);for(const e of o)kw(e)||/thin|medium|thick/.test(e)?t.width=e:bw(e)?t.style=e:t.color=e;return t}function Qk(e){const t=[];return t.push(...Zk(Yk(e,"top"),"top")),t.push(...Zk(Yk(e,"right"),"right")),t.push(...Zk(Yk(e,"bottom"),"bottom")),t.push(...Zk(Yk(e,"left"),"left")),t}function Jk(e){return t=>Zk(t,e)}function Zk(e,t){const o=[];return e&&void 0!==e.width&&o.push(e.width),e&&void 0!==e.style&&o.push(e.style),e&&void 0!==e.color&&o.push(e.color),o.length?[["border-"+t,o.join(" ")]]:[]}function Xk(e){var t;e.setNormalizer("padding",(t="padding",e=>({path:t,value:Ew(e)}))),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",Pw("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}function e_(e,t,o,i){e.for("upcast").attributeToAttribute({view:{styles:{[i]:/[\s\S]+/}},model:{name:t,key:o,value:e=>e.getNormalizedStyle(i)}})}function t_(e,t){e.for("upcast").add(e=>e.on("element:"+t,(e,t,o)=>{const i=["border-top","border-right","border-bottom","border-left"].filter(e=>t.viewItem.hasStyle(e));if(!i.length)return;const n={styles:i};if(!o.consumable.test(t.viewItem,n))return;t.modelRange||(t=Object.assign(t,o.convertChildren(t.viewItem,t.modelCursor)));const r=[...t.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(t.viewItem,n),o.writer.setAttribute("borderStyle",t.viewItem.getNormalizedStyle("border-style"),r),o.writer.setAttribute("borderColor",t.viewItem.getNormalizedStyle("border-color"),r),o.writer.setAttribute("borderWidth",t.viewItem.getNormalizedStyle("border-width"),r)}))}function o_(e,t,o,i){e.for("downcast").attributeToAttribute({model:{name:t,key:o},view:e=>({key:"style",value:{[i]:e}})})}function i_(e,t,o){e.for("downcast").add(e=>e.on(`attribute:${t}:table`,(e,t,i)=>{const{item:n,attributeNewValue:r}=t,{mapper:s,writer:a}=i;if(!i.consumable.consume(t.item,e.name))return;const l=[...s.toViewElement(n).getChildren()].find(e=>e.is("element","table"));r?a.setStyle(o,r,l):a.removeStyle(o,l)}))}class n_ extends wd{constructor(e,t){super(e),this.attributeName=t}refresh(){const e=gp(this.editor.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(e={}){const{value:t,batch:o}=e,i=this.editor.model,n=gp(i.document.selection),r=this._getValueToSet(t);i.enqueueChange(o||"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 e.getAttribute(this.attributeName)}_getValueToSet(e){return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}function r_(e){if(!e||!D(e))return e;const{top:t,right:o,bottom:i,left:n}=e;return t==o&&o==i&&i==n?t:void 0}function s_(e,t){const o=parseFloat(e);return Number.isNaN(o)||String(o)!==String(e)?e:`${o}${t}`}class a_ extends n_{constructor(e){super(e,"padding")}_getAttribute(e){if(e)return r_(e.getAttribute(this.attributeName))}_getValueToSet(e){return s_(e,"px")}}class l_ extends n_{constructor(e){super(e,"width")}_getValueToSet(e){return s_(e,"px")}}class c_ extends n_{constructor(e){super(e,"height")}_getValueToSet(e){return s_(e,"px")}}class d_ extends n_{constructor(e){super(e,"backgroundColor")}}class u_ extends n_{constructor(e){super(e,"verticalAlignment")}}class h_ extends n_{constructor(e){super(e,"horizontalAlignment")}}class f_ extends n_{constructor(e){super(e,"borderStyle")}_getAttribute(e){if(e)return r_(e.getAttribute(this.attributeName))}}class m_ extends n_{constructor(e){super(e,"borderColor")}_getAttribute(e){if(e)return r_(e.getAttribute(this.attributeName))}}class g_ extends n_{constructor(e){super(e,"borderWidth")}_getAttribute(e){if(e)return r_(e.getAttribute(this.attributeName))}_getValueToSet(e){return s_(e,"px")}}const p_=/^(top|bottom)$/;class b_ extends ud{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[ub]}init(){const e=this.editor,t=e.model.schema,o=e.conversion,i=e.locale;e.data.addStyleProcessorRules(Fk),function(e,t){e.extend("tableCell",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),t_(t,"td"),t_(t,"th"),o_(t,"tableCell","borderStyle","border-style"),o_(t,"tableCell","borderColor","border-color"),o_(t,"tableCell","borderWidth","border-width")}(t,o),e.commands.add("tableCellBorderStyle",new f_(e)),e.commands.add("tableCellBorderColor",new m_(e)),e.commands.add("tableCellBorderWidth",new g_(e)),function(e,t,o){e.extend("tableCell",{allowAttributes:["horizontalAlignment"]});const i=["rtl"==o.contentLanguageDirection?"left":"right","center","justify"];t.attributeToAttribute({model:{name:"tableCell",key:"horizontalAlignment",values:i},view:i.reduce((e,t)=>({...e,[t]:{key:"style",value:{"text-align":t}}}),{})})}(t,o,i),e.commands.add("tableCellHorizontalAlignment",new h_(e)),w_(t,o,"width","width"),e.commands.add("tableCellWidth",new l_(e)),w_(t,o,"height","height"),e.commands.add("tableCellHeight",new c_(e)),e.data.addStyleProcessorRules(Xk),w_(t,o,"padding","padding"),e.commands.add("tableCellPadding",new a_(e)),e.data.addStyleProcessorRules(Nw),w_(t,o,"backgroundColor","background-color"),e.commands.add("tableCellBackgroundColor",new d_(e)),function(e,t){e.extend("tableCell",{allowAttributes:["verticalAlignment"]}),t.attributeToAttribute({model:{name:"tableCell",key:"verticalAlignment",values:["top","bottom"]},view:{top:{key:"style",value:{"vertical-align":"top"}},bottom:{key:"style",value:{"vertical-align":"bottom"}}}}),t.for("upcast").attributeToAttribute({view:{attributes:{valign:p_}},model:{name:"tableCell",key:"verticalAlignment",value:e=>e.getAttribute("valign")}})}(t,o),e.commands.add("tableCellVerticalAlignment",new u_(e))}}function w_(e,t,o,i){e.extend("tableCell",{allowAttributes:[o]}),e_(t,"tableCell",o,i),o_(t,"tableCell",o,i)}class k_ extends wd{constructor(e,t){super(e),this.attributeName=t}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,o=t.document.selection,{value:i,batch:n}=e,r=o.getFirstPosition().findAncestor("table"),s=this._getValueToSet(i);t.enqueueChange(n||"default",e=>{s?e.setAttribute(this.attributeName,s,r):e.removeAttribute(this.attributeName,r)})}_getValue(e){if(e)return e.getAttribute(this.attributeName)}_getValueToSet(e){return e}}class __ extends k_{constructor(e){super(e,"backgroundColor")}}class v_ extends k_{constructor(e){super(e,"borderColor")}_getValue(e){if(e)return r_(e.getAttribute(this.attributeName))}}class y_ extends k_{constructor(e){super(e,"borderStyle")}_getValue(e){if(e)return r_(e.getAttribute(this.attributeName))}}class x_ extends k_{constructor(e){super(e,"borderWidth")}_getValue(e){if(e)return r_(e.getAttribute(this.attributeName))}_getValueToSet(e){return s_(e,"px")}}class C_ extends k_{constructor(e){super(e,"width")}_getValueToSet(e){return s_(e,"px")}}class A_ extends k_{constructor(e){super(e,"height")}_getValueToSet(e){return s_(e,"px")}}class T_ extends k_{constructor(e){super(e,"alignment")}}const S_=/^(left|right)$/;class E_ extends ud{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[ub]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.data.addStyleProcessorRules(Fk),function(e,t){e.extend("table",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),t_(t,"table"),i_(t,"borderColor","border-color"),i_(t,"borderStyle","border-style"),i_(t,"borderWidth","border-width")}(t,o),e.commands.add("tableBorderColor",new v_(e)),e.commands.add("tableBorderStyle",new y_(e)),e.commands.add("tableBorderWidth",new x_(e)),function(e,t){e.extend("table",{allowAttributes:["alignment"]}),t.attributeToAttribute({model:{name:"table",key:"alignment",values:["left","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}}},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{attributes:{align:S_}},model:{name:"table",key:"alignment",value:e=>e.getAttribute("align")}})}(t,o),e.commands.add("tableAlignment",new T_(e)),P_(t,o,"width","width"),e.commands.add("tableWidth",new C_(e)),P_(t,o,"height","height"),e.commands.add("tableHeight",new A_(e)),e.data.addStyleProcessorRules(Nw),function(e,t,o,i){e.extend("table",{allowAttributes:[o]}),e_(t,"table",o,i),i_(t,o,i)}(t,o,"backgroundColor","background-color"),e.commands.add("tableBackgroundColor",new __(e))}}function P_(e,t,o,i){e.extend("table",{allowAttributes:[o]}),e_(t,"table",o,i),o_(t,"table",o,i)}o(120);const M_={left:Am,center:Tm,right:Sm};class I_ extends xc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:i,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:f}=this._createAlignmentFields();this.focusTracker=new Yl,this.keystrokes=new Bl,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=i,this.borderColorInput=n,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:m,cancelButtonView:g}=this._createActionButtons();this.saveButtonView=m,this.cancelButtonView=g,this._focusables=new ic,this._focusCycler=new Oc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Ek(e,{label:this.t("Table properties")})),this.children.add(new Sk(e,{labelView:r,children:[r,o,n,i],class:"ck-table-form__border-row"})),this.children.add(new Sk(e,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new Sk(e,{children:[new Sk(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new Sk(e,{labelView:f,children:[f,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new Sk(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(),Nf({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=Ak({colorConfig:this.options.borderColors,columns:5}),t=this.locale,o=this.t,i=new Sc(t);i.text=o("Border");const n=pk(this.t),r=new Sf(t,Mf);r.set({label:o("Style"),class:"ck-table-form__border-style"}),r.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:o("Style")}),r.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>n[e||"none"]),r.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),r.bind("isEmpty").to(this,"borderStyle",e=>!e),nd(r.fieldView,yk(this));const s=new Sf(t,Pf);s.set({label:o("Width"),class:"ck-table-form__border-width"}),s.fieldView.bind("value").to(this,"borderWidth"),s.bind("isEnabled").to(this,"borderStyle",N_),s.fieldView.on("input",()=>{this.borderWidth=s.fieldView.element.value});const a=new Sf(t,e);return a.set({label:o("Color"),class:"ck-table-form__border-color"}),a.fieldView.bind("value").to(this,"borderColor"),a.bind("isEnabled").to(this,"borderStyle",N_),a.fieldView.on("input",()=>{this.borderColor=a.fieldView.value}),this.on("change:borderStyle",(e,t,o)=>{N_(o)||(this.borderColor="",this.borderWidth="")}),{borderRowLabel:i,borderStyleDropdown:r,borderColorInput:a,borderWidthInput:s}}_createBackgroundFields(){const e=this.locale,t=this.t,o=new Sc(e);o.text=t("Background");const i=Ak({colorConfig:this.options.backgroundColors,columns:5}),n=new Sf(e,i);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:o,backgroundInput:n}}_createDimensionFields(){const e=this.locale,t=this.t,o=new Sc(e);o.text=t("Dimensions");const i=new Sf(e,Pf);i.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",()=>{this.width=i.fieldView.element.value});const n=new xc(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Sf(e,Pf);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:o,widthInput:i,operatorLabel:n,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new Sc(e);o.text=t("Alignment");const i=new rd(e);return i.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),xk({view:this,icons:M_,toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",nameToValue:e=>"center"===e?"":e}),{alignmentLabel:o,alignmentToolbar:i}}_createActionButtons(){const e=this.locale,t=this.t,o=new Yc(e),i=new Yc(e),n=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),icon:Rf,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(n,"errorText",(...e)=>e.every(e=>!e)),i.set({label:t("Cancel"),icon:Of,class:"ck-button-cancel",type:"cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:i}}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left"),i=t("Center table"),n=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:n,center:i,left:o}:{left:o,center:i,right:n}}}function N_(e){return!!e}const R_={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class O_ extends ud{static get requires(){return[Df]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:Ck,backgroundColors:Ck})}init(){const e=this.editor,t=e.t;this._balloon=e.plugins.get(Df),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableProperties",o=>{const i=new Yc(o);i.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.5l1.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(i,"execute",()=>this._showView());const n=Object.values(R_).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),i})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,o=e.config.get("table.tableProperties"),i=Lw(o.borderColors),n=Vw(e.locale,i),r=Lw(o.backgroundColors),s=Vw(e.locale,r),a=new I_(e.locale,{borderColors:n,backgroundColors:s}),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",()=>{Sb(t.selection)?this._isViewVisible&&Vk(e,"table"):this._hideView()}),td({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=bk(l),d=wk(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:kk})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:vk})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:kk})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:_k})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:_k})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands;Object.entries(R_).map(([t,o])=>[t,e.get(o).value||""]).forEach(([e,t])=>this.view.set(e,t))}_showView(){const e=this.editor;this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Lk(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){return(t,o,i)=>{this.editor.execute(e,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback({commandName:e,viewField:t,validator:o,errorText:i}){const n=Kr(()=>{t.errorText=i},500);return(i,r,s)=>{n.cancel(),o(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),t.errorText=null):n()}}}class V_{constructor(e,t){this.loader=e,this.options=t}upload(){return this.loader.file.then(e=>new Promise((t,o)=>{this._initRequest(),this._initListeners(t,o,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.options.uploadUrl,!0),e.responseType="json"}_initListeners(e,t,o){const i=this.xhr,n=this.loader,r=`Couldn't upload file: ${o.name}.`;i.addEventListener("error",()=>t(r)),i.addEventListener("abort",()=>t()),i.addEventListener("load",()=>{const o=i.response;if(!o||o.error)return t(o&&o.error&&o.error.message?o.error.message:r);e(o.url?{default:o.url}:o.urls)}),i.upload&&i.upload.addEventListener("progress",e=>{e.lengthComputable&&(n.uploadTotal=e.total,n.uploaded=e.loaded)})}_sendRequest(e){const t=this.options.headers||{},o=this.options.withCredentials||!1;for(const e of Object.keys(t))this.xhr.setRequestHeader(e,t[e]);this.xhr.withCredentials=o;const i=new FormData;i.append("upload",e),this.xhr.send(i)}}class L_ extends dd{}L_.builtinPlugins=[class extends ud{static get requires(){return[bd,Cd,Od,Ed,Yd,gu]}static get pluginName(){return"Essentials"}},yu,class extends ud{static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats()}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&Au(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&Au(this.editor,this,/^1[.|)]\s$/,"numberedList")}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=Eu(this.editor,"bold");Tu(this.editor,this,/(\*\*)([^*]+)(\*\*)$/g,e),Tu(this.editor,this,/(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=Eu(this.editor,"italic");Tu(this.editor,this,/(?:^|[^*])(\*)([^*_]+)(\*)$/g,e),Tu(this.editor,this,/(?:^|[^_])(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=Eu(this.editor,"code");Tu(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get("strikethrough")){const e=Eu(this.editor,"strikethrough");Tu(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 o=t[7],i=new RegExp(`^(#{${o}})\\s$`);Au(this.editor,this,i,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&Au(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){this.editor.commands.get("codeBlock")&&Au(this.editor,this,/^```$/,"codeBlock")}},class extends ud{static get requires(){return[Mu,Iu]}static get pluginName(){return"Bold"}},class extends ud{static get requires(){return[Nu,Ru]}static get pluginName(){return"Italic"}},class extends ud{static get requires(){return[zu,Bu]}static get pluginName(){return"BlockQuote"}},class extends ud{static get pluginName(){return"CKFinder"}static get requires(){return[lf,ju,yu]}},class extends ud{static get requires(){return[gf,Uf,rm]}static get pluginName(){return"EasyImage"}},class extends ud{static get requires(){return[hm,mm]}static get pluginName(){return"Heading"}},Uf,class extends ud{static get requires(){return[bm]}static get pluginName(){return"ImageCaption"}},class extends ud{static get requires(){return[Nm,Rm]}static get pluginName(){return"ImageStyle"}},class extends ud{static get requires(){return[Om]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t;e.plugins.get(Om).register("image",{ariaLabel:t("Image toolbar"),items:e.config.get("image.toolbar")||[],getRelatedElement:lh})}},rm,class extends ud{static get pluginName(){return"Indent"}static get requires(){return[zm,Fm]}},class extends ud{static get requires(){return[tf,qm,Qm]}static get pluginName(){return"Link"}},class extends ud{static get requires(){return[yg,Cg]}static get pluginName(){return"List"}},class extends ud{static get requires(){return[Ng,Lg,Og,xf]}static get pluginName(){return"MediaEmbed"}},cm,class extends ud{static get pluginName(){return"PasteFromOffice"}static get requires(){return[bd]}init(){const e=this.editor,t=e.editing.view.document,o=[];o.push(new Yg(t)),o.push(new Hg(t)),e.plugins.get("Clipboard").on("inputTransformation",(e,t)=>{if(t.isTransformedWithPasteFromOffice)return;const i=t.dataTransfer.getData("text/html"),n=o.find(e=>e.isActive(i));n&&(n.execute(t),t.isTransformedWithPasteFromOffice=!0)},{priority:"high"})}},class extends ud{static get requires(){return[ub,gb,bb,Cb,yb,wb,xf]}static get pluginName(){return"Table"}},class extends ud{static get requires(){return[Om]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,o=e.plugins.get(Om),i=e.config.get("table.contentToolbar"),n=e.config.get("table.tableToolbar");i&&o.register("tableContent",{ariaLabel:t("Table toolbar"),items:i,getRelatedElement:Sb}),n&&o.register("table",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:Tb})}},class extends ud{static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:Ob}})}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,o=e.plugins.get("Input"),i=function(e){const t=e.extra||[],o=e.remove||[],i=e=>!o.includes(e);return function(e){const t=new Set;for(const o of e)if(Rb[o])for(const e of Rb[o])t.add(e);else t.add(o);return Array.from(t)}(e.include.concat(t).filter(i)).filter(i).map(e=>Nb[e]||e).map(e=>({from:Vb(e.from),to:Lb(e.to)}))}(e.config.get("typing.transformations")),n=new Ym(e.model,e=>{for(const t of i){if(t.from.test(e))return{normalizedTransformation:t}}});n.on("matched:data",(e,i)=>{if(!o.isInput(i.batch))return;const{from:n,to:r}=i.normalizedTransformation,s=n.exec(i.text),a=r(s.slice(1)),l=i.range;let c=s.index;t.enqueueChange(e=>{for(let o=1;o<s.length;o++){const i=s[o],n=a[o-1];if(null==n){c+=i.length;continue}const r=l.start.getShiftedBy(c),d=t.createRange(r,r.getShiftedBy(i.length)),u=Db(r);t.insertContent(e.createText(n,u),d),c+=n.length}})}),n.bind("isEnabled").to(this)}},class extends ud{static get requires(){return[Ub,Kb]}static get pluginName(){return"Alignment"}},class extends ud{static get requires(){return[Ow,Bw]}static get pluginName(){return"FontBackgroundColor"}},class extends ud{static get requires(){return[Zb,Qb]}static get pluginName(){return"RemoveFormat"}},class extends ud{static get requires(){return[Xw,ek]}static get pluginName(){return"FontFamily"}},class extends ud{static get requires(){return[Gw,Yw]}static get pluginName(){return"FontColor"}},class extends ud{static get requires(){return[Ww,qw]}static get pluginName(){return"FontSize"}},class extends ud{static get requires(){return[ok,ik]}static get pluginName(){return"PageBreak"}},class extends ud{static get requires(){return[rk,sk]}static get pluginName(){return"HorizontalLine"}},class extends ud{static get requires(){return[ak,lk]}static get pluginName(){return"Underline"}},class extends ud{static get requires(){return[ck,dk]}static get pluginName(){return"Subscript"}},class extends ud{static get requires(){return[uk,hk]}static get pluginName(){return"Superscript"}},class extends ud{static get pluginName(){return"TableCellProperties"}static get requires(){return[b_,jk]}},class extends ud{static get pluginName(){return"TableProperties"}static get requires(){return[E_,O_]}},class extends ud{static get requires(){return[ku]}static get pluginName(){return"SimpleUploadAdapter"}init(){const e=this.editor.config.get("simpleUpload");e&&(e.uploadUrl?this.editor.plugins.get(ku).createUploadAdapter=t=>new V_(t,e):Object(ho.c)("simple-upload-adapter-missing-uploadurl"))}}],L_.defaultConfig={toolbar:{items:["undo","redo","removeFormat","heading","fontSize","fontFamily","fontColor","fontBackgroundColor","superscript","subscript","|","bold","italic","link","underline","bulletedList","numberedList","|","alignment","|","indent","outdent","pageBreak","HorizontalLine","|","imageUpload","blockQuote","insertTable","mediaEmbed","SimpleUploadAdapter"]},image:{toolbar:["imageStyle:full","imageStyle:side","|","imageTextAlternative"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"]},fontColor:{colors:[{color:"#86BC25",label:"#86BC25"},{color:"#C4D600",label:"#C4D600"},{color:"#43B02A",label:"#43B02A"},{color:"#046A38",label:"#046A38"},{color:"#2C5234",label:"#2C5234"},{color:"#0097A9",label:"#0097A9"},{color:"#62B5E5",label:"#62B5E5"},{color:"#00A3E0",label:"#00A3E0"},{color:"#0076A8",label:"#0076A8"},{color:"#012169",label:"#012169"},{color:"#D0D0CE",label:"#D0D0CE"},{color:"#BBBCBC",label:"#BBBCBC"},{color:"#97999B",label:"#97999B"},{color:"#75787B",label:"#75787B"},{color:"#53565A",label:"#53565A"},{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},fontBackgroundColor:{colors:[{color:"#86BC25",label:"#86BC25"},{color:"#C4D600",label:"#C4D600"},{color:"#43B02A",label:"#43B02A"},{color:"#046A38",label:"#046A38"},{color:"#2C5234",label:"#2C5234"},{color:"#0097A9",label:"#0097A9"},{color:"#62B5E5",label:"#62B5E5"},{color:"#00A3E0",label:"#00A3E0"},{color:"#0076A8",label:"#0076A8"},{color:"#012169",label:"#012169"},{color:"#D0D0CE",label:"#D0D0CE"},{color:"#BBBCBC",label:"#BBBCBC"},{color:"#97999B",label:"#97999B"},{color:"#75787B",label:"#75787B"},{color:"#53565A",label:"#53565A"},{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},fontFamily:{options:["default","Calibri, Verdana, Geneva, sans-serif","Arial/Arial, Helvetica, sans-serif","Comic Sans MS/Comic Sans MS, cursive","Courier New/Courier New, Courier, monospace","Georgia/Georgia, serif","Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma/Tahoma, Geneva, sans-serif","Times New Roman/Times New Roman, Times, serif","Trebuchet MS/Trebuchet MS, Helvetica, sans-serif","Verdana/Verdana, Geneva, sans-serif","Ubuntu, Arial, sans-serif","Ubuntu Mono, Courier New, Courier, monospace"],supportAllValues:!0},fontSize:{options:[9,11,13,"default",17,19,21]},link:{decorators:{isExternal:{mode:"manual",label:"Open in a new tab",attributes:{target:"_blank"}}}},language:"en"}}]).default}));
  //# sourceMappingURL=ckeditor.js.map