/*!
* @license Copyright (c) 2003-2020, 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 center":"Align center","Align left":"Align left","Align right":"Align right",Aquamarine:"Aquamarine",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold","Bulleted List":"Bulleted List",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",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.","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey","Document colors":"Document colors",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","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",Huge:"Huge","Image toolbar":"Image toolbar","image widget":"image widget","Increase indent":"Increase indent",Insert:"Insert","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 image via URL":"Insert image via URL","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",Italic:"Italic",Justify:"Justify","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","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",Paragraph:"Paragraph","Paste the image source URL.":"Paste the image source URL.","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","Rich Text Editor, %0":"Rich Text Editor, %0","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","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Strikethrough:"Strikethrough","Table toolbar":"Table toolbar","Text alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar","Text alternative":"Text alternative","The URL must not be empty.":"The URL must not be empty.","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",Update:"Update","Upload failed":"Upload failed","Upload in progress":"Upload in progress",White:"White","Widget toolbar":"Widget toolbar",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.DecoupledEditor=t():e.DecoupledEditor=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=102)}([function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));class o extends Error{constructor(e,t,n){e=i(e),n&&(e+=" "+JSON.stringify(n)),super(e),this.name="CKEditorError",this.context=t,this.data=n}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const n=new o(e.message,t);throw n.stack=e.stack,n}}function i(e){const t=e.match(/^([^:]+):/);return t?e+` Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-${t[1]}\n`:e}},function(e,t,n){"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n: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,n){var o=n(1),i=n(20);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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(0.5*var(--ck-icon-size))}.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,n){var o=n(1),i=n(22);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(24);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after{top:calc(-1*var(--ck-tooltip-arrow-size));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_n{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{bottom:calc(-1*var(--ck-tooltip-arrow-size));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)}'},function(e,t,n){var o=n(1),i=n(26);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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(-1*var(--ck-spacing-small));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(-1*var(--ck-spacing-small));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,n){var o=n(1),i=n(28);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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(0.2*var(--ck-line-height-base)*var(--ck-font-size-base)) calc(0.4*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(1.2*var(--ck-line-height-base)*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,n){var o=n(1),i=n(30);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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) - 2*var(--ck-switch-button-toggle-spacing))}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(2*var(--ck-spacing-large))}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(2*var(--ck-spacing-large))}.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(0.5*var(--ck-border-radius))}.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(-1*var(--ck-switch-button-translation)))}"},function(e,t,n){var o=n(1),i=n(32);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-toolbar-dropdown .ck.ck-toolbar .ck.ck-toolbar__items{flex-wrap:nowrap}.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,n){var o=n(1),i=n(34);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(36);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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_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__items>*{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small);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>*,.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,n){var o=n(1),i=n(38);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(40);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(42);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(44);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(46);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(48);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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.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)}.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(-1*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.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(-1*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{left:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{right:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.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(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.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(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.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(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.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(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}'},function(e,t,n){var o=n(1),i=n(50);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(52);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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(-0.5*var(--ck-widget-outline-thickness));left:min(10%,30px);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(-0.5*var(--ck-widget-outline-thickness));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(-1*var(--ck-widget-outline-thickness));right:calc(-1*var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:calc(-1*var(--ck-widget-outline-thickness) - 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(-1*var(--ck-widget-outline-thickness) - 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-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,n){var o=n(1),i=n(54);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(56);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".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_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view>.ck.ck-label{width:100%;text-overflow:ellipsis;overflow:hidden}"},function(e,t,n){var o=n(1),i=n(58);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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{box-shadow:var(--ck-inner-shadow),0 0;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 .2s ease-in-out,border .2s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),var(--ck-inner-shadow)}.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),var(--ck-inner-shadow)}.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),var(--ck-inner-shadow)}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,n){var o=n(1),i=n(60);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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%}}.ck.ck-text-alternative-form{padding:var(--ck-spacing-standard)}.ck.ck-text-alternative-form:focus{outline:none}[dir=ltr] .ck.ck-text-alternative-form>:not(:first-child),[dir=rtl] .ck.ck-text-alternative-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-text-alternative-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-text-alternative-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-text-alternative-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-text-alternative-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-text-alternative-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-text-alternative-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,n){var o=n(1),i=n(62);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(64);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(66);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(68);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(70);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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-image-upload-form__action-row{margin-top:var(--ck-spacing-standard)}.ck.ck-form__row.ck-image-upload-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-image-upload-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row.ck-image-upload-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t,n){var o=n(1),i=n(72);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-image-upload__panel{padding:var(--ck-spacing-standard)}.ck.ck-image-upload__ck-finder-button{display:block;width:100%;margin:var(--ck-spacing-standard) auto;border:1px solid #ccc;border-radius:var(--ck-border-radius)}"},function(e,t,n){var o=n(1),i=n(74);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(76);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(78);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(81);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(83);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(85);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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{padding:var(--ck-spacing-standard)}.ck.ck-link-form:focus{outline:none}[dir=ltr] .ck.ck-link-form>:not(:first-child),[dir=rtl] .ck.ck-link-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}.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-standard) var(--ck-spacing-standard) 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{margin-left:0}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[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-left:0}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,n){var o=n(1),i=n(87);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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{padding:var(--ck-spacing-standard)}.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}.ck.ck-link-actions:focus{outline:none}[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{padding:0;width:calc(0.8*var(--ck-input-text-width))}.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%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,n){var o=n(1),i=n(89);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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(3*var(--ck-spacing-standard));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,n){var o=n(1),i=n(91);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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%}}.ck.ck-media-form{padding:var(--ck-spacing-standard)}.ck.ck-media-form:focus{outline:none}[dir=ltr] .ck.ck-media-form>:not(:first-child),[dir=rtl] .ck.ck-media-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-media-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-media-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-media-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-media-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-media-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-media-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-media-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-media-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-media-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,n){var o=n(1),i=n(93);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .media{clear:both;margin:1em 0;display:block;min-width:15em}"},function(e,t,n){var o=n(1),i=n(95);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(97);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(99);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){var o=n(1),i=n(101);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(i,r);e.exports=i.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,n){"use strict";n.r(t),n.d(t,"default",(function(){return Rw}));var o=n(3),i=o.a.Symbol,r=Object.prototype,s=r.hasOwnProperty,a=r.toString,c=i?i.toStringTag:void 0;var l=function(e){var t=s.call(e,c),n=e[c];try{e[c]=void 0;var o=!0}catch(e){}var i=a.call(e);return o&&(t?e[c]=n:delete e[c]),i},d=Object.prototype.toString;var u=function(e){return d.call(e)},h=i?i.toStringTag:void 0;var f=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":h&&h in Object(e)?l(e):u(e)};var m=function(e,t){return function(n){return e(t(n))}},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 n=_.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&k.call(n)==v};var x=function(){this.__data__=[],this.size=0};var A=function(e,t){return e===t||e!=e&&t!=t};var C=function(e,t){for(var n=e.length;n--;)if(A(e[n][0],t))return n;return-1},T=Array.prototype.splice;var P=function(e){var t=this.__data__,n=C(t,e);return!(n<0)&&(n==t.length-1?t.pop():T.call(t,n,1),--this.size,!0)};var S=function(e){var t=this.__data__,n=C(t,e);return n<0?void 0:t[n][1]};var E=function(e){return C(this.__data__,e)>-1};var M=function(e,t){var n=this.__data__,o=C(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function I(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},Be={};Be["[object Float32Array]"]=Be["[object Float64Array]"]=Be["[object Int8Array]"]=Be["[object Int16Array]"]=Be["[object Int32Array]"]=Be["[object Uint8Array]"]=Be["[object Uint8ClampedArray]"]=Be["[object Uint16Array]"]=Be["[object Uint32Array]"]=!0,Be["[object Arguments]"]=Be["[object Array]"]=Be["[object ArrayBuffer]"]=Be["[object Boolean]"]=Be["[object DataView]"]=Be["[object Date]"]=Be["[object Error]"]=Be["[object Function]"]=Be["[object Map]"]=Be["[object Number]"]=Be["[object Object]"]=Be["[object RegExp]"]=Be["[object Set]"]=Be["[object String]"]=Be["[object WeakMap]"]=!1;var Fe=function(e){return p(e)&&ze(e.length)&&!!Be[f(e)]};var Ue=function(e){return function(t){return e(t)}},He=n(5),qe=He.a&&He.a.isTypedArray,We=qe?Ue(qe):Fe,$e=Object.prototype.hasOwnProperty;var Ge=function(e,t){var n=De(e),o=!n&&Re(e),i=!n&&!o&&Object(Le.a)(e),r=!n&&!o&&!i&&We(e),s=n||o||i||r,a=s?Ee(e.length,String):[],c=a.length;for(var l in e)!t&&!$e.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||je(l,c))||a.push(l);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 n in Object(e))Je.call(e,n)&&"constructor"!=n&&t.push(n);return t};var Xe=function(e){return null!=e&&ze(e.length)&&!z(e)};var et=function(e){return Xe(e)?Ge(e):Ze(e)};var tt=function(e,t){return e&&Se(t,et(t),e)};var nt=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},ot=Object.prototype.hasOwnProperty;var it=function(e){if(!V(e))return nt(e);var t=Ke(e),n=[];for(var o in e)("constructor"!=o||!t&&ot.call(e,o))&&n.push(o);return n};var rt=function(e){return Xe(e)?Ge(e,!0):it(e)};var st=function(e,t){return e&&Se(t,rt(t),e)},at=n(8);var ct=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n{this._setToTarget(e,o,t[o],n)})}}function rn(e){return tn(e,sn)}function sn(e){return nn(e)?e:void 0}var an=function(){return function e(){e.called=!0}};class cn{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=an(),this.off=an()}}const ln=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function dn(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+ln[e>>0&255]+ln[e>>8&255]+ln[e>>16&255]+ln[e>>24&255]+ln[t>>0&255]+ln[t>>8&255]+ln[t>>16&255]+ln[t>>24&255]+ln[n>>0&255]+ln[n>>8&255]+ln[n>>16&255]+ln[n>>24&255]+ln[o>>0&255]+ln[o>>8&255]+ln[o>>16&255]+ln[o>>24&255]}var un={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},hn=(n(6),n(0));const fn=Symbol("listeningTo"),mn=Symbol("emitterId");var gn={on(e,t,n={}){this.listenTo(this,e,t,n)},once(e,t,n){let o=!1;this.listenTo(this,e,(function(e,...n){o||(o=!0,e.off(),t.call(this,e,...n))}),n)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,n,o={}){let i,r;this[fn]||(this[fn]={});const s=this[fn];bn(e)||pn(e);const a=bn(e);(i=s[a])||(i=s[a]={emitter:e,callbacks:{}}),(r=i.callbacks[t])||(r=i.callbacks[t]=[]),r.push(n),function(e,t){const n=wn(e);if(n[t])return;let o=t,i=null;const r=[];for(;""!==o&&!n[o];)n[o]={callbacks:[],childEvents:[]},r.push(n[o]),i&&n[o].childEvents.push(i),i=o,o=o.substr(0,o.lastIndexOf(":"));if(""!==o){for(const e of r)e.callbacks=n[o].callbacks.slice();n[o].childEvents.push(i)}}(e,t);const c=kn(e,t),l=un.get(o.priority),d={callback:n,priority:l};for(const e of c){let t=!1;for(let n=0;n-1?e(t,n.substr(0,n.lastIndexOf(":"))):null;return o.callbacks}(this,o);if(n.path.push(this),i){const e=[n,...t];i=Array.from(i);for(let t=0;t{this._delegations||(this._delegations=new Map),e.forEach(e=>{const o=this._delegations.get(e);o?o.set(t,n):this._delegations.set(e,new Map([[t,n]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const n=this._delegations.get(e);n&&n.delete(t)}else this._delegations.delete(e);else this._delegations.clear()}};function pn(e,t){e[mn]||(e[mn]=t||dn())}function bn(e){return e[mn]}function wn(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function kn(e,t){const n=wn(e)[t];if(!n)return[];let o=[n.callbacks];for(let t=0;t{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(n=>{if(n in e.prototype)return;const o=Object.getOwnPropertyDescriptor(t,n);o.enumerable=!1,Object.defineProperty(e.prototype,n,o)})})}class An{constructor(e={},t={}){const n=yn(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)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 hn.b("collection-add-item-invalid-index: The index passed to Collection#addMany() is invalid.",this);for(let n=0;n{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,n=(n,o,i)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(o);if(r&&s)this._bindToExternalToInternalMap.set(o,s),this._bindToInternalToExternalMap.set(s,o);else{const n=e(o);if(!n)return void this._skippedIndexesFromExternal.push(i);let r=i;for(const e of this._skippedIndexesFromExternal)i>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(o,n),this._bindToInternalToExternalMap.set(n,o),this.add(n,r);for(let e=0;e{const o=this._bindToExternalToInternalMap.get(t);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(nt&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let n;if(t in e){if(n=e[t],"string"!=typeof n)throw new hn.b("collection-add-invalid-id: This item's id should be a string.",this);if(this.get(n))throw new hn.b("collection-add-item-already-exists: This item already exists in the collection.",this)}else e[t]=n=dn();return n}_remove(e){let t,n,o,i=!1;const r=this._idProperty;if("string"==typeof e?(n=e,o=this._itemMap.get(n),i=!o,o&&(t=this._items.indexOf(o))):"number"==typeof e?(t=e,o=this._items[t],i=!o,o&&(n=o[r])):(o=e,n=o[r],t=this._items.indexOf(o),i=-1==t||!this._itemMap.get(n)),i)throw new hn.b("collection-remove-404: Item not found.",this);this._items.splice(t,1),this._itemMap.delete(n);const s=this._bindToInternalToExternalMap.get(o);return this._bindToInternalToExternalMap.delete(o),this._bindToExternalToInternalMap.delete(s),this.fire("remove",o,t),[o,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}xn(An,gn);class Cn{constructor(e,t=[],n=[]){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 n)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){const t="plugincollection-plugin-not-loaded: The requested plugin is not loaded.";let n=e;throw"function"==typeof e&&(n=e.pluginName||e.name),new hn.b(t,this._context,{plugin:n})}return t}has(e){return this._plugins.has(e)}init(e,t=[]){const n=this,o=this._context,i=new Set,r=[],s=h(e),a=h(t),c=function(e){const t=[];for(const n of e)u(n)||t.push(n);return t.length?t:null}(e);if(c){const e="plugincollection-plugin-not-found: Some plugins are not available and could not be loaded.";return console.error(Object(hn.a)(e),{plugins:c}),Promise.reject(new hn.b(e,o,{plugins:c}))}return Promise.all(s.map(l)).then(()=>d(r,"init")).then(()=>d(r,"afterInit")).then(()=>r);function l(e){if(!a.includes(e)&&!n._plugins.has(e)&&!i.has(e))return function(e){return new Promise(s=>{i.add(e),e.requires&&e.requires.forEach(n=>{const i=u(n);if(e.isContextPlugin&&!i.isContextPlugin)throw new hn.b("plugincollection-context-required: Context plugin can not require plugin which is not a context plugin",null,{plugin:i.name,requiredBy:e.name});if(t.includes(i))throw new hn.b("plugincollection-required: Cannot load a plugin because one of its dependencies is listed inthe `removePlugins` option.",o,{plugin:i.name,requiredBy:e.name});l(i)});const a=n._contextPlugins.get(e)||new e(o);n._add(e,a),r.push(a),s()})}(e).catch(t=>{throw console.error(Object(hn.a)("plugincollection-load: It was not possible to load the plugin."),{plugin:e}),t})}function d(e,t){return e.reduce((e,o)=>o[t]?n._contextPlugins.has(o)?e:e.then(o[t].bind(o)):e,Promise.resolve())}function u(e){return"function"==typeof e?e:n._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 n=e.pluginName;if(n){if(this._plugins.has(n))throw new hn.b("plugincollection-plugin-name-conflict: Two plugins with the same name were loaded.",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}function Tn(e,t,n=1){if("number"!=typeof n)throw new hn.b("translation-service-quantity-not-a-number: Expecting `quantity` to be a number.",null,{quantity:n});const o=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===o&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const i=t.id||t.string;if(0===o||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,i))return 1!==n?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[i])return r[i];const a=Number(s(n));return r[i][a]}xn(Cn,gn),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const Pn=["ar","fa","he","ku","ug"];class Sn{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=En(this.uiLanguage),this.contentLanguageDirection=En(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=[]){Array.isArray(t)||(t=[t]),"string"==typeof e&&(e={string:e});const n=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,n)=>ne.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new hn.b("context-addEditor-private-context: Cannot add multiple editors to the context which is created by the editor.");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 n=new this(e);t(n.initPlugins().then(()=>n))})}}function In(e,t){const n=Math.min(e.length,t.length);for(let o=0;oe.data.length)throw new hn.b("view-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(n<0||t+n>e.data.length)throw new hn.b("view-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+n),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 n=e.includeSelf?this.textNode:this.parent;for(;null!==n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}}function Ln(e){return yn(e)?new Map(e):function(e){const t=new Map;for(const n in e)t.set(n,e[n]);return t}(e)}class Vn{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 n=jn(t,e);if(n)return{element:t,pattern:e,match:n}}return null}matchAll(...e){const t=[];for(const n of e)for(const e of this._patterns){const o=jn(n,e);o&&t.push({element:n,pattern:e,match:o})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function jn(e,t){if("function"==typeof t)return t(e);const n={};return t.name&&(n.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!n.name)||t.attributes&&(n.attributes=function(e,t){const n=[];for(const o in e){const i=e[o];if(!t.hasAttribute(o))return null;{const e=t.getAttribute(o);if(!0===i)n.push(o);else if(i instanceof RegExp){if(!i.test(e))return null;n.push(o)}else{if(e!==i)return null;n.push(o)}}}return n}(t.attributes,e),!n.attributes)?null:!(t.classes&&(n.classes=function(e,t){const n=[];for(const o of e)if(o instanceof RegExp){const e=t.getClassNames();for(const t of e)o.test(t)&&n.push(t);if(0===n.length)return null}else{if(!t.hasClass(o))return null;n.push(o)}return n}(t.classes,e),!n.classes))&&(!(t.styles&&(n.styles=function(e,t){const n=[];for(const o in e){const i=e[o];if(!t.hasStyle(o))return null;{const e=t.getStyle(o);if(i instanceof RegExp){if(!i.test(e))return null;n.push(o)}else{if(e!==i)return null;n.push(o)}}}return n}(t.styles,e),!n.styles))&&n)}var zn=function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==f(e)},Bn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fn=/^\w*$/;var Un=function(e,t){if(De(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!zn(e))||(Fn.test(e)||!Bn.test(e)||null!=t&&e in Object(t))};function Hn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,i=t?t.apply(this,o):o[0],r=n.cache;if(r.has(i))return r.get(i);var s=e.apply(this,o);return n.cache=r.set(i,s)||r,s};return n.cache=new(Hn.Cache||ke),n}Hn.Cache=ke;var qn=Hn;var Wn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$n=/\\(\\)?/g,Gn=function(e){var t=qn(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Wn,(function(e,n,o,i){t.push(o?i.replace($n,"$1"):n||e)})),t}));var Yn=function(e,t){for(var n=-1,o=null==e?0:e.length,i=Array(o);++ni?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++o0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(vo);var Ao=function(e,t){return xo(ko(e,t,po),e+"")};var Co=function(e,t,n){if(!V(n))return!1;var o=typeof t;return!!("number"==o?Xe(n)&&je(t,n.length):"string"==o&&t in n)&&A(n[t],e)};var To=function(e){return Ao((function(t,n){var o=-1,i=n.length,r=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,s&&Co(n[0],n[1],s)&&(r=i<3?void 0:r,i=1),t=Object(t);++ot===e);return Array.isArray(t)}set(e,t){if(V(e))for(const[t,n]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,n,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=No(e);so(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]&&!V(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 n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const n=t.splice(0,t.length-1).join("."),o=ao(this._styles,n);if(!o)return;!Array.from(Object.keys(o)).length&&this.remove(n)}}class Io{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(V(t))Oo(n,No(e),t);else if(this._normalizers.has(e)){const o=this._normalizers.get(e),{path:i,value:r}=o(t);Oo(n,i,r)}else Oo(n,e,t)}getNormalized(e,t){if(!e)return Po({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if("string"==typeof n)return ao(t,n);const o=n(e,t);if(o)return o}return ao(t,No(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);if(void 0===n)return[];if(this._reducers.has(e)){return this._reducers.get(e)(n)}return[[e,n]]}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 n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function No(e){return e.replace("-",".")}function Oo(e,t,n){let o=n;V(n)&&(o=Po({},ao(e,t),n)),Eo(e,t,o)}class Ro extends On{constructor(e,t,n,o){if(super(e),this.name=t,this._attrs=function(e){e=Ln(e);for(const[t,n]of e)null===n?e.delete(t):"string"!=typeof n&&e.set(t,String(n));return e}(n),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");Do(this._classes,e),this._attrs.delete("class")}this._styles=new Mo(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 Ro))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,n]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==n)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 Vn(...e);let n=this.parent;for(;n;){if(t.match(n))return n;n=n.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(),n=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==n?"":" "+n)}_clone(e=!1){const t=[];if(e)for(const n of this.getChildren())t.push(n._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let n=0;const o=function(e,t){if("string"==typeof t)return[new Rn(e,t)];yn(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Rn(e,t):t instanceof Dn?new Rn(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.add(e))}_removeClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.delete(e))}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._styles.remove(e))}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function Do(e,t){const n=t.split(/\s+/);e.clear(),n.forEach(t=>e.add(t))}class Lo extends Ro{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=Vo}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 Vo(){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 jo=To((function(e,t){Se(t,rt(t),e)}));const zo=Symbol("observableProperties"),Bo=Symbol("boundObservables"),Fo=Symbol("boundProperties"),Uo={set(e,t){if(V(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);qo(this);const n=this[zo];if(e in this&&!n.has(e))throw new hn.b("observable-set-cannot-override: Cannot override an existing property.",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>n.get(e),set(t){const o=n.get(e);let i=this.fire("set:"+e,e,t,o);void 0===i&&(i=t),o===i&&n.has(e)||(n.set(e,i),this.fire("change:"+e,e,i,o))}}),this[e]=t},bind(...e){if(!e.length||!Go(e))throw new hn.b("observable-bind-wrong-properties: All properties must be strings.",this);if(new Set(e).size!==e.length)throw new hn.b("observable-bind-duplicate-properties: Properties must be unique.",this);qo(this);const t=this[Fo];e.forEach(e=>{if(t.has(e))throw new hn.b("observable-bind-rebind: Cannot bind the same property more than once.",this)});const n=new Map;return e.forEach(e=>{const o={property:e,to:[]};t.set(e,o),n.set(e,o)}),{to:Wo,toMany:$o,_observable:this,_bindProperties:e,_to:[],_bindings:n}},unbind(...e){if(!this[zo])return;const t=this[Fo],n=this[Bo];if(e.length){if(!Go(e))throw new hn.b("observable-unbind-wrong-properties: Properties must be strings.",this);e.forEach(e=>{const o=t.get(e);if(!o)return;let i,r,s,a;o.to.forEach(e=>{i=e[0],r=e[1],s=n.get(i),a=s[r],a.delete(o),a.size||delete s[r],Object.keys(s).length||(n.delete(i),this.stopListening(i,"change"))}),t.delete(e)})}else n.forEach((e,t)=>{this.stopListening(t,"change")}),n.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new hn.b("observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.",this,{object:this,methodName:e});this.on(e,(e,n)=>{e.return=t.apply(this,n)}),this[e]=function(...t){return this.fire(e,t)}}};jo(Uo,gn);var Ho=Uo;function qo(e){e[zo]||(Object.defineProperty(e,zo,{value:new Map}),Object.defineProperty(e,Bo,{value:new Map}),Object.defineProperty(e,Fo,{value:new Map}))}function Wo(...e){const t=function(...e){if(!e.length)throw new hn.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);const t={to:[]};let n;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)n.properties.push(e);else{if("object"!=typeof e)throw new hn.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);n={observable:e,properties:[]},t.to.push(n)}}),t}(...e),n=Array.from(this._bindings.keys()),o=n.length;if(!t.callback&&t.to.length>1)throw new hn.b("observable-bind-to-no-callback: Binding multiple observables only possible with callback.",this);if(o>1&&t.callback)throw new hn.b("observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.",this);var i;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==o)throw new hn.b("observable-bind-to-properties-length: The number of properties must match.",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(n[0]).callback=t.callback),i=this._observable,this._to.forEach(e=>{const t=i[Bo];let n;t.get(e.observable)||i.listenTo(e.observable,"change",(o,r)=>{n=t.get(e.observable)[r],n&&n.forEach(e=>{Yo(i,e.property)})})}),function(e){let t;e._bindings.forEach((n,o)=>{e._to.forEach(i=>{t=i.properties[n.callback?0:e._bindProperties.indexOf(o)],n.to.push([i.observable,t]),function(e,t,n,o){const i=e[Bo],r=i.get(n),s=r||{};s[o]||(s[o]=new Set);s[o].add(t),r||i.set(n,s)}(e._observable,n,i.observable,t)})})}(this),this._bindProperties.forEach(e=>{Yo(this._observable,e)})}function $o(e,t,n){if(this._bindings.size>1)throw new hn.b("observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().",this);this.to(...function(e,t){const n=e.map(e=>[e,t]);return Array.prototype.concat.apply([],n)}(e,t),n)}function Go(e){return e.every(e=>"string"==typeof e)}function Yo(e,t){const n=e[Fo].get(t);let o;n.callback?o=n.callback.apply(e,n.to.map(e=>e[0][e[1]])):(o=n.to[0],o=o[0][o[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=o:e.set(t,o)}class Ko extends Lo{constructor(e,t,n,o){super(e,t,n,o),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}is(e,t=null){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}destroy(){this.stopListening()}}xn(Ko,Ho);const Qo=Symbol("rootName");class Jo extends Ko{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(Qo)}set rootName(e){this._setCustomProperty(Qo,e)}set _name(e){this.name=e}}class Zo{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new hn.b("view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new hn.b("view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=Xo._createAt(e.startPosition):this.position=Xo._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,n,o;do{o=this.position,({done:t,value:n}=this.next())}while(!t&&e(n));t||(this.position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&e.offset===n.childCount)return{done:!0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let o;if(n instanceof Rn){if(e.isAtEnd)return this.position=Xo._createAfter(n),this._next();o=n.data[e.offset]}else o=n.getChild(e.offset);if(o instanceof Ro)return this.shallow?e.offset++:e=new Xo(o,0),this.position=e,this._formatReturnValue("elementStart",o,t,e,1);if(o instanceof Rn){if(this.singleCharacters)return e=new Xo(o,0),this.position=e,this._next();{let n,i=o.data.length;return o==this._boundaryEndParent?(i=this.boundaries.end.offset,n=new Dn(o,0,i),e=Xo._createAfter(n)):(n=new Dn(o,0,o.data.length),e.offset++),this.position=e,this._formatReturnValue("text",n,t,e,i)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{o=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset}const i=new Dn(n,e.offset,o);return e.offset+=o,this.position=e,this._formatReturnValue("text",i,t,e,o)}return e=Xo._createAfter(n),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(null===n.parent&&0===e.offset)return{done:!0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let o;if(n instanceof Rn){if(e.isAtStart)return this.position=Xo._createBefore(n),this._previous();o=n.data[e.offset-1]}else o=n.getChild(e.offset-1);if(o instanceof Ro)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",o,t,e,1)):(e=new Xo(o,o.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",o,t,e));if(o instanceof Rn){if(this.singleCharacters)return e=new Xo(o,o.data.length),this.position=e,this._previous();{let n,i=o.data.length;if(o==this._boundaryStartParent){const t=this.boundaries.start.offset;n=new Dn(o,t,o.data.length-t),i=n.data.length,e=Xo._createBefore(n)}else n=new Dn(o,0,o.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",n,t,e,i)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{const t=n===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-t}e.offset-=o;const i=new Dn(n,e.offset,o);return this.position=e,this._formatReturnValue("text",i,t,e,o)}return e=Xo._createBefore(n),this.position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,o,i){return t instanceof Dn&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=Xo._createAfter(t.textNode):(o=Xo._createAfter(t.textNode),this.position=o)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=Xo._createBefore(t.textNode):(o=Xo._createBefore(t.textNode),this.position=o))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:o,length:i}}}}class Xo{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 Ko);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=Xo._createAt(this),n=t.offset+e;return t.offset=n<0?0:n,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new Zo(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let o=0;for(;t[o]==n[o]&&t[o];)o++;return 0===o?null:t[o-1]}is(e){return"position"===e||"view:position"===e}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const o=In(t,n);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]0?new this(n,o):new this(o,n)}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(Xo._createBefore(e),t)}}function ti(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function ni(e){let t=0;for(const n of e)t++;return t}class oi{constructor(e=null,t,n){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,n)}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 n=!1;for(const o of e._ranges)if(t.isEqual(o)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=ni(this.getRanges());if(t!=ni(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let n=!1;for(let o of e.getRanges())if(o=o.getTrimmed(),t.start.isEqual(o.start)&&t.end.isEqual(o.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,n){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof oi||e instanceof ii)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof ei)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof Xo)this._setRanges([new ei(e)]),this._setFakeOptions(t);else if(e instanceof On){const o=!!n&&!!n.backward;let i;if(void 0===t)throw new hn.b("view-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",this);i="in"==t?ei._createIn(e):"on"==t?ei._createOn(e):new ei(Xo._createAt(e,t)),this._setRanges([i],o),this._setFakeOptions(n)}else{if(!yn(e))throw new hn.b("view-selection-setTo-not-selectable: Cannot set selection to given place.",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new hn.b("view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",this);const n=Xo._createAt(e,t);if("same"==n.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==n.compareWith(o)?this._addRange(new ei(n,o),!0):this._addRange(new ei(o,n)),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 ei))throw new hn.b("view-selection-add-range-not-range: Selection range set to an object that is not an instance of view.Range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new hn.b("view-selection-range-intersects: Trying to add a range that intersects with another range from selection.",this,{addedRange:e,intersectingRange:t});this._ranges.push(new ei(e.start,e.end))}}xn(oi,gn);class ii{constructor(e=null,t,n){this._selection=new oi,this._selection.delegate("change").to(this),this._selection.setTo(e,t,n)}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,n){this._selection.setTo(e,t,n)}_setFocus(e,t){this._selection.setFocus(e,t)}}xn(ii,gn);class ri{constructor(e){this.selection=new ii,this.roots=new An({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 n of this._postFixers)if(t=n(e),t)break}while(t)}}xn(ri,Ho);class si extends Ro{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=ai,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 hn.b("attribute-element-get-elements-with-same-id-no-id: Cannot get elements with the same id for an attribute element without 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 ai(){if(ci(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(ci(e)>1)return null;e=e.parent}return!e||ci(e)>1?null:this.childCount}function ci(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}si.DEFAULT_PRIORITY=10;class li extends Ro{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=di}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 On||Array.from(t).length>0))throw new hn.b("view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.",[this,t])}}function di(){return null}const ui=navigator.userAgent.toLowerCase();var hi={isMac:function(e){return e.indexOf("macintosh")>-1}(ui),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(ui),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(ui),isAndroid:function(e){return e.indexOf("android")>-1}(ui),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const fi={"⌘":"ctrl","⇧":"shift","⌥":"alt"},mi={ctrl:"⌘",shift:"⇧",alt:"⌥"},gi=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 n=String.fromCharCode(t);e[n.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 pi(e){let t;if("string"==typeof e){if(t=gi[e.toLowerCase()],!t)throw new hn.b("keyboard-unknown-key: Unknown key name.",null,{key:e})}else t=e.keyCode+(e.altKey?gi.alt:0)+(e.ctrlKey?gi.ctrl:0)+(e.shiftKey?gi.shift:0);return t}function bi(e){return"string"==typeof e&&(e=yi(e)),e.map(e=>"string"==typeof e?pi(e):e).reduce((e,t)=>t+e,0)}function wi(e){return hi.isMac?yi(e).map(e=>mi[e.toLowerCase()]||e).reduce((e,t)=>e.slice(-1)in fi?e+t:e+"+"+t):e}function ki(e){return e==gi.arrowright||e==gi.arrowleft||e==gi.arrowup||e==gi.arrowdown}function _i(e,t){const n="ltr"===t;switch(e){case gi.arrowleft:return n?"left":"right";case gi.arrowright:return n?"right":"left";case gi.arrowup:return"up";case gi.arrowdown:return"down"}}function vi(e,t){const n=_i(e,t);return"down"===n||"right"===n}function yi(e){return e.split(/\s*\+\s*/)}class xi extends Ro{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=Ci}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 On||Array.from(t).length>0))throw new hn.b("view-uielement-cannot-add: Cannot add child nodes to UIElement instance.",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 Ai(e){e.document.on("keydown",(t,n)=>function(e,t,n){if(t.keyCode==gi.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),o=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(o||t.shiftKey){const t=e.focusNode,i=e.focusOffset,r=n.domPositionToView(t,i);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=n.viewPositionToDom(a);o?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,n,e.domConverter))}function Ci(){return null}class Ti extends Ro{constructor(e,t,n,o){super(e,t,n,o),this.getFillerOffset=Pi}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 On||Array.from(t).length>0))throw new hn.b("view-rawelement-cannot-add: Cannot add child nodes to a RawElement instance.",[this,t])}}function Pi(){return null}class Si{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 n=0;const o=function(e,t){if("string"==typeof t)return[new Rn(e,t)];yn(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new Rn(e,t):t instanceof Dn?new Rn(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n{}),o}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){y(e)&&void 0===n&&(n=t),n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof Xo?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new hn.b("view-writer-break-non-container-element: Trying to break an element which is not a container element.",this.document);if(!t.parent)throw new hn.b("view-writer-break-root: Trying to break root element.",this.document);if(e.isAtStart)return Xo._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(Xo._createAfter(t),n);const o=new ei(e,Xo._createAt(t,"end")),i=new Xo(n,0);this.move(o,i)}return Xo._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("$text"))return e;if(n.is("attributeElement")&&0===n.childCount){const e=n.parent,t=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new Xo(e,t))}const o=n.getChild(t-1),i=n.getChild(t);if(!o||!i)return e;if(o.is("$text")&&i.is("$text"))return Ri(o,i);if(o.is("attributeElement")&&i.is("attributeElement")&&o.isSimilar(i)){const e=o.childCount;return o._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new Xo(o,e))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!(t&&n&&t.is("containerElement")&&n.is("containerElement")))throw new hn.b("view-writer-merge-containers-invalid-position: Element before and after given position cannot be merged.",this.document);const o=t.getChild(t.childCount-1),i=o instanceof Rn?Xo._createAt(o,"end"):Xo._createAt(t,"end");return this.move(ei._createIn(n),Xo._createAt(t,"end")),this.remove(ei._createOn(n)),i}insert(e,t){(function e(t,n){for(const o of t){if(!Di.some(e=>o instanceof e))throw new hn.b("view-writer-insert-invalid-node-type: One of the nodes to be inserted is of invalid type.",n);o.is("$text")||e(o.getChildren(),n)}})(t=yn(t)?[...t]:[t],this.document);const n=Mi(e);if(!n)throw new hn.b("view-writer-invalid-position-container: Position's parent container cannot be found.",this.document);const o=this._breakAttributes(e,!0),i=n._insertChild(o.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=o.getShiftedBy(i),s=this.mergeAttributes(o);if(0===i)return new ei(s,s);{s.isEqual(o)||r.offset--;const e=this.mergeAttributes(r);return new ei(s,e)}}remove(e){const t=e instanceof ei?e:ei._createOn(e);if(Vi(t,this.document),t.isCollapsed)return new Si(this.document);const{start:n,end:o}=this._breakAttributesRange(t,!0),i=n.parent,r=o.offset-n.offset,s=i._removeChildren(n.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(n);return t.start=a,t.end=a.clone(),new Si(this.document,s)}clear(e,t){Vi(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const o of n){const n=o.item;let i;if(n.is("element")&&t.isSimilar(n))i=ei._createOn(n);else if(!o.nextPosition.isAfter(e.start)&&n.is("$textProxy")){const e=n.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(i=ei._createIn(e))}i&&(i.end.isAfter(e.end)&&(i.end=e.end),i.start.isBefore(e.start)&&(i.start=e.start),this.remove(i))}}move(e,t){let n;if(t.isAfter(e.end)){const o=(t=this._breakAttributes(t,!0)).parent,i=o.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=o.childCount-i}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof si))throw new hn.b("view-writer-wrap-invalid-attribute: DowncastWriter#wrap() must be called with an attribute element.",this.document);if(Vi(e,this.document),e.isCollapsed){let o=e.start;o.parent.is("element")&&(n=o.parent,!Array.from(n.getChildren()).some(e=>!e.is("uiElement")))&&(o=o.getLastMatchingPosition(e=>e.item.is("uiElement"))),o=this._wrapPosition(o,t);const i=this.document.selection;return i.isCollapsed&&i.getFirstPosition().isEqual(e.start)&&this.setSelection(o),new ei(o)}return this._wrapRange(e,t);var n}unwrap(e,t){if(!(t instanceof si))throw new hn.b("view-writer-unwrap-invalid-attribute: DowncastWriter#unwrap() must be called with an attribute element.",this.document);if(Vi(e,this.document),e.isCollapsed)return e;const{start:n,end:o}=this._breakAttributesRange(e,!0),i=n.parent,r=this._unwrapChildren(i,n.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ei(s,a)}rename(e,t){const n=new Lo(this.document,e,t.getAttributes());return this.insert(Xo._createAfter(t),n),this.move(ei._createIn(t),Xo._createAt(n,0)),this.remove(ei._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return Xo._createAt(e,t)}createPositionAfter(e){return Xo._createAfter(e)}createPositionBefore(e){return Xo._createBefore(e)}createRange(e,t){return new ei(e,t)}createRangeOn(e){return ei._createOn(e)}createRangeIn(e){return ei._createIn(e)}createSelection(e,t,n){return new oi(e,t,n)}_wrapChildren(e,t,n,o){let i=t;const r=[];for(;i!1,e.parent._insertChild(e.offset,n);const o=new ei(e,e.getShiftedBy(1));this.wrap(o,t);const i=new Xo(n.parent,n.index);n._remove();const r=i.nodeBefore,s=i.nodeAfter;return r instanceof Rn&&s instanceof Rn?Ri(r,s):Ni(i)}_wrapAttributeElement(e,t){if(!ji(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&(t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t));for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!ji(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if("class"!==n&&"style"!==n&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())"class"!==n&&"style"!==n&&this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,o=e.end;if(Vi(e,this.document),e.isCollapsed){const n=this._breakAttributes(e.start,t);return new ei(n,n)}const i=this._breakAttributes(o,t),r=i.parent.childCount,s=this._breakAttributes(n,t);return i.offset+=i.parent.childCount-r,new ei(s,i)}_breakAttributes(e,t=!1){const n=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new hn.b("view-writer-cannot-break-empty-element: Cannot break an EmptyElement instance.",this.document);if(e.parent.is("uiElement"))throw new hn.b("view-writer-cannot-break-ui-element: Cannot break a UIElement instance.",this.document);if(e.parent.is("rawElement"))throw new hn.b("view-writer-cannot-break-raw-element: Cannot break a RawElement instance.",this.document);if(!t&&o.is("$text")&&Li(o.parent))return e.clone();if(Li(o))return e.clone();if(o.is("$text"))return this._breakAttributes(Oi(e),t);if(n==o.childCount){const e=new Xo(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===n){const e=new Xo(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,i=o._clone();o.parent._insertChild(e,i),this._addToClonedElementsGroup(i);const r=o.childCount-n,s=o._removeChildren(n,r);i._appendChild(s);const a=new Xo(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function Mi(e){let t=e.parent;for(;!Li(t);){if(!t)return;t=t.parent}return t}function Ii(e,t){return e.priorityt.priority)&&e.getIdentity()e.createTextNode(" "),Fi=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},Ui=(()=>{let e="";for(let t=0;t<7;t++)e+="";return e})();function Hi(e){return zi(e)&&e.data.substr(0,7)===Ui}function qi(e){return 7==e.data.length&&Hi(e)}function Wi(e){return Hi(e)?e.data.slice(7):e.data}function $i(e,t){if(t.keyCode==gi.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,n=e.getRangeAt(0).startOffset;Hi(t)&&n<=7&&e.collapse(t,0)}}}function Gi(e,t,n,o=!1){n=n||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 i=function(e,t,n){const o=Yi(e,t,n);if(-1===o)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const i=Ki(e,o),r=Ki(t,o),s=Yi(i,r,n),a=e.length-s,c=t.length-s;return{firstIndex:o,lastIndexOld:a,lastIndexNew:c}}(e,t,n);return o?function(e,t){const{firstIndex:n,lastIndexOld:o,lastIndexNew:i}=e;if(-1===n)return Array(t).fill("equal");let r=[];n>0&&(r=r.concat(Array(n).fill("equal")));i-n>0&&(r=r.concat(Array(i-n).fill("insert")));o-n>0&&(r=r.concat(Array(o-n).fill("delete")));i0&&n.push({index:o,type:"insert",values:e.slice(o,r)});i-o>0&&n.push({index:o+(r-o),type:"delete",howMany:i-o});return n}(t,i)}function Yi(e,t,n){for(let o=0;o200||i>200||o+i>300)return Qi.fastDiff(e,t,n,!0);let r,s;if(il?-1:1;d[o+h]&&(d[o]=d[o+h].slice(0)),d[o]||(d[o]=[]),d[o].push(i>l?r:s);let f=Math.max(i,l),m=f-o;for(;ml;f--)u[f]=h(f);u[l]=h(l),m++}while(u[l]!==c);return d[l].slice(1)}function Ji(e,t,n){e.insertBefore(n,e.childNodes[t]||null)}function Zi(e){const t=e.parentNode;t&&t.removeChild(e)}function Xi(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}Qi.fastDiff=Gi;class er{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 hn.b("view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.",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),n=t.parent.ownerDocument;Hi(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=tr(n,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 n=this.domConverter.mapViewToDom(e).childNodes,o=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(n,o),r=this._findReplaceActions(i,n,o);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const i of r)if("replace"===i){const i=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(i);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,n[r]),Zi(o[i]),t.equal++}else t[i]++}}_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")?Xo._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&&zi(t.parent)&&Hi(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Hi(e))throw new hn.b("view-renderer-filler-was-lost: The inline filler node was lost.",this);qi(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,n=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(n===t.getFillerOffset())return!1;const o=e.nodeBefore,i=e.nodeAfter;return!(o instanceof Rn||i instanceof Rn)}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e),o=this.domConverter.viewToDom(e,n.ownerDocument),i=n.data;let r=o.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=Ui+r),i!=r){const e=Gi(i,r);for(const t of e)"insert"===t.type?n.insertData(t.index,t.values.join("")):n.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.attributes).map(e=>e.name),o=e.getAttributeKeys();for(const n of o)t.setAttribute(n,e.getAttribute(n));for(const o of n)e.hasAttribute(o)||t.removeAttribute(o)}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;const o=t.inlineFillerPosition,i=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,n.ownerDocument,{bind:!0,inlineFillerPosition:o}));o&&o.parent===e&&tr(n.ownerDocument,r,o.offset);const s=this._diffNodeLists(i,r);let a=0;const c=new Set;for(const e of s)"delete"===e?(c.add(i[a]),Zi(i[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(Ji(n,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of c)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return Qi(e=function(e,t){const n=Array.from(e);if(0==n.length||!t)return n;n[n.length-1]==t&&n.pop();return n}(e,this._fakeSelectionContainer),t,or.bind(null,this.domConverter))}_findReplaceActions(e,t,n){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let o=[],i=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(n[s.equal+s.insert]):"delete"===a?i.push(t[s.equal+s.delete]):(o=o.concat(Qi(i,r,nr).map(e=>"equal"===e?"replace":e)),o.push("equal"),i=[],r=[]),s[a]++;return o.concat(Qi(i,r,nr).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 Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;n.parentElement&&n.parentElement==e||e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const o=t.getSelection(),i=t.createRange();o.removeAllRanges(),i.selectNodeContents(n),o.addRange(i)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),t.collapse(n.parent,n.offset),t.extend(o.parent,o.offset),hi.isGecko&&function(e,t){const n=e.parent;if(n.nodeType!=Node.ELEMENT_NODE||e.offset!=n.childNodes.length-1)return;const o=n.childNodes[e.offset];o&&"BR"==o.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(n.anchorNode!==t&&!t.contains(n.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,n=this.domConverter.mapDomToView(t);t&&n&&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 tr(e,t,n){const o=t instanceof Array?t:t.childNodes,i=o[n];if(zi(i))return i.data=Ui+i.data,i;{const i=e.createTextNode(Ui);return Array.isArray(t)?o.splice(n,0,i):Ji(t,n,i),i}}function nr(e,t){return Xi(e)&&Xi(t)&&!zi(e)&&!zi(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function or(e,t,n){return t===n||(zi(t)&&zi(n)?t.data===n.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(n)))}xn(er,Ho);var ir={window:window,document:document};function rr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function sr(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const ar=Fi(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?Fi:Bi,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new oi(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,n={}){if(e.is("$text")){const n=this._processDataFromViewText(e);return t.createTextNode(n)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let o;if(e.is("documentFragment"))o=t.createDocumentFragment(),n.bind&&this.bindDocumentFragments(o,e);else{if(e.is("uiElement"))return o=e.render(t),n.bind&&this.bindElements(o,e),o;o=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(o),n.bind&&this.bindElements(o,e);for(const t of e.getAttributeKeys())o.setAttribute(t,e.getAttribute(t))}if(n.withChildren||void 0===n.withChildren)for(const i of this.viewChildrenToDom(e,t,n))o.appendChild(i);return o}}*viewChildrenToDom(e,t,n={}){const o=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren())o===i&&(yield this._blockFiller(t)),yield this.viewToDom(r,t,n),i++;o===i&&(yield this._blockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),o=document.createRange();return o.setStart(t.parent,t.offset),o.setEnd(n.parent,n.offset),o}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let o=e.offset;return Hi(n)&&(o+=7),{parent:n,offset:o}}{let n,o,i;if(0===e.offset){if(n=this.mapViewToDom(t),!n)return null;i=n.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!o)return null;n=o.parentNode,i=o.nextSibling}if(zi(i)&&Hi(i))return{parent:i,offset:7};return{parent:n,offset:o?rr(o)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const n=this.getHostViewElement(e,this._domToViewMapping);if(n)return n;if(zi(e)){if(qi(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new Rn(this.document,t)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let n;if(this.isDocumentFragment(e))n=new Si(this.document),t.bind&&this.bindDocumentFragments(e,n);else{const o=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();n=new Ro(this.document,o),t.bind&&this.bindElements(e,n);const i=e.attributes;for(let e=i.length-1;e>=0;e--)n._setAttribute(i[e].name,i[e].value)}if(t.withChildren||void 0===t.withChildren)for(const o of this.domChildrenToView(e,t))n._appendChild(o);return n}}*domChildrenToView(e,t={}){for(let n=0;n{const{scrollLeft:t,scrollTop:n}=e;o.push([t,n])}),t.focus(),dr(t,e=>{const[t,n]=o.shift();e.scrollLeft=t,e.scrollTop=n}),ir.window.scrollTo(e,n)}}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(ar):!("BR"!==e.tagName||!ur(e,this.blockElements)||1!==e.parentNode.childNodes.length)||function(e,t){return zi(e)&&" "==e.data&&ur(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 n=t.collapsed;return t.detach(),n}getHostViewElement(e){const t=sr(e);for(t.pop();t.length;){const e=t.pop(),n=this._domToViewMapping.get(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return n}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}_isDomSelectionPositionCorrect(e,t){if(zi(e)&&Hi(e)&&t<7)return!1;if(this.isElement(e)&&Hi(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!n||!n.is("uiElement")&&!n.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 n=this._getTouchingViewTextNode(e,!1);!(n&&this._nodeEndsWithSpace(n))&&n||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const n=this._getTouchingViewTextNode(e,!0);" "!=t.charAt(t.length-2)&&n&&" "!=n.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(lr(e,this.preElements))return Wi(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const n=this._getTouchingInlineDomNode(e,!1),o=this._getTouchingInlineDomNode(e,!0),i=this._checkShouldLeftTrimDomText(n),r=this._checkShouldRightTrimDomText(e,o);return i&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=Wi(new Text(t)),t=t.replace(/ \u00A0/g," "),(/( |\u00A0)\u00A0$/.test(t)||!o||o.data&&" "==o.data.charAt(0))&&(t=t.replace(/\u00A0$/," ")),i&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e){return!e||(!!nn(e)||/[^\S\u00A0]/.test(e.data.charAt(e.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!Hi(e)}_getTouchingViewTextNode(e,t){const n=new Zo({startPosition:t?Xo._createAfter(e):Xo._createBefore(e),direction:t?"forward":"backward"});for(const e of n){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 n=t?"nextNode":"previousNode",o=e.ownerDocument,i=sr(e)[0],r=o.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>zi(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});r.currentNode=e;const s=r[n]();if(null!==s){const t=function(e,t){const n=sr(e),o=sr(t);let i=0;for(;n[i]==o[i]&&n[i];)i++;return 0===i?null:n[i-1]}(e,s);if(t&&!lr(e,this.blockElements,t)&&!lr(s,this.blockElements,t))return s}return null}}function lr(e,t,n){let o=sr(e);return n&&(o=o.slice(o.indexOf(n)+1)),o.some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}function dr(e,t){for(;e&&e!=ir.document;)t(e),e=e.parentNode}function ur(e,t){const n=e.parentNode;return n&&n.tagName&&t.includes(n.tagName.toLowerCase())}function hr(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var fr=jo({},gn,{listenTo(e,...t){if(Xi(e)||hr(e)){const n=this._getProxyEmitter(e)||new mr(e);n.attach(...t),e=n}gn.listenTo.call(this,e,...t)},stopListening(e,t,n){if(Xi(e)||hr(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}gn.stopListening.call(this,e,t,n),e instanceof mr&&e.detach(t)},_getProxyEmitter(e){return t=this,n=gr(e),t[fn]&&t[fn][n]?t[fn][n].emitter:null;var t,n}});class mr{constructor(e){pn(this,gr(e)),this._domNode=e}}function gr(e){return e["data-ck-expando"]||(e["data-ck-expando"]=dn())}jo(mr.prototype,gn,{attach(e,t,n={}){if(this._domListeners&&this._domListeners[e])return;const o={capture:!!n.useCapture,passive:!!n.usePassive},i=this._createDomListener(e,o);this._domNode.addEventListener(e,i,o),this._domListeners||(this._domListeners={}),this._domListeners[e]=i},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const n=t=>{this.fire(e,t)};return n.removeListener=()=>{this._domNode.removeEventListener(e,n,t),delete this._domListeners[e]},n}});class pr{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()}}xn(pr,fr);var br=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var wr=function(e){return this.__data__.has(e)};function kr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ke;++ta))return!1;var l=r.get(e);if(l&&r.get(t))return l==t;var d=-1,u=!0,h=2&n?new _r:void 0;for(r.set(e,t),r.set(t,e);++d{this.listenTo(e,t,(e,t)=>{this.isEnabled&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Lr(this.view,t,n))}}class jr extends Vr{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 pi(this)}})}}var zr=function(){return o.a.Date.now()},Br=/^\s+|\s+$/g,Fr=/^[-+]0x[0-9a-f]+$/i,Ur=/^0b[01]+$/i,Hr=/^0o[0-7]+$/i,qr=parseInt;var Wr=function(e){if("number"==typeof e)return e;if(zn(e))return NaN;if(V(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=V(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Br,"");var n=Ur.test(e);return n||Hr.test(e)?qr(e.slice(2),n?2:8):Fr.test(e)?NaN:+e},$r=Math.max,Gr=Math.min;var Yr=function(e,t,n){var o,i,r,s,a,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=o,r=i;return o=i=void 0,l=t,s=e.apply(r,n)}function m(e){return l=e,a=setTimeout(p,t),d?f(e):s}function g(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function p(){var e=zr();if(g(e))return b(e);a=setTimeout(p,function(e){var n=t-(e-c);return u?Gr(n,r-(e-l)):n}(e))}function b(e){return a=void 0,h&&o?f(e):(o=i=void 0,s)}function w(){var e=zr(),n=g(e);if(o=arguments,i=this,c=e,n){if(void 0===a)return m(c);if(u)return clearTimeout(a),a=setTimeout(p,t),f(c)}return void 0===a&&(a=setTimeout(p,t)),s}return t=Wr(t)||0,V(n)&&(d=!!n.leading,r=(u="maxWait"in n)?$r(Wr(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),w.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=i=a=void 0},w.flush=function(){return void 0===a?s:b(zr())},w};class Kr extends pr{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Yr(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(t,n)=>{var o;e.selection.isFake&&((o=n.keyCode)==gi.arrowright||o==gi.arrowleft||o==gi.arrowup||o==gi.arrowdown)&&this.isEnabled&&(n.preventDefault(),this._handleSelectionMove(n.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new oi(t.getRanges(),{backward:t.isBackward,fake:!1});e!=gi.arrowleft&&e!=gi.arrowup||n.setTo(n.getFirstPosition()),e!=gi.arrowright&&e!=gi.arrowdown||n.setTo(n.getLastPosition());const o={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}class Qr extends pr{constructor(e){super(e),this.mutationObserver=e.getObserver(Dr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Yr(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",()=>{this._handleSelectionChange(t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e){if(!this.isEnabled)return;this.mutationObserver.flush();const t=e.defaultView.getSelection(),n=this.domConverter.domSelectionToView(t);if(0!=n.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(n)&&this.domConverter.isDomSelectionCorrect(t)||++this._loopbackCounter>60))if(this.selection.isSimilar(n))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:n,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class Jr extends Vr{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",(n,o)=>{const i=t.selection.editableElement;null!==i&&i!==o.target||(t.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class Zr extends Vr{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 Xr extends Vr{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}function es(e){return"[object Range]"==Object.prototype.toString.apply(e)}function ts(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 ns=["top","right","bottom","left","width","height"];class os{constructor(e){const t=es(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),nn(e)||t)if(t){const t=os.getDomRangeRects(e);is(this,os.getBoundingRect(t))}else is(this,e.getBoundingClientRect());else if(hr(e)){const{innerWidth:t,innerHeight:n}=e;is(this,{top:0,right:t,bottom:n,left:0,width:t,height:n})}else is(this,e)}clone(){return new os(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 os(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(!rs(e)){let n=e.parentNode||e.commonAncestorContainer;for(;n&&!rs(n);){const e=new os(n),o=t.getIntersection(e);if(!o)return null;o.getArea()gs(e,o));const s=gs(e,o);if(as(o,s,t),o.parent!=o){if(i=o.frameElement,o=o.parent,!i)return}else o=null}}function as(e,t,n){const o=t.clone().moveBy(0,n),i=t.clone().moveBy(0,-n),r=new os(e).excludeScrollbarsAndBorders();if(![i,o].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;ds(i,r)?a-=r.top-t.top+n:ls(o,r)&&(a+=t.bottom-r.bottom+n),us(t,r)?s-=r.left-t.left+n:hs(t,r)&&(s+=t.right-r.right+n),e.scrollTo(s,a)}}function cs(e,t){const n=fs(e);let o,i;for(;e!=n.document.body;)i=t(),o=new os(e).excludeScrollbarsAndBorders(),o.contains(i)||(ds(i,o)?e.scrollTop-=o.top-i.top:ls(i,o)&&(e.scrollTop+=i.bottom-o.bottom),us(i,o)?e.scrollLeft-=o.left-i.left:hs(i,o)&&(e.scrollLeft+=i.right-o.right)),e=e.parentNode}function ls(e,t){return e.bottom>t.bottom}function ds(e,t){return e.topt.right}function fs(e){return es(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function ms(e){if(es(e)){let t=e.commonAncestorContainer;return zi(t)&&(t=t.parentNode),t}return e.parentNode}function gs(e,t){const n=fs(e),o=new os(e);if(n===t)return o;{let e=n;for(;e!=t;){const t=e.frameElement,n=new os(t).excludeScrollbarsAndBorders();o.moveBy(n.left,n.top),e=e.parent}}return o}Object.assign({},{scrollViewportToShowTarget:ss,scrollAncestorsToShowTarget:function(e){cs(ms(e),()=>new os(e))}});class ps{constructor(e){this.document=new ri(e),this.domConverter=new cr(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new er(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 Ei(this.document),this.addObserver(Dr),this.addObserver(Qr),this.addObserver(Jr),this.addObserver(jr),this.addObserver(Kr),this.addObserver(Zr),hi.isAndroid&&this.addObserver(Xr),this.document.on("keydown",$i),Ai(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 n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const o={};for(const{name:t,value:i}of Array.from(e.attributes))o[t]=i,"class"===t?this._writer.addClass(i.split(" "),n):this._writer.setAttribute(t,i,n);this._initialDomRootAttributes.set(e,o);const i=()=>{this._writer.setAttribute("contenteditable",!n.isReadOnly,n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};i(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),n.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),n.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),n.on("change:isReadOnly",()=>this.change(i)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const n of this._observers.values())n.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const n=this._initialDomRootAttributes.get(t);for(const e in n)t.setAttribute(e,n[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,n]of this.domRoots)t.observe(n,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&&ss({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 hn.b("cannot-change-view-tree: Attempting to make changes to the view when it is in an incorrect state: rendering or post-fixers are in progress. This may cause some unexpected behavior and inconsistency between the DOM and the view.",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){hn.b.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 Xo._createAt(e,t)}createPositionAfter(e){return Xo._createAfter(e)}createPositionBefore(e){return Xo._createBefore(e)}createRange(e,t){return new ei(e,t)}createRangeOn(e){return ei._createOn(e)}createRangeIn(e){return ei._createIn(e)}createSelection(e,t,n){return new oi(e,t,n)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}xn(ps,Ho);class bs{constructor(e){this.parent=null,this._attrs=Ln(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new hn.b("model-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new hn.b("model-node-not-found-in-parent: The node's parent does not contain this node.",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 n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),o=e.getAncestors(t);let i=0;for(;n[i]==o[i]&&n[i];)i++;return 0===i?null:n[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),o=In(t,n);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o](e[t[0]]=t[1],e),{})),e}is(e){return"node"===e||"model:node"===e}_clone(){return new bs(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Ln(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class ws extends bs{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 ws(this.data,this.getAttributes())}static fromJSON(e){return new ws(e.data,e.attributes)}}class ks{constructor(e,t,n){if(this.textNode=e,t<0||t>e.offsetSize)throw new hn.b("model-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(n<0||t+n>e.offsetSize)throw new hn.b("model-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+n),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 n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.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 _s{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 hn.b("model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const n of this._nodes){if(e>=t&&ee.toJSON())}}class vs extends bs{constructor(e,t,n){super(t),this.name=e,this._children=new _s,n&&this._insertChild(0,n)}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 n of e)t=t.getChild(t.offsetToIndex(n));return t}findAncestor(e,t={includeSelf:!1}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.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 vs(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new ws(e)];yn(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ws(e):e instanceof ks?new ws(e.data,e.getAttributes()):e)}(t);for(const e of n)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const e of n)e.parent=null;return n}static fromJSON(e){let t=null;if(e.children){t=[];for(const n of e.children)n.name?t.push(vs.fromJSON(n)):t.push(ws.fromJSON(n))}return new vs(e.name,e.attributes,t)}}class ys{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new hn.b("model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new hn.b("model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",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,n,o,i;do{o=this.position,i=this._visitedParent,({done:t,value:n}=this.next())}while(!t&&e(n));t||(this.position=o,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(null===n.parent&&t.offset===n.maxOffset)return{done:!0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const o=t.parent,i=Cs(t,o),r=i||Ts(t,o,i);if(r instanceof vs)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,xs("elementStart",r,e,t,1);if(r instanceof ws){let o;if(this.singleCharacters)o=1;else{let e=r.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offsete&&(e=this.boundaries.start.offset),o=t.offset-e}const i=t.offset-r.startOffset,s=new ks(r,i-o,o);return t.offset-=o,this.position=t,xs("text",s,e,t,o)}return t.path.pop(),this.position=t,this._visitedParent=n.parent,xs("elementStart",n,e,t,1)}}function xs(e,t,n,o,i){return{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:o,length:i}}}class As{constructor(e,t,n="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new hn.b("model-position-root-invalid: Position root invalid.",e);if(!(t instanceof Array)||0===t.length)throw new hn.b("model-position-path-incorrect-format: Position path must be an array with at least one item.",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=n}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;tn.path.length){if(t.offset!==o.maxOffset)return!1;t.path=t.path.slice(0,-1),o=o.parent,t.offset++}else{if(0!==n.offset)return!1;n.path=n.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==In(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 n;return t.containsPosition(this)||t.start.isEqual(this)?(n=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(n=n._getTransformedByDeletion(e.deletionPosition,1))):n=this.isEqual(e.deletionPosition)?As._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),n}_getTransformedByDeletion(e,t){const n=As._createAt(this);if(this.root!=e.root)return n;if("same"==In(e.getParentPath(),this.getParentPath())){if(e.offsetthis.offset)return null;n.offset-=t}}else if("prefix"==In(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;if(e.offset<=this.path[o]){if(e.offset+t>this.path[o])return null;n.path[o]-=t}}return n}_getTransformedByInsertion(e,t){const n=As._createAt(this);if(this.root!=e.root)return n;if("same"==In(e.getParentPath(),this.getParentPath()))(e.offsett+1;){const t=o.maxOffset-n.offset;0!==t&&e.push(new Ss(n,n.getShiftedBy(t))),n.path=n.path.slice(0,-1),n.offset++,o=o.parent}for(;n.path.length<=this.end.path.length;){const t=this.end.path[n.path.length-1],o=t-n.offset;0!==o&&e.push(new Ss(n,n.getShiftedBy(o))),n.offset=t,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new ys(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ys(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new ys(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 Ss(this.start,this.end)]}getTransformedByOperations(e){const t=[new Ss(this.start,this.end)];for(const n of e)for(let e=0;e0?new this(n,o):new this(o,n)}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 hn.b("range-create-from-ranges-empty-array: At least one range has to be passed.",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 n=e.indexOf(t),o=new this(t.start,t.end);if(n>0)for(let t=n-1;e[t].end.isEqual(o.start);t++)o.start=As._createAt(e[t].start);for(let t=n+1;t{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),o=this._viewToModelMapping.get(n),i=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=As._createAt(o,i)},{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 n=this._markerNameToElements.get(t)||new Set;n.add(e);const o=this._elementToMarkerNames.get(e)||new Set;o.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,o)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),0==n.size&&this._markerNameToElements.delete(t));const o=this._elementToMarkerNames.get(e);o&&(o.delete(t),0==o.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new Ss(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new ei(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 n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())n.add(t);else n.add(e);return n}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,n){if(n!=e){return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let o=0;for(let n=0;n1?t[0]+":"+t[1]:t[0]}class Ns{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e)}convertChanges(e,t,n){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,n);for(const t of e.getChanges())"insert"==t.type?this.convertInsert(Ss._createFromPositionAndShift(t.position,t.length),n):"remove"==t.type?this.convertRemove(t.position,t.length,t.name,n):this.convertAttribute(t.range,t.attributeKey,t.attributeOldValue,t.attributeNewValue,n);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const o=t.get(e).getRange();this.convertMarkerRemove(e,o,n),this.convertMarkerAdd(e,o,n)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,n)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of e){const e=t.item,n={item:e,range:Ss._createFromPositionAndShift(t.previousPosition,t.length)};this._testAndFire("insert",n);for(const t of e.getAttributeKeys())n.attributeKey=t,n.attributeOldValue=null,n.attributeNewValue=e.getAttribute(t),this._testAndFire("attribute:"+t,n)}this._clearConversionApi()}convertRemove(e,t,n,o){this.conversionApi.writer=o,this.fire("remove:"+n,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,n,o,i){this.conversionApi.writer=i,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const i of e){const e={item:i.item,range:Ss._createFromPositionAndShift(i.previousPosition,i.length),attributeKey:t,attributeOldValue:n,attributeNewValue:o};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}convertSelection(e,t,n){const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=n,this.conversionApi.consumable=this._createSelectionConsumable(e,o),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of o){const n=t.getRange();if(!Os(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const o={item:e,markerName:t.name,markerRange:n};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,o,this.conversionApi)}for(const t of e.getAttributeKeys()){const n={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+n.attributeKey)&&this.fire("attribute:"+n.attributeKey+":$text",n,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,t,n){if(!t.root.document||"$graveyard"==t.root.rootName)return;this.conversionApi.writer=n;const o="addMarker:"+e,i=new Ms;if(i.add(t,o),this.conversionApi.consumable=i,this.fire(o,{markerName:e,markerRange:t},this.conversionApi),i.test(t,o)){this.conversionApi.consumable=this._createConsumableForRange(t,o);for(const n of t.getItems()){if(!this.conversionApi.consumable.test(n,o))continue;const i={item:n,range:Ss._createOn(n),markerName:e,markerRange:t};this.fire(o,i,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,t,n){t.root.document&&"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=n,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_createInsertConsumable(e){const t=new Ms;for(const n of e){const e=n.item;t.add(e,"insert");for(const n of e.getAttributeKeys())t.add(e,"attribute:"+n)}return t}_createConsumableForRange(e,t){const n=new Ms;for(const o of e.getItems())n.add(o,t);return n}_createSelectionConsumable(e,t){const n=new Ms;n.add(e,"selection");for(const o of t)n.add(e,"addMarker:"+o.name);for(const t of e.getAttributeKeys())n.add(e,"attribute:"+t);return n}_testAndFire(e,t){if(!this.conversionApi.consumable.test(t.item,e))return;const n=t.item.name||"$text";this.fire(e+":"+n,t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}}function Os(e,t,n){const o=t.getRange(),i=Array.from(e.getAncestors());i.shift(),i.reverse();return!i.some(e=>{if(o.containsItem(e)){return!!n.toViewElement(e).getCustomProperty("addHighlight")}})}xn(Ns,gn);class Rs{constructor(e,t,n){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,n)}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 n=!1;for(const o of e._ranges)if(t.isEqual(o)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new Ss(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 Ss(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 Ss(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,n){if(null===e)this._setRanges([]);else if(e instanceof Rs)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof Ss)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof As)this._setRanges([new Ss(e)]);else if(e instanceof bs){const o=!!n&&!!n.backward;let i;if("in"==t)i=Ss._createIn(e);else if("on"==t)i=Ss._createOn(e);else{if(void 0===t)throw new hn.b("model-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",[this,e]);i=new Ss(As._createAt(e,t))}this._setRanges([i],o)}else{if(!yn(e))throw new hn.b("model-selection-setTo-not-selectable: Cannot set the selection to the given place.",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const n=(e=Array.from(e)).some(t=>{if(!(t instanceof Ss))throw new hn.b("model-selection-set-ranges-not-range: Selection range set to an object that is not an instance of model.Range.",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||n){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 hn.b("model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",[this,e]);const n=As._createAt(e,t);if("same"==n.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==n.compareWith(o)?(this._pushRange(new Ss(n,o)),this._lastRangeBackward=!0):(this._pushRange(new Ss(o,n)),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 n=Vs(t.start,e);n&&js(n,t)&&(yield n);for(const n of t.getWalker()){const o=n.item;"elementEnd"==n.type&&Ls(o,e,t)&&(yield o)}const o=Vs(t.end,e);o&&!t.end.isTouching(As._createAt(o,0))&&js(o,t)&&(yield o)}}containsEntireContent(e=this.anchor.root){const t=As._createAt(e,0),n=As._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new Ss(e.start,e.end))}_checkRange(e){for(let t=0;t0;)this._popRange()}_popRange(){this._ranges.pop()}}function Ds(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function Ls(e,t,n){return Ds(e,t)&&js(e,n)}function Vs(e,t){const n=e.parent.root.document.model.schema,o=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=o.find(e=>!i&&(i=n.isLimit(e),!i&&Ds(e,t)));return o.forEach(e=>t.add(e)),r}function js(e,t){const n=function(e){const t=e.root.document.model.schema;let n=e.parent;for(;n;){if(t.isBlock(n))return n;n=n.parent}}(e);if(!n)return!0;return!t.containsRange(Ss._createOn(n),!0)}xn(Rs,gn);class zs extends Ss{constructor(e,t){super(e,t),Bs.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new Ss(this.start,this.end)}static fromRange(e){return new zs(e.start,e.end)}}function Bs(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&Fs.call(this,n)},{priority:"low"})}function Fs(e){const t=this.getTransformedByOperation(e),n=Ss._createFromRanges(t),o=!n.isEqual(this),i=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let r=null;if(o){"$graveyard"==n.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=n.start,this.end=n.end,this.fire("change:range",t,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}xn(zs,gn);class Us{constructor(e){this._selection=new Hs(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)}is(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,n){this._selection.setTo(e,t,n)}_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:")}}xn(Us,gn);class Hs extends Rs{constructor(e){super(),this.markers=new An({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&"marker"!=n.type&&"rename"!=n.type&&"noop"!=n.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 hn.b("document-selection-wrong-position: Range from document selection starts or ends at incorrect position.",this,{range:e})}),this.listenTo(this._model.markers,"update",()=>this._updateMarkers()),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const n=e.document.differ;for(const o of n.getChanges()){if("insert"!=o.type)continue;const n=o.position.parent;o.length===n.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(n.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const o of t)e.removeAttribute(o,n)})}}(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{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}_updateMarkers(){const e=[];let t=!1;for(const t of this._model.markers){const n=t.getRange();for(const o of this.getRanges())n.containsRange(o,!o.isCollapsed)&&e.push(t)}const n=Array.from(this.markers);for(const n of e)this.markers.has(n)||(this.markers.add(n),t=!0);for(const n of Array.from(this.markers))e.includes(n)||(this.markers.remove(n),t=!0);t&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){const t=Ln(this._getSurroundingAttributes()),n=Ln(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())n.has(e)&&n.get(e)===t||o.push(e);for(const[e]of n)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,n=!0){const o=n?"normal":"low";if("low"==o&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,o),!0)}_removeAttribute(e,t=!0){const n=t?"normal":"low";return("low"!=n||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,n),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,n]of this.getAttributes())e.get(t)!==n&&this._removeAttribute(t,!1);for(const[n,o]of e){this._setAttribute(n,o,!1)&&t.add(n)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const n=t.substr("selection:".length);yield[n,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let n=null;if(this.isCollapsed){const o=e.textNode?e.textNode:e.nodeBefore,i=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=qs(o)),n||(n=qs(i)),!this.isGravityOverridden&&!n){let e=o;for(;e&&!t.isInline(e)&&!n;)e=e.previousSibling,n=qs(e)}if(!n){let e=i;for(;e&&!t.isInline(e)&&!n;)e=e.nextSibling,n=qs(e)}n||(n=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const o of e){if(o.item.is("element")&&t.isObject(o.item))break;if("text"==o.type){n=o.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function qs(e){return e instanceof ks||e instanceof ws?e.getAttributes():null}class Ws{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var $s=function(e){return en(e,5)};class Gs extends Ws{elementToElement(e){return this.add(function(e){return(e=$s(e)).view=Qs(e.view,"container"),t=>{var n;t.on("insert:"+e.model,(n=e.view,(e,t,o)=>{const i=n(t.item,o);if(!i)return;if(!o.consumable.consume(t.item,"insert"))return;const r=o.mapper.toViewPosition(t.range.start);o.mapper.bindElements(t.item,i),o.writer.insert(r,i)}),{priority:e.converterPriority||"normal"})}}(e))}attributeToElement(e){return this.add(function(e){e=$s(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]=Qs(e.view[t],"attribute");else e.view=Qs(e.view,"attribute");const n=Js(e);return o=>{o.on(t,function(e){return(t,n,o)=>{const i=e(n.attributeOldValue,o),r=e(n.attributeNewValue,o);if(!i&&!r)return;if(!o.consumable.consume(n.item,t.name))return;const s=o.writer,a=s.document.selection;if(n.item instanceof Rs||n.item instanceof Us)s.wrap(a.getFirstRange(),r);else{let e=o.mapper.toViewRange(n.range);null!==n.attributeOldValue&&i&&(e=s.unwrap(e,i)),null!==n.attributeNewValue&&r&&s.wrap(e,r)}}}(n),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=$s(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]=Zs(e.view[t]);else e.view=Zs(e.view);const n=Js(e);return o=>{var i;o.on(t,(i=n,(e,t,n)=>{const o=i(t.attributeOldValue,n),r=i(t.attributeNewValue,n);if(!o&&!r)return;if(!n.consumable.consume(t.item,e.name))return;const s=n.mapper.toViewElement(t.item),a=n.writer;if(!s)throw new hn.b("conversion-attribute-to-attribute-on-text: Trying to convert text node's attribute with attribute-to-attribute converter.",[t,n]);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e=Array.isArray(o.value)?o.value:[o.value];for(const t of e)a.removeClass(t,s)}else if("style"==o.key){const e=Object.keys(o.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(o.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=Array.isArray(r.value)?r.value:[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=$s(e)).view=Qs(e.view,"ui"),t=>{var n;t.on("addMarker:"+e.model,(n=e.view,(e,t,o)=>{t.isOpening=!0;const i=n(t,o);t.isOpening=!1;const r=n(t,o);if(!i||!r)return;const s=t.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,e.name))return;for(const t of s)if(!o.consumable.consume(t.item,e.name))return;const a=o.mapper,c=o.writer;c.insert(a.toViewPosition(s.start),i),o.mapper.bindElementToMarker(i,t.markerName),s.isCollapsed||(c.insert(a.toViewPosition(s.end),r),o.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,n)=>{const o=n.mapper.markerNameToElements(t.markerName);if(o){for(const e of o)n.mapper.unbindElementFromMarkerName(e,t.markerName),n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var n;t.on("addMarker:"+e.model,(n=e.view,(e,t,o)=>{if(!t.item)return;if(!(t.item instanceof Rs||t.item instanceof Us||t.item.is("$textProxy")))return;const i=Xs(n,t,o);if(!i)return;if(!o.consumable.consume(t.item,e.name))return;const r=o.writer,s=Ys(r,i),a=r.document.selection;if(t.item instanceof Rs||t.item instanceof Us)r.wrap(a.getFirstRange(),s,a);else{const e=o.mapper.toViewRange(t.range),n=r.wrap(e,s);for(const e of n.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){o.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,n,o)=>{if(!n.item)return;if(!(n.item instanceof vs))return;const i=Xs(e,n,o);if(!i)return;if(!o.consumable.test(n.item,t.name))return;const r=o.mapper.toViewElement(n.item);if(r&&r.getCustomProperty("addHighlight")){o.consumable.consume(n.item,t.name);for(const e of Ss._createIn(n.item))o.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,i,o.writer),o.mapper.bindElementToMarker(r,n.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,n,o)=>{if(n.markerRange.isCollapsed)return;const i=Xs(e,n,o);if(!i)return;const r=Ys(o.writer,i),s=o.mapper.markerNameToElements(n.markerName);if(s){for(const e of s)o.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("attributeElement")?o.writer.unwrap(o.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,i.id,o.writer);o.writer.clearClonedElementsGroup(n.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=$s(e)).model;e.view||(e.view=n=>({group:t,name:n.substr(e.model.length+1)}));return n=>{var o;n.on("addMarker:"+t,(o=e.view,(e,t,n)=>{const i=o(t.markerName,n);if(!i)return;const r=t.markerRange;n.consumable.consume(r,e.name)&&(Ks(r,!1,n,t,i),Ks(r,!0,n,t,i),e.stop())}),{priority:e.converterPriority||"normal"}),n.on("removeMarker:"+t,function(e){return(t,n,o)=>{const i=e(n.markerName,o);if(!i)return;const r=o.mapper.markerNameToElements(n.markerName);if(r){for(const e of r)o.mapper.unbindElementFromMarkerName(e,n.markerName),e.is("containerElement")?(s(`data-${i.group}-start-before`,e),s(`data-${i.group}-start-after`,e),s(`data-${i.group}-end-before`,e),s(`data-${i.group}-end-after`,e)):o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(n.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const n=new Set(t.getAttribute(e).split(","));n.delete(i.name),0==n.size?o.writer.removeAttribute(e,t):o.writer.setAttribute(e,Array.from(n).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Ys(e,t){const n=e.createAttributeElement("span",t.attributes);return t.classes&&n._addClass(t.classes),t.priority&&(n._priority=t.priority),n._id=t.id,n}function Ks(e,t,n,o,i){const r=t?e.start:e.end;if(n.schema.checkChild(r,"$text")){!function(e,t,n,o,i){const r=`${i.group}-${t?"start":"end"}`,s=i.name?{name:i.name}:null,a=n.writer.createUIElement(r,s);n.writer.insert(e,a),n.mapper.bindElementToMarker(a,o.markerName)}(n.mapper.toViewPosition(r),t,n,o,i)}else{let e,s;t&&r.nodeAfter||!t&&!r.nodeBefore?(e=r.nodeAfter,s=!0):(e=r.nodeBefore,s=!1);!function(e,t,n,o,i,r){const s=`data-${r.group}-${t?"start":"end"}-${n?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),o.writer.setAttribute(s,a.join(","),e),o.mapper.bindElementToMarker(e,i.markerName)}(n.mapper.toViewElement(e),t,s,n,o,i)}}function Qs(e,t){return"function"==typeof e?e:(n,o)=>function(e,t,n){"string"==typeof e&&(e={name:e});let o;const i=t.writer,r=Object.assign({},e.attributes);if("container"==n)o=i.createContainerElement(e.name,r);else if("attribute"==n){const t={priority:e.priority||si.DEFAULT_PRIORITY};o=i.createAttributeElement(e.name,r,t)}else o=i.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const n of t)i.setStyle(n,e.styles[n],o)}if(e.classes){const t=e.classes;if("string"==typeof t)i.addClass(t,o);else for(const e of t)i.addClass(e,o)}return o}(e,o,t)}function Js(e){return e.model.values?(t,n)=>{const o=e.view[t];return o?o(t,n):null}:e.view}function Zs(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function Xs(e,t,n){const o="function"==typeof e?e(t,n):e;return o?(o.priority||(o.priority=10),o.id||(o.id=t.markerName),o):null}function ea(e){const{schema:t,document:n}=e.model;for(const o of n.getRootNames()){const i=n.getRoot(o);if(i.isEmpty&&!t.checkChild(i,"$text")&&t.checkChild(i,"paragraph"))return e.insertElement("paragraph",i),!0}return!1}function ta(e,t,n){const o=n.createContext(e);return!!n.checkChild(o,"paragraph")&&!!n.checkChild(o.push("paragraph"),t)}function na(e,t){const n=t.createElement("paragraph");return t.insert(n,e),t.createPositionAt(n,0)}class oa extends Ws{elementToElement(e){return this.add(ia(e))}elementToAttribute(e){return this.add(function(e){aa(e=$s(e));const t=ca(e,!1),n=ra(e.view),o=n?"element:"+n:"element";return n=>{n.on(o,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=$s(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 n;if("class"==t||"style"==t){n={["class"==t?"classes":"styles"]:e.view.value}}else{const o=void 0===e.view.value?/[\s\S]*/:e.view.value;n={attributes:{[t]:o}}}e.view.name&&(n.name=e.view.name);return e.view=n,t}(e));aa(e,t);const n=ca(e,!0);return t=>{t.on("element",n,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return console.warn(Object(hn.a)("upcast-helpers-element-to-marker-deprecated: The UpcastHelpers#elementToMarker() method was deprecated and will be removed in the near future. Please use UpcastHelpers#dataToMarker() instead.")),this.add(function(e){return function(e){const t=e.model;e.model=(e,n)=>{const o="string"==typeof t?t:t(e,n);return n.writer.createElement("$marker",{"data-name":o})}}(e=$s(e)),ia(e)}(e))}dataToMarker(e){return this.add(function(e){(e=$s(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=sa(la(e,"start")),n=sa(la(e,"end"));return o=>{o.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),o.on("element:"+e.view+"-end",n,{priority:e.converterPriority||"normal"});const i=un.get("low"),r=un.get("highest"),s=un.get(e.converterPriority)/r;o.on("element",function(e){return(t,n,o)=>{const i="data-"+e.view;function r(t,i){for(const r of i){const i=e.model(r,o),s=o.writer.createElement("$marker",{"data-name":i});o.writer.insert(s,t),n.modelCursor.isEqual(t)?n.modelCursor=n.modelCursor.getShiftedBy(1):n.modelCursor=n.modelCursor._getTransformedByInsertion(t,1),n.modelRange=n.modelRange._getTransformedByInsertion(t,1)[0]}}n.modelRange||(n=Object.assign(n,o.convertChildren(n.viewItem,n.modelCursor))),o.consumable.consume(n.viewItem,{attributes:i+"-end-after"})&&r(n.modelRange.end,n.viewItem.getAttribute(i+"-end-after").split(",")),o.consumable.consume(n.viewItem,{attributes:i+"-start-after"})&&r(n.modelRange.end,n.viewItem.getAttribute(i+"-start-after").split(",")),o.consumable.consume(n.viewItem,{attributes:i+"-end-before"})&&r(n.modelRange.start,n.viewItem.getAttribute(i+"-end-before").split(",")),o.consumable.consume(n.viewItem,{attributes:i+"-start-before"})&&r(n.modelRange.start,n.viewItem.getAttribute(i+"-start-before").split(","))}}(e),{priority:i+s})}}(e))}}function ia(e){const t=sa(e=$s(e)),n=ra(e.view),o=n?"element:"+n:"element";return n=>{n.on(o,t,{priority:e.converterPriority||"normal"})}}function ra(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function sa(e){const t=new Vn(e.view);return(n,o,i)=>{const r=t.match(o.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!i.consumable.test(o.viewItem,s))return;const a=function(e,t,n){return e instanceof Function?e(t,n):n.writer.createElement(e)}(e.model,o.viewItem,i);a&&i.safeInsert(a,o.modelCursor)&&(i.consumable.consume(o.viewItem,s),i.convertChildren(o.viewItem,a),i.updateConversionResult(a,o))}}function aa(e,t=null){const n=null===t||(e=>e.getAttribute(t)),o="object"!=typeof e.model?e.model:e.model.key,i="object"!=typeof e.model||void 0===e.model.value?n:e.model.value;e.model={key:o,value:i}}function ca(e,t){const n=new Vn(e.view);return(o,i,r)=>{const s=n.match(i.viewItem);if(!s)return;const a=e.model.key,c="function"==typeof e.model.value?e.model.value(i.viewItem,r):e.model.value;if(null===c)return;if(!function(e,t){const n="function"==typeof e?e(t):e;if("object"==typeof n&&!ra(n))return!1;return!n.classes&&!n.attributes&&!n.styles}(e.view,i.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(i.viewItem,s.match))return;i.modelRange||(i=Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor)));(function(e,t,n,o){let i=!1;for(const r of Array.from(e.getItems({shallow:n})))o.schema.checkAttribute(r,t.key)&&(o.writer.setAttribute(t.key,t.value,r),i=!0);return i})(i.modelRange,{key:a,value:c},t,r)&&r.consumable.consume(i.viewItem,s.match)}}function la(e,t){const n={};return n.view=e.view+"-"+t,n.model=(t,n)=>{const o=t.getAttribute("name"),i=e.model(o,n);return n.writer.createElement("$marker",{"data-name":i})},n}class da{constructor(e,t){this.model=e,this.view=new ps(t),this.mapper=new Es,this.downcastDispatcher=new Ns({mapper:this.mapper,schema:e.schema});const n=this.model.document,o=n.selection,i=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(n,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(n.differ,i,e),this.downcastDispatcher.convertSelection(o,i,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(n,o)=>{const i=o.newSelection,r=[];for(const e of i.getRanges())r.push(t.toModelRange(e));const s=e.createSelection(r,{backward:i.isBackward});s.isEqual(e.document.selection)||e.change(e=>{e.setSelection(s)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,n)=>{if(!n.consumable.consume(t.item,"insert"))return;const o=n.writer,i=n.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(i,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,n)=>{const o=n.mapper.toViewPosition(t.position),i=t.position.getShiftedBy(t.length),r=n.mapper.toViewPosition(i,{isPhantom:!0}),s=n.writer.createRange(o,r),a=n.writer.remove(s.getTrimmed());for(const e of n.writer.createRangeIn(a).getItems())n.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const o=n.writer,i=o.document.selection;for(const e of i.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&n.writer.mergeAttributes(e.start);o.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const o=t.selection;if(o.isCollapsed)return;if(!n.consumable.consume(o,"selection"))return;const i=[];for(const e of o.getRanges()){const t=n.mapper.toViewRange(e);i.push(t)}n.writer.setSelection(i,{backward:o.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,n)=>{const o=t.selection;if(!o.isCollapsed)return;if(!n.consumable.consume(o,"selection"))return;const i=n.writer,r=o.getFirstPosition(),s=n.mapper.toViewPosition(r),a=i.breakAttributes(s);i.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new Jo(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}xn(da,Ho);class ua{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new hn.b("commandcollection-command-not-found: Command does not exist.",this,{commandName:e});return n.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 ha{constructor(){this._consumables=new Map}add(e,t){let n;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?n=this._consumables.get(e):(n=new fa(e),this._consumables.set(e,n)),n.add(t))}test(e,t){const n=this._consumables.get(e);return void 0===n?null:e.is("$text")||e.is("documentFragment")?n:n.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 n=this._consumables.get(e);void 0!==n&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const e of n)"style"!=e&&"class"!=e&&t.attributes.push(e);const o=e.getClassNames();for(const e of o)t.classes.push(e);const i=e.getStyleNames();for(const e of i)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new ha(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,ha.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=ha.createFrom(n,t);return t}}class fa{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 n=this._test(t,e[t]);if(!0!==n)return n}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 n=De(t)?t:[t],o=this._consumables[e];for(const t of n){if("attributes"===e&&("class"===t||"style"===t))throw new hn.b("viewconsumable-invalid-attribute: Classes and styles should be handled separately.",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",n=this._test(e,[...this._consumables[e].keys()]);if(!0!==n)return n}return!0}_consume(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const n=De(t)?t:[t],o=this._consumables[e];for(const t of n)if("attributes"!==e||"class"!==t&&"style"!==t){!1===o.get(t)&&o.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class ma{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new ga(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new ga(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new hn.b("schema-cannot-register-item-twice: A single item cannot be registered twice in the schema.",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new hn.b("schema-cannot-extend-missing-item: Cannot extend an item which was not registered yet.",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 n=this.getDefinition(e.last);return!!n&&n.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof As){const t=e.nodeBefore,n=e.nodeAfter;if(!(t instanceof vs))throw new hn.b("schema-check-merge-no-element-before: The node before the merge position must be an element.",this);if(!(n instanceof vs))throw new hn.b("schema-check-merge-no-element-after: The node after the merge position must be an element.",this);return this.checkMerge(t,n)}for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[n,o])=>{if(!o)return;const i=e(n,o);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[n,o])=>{const i=e(n,o);"boolean"==typeof i&&(t.stop(),t.return=i)},{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 Ss?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const n=t.getCommonAncestor();return e?e.getCommonAncestor(n,{includeSelf:!0}):n},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const n=[...e.getFirstPosition().getAncestors(),new ws("",e.getAttributes())];return this.checkAttribute(n,t)}{const n=e.getRanges();for(const e of n)for(const n of e)if(this.checkAttribute(n.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new Ss(e);let n,o;const i=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(n=new ys({boundaries:Ss._createIn(i),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(o=new ys({boundaries:Ss._createIn(i),startPosition:e}));for(const e of function*(e,t){let n=!1;for(;!n;){if(n=!0,e){const t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}}}(n,o)){const t=e.walker==n?"elementEnd":"elementStart",o=e.value;if(o.type==t&&this.isObject(o.item))return Ss._createOn(o.item);if(this.checkChild(o.nextPosition,"$text"))return new Ss(o.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("$text"))Ta(this,n,t);else{const e=Ss._createIn(n).getPositions();for(const n of e){Ta(this,n.nodeBefore||n.parent,t)}}}createContext(e){return new ga(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const o of n)e[o]=pa(t[o],o);for(const t of n)ba(e,t);for(const t of n)wa(e,t);for(const t of n)ka(e,t),_a(e,t);for(const t of n)va(e,t),ya(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,n=t.length-1){const o=t.getItem(n);if(e.allowIn.includes(o.name)){if(0==n)return!0;{const e=this.getDefinition(o);return this._checkContextMatch(e,t,n-1)}}return!1}*_getValidRangesForRange(e,t){let n=e.start,o=e.start;for(const i of e.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(Ss._createIn(i),t)),this.checkAttribute(i,t)||(n.isEqual(o)||(yield new Ss(n,o)),n=As._createAfter(i)),o=As._createAfter(i);n.isEqual(o)||(yield new Ss(n,o))}}xn(ma,Ho);class ga{constructor(e){if(e instanceof ga)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(Ca)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new ga([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function pa(e,t){const n={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,t){for(const n of e){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const o of e)t[o]=n[o]}}(e,n),xa(e,n,"allowIn"),xa(e,n,"allowContentOf"),xa(e,n,"allowWhere"),xa(e,n,"allowAttributes"),xa(e,n,"allowAttributesOf"),xa(e,n,"inheritTypesFrom"),function(e,t){for(const n of e){const e=n.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,n),n}function ba(e,t){for(const n of e[t].allowContentOf)if(e[n]){Aa(e,n).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function wa(e,t){for(const n of e[t].allowWhere){const o=e[n];if(o){const n=o.allowIn;e[t].allowIn.push(...n)}}delete e[t].allowWhere}function ka(e,t){for(const n of e[t].allowAttributesOf){const o=e[n];if(o){const n=o.allowAttributes;e[t].allowAttributes.push(...n)}}delete e[t].allowAttributesOf}function _a(e,t){const n=e[t];for(const t of n.inheritTypesFrom){const o=e[t];if(o){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const t of e)t in n||(n[t]=o[t])}}delete n.inheritTypesFrom}function va(e,t){const n=e[t],o=n.allowIn.filter(t=>e[t]);n.allowIn=Array.from(new Set(o))}function ya(e,t){const n=e[t];n.allowAttributes=Array.from(new Set(n.allowAttributes))}function xa(e,t,n){for(const o of e)"string"==typeof o[n]?t[n].push(o[n]):Array.isArray(o[n])&&t[n].push(...o[n])}function Aa(e,t){const n=e[t];return(o=e,Object.keys(o).map(e=>o[e])).filter(e=>e.allowIn.includes(n.name));var o}function Ca(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 Ta(e,t,n){for(const o of t.getAttributeKeys())e.checkAttribute(t,o)||n.removeAttribute(o,t)}class Pa{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,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let n;for(const o of new ga(e)){const e={};for(const t of o.getAttributeKeys())e[t]=o.getAttribute(t);const i=t.createElement(o.name,e);n&&t.append(i,n),n=As._createAt(i,0)}return n}(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=ha.createFrom(e),this.conversionApi.store={};const{modelRange:o}=this._convertItem(e,this._modelCursor),i=t.createDocumentFragment();if(o){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,i);i.markers=function(e,t){const n=new Set,o=new Map,i=Ss._createIn(e).getItems();for(const e of i)"$marker"==e.name&&n.add(e);for(const e of n){const n=e.getAttribute("data-name"),i=t.createPositionBefore(e);o.has(n)?o.get(n).end=i.clone():o.set(n,new Ss(i.clone())),t.remove(e)}return o}(i,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(e,t){const n=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,n,this.conversionApi):e.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof Ss))throw new hn.b("view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is("position")?t:As._createAt(t,0);const o=new Ss(n);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,n);e.modelRange instanceof Ss&&(o.end=e.modelRange.end,n=e.modelCursor)}return{modelRange:o,modelCursor:n}}_safeInsert(e,t){const n=this._splitToAllowedParent(e,t);return!!n&&(this.conversionApi.writer.insert(e,n.position),!0)}_updateConversionResult(e,t){const n=this._getSplitParts(e),o=this.conversionApi.writer;t.modelRange||(t.modelRange=o.createRange(o.createPositionBefore(e),o.createPositionAfter(n[n.length-1])));const i=this._cursorParents.get(e);t.modelCursor=i?o.createPositionAt(i,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:n,writer:o}=this.conversionApi;let i=n.findAllowedParent(t,e);if(i){if(i===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(i)&&(i=null)}if(!i)return ta(t,e,n)?{position:na(t,o)}:null;const r=this.conversionApi.writer.split(t,i),s=[];for(const e of r.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),n=e.item;this._registerSplitPair(t,n)}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 n=this._splitParts.get(e);this._splitParts.set(t,n),n.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()}}xn(Pa,gn);class Sa{constructor(e,t){this.model=e,this.stylesProcessor=t,this.processor,this.mapper=new Es,this.downcastDispatcher=new Ns({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,n)=>{if(!n.consumable.consume(t.item,"insert"))return;const o=n.writer,i=n.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(i,r)},{priority:"lowest"}),this.upcastDispatcher=new Pa({schema:e.schema}),this.viewDocument=new ri(t),this._viewWriter=new Ei(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:n,consumable:o,writer:i})=>{let r=t.modelCursor;if(!o.test(t.viewItem))return;if(!n.checkChild(r,"$text")){if(!ta(r,"$text",n))return;r=na(r,i)}o.consume(t.viewItem);const s=i.createText(t.viewItem.data);i.insert(s,r),t.modelRange=i.createRange(r,r.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",ea)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:n="empty"}=e;if(!this._checkIfRootsExists([t]))throw new hn.b("datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.",this);const o=this.model.document.getRoot(t);return"empty"!==n||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,e):""}stringify(e,t){const n=this.toView(e,t);return this.processor.toData(n)}toView(e,t){const n=this.viewDocument,o=this._viewWriter;this.mapper.clearBindings();const i=Ss._createIn(e),r=new Si(n);if(this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(i,o),!e.is("documentFragment")){const t=function(e){const t=[],n=e.root.document;if(!n)return[];const o=Ss._createIn(e);for(const e of n.model.markers){const n=o.getIntersection(e.getRange());n&&t.push([e.name,n])}return t}(e);for(const[e,n]of t)this.downcastDispatcher.convertMarkerAdd(e,n,o)}return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new hn.b("datacontroller-init-document-not-empty: Trying to set initial data to not empty document.",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new hn.b("datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.",this);return this.model.enqueueChange("transparent",e=>{for(const n of Object.keys(t)){const o=this.model.document.getRoot(n);e.insert(this.parse(t[n],o),o,0)}}),Promise.resolve()}set(e){let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new hn.b("datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.",this);this.model.enqueueChange("transparent",e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const n of Object.keys(t)){const o=this.model.document.getRoot(n);e.remove(e.createRangeIn(o)),e.insert(this.parse(t[n],o),o,0)}})}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change(n=>this.upcastDispatcher.convert(e,n,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}}xn(Sa,Ho);class Ea{constructor(e,t){this._helpers=new Map,this._downcast=Array.isArray(e)?e:[e],this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Array.isArray(t)?t:[t],this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new hn.b("conversion-add-alias-dispatcher-not-registered: Trying to register and alias for a dispatcher that nas not been registered.",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new hn.b("conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of Ma(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of Ma(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of Ma(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new hn.b("conversion-group-exists: Trying to register a group name that has already been registered.",this);const o=n?new Gs(t):new oa(t);this._helpers.set(e,o)}}function*Ma(e){if(e.model.values)for(const t of e.model.values){const n={key:e.model.key,value:t},o=e.view[t],i=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Ia(n,o,i)}else yield*Ia(e.model,e.view,e.upcastAlso)}function*Ia(e,t,n){if(yield{model:e,view:t},n){n=Array.isArray(n)?n:[n];for(const t of n)yield{model:e,view:t}}}class Na{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 Oa{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 Ra{constructor(e){this.markers=new Map,this._children=new _s,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 n of e)t=t.getChild(t.offsetToIndex(n));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 n of e)n.name?t.push(vs.fromJSON(n)):t.push(ws.fromJSON(n));return new Ra(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(e){if("string"==typeof e)return[new ws(e)];yn(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ws(e):e instanceof ks?new ws(e.data,e.getAttributes()):e)}(t);for(const e of n)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const e of n)e.parent=null;return n}}function Da(e,t){const n=(t=ja(t)).reduce((e,t)=>e+t.offsetSize,0),o=e.parent;Ba(e);const i=e.index;return o._insertChild(i,t),za(o,i+t.length),za(o,i),new Ss(e,e.getShiftedBy(n))}function La(e){if(!e.isFlat)throw new hn.b("operation-utils-remove-range-not-flat: Trying to remove a range which starts and ends in different element.",this);const t=e.start.parent;Ba(e.start),Ba(e.end);const n=t._removeChildren(e.start.index,e.end.index-e.start.index);return za(t,e.start.index),n}function Va(e,t){if(!e.isFlat)throw new hn.b("operation-utils-move-range-not-flat: Trying to move a range which starts and ends in different element.",this);const n=La(e);return Da(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),n)}function ja(e){const t=[];e instanceof Array||(e=[e]);for(let n=0;ne.maxOffset)throw new hn.b("move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.",this);if(e===t&&n=n&&this.targetPosition.path[e]e._clone(!0))),t=new $a(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 Wa(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffsete._clone(!0))),Da(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 n=[];for(const t of e.nodes)t.name?n.push(vs.fromJSON(t)):n.push(ws.fromJSON(t));const o=new $a(As.fromJSON(e.position,t),n,e.baseVersion);return o.shouldReceiveAttributes=e.shouldReceiveAttributes,o}}class Ga extends Oa{constructor(e,t,n,o,i,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=i,this._markers=o}get type(){return"marker"}clone(){return new Ga(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ga(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 Ga(e.name,e.oldRange?Ss.fromJSON(e.oldRange,t):null,e.newRange?Ss.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Ya extends Oa{constructor(e,t,n,o){super(o),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}clone(){return new Ya(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ya(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof vs))throw new hn.b("rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.",this);if(e.name!==this.oldName)throw new hn.b("rename-operation-wrong-name: Element to change has different name than operation's old 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 Ya(As.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Ka extends Oa{constructor(e,t,n,o,i){super(i),this.root=e,this.key=t,this.oldValue=n,this.newValue=o}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Ka(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Ka(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new hn.b("rootattribute-operation-not-a-root: The element to change is not a root element.",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new hn.b("rootattribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new hn.b("rootattribute-operation-attribute-exists: The attribute with given key already 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 hn.b("rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.",this,{rootName:e.root});return new Ka(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Qa extends Oa{constructor(e,t,n,o,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=o.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 Ss(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),n=new As(this.sourcePosition.root,t)._getTransformedByMergeOperation(this),o=new Ja(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return o.insertionPosition=n,o}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new hn.b("merge-operation-source-position-invalid: Merge source position is invalid.",this);if(!t.parent)throw new hn.b("merge-operation-target-position-invalid: Merge target position is invalid.",this);if(this.howMany!=e.maxOffset)throw new hn.b("merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.",this)}_execute(){const e=this.sourcePosition.parent;Va(Ss._createIn(e),this.targetPosition),Va(Ss._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 n=As.fromJSON(e.sourcePosition,t),o=As.fromJSON(e.targetPosition,t),i=As.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,o,i,e.baseVersion)}}class Ja extends Oa{constructor(e,t,n,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=Ja.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",this.graveyardPosition=n?n.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 Ss(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 Qa(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof Ss)for(const n of e.getItems())t(n);else t(e)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof Ss))throw new hn.b("writer-move-invalid-range: Invalid range to move.",this);if(!e.isFlat)throw new hn.b("writer-move-range-not-flat: Range to move is not flat.",this);const o=As._createAt(t,n);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!ic(e.root,o.root))throw new hn.b("writer-move-different-document: Range is going to be moved between different documents.",this);const i=e.root.document?e.root.document.version:null,r=new Wa(e.start,e.end.offset-e.start.offset,o,i);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof Ss?e:Ss._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),oc(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof vs))throw new hn.b("writer-merge-no-element-before: Node before merge position must be an element.",this);if(!(n instanceof vs))throw new hn.b("writer-merge-no-element-after: Node after merge position must be an element.",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}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,n){return this.model.createSelection(e,t,n)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(Ss._createIn(n),As._createAt(t,"end")),this.remove(n)}_merge(e){const t=As._createAt(e.nodeBefore,"end"),n=As._createAt(e.nodeAfter,0),o=e.root.document.graveyard,i=new As(o,[0]),r=e.root.document.version,s=new Qa(n,e.nodeAfter.maxOffset,t,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof vs))throw new hn.b("writer-rename-not-element-instance: Trying to rename an object which is not an instance of Element.",this);const n=e.root.document?e.root.document.version:null,o=new Ya(As._createBefore(e),e.name,t,n);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let n,o,i=e.parent;if(!i.parent)throw new hn.b("writer-split-element-no-parent: Element with no parent can not be split.",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new hn.b("writer-split-invalid-limit-element: Limit element is not a position ancestor.",this);do{const t=i.root.document?i.root.document.version:null,r=i.maxOffset-e.offset,s=new Ja(e,r,null,t);this.batch.addOperation(s),this.model.applyOperation(s),n||o||(n=i,o=e.parent.nextSibling),i=(e=this.createPositionAfter(e.parent)).parent}while(i!==t);return{position:e,range:new Ss(As._createAt(n,"end"),As._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new hn.b("writer-wrap-range-not-flat: Range to wrap is not flat.",this);const n=t instanceof vs?t:new vs(t);if(n.childCount>0)throw new hn.b("writer-wrap-element-not-empty: Element to wrap with is not empty.",this);if(null!==n.parent)throw new hn.b("writer-wrap-element-attached: Element to wrap with is already attached to tree model.",this);this.insert(n,e.start);const o=new Ss(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,As._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new hn.b("writer-unwrap-element-no-parent: Trying to unwrap an element which has no parent.",this);this.move(Ss._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new hn.b("writer-addMarker-no-usingOperation: The options.usingOperation parameter is required when adding a new marker.",this);const n=t.usingOperation,o=t.range,i=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new hn.b("writer-addMarker-marker-exists: Marker with provided name already exists.",this);if(!o)throw new hn.b("writer-addMarker-no-range: Range parameter is required when adding a new marker.",this);return n?(nc(this,e,null,o,i),this.model.markers.get(e)):this.model.markers._set(e,o,n,i)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n="string"==typeof e?e:e.name,o=this.model.markers.get(n);if(!o)throw new hn.b("writer-updateMarker-marker-not-exists: Marker with provided name does not exists.",this);if(!t)return void this.model.markers._refresh(o);const i="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:o.affectsData;if(!i&&!t.range&&!r)throw new hn.b("writer-updateMarker-wrong-options: One of the options is required - provide range, usingOperations or affectsData.",this);const a=o.getRange(),c=t.range?t.range:a;i&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?nc(this,n,null,c,s):(nc(this,n,a,null,s),this.model.markers._set(n,c,void 0,s)):o.managedUsingOperations?nc(this,n,a,c,s):this.model.markers._set(n,c,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new hn.b("writer-removeMarker-no-marker: Trying to remove marker which does not exist.",this);const n=this.model.markers.get(t);if(!n.managedUsingOperations)return void this.model.markers._remove(t);nc(this,t,n.getRange(),null,n.affectsData)}setSelection(e,t,n){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,n)}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,n]of Ln(e))this._setSelectionAttribute(t,n)}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 n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const o=Us._getStoreAttributeKey(e);this.setAttribute(o,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=Us._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new hn.b("writer-incorrect-use: Trying to use a writer outside the change() block.",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const o=n.getRange();let i=!1;if("move"===e)i=t.containsPosition(o.start)||t.start.isEqual(o.start)||t.containsPosition(o.end)||t.end.isEqual(o.end);else{const e=t.nodeBefore,n=t.nodeAfter,r=o.start.parent==e&&o.start.isAtEnd,s=o.end.parent==n&&0==o.end.offset,a=o.end.nodeAfter==n,c=o.start.nodeAfter==n;i=r||s||a||c}i&&this.updateMarker(n.name,{range:o})}}}function ec(e,t,n,o){const i=e.model,r=i.document;let s,a,c,l=o.start;for(const e of o.getWalker({shallow:!0}))c=e.item.getAttribute(t),s&&a!=c&&(a!=n&&d(),l=s),s=e.nextPosition,a=c;function d(){const o=new Ss(l,s),c=o.root.document?r.version:null,d=new Ha(o,t,a,n,c);e.batch.addOperation(d),i.applyOperation(d)}s instanceof As&&s!=l&&a!=n&&d()}function tc(e,t,n,o){const i=e.model,r=i.document,s=o.getAttribute(t);let a,c;if(s!=n){if(o.root===o){const e=o.document?r.version:null;c=new Ka(o,t,s,n,e)}else{a=new Ss(As._createBefore(o),e.createPositionAfter(o));const i=a.root.document?r.version:null;c=new Ha(a,t,s,n,i)}e.batch.addOperation(c),i.applyOperation(c)}}function nc(e,t,n,o,i){const r=e.model,s=r.document,a=new Ga(t,n,o,r.markers,i,s.version);e.batch.addOperation(a),r.applyOperation(a)}function oc(e,t,n,o){let i;if(e.root.document){const n=o.document,r=new As(n.graveyard,[0]);i=new Wa(e,t,r,n.version)}else i=new qa(e,t);n.addOperation(i),o.applyOperation(i)}function ic(e,t){return e===t||e instanceof Za&&t instanceof Za}class rc{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=Ss._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),n=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),n||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=Ss._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 n=e.graveyardPosition.parent;this._markInsert(n,e.graveyardPosition.offset,1);const o=e.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n,o){const i=this._changedMarkers.get(e);i?(i.newRange=n,i.affectsData=o,null==i.oldRange&&null==i.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:n,affectsData:o})}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.oldRange&&e.push({name:t,range:n.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)null!=n.newRange&&e.push({name:t,range:n.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 n=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offsete.position.root!=t.position.root?e.position.root.rootNamen.offset){if(o>i){const e={type:"attribute",offset:i,howMany:o-i,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offseti?(e.nodesToHandle=o-i,e.offset=i):e.nodesToHandle=0);if("remove"==n.type&&e.offsetn.offset){const i={type:"attribute",offset:n.offset,howMany:o-n.offset,count:this._changeCount++};this._handleChange(i,t),t.push(i),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==n.type&&(e.offset>=n.offset&&o<=i?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&o>=i&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n){return{type:"insert",position:As._createAt(e,t),name:n,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,n){return{type:"remove",position:As._createAt(e,t),name:n,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){const o=[];n=new Map(n);for(const[i,r]of t){const t=n.has(i)?n.get(i):null;t!==r&&o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),n.delete(i)}for(const[t,i]of n)o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:i,changeCount:this._changeCount++});return o}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),o=e.startOffset;if(n)for(const e of n)if("insert"==e.type&&o>=e.offset&&oo){for(let t=0;t{const n=t[0];if(n.isDocumentOperation&&n.baseVersion!==this.version)throw new hn.b("model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.",this,{operation:n})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&this.differ.bufferOperation(n)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&(this.version++,this.history.addOperation(n))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,n,o)=>{this.differ.bufferMarkerChange(t.name,n,o,t.affectsData),null===n&&t.on("change",(e,n)=>{this.differ.bufferMarkerChange(t.name,n,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new hn.b("model-document-createRoot-name-exists: Root with specified name already exists.",this,{name:t});const n=new Za(this,e,t);return this.roots.add(n),n}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=Nn(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,n=t.schema,o=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(o)||t.createRange(o)}_validateSelectionRange(e){return fc(e.start)&&fc(e.end)}_callPostFixers(e){let t=!1;do{for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break}while(t)}}function fc(e){const t=e.textNode;if(t){const n=t.data,o=e.offset-t.startOffset;return!dc(n,o)&&!uc(n,o)}return!0}xn(hc,gn);class mc{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,n=!1,o=!1){const i=e instanceof gc?e.name:e;if(i.includes(","))throw new hn.b('markercollection-incorrect-marker-name: Marker name cannot contain the "," character.',this);const r=this._markers.get(i);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(zs.fromRange(t)),s=!0),n!=r.managedUsingOperations&&(r._managedUsingOperations=n,s=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,s=!0),s&&this.fire("update:"+i,r,e,t),r}const s=zs.fromRange(t),a=new gc(i,s,n,o);return this._markers.set(i,a),this.fire("update:"+i,a,null,t),a}_remove(e){const t=e instanceof gc?e.name:e,n=this._markers.get(t);return!!n&&(this._markers.delete(t),this.fire("update:"+t,n,n.getRange(),null),this._destroyMarker(n),!0)}_refresh(e){const t=e instanceof gc?e.name:e,n=this._markers.get(t);if(!n)throw new hn.b("markercollection-refresh-marker-not-exists: Marker with provided name does not exists.",this);const o=n.getRange();this.fire("update:"+t,n,o,o,n.managedUsingOperations,n.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()}}xn(mc,gn);class gc{constructor(e,t,n,o){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=o}get managedUsingOperations(){if(!this._liveRange)throw new hn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new hn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._affectsData}getStart(){if(!this._liveRange)throw new hn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new hn.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new hn.b("marker-destroyed: Cannot use a destroyed marker instance.",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}}xn(gc,gn);class pc extends Oa{get type(){return"noop"}clone(){return new pc(this.baseVersion)}getReversed(){return new pc(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const bc={};bc[Ha.className]=Ha,bc[$a.className]=$a,bc[Ga.className]=Ga,bc[Wa.className]=Wa,bc[pc.className]=pc,bc[Oa.className]=Oa,bc[Ya.className]=Ya,bc[Ka.className]=Ka,bc[Ja.className]=Ja,bc[Qa.className]=Qa;class wc extends As{constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new hn.b("model-liveposition-root-not-rootelement: LivePosition's root has to be an instance of RootElement.",e);kc.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 kc(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const n=t[0];n.isDocumentOperation&&_c.call(this,n)},{priority:"low"})}function _c(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)}}xn(wc,gn);class vc{constructor(e,t,n){this.model=e,this.writer=t,this.position=n,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 n=0;n{if(!n.doNotResetEntireContent&&function(e,t){const n=e.getLimitElement(t);if(!t.containsEntireContent(n))return!1;const o=t.getFirstRange();if(o.start.parent==o.end.parent)return!1;return e.checkChild(n,"paragraph")}(i,t))return void function(e,t){const n=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(n)),Ac(e,e.createPositionAt(n,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,n=e.start;let o=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const n=function(e){const t=e.parent,n=t.root.document.model.schema,o=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of o){if(n.isLimit(e))return null;if(n.isBlock(e))return e}}(o);if(n&&o.isTouching(t.createPositionAt(n,0))){const n=t.createSelection(e);t.modifySelection(n,{direction:"backward"}),o=n.getLastPosition()}}return[wc.fromPosition(n,"toPrevious"),wc.fromPosition(o,"toNext")]}(o);o.start.isTouching(o.end)||e.remove(o),n.leaveUnmerged||(!function(e,t,n){const o=e.model;if(!xc(e.model.schema,t,n))return;const[i,r]=function(e,t){const n=e.getAncestors(),o=t.getAncestors();let i=0;for(;n[i]&&n[i]==o[i];)i++;return[n[i],o[i]]}(t,n);!o.hasContent(i,{ignoreMarkers:!0})&&o.hasContent(r,{ignoreMarkers:!0})?function e(t,n,o,i){const r=n.parent,s=o.parent;if(r==i||s==i)return;n=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(n)||t.insert(r,o);for(;n.parent.isEmpty;){const e=n.parent;n=t.createPositionBefore(e),t.remove(e)}if(o=t.createPositionBefore(s),function(e,t){const n=t.nodeBefore,o=t.nodeAfter;n.name!=o.name&&e.rename(n,o.name);e.clearAttributes(n),e.setAttributes(Object.fromEntries(o.getAttributes()),n),e.merge(t)}(t,o),!xc(t.model.schema,n,o))return;e(t,n,o,i)}(e,t,n,i.parent):function e(t,n,o,i){const r=n.parent,s=o.parent;if(r==i||s==i)return;n=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(n)||t.insert(s,n);t.merge(n);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(!xc(t.model.schema,n,o))return;e(t,n,o,i)}(e,t,n,i.parent)}(e,r,s),i.removeDisallowedAttributes(r.parent.getChildren(),e)),Cc(e,t,r),!n.doNotAutoparagraph&&function(e,t){const n=e.checkChild(t,"$text"),o=e.checkChild(t,"paragraph");return!n&&o}(i,r)&&Ac(e,r,t),r.detach(),s.detach()})}function xc(e,t,n){const o=t.parent,i=n.parent;return o!=i&&(!e.isLimit(o)&&!e.isLimit(i)&&function(e,t,n){const o=new Ss(e,t);for(const e of o.getWalker())if(n.isLimit(e.item))return!1;return!0}(t,n,e))}function Ac(e,t,n){const o=e.createElement("paragraph");e.insert(o,t),Cc(e,n,e.createPositionAt(o,0))}function Cc(e,t,n){t instanceof Us?e.setSelection(n):t.setTo(n)}function Tc(e,t){const{isForward:n,walker:o,unit:i,schema:r}=e,{type:s,item:a,nextPosition:c}=t;if("text"==s)return"word"===e.unit?function(e,t){let n=e.position.textNode;if(n){let o=e.position.offset-n.startOffset;for(;!Sc(n.data,o,t)&&!Ec(n,o,t);){e.next();const i=t?e.position.nodeAfter:e.position.nodeBefore;if(i&&i.is("$text")){const o=i.data.charAt(t?0:i.data.length-1);' ,.?!:;"-()'.includes(o)||(e.next(),n=e.position.textNode)}o=e.position.offset-n.startOffset}}return e.position}(o,n):function(e,t){const n=e.position.textNode;if(n){const o=n.data;let i=e.position.offset-n.startOffset;for(;dc(o,i)||"character"==t&&uc(o,i);)e.next(),i=e.position.offset-n.startOffset}return e.position}(o,i);if(s==(n?"elementStart":"elementEnd")){if(r.isSelectable(a))return As._createAt(a,n?"after":"before");if(r.checkChild(c,"$text"))return c}else{if(r.isLimit(a))return void o.skip(()=>!0);if(r.checkChild(c,"$text"))return c}}function Pc(e,t){const n=e.root,o=As._createAt(n,t?"end":0);return t?new Ss(e,o):new Ss(o,e)}function Sc(e,t,n){const o=t+(n?0:-1);return' ,.?!:;"-()'.includes(e.charAt(o))}function Ec(e,t,n){return t===(n?e.endOffset:0)}function Mc(e,t){const n=[];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=>{n.push(e.start.parent),t.remove(e)}),n.forEach(e=>{let n=e;for(;n.parent&&n.isEmpty;){const e=t.createRangeOn(n);n=n.parent,t.remove(e)}})}function Ic(e){e.document.registerPostFixer(t=>function(e,t){const n=t.document.selection,o=t.schema,i=[];let r=!1;for(const e of n.getRanges()){const t=Nc(e,o);t&&!t.isEqual(e)?(i.push(t),r=!0):i.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const n of e){const e=t.pop();if(n.isIntersecting(e)){const o=e.start.isAfter(n.start)?n.start:e.start,i=e.end.isAfter(n.end)?e.end:n.end,r=new Ss(o,i);t.push(r)}else t.push(e),t.push(n)}return t}(i),{backward:n.isBackward})}(t,e))}function Nc(e,t){return e.isCollapsed?function(e,t){const n=e.start,o=t.getNearestSelectionRange(n);if(!o)return null;if(!o.isCollapsed)return o;const i=o.start;if(n.isEqual(i))return null;return new Ss(i)}(e,t):function(e,t){const{start:n,end:o}=e,i=t.checkChild(n,"$text"),r=t.checkChild(o,"$text"),s=t.getLimitElement(n),a=t.getLimitElement(o);if(s===a){if(i&&r)return null;if(function(e,t,n){const o=e.nodeAfter&&!n.isLimit(e.nodeAfter)||n.checkChild(e,"$text"),i=t.nodeBefore&&!n.isLimit(t.nodeBefore)||n.checkChild(t,"$text");return o||i}(n,o,t)){const e=n.nodeAfter&&t.isSelectable(n.nodeAfter)?null:t.getNearestSelectionRange(n,"forward"),i=o.nodeBefore&&t.isSelectable(o.nodeBefore)?null:t.getNearestSelectionRange(o,"backward"),r=e?e.start:n,s=i?i.start:o;return new Ss(r,s)}}const c=s&&!s.is("rootElement"),l=a&&!a.is("rootElement");if(c||l){const e=n.nodeAfter&&o.nodeBefore&&n.nodeAfter.parent===o.nodeBefore.parent,i=c&&(!e||!Rc(n.nodeAfter,t)),r=l&&(!e||!Rc(o.nodeBefore,t));let d=n,u=o;return i&&(d=As._createBefore(Oc(s,t))),r&&(u=As._createAfter(Oc(a,t))),new Ss(d,u)}return null}(e,t)}function Oc(e,t){let n=e,o=n;for(;t.isLimit(o)&&o.parent;)n=o,o=o.parent;return n}function Rc(e,t){return e&&t.isSelectable(e)}class Dc{constructor(){this.markers=new mc,this.document=new hc(this),this.schema=new ma,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}),Ic(this),this.document.registerPostFixer(ea)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Na,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){hn.b.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new Na(e):"function"==typeof e&&(t=e,e=new Na),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){hn.b.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,n){return function(e,t,n,o){return e.change(i=>{let r;r=n?n instanceof Rs||n instanceof Us?n:i.createSelection(n,o):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new vc(e,i,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a,{isFirst:!0,isLast:!0});const c=s.getSelectionRange();c&&(r instanceof Us?i.setSelection(c):r.setTo(c));const l=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),l})}(this,e,t,n)}deleteContent(e,t){yc(this,e,t)}modifySelection(e,t){!function(e,t,n={}){const o=e.schema,i="backward"!=n.direction,r=n.unit?n.unit:"character",s=t.focus,a=new ys({boundaries:Pc(s,i),singleCharacters:!0,direction:i?"forward":"backward"}),c={walker:a,schema:o,isForward:i,unit:r};let l;for(;l=a.next();){if(l.done)return;const n=Tc(c,l.value);if(n)return void(t instanceof Us?e.change(e=>{e.setSelectionFocus(n)}):t.setFocus(n))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const n=e.createDocumentFragment(),o=t.getFirstRange();if(!o||o.isCollapsed)return n;const i=o.start.root,r=o.start.getCommonPath(o.end),s=i.getNodeByPath(r);let a;a=o.start.parent==o.end.parent?o:e.createRange(e.createPositionAt(s,o.start.path[r.length]),e.createPositionAt(s,o.end.path[r.length]+1));const c=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),n):e.append(e.cloneElement(t,!0),n);if(a!=o){const t=o._getTransformedByMove(a.start,e.createPositionAt(n,0),c)[0],i=e.createRange(e.createPositionAt(n,0),t.start);Mc(e.createRange(t.end,e.createPositionAt(n,"end")),e),Mc(i,e)}return n})}(this,e)}hasContent(e,t={}){const n=e instanceof vs?Ss._createIn(e):e;if(n.isCollapsed)return!1;const{ignoreWhitespaces:o=!1,ignoreMarkers:i=!1}=t;if(!i)for(const e of this.markers.getMarkersIntersectingRange(n))if(e.affectsData)return!0;for(const e of n.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!o)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}createPositionFromPath(e,t,n){return new As(e,t,n)}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 Ss(e,t)}createRangeIn(e){return Ss._createIn(e)}createRangeOn(e){return Ss._createOn(e)}createSelection(e,t,n){return new Rs(e,t,n)}createBatch(e){return new Na(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return bc[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 Xa(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}xn(Dc,Ho);class Lc{constructor(){this._listener=Object.create(fr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+pi(t),t)})}set(e,t,n={}){const o=bi(e),i=n.priority;this._listener.listenTo(this._listener,"_keydown:"+o,(e,n)=>{t(n,()=>{n.preventDefault(),n.stopPropagation(),e.stop()}),e.return=!0},{priority:i})}press(e){return!!this._listener.fire("_keydown:"+pi(e),e)}destroy(){this._listener.stopListening()}}class Vc extends Lc{constructor(e){super(),this.editor=e}set(e,t,n={}){if("string"==typeof t){const e=t;t=(t,n)=>{this.editor.execute(e),n()}}super.set(e,t,n)}}class jc{constructor(e={}){this._context=e.context||new Mn({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new on(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new Cn(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new ua,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 Dc;const n=new Io;this.data=new Sa(this.model,n),this.editing=new da(this.model,n),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Ea([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 Vc(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],o=e.get("extraPlugins")||[];return this.plugins.init(t.concat(o),n)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(...e){try{return this.commands.execute(...e)}catch(e){hn.b.rethrowUnexpectedError(e,this)}}}xn(jc,Ho);var zc={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};class Bc{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Fc{constructor(e){this._domParser=new DOMParser,this._domConverter=new cr(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new Bc}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)}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),o=t.body.childNodes;for(;o.length>0;)n.appendChild(o[0]);return n}}class Uc{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(Hc(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new hn.b("componentfactory-item-missing: The required component is not registered in the factory.",this,{name:e});return this._components.get(Hc(e)).callback(this.editor.locale)}has(e){return this._components.has(Hc(e))}}function Hc(e){return String(e).toLowerCase()}class qc{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 hn.b("focusTracker-add-element-already-exist: This element is already tracked by FocusTracker.",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)}}xn(qc,fr),xn(qc,Ho);class Wc{constructor(e){this.editor=e,this.componentFactory=new Uc(e),this.focusTracker=new qc,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}}xn(Wc,gn);n(13);const $c=new WeakMap;function Gc(e){const{view:t,element:n,text:o,isDirectHost:i=!0}=e,r=t.document;$c.has(r)||($c.set(r,new Map),r.registerPostFixer(e=>Kc(r,e))),$c.get(r).set(n,{text:o,isDirectHost:i}),t.change(e=>Kc(r,e))}function Yc(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function Kc(e,t){const n=$c.get(e);let o=!1;for(const[e,i]of n)Qc(t,e,i)&&(o=!0);return o}function Qc(e,t,n){const{text:o,isDirectHost:i}=n,r=i?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&&(n.hostElement=r,r.getAttribute("data-placeholder")!==o&&(e.setAttribute("data-placeholder",o,r),s=!0),!function(e){if(!e.isAttached())return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement")),n=e.document;if(!n.isFocused&&t)return!0;const o=n.selection.anchor;return!(!t||!o||o.parent===e)}(r)?Yc(e,r)&&(s=!0):function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0),s)}class Jc extends Wc{constructor(e,t){var n;super(e),this.view=t,this._toolbarConfig=(n=e.config.get("toolbar"),Array.isArray(n)?{items:n}:n?Object.assign({items:[]},n):{items:[]})}init(){const e=this.editor,t=this.view,n=e.editing.view,o=t.editable,i=n.document.getRoot();t.editable.name=i.rootName,t.render();const r=o.element;this.setEditableElement(o.name,r),this.focusTracker.add(r),t.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initToolbar(){const e=this.editor,t=this.view.toolbar;t.fillFromConfig(this._toolbarConfig.items,this.componentFactory),function({origin:e,originKeystrokeHandler:t,originFocusTracker:n,toolbar:o,beforeFocus:i,afterBlur:r}){n.add(o.element),t.set("Alt+F10",(e,t)=>{n.isFocused&&!o.focusTracker.isFocused&&(i&&i(),o.focus(),t())}),o.keystrokes.set("Esc",(t,n)=>{o.focusTracker.isFocused&&(e.focus(),r&&r(),n())})}({origin:e.editing.view,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:t})}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),o=e.sourceElement,i=e.config.get("placeholder")||o&&"textarea"===o.tagName.toLowerCase()&&o.getAttribute("placeholder");i&&Gc({view:t,element:n,text:i,isDirectHost:!1})}}class Zc extends An{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,n)=>{this._renderViewIntoCollectionParent(t,n)}),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 hn.b("ui-viewcollection-delegate-wrong-events: All event names must be strings.",this);return{to:t=>{for(const n of this)for(const o of e)n.delegate(o).to(t);this.on("add",(n,o)=>{for(const n of e)o.delegate(n).to(t)}),this.on("remove",(n,o)=>{for(const n of e)o.stopDelegating(n,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}class Xc{constructor(e){Object.assign(this,ll(cl(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 hn.b("ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const n of t.children)ml(n)?yield n:gl(n)&&(yield*e(n))}(this)}static bind(e,t){return{to:(n,o)=>new tl({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:o}),if:(n,o,i)=>new nl({observable:e,emitter:t,attribute:n,valueIfTrue:o,callback:i})}}static extend(e,t){if(e._isRendered)throw new hn.b("template-extend-render: Attempting to extend a template which has already been rendered.",[this,e]);!function e(t,n){n.attributes&&(t.attributes||(t.attributes={}),hl(t.attributes,n.attributes));n.eventListeners&&(t.eventListeners||(t.eventListeners={}),hl(t.eventListeners,n.eventListeners));n.text&&t.text.push(...n.text);if(n.children&&n.children.length){if(t.children.length!=n.children.length)throw new hn.b("ui-template-extend-children-mismatch: The number of children in extended definition does not match.",t);let o=0;for(const i of n.children)e(t.children[o++],i)}}(e,ll(cl(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new hn.b('ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.',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(""),ol(this.text)?this._bindToObservable({schema:this.text,updater:rl(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,n,o,i;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(o=r.getAttribute(t),n=this.attributes[t],s&&(s.attributes[t]=o),i=V(n[0])&&n[0].ns?n[0].ns:null,ol(n)){const a=i?n[0].value:n;s&&bl(t)&&a.unshift(o),this._bindToObservable({schema:a,updater:sl(r,t,i),data:e})}else"style"==t&&"string"!=typeof n[0]?this._renderStyleAttribute(n[0],e):(s&&o&&bl(t)&&n.unshift(o),n=n.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(ul,""),fl(n)||r.setAttributeNS(i,t,n))}_renderStyleAttribute(e,t){const n=t.node;for(const o in e){const i=e[o];ol(i)?this._bindToObservable({schema:[i],updater:al(n,o),data:t}):n.style[o]=i}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let i=0;for(const r of this.children)if(pl(r)){if(!o){r.setParent(t);for(const e of r)n.appendChild(e.element)}}else if(ml(r))o||(r.isRendered||r.render(),n.appendChild(r.element));else if(Xi(r))n.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:n.childNodes[i++],isApplying:!0,revertData:t})}else n.appendChild(r.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map(n=>{const[o,i]=t.split("@");return n.activateDomEventListener(o,i,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const o=n.revertData;il(e,t,n);const i=e.filter(e=>!fl(e)).filter(e=>e.observable).map(o=>o.activateAttributeListener(e,t,n));o&&o.bindings.push(i)}_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 n in t.attributes){const o=t.attributes[n];null===o?e.removeAttribute(n):e.setAttribute(n,o)}for(let n=0;nil(e,t,n);return this.emitter.listenTo(this.observable,"change:"+this.attribute,o),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,o)}}}class tl extends el{activateDomEventListener(e,t,n){const o=(e,n)=>{t&&!n.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,e,o),()=>{this.emitter.stopListening(n.node,e,o)}}}class nl extends el{getValue(e){return!fl(super.getValue(e))&&(this.valueIfTrue||!0)}}function ol(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(ol):e instanceof el)}function il(e,t,{node:n}){let o=function(e,t){return e.map(e=>e instanceof el?e.getValue(t):e)}(e,n);o=1==e.length&&e[0]instanceof nl?o[0]:o.reduce(ul,""),fl(o)?t.remove():t.set(o)}function rl(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function sl(e,t,n){return{set(o){e.setAttributeNS(n,t,o)},remove(){e.removeAttributeNS(n,t)}}}function al(e,t){return{set(n){e.style[t]=n},remove(){e.style[t]=null}}}function cl(e){return tn(e,e=>{if(e&&(e instanceof el||gl(e)||ml(e)||pl(e)))return e})}function ll(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){Array.isArray(e.text)||(e.text=[e.text])}(e),e.on&&(e.eventListeners=function(e){for(const t in e)dl(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=[].concat(e[t].value)),dl(e,t)}(e.attributes);const t=[];if(e.children)if(pl(e.children))t.push(e.children);else for(const n of e.children)gl(n)||ml(n)||Xi(n)?t.push(n):t.push(new Xc(n));e.children=t}return e}function dl(e,t){Array.isArray(e[t])||(e[t]=[e[t]])}function ul(e,t){return fl(t)?e:fl(e)?t:`${e} ${t}`}function hl(e,t){for(const n in t)e[n]?e[n].push(...t[n]):e[n]=t[n]}function fl(e){return!e&&0!==e}function ml(e){return e instanceof wl}function gl(e){return e instanceof Xc}function pl(e){return e instanceof Zc}function bl(e){return"class"==e||"style"==e}n(15);class wl{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new An,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,n)=>{n.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Xc.bind(this,this)}createCollection(e){const t=new Zc(e);return this._viewCollections.add(t),t}registerChild(e){yn(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){yn(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Xc(e)}extendTemplate(e){Xc.extend(this.template,e)}render(){if(this.isRendered)throw new hn.b("ui-view-render-already-rendered: This View has already been 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)}}xn(wl,fr),xn(wl,Ho);var kl=function(e){return"string"==typeof e||!De(e)&&p(e)&&"[object String]"==f(e)};class _l extends Zc{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new Xc({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,n={},o=[]){const i=n&&n.xmlns,r=i?e.createElementNS(i,t):e.createElement(t);for(const e in n)r.setAttribute(e,n[e]);!kl(o)&&yn(o)||(o=[o]);for(let t of o)kl(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()}}n(17);class vl extends wl{constructor(e){super(e),this.body=new _l(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class yl extends wl{constructor(e,t,n){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=n,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(n=>{const o=e.document.getRoot(t.name);n.addClass(t.isFocused?"ck-focused":"ck-blurred",o),n.removeClass(t.isFocused?"ck-blurred":"ck-focused",o)})}e.isRenderingInProgress?function n(o){e.once("change:isRenderingInProgress",(e,i,r)=>{r?n(o):t(o)})}(this):t(this)}}class xl extends yl{constructor(e,t,n){super(e,t,n),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(n=>{const o=e.document.getRoot(this.name);n.setAttribute("aria-label",t("Rich Text Editor, %0",[this.name]),o)})}}class Al{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];"string"==typeof n&&(n=[n]);for(const o of n)e.keystrokeHandler.set(o,(e,n)=>{this[t](),n()})}}get first(){return this.focusables.find(Cl)||null}get last(){return this.focusables.filter(Cl).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,n)=>{const o=t.element===this.focusTracker.focusedElement;return o&&(e=n),o}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,n=this.focusables.length;if(!n)return null;if(null===t)return this[1===e?"first":"last"];let o=(t+n+e)%n;do{const t=this.focusables.get(o);if(Cl(t))return t;o=(o+n+e)%n}while(o!==t);return null}}function Cl(e){return!(!e.focus||"none"==ir.window.getComputedStyle(e.element).display)}class Tl extends wl{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Pl{constructor(e,t){Pl._observerInstance||Pl._createObserver(),this._element=e,this._callback=t,Pl._addElementCallback(e,t),Pl._observerInstance.observe(e)}destroy(){Pl._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Pl._elementCallbacks||(Pl._elementCallbacks=new Map);let n=Pl._elementCallbacks.get(e);n||(n=new Set,Pl._elementCallbacks.set(e,n)),n.add(t)}static _deleteElementCallback(e,t){const n=Pl._getElementCallbacks(e);n&&(n.delete(t),n.size||(Pl._elementCallbacks.delete(e),Pl._observerInstance.unobserve(e))),Pl._elementCallbacks&&!Pl._elementCallbacks.size&&(Pl._observerInstance=null,Pl._elementCallbacks=null)}static _getElementCallbacks(e){return Pl._elementCallbacks?Pl._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof ir.window.ResizeObserver?ir.window.ResizeObserver:Sl,Pl._observerInstance=new e(e=>{for(const t of e){const e=Pl._getElementCallbacks(t.target);if(e)for(const n of e)n(t)}})}}Pl._observerInstance=null,Pl._elementCallbacks=null;class Sl{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(ir.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 os(e),n=this._previousRects.get(e),o=!n||!n.isEqual(t);return this._previousRects.set(e,t),o}}xn(Sl,fr);class El extends wl{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()}}}n(19);function Ml({element:e,target:t,positions:n,limiter:o,fitInViewport:i}){z(t)&&(t=t()),z(o)&&(o=o());const r=function(e){return e&&e.parentNode?e.offsetParent===ir.document.body?null:e.offsetParent:null}(e),s=new os(e),a=new os(t);let c,l;if(o||i){const e=function(e,t){const{elementRect:n,viewportRect:o}=t,i=n.getArea(),r=function(e,{targetRect:t,elementRect:n,limiterRect:o,viewportRect:i}){const r=[],s=n.getArea();for(const a of e){const e=Il(a,t,n);if(!e)continue;const[c,l]=e;let d=0,u=0;if(o)if(i){const e=o.getIntersection(i);e&&(d=e.getIntersectionArea(l))}else d=o.getIntersectionArea(l);i&&(u=i.getIntersectionArea(l));const h={positionName:c,positionRect:l,limiterIntersectArea:d,viewportIntersectArea:u};if(d===s)return[h];r.push(h)}return r}(e,t);if(o){const e=Nl(r.filter(({viewportIntersectArea:e})=>e===i),i);if(e)return e}return Nl(r,i)}(n,{targetRect:a,elementRect:s,limiterRect:o&&new os(o).getVisible(),viewportRect:i&&new os(ir.window)});[l,c]=e||Il(n[0],a,s)}else[l,c]=Il(n[0],a,s);let d=Ol(c);return r&&(d=function({left:e,top:t},n){const o=Ol(new os(n)),i=ts(n);return e-=o.left,t-=o.top,e+=n.scrollLeft,t+=n.scrollTop,e-=i.left,t-=i.top,{left:e,top:t}}(d,r)),{left:d.left,top:d.top,name:l}}function Il(e,t,n){const o=e(t,n);if(!o)return null;const{left:i,top:r,name:s}=o;return[s,n.clone().moveTo(i,r)]}function Nl(e,t){let n,o,i=0;for(const{positionName:r,positionRect:s,limiterIntersectArea:a,viewportIntersectArea:c}of e){if(a===t)return[r,s];const e=c**2+a**2;e>i&&(i=e,n=s,o=r)}return n?[o,n]:null}function Ol({left:e,top:t}){const{scrollX:n,scrollY:o}=ir.window;return{left:e+n,top:t+o}}class Rl extends wl{constructor(e,t,n){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Lc,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",e=>!e)],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,n]}),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=Rl._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:n,northWest:o}=Rl.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,t,n,o]:[t,e,o,n]}}Rl.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"})},Rl._getOptimalPosition=Ml;n(21);class Dl extends wl{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})}}n(23);class Ll extends wl{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")}]}]})}}n(25);class Vl extends wl{constructor(e){super(e);const t=this.bindTemplate,n=dn();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(n),this.iconView=new Dl,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_"+n,"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 Ll;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new wl,n=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:n.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new wl;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>wi(e))}]}),e}_getTooltipString(e,t,n){return e?"string"==typeof e?e:(n&&(n=wi(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}var jl='';class zl extends Vl{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 Dl;return e.content=jl,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}n(27);class Bl extends wl{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new qc,this.keystrokes=new Lc,this._focusCycler=new Al({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 Fl extends wl{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 Ul extends wl{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}n(29);class Hl extends Vl{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 wl;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function ql({emitter:e,activator:t,callback:n,contextElements:o}){e.listenTo(document,"mousedown",(e,i)=>{if(!t())return;const r="function"==typeof i.composedPath?i.composedPath():[];for(const e of o)if(e.contains(i.target)||r.includes(e))return;n()})}n(31),n(33);function Wl(e,t=zl){const n=new t(e),o=new El(e),i=new Rl(e,n,o);return n.bind("isEnabled").to(i),n instanceof zl?n.bind("isOn").to(i,"isOpen"):n.arrowView.bind("isOn").to(i,"isOpen"),function(e){(function(e){e.on("render",()=>{ql({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof Hl||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,n)=>{e.isOpen&&(e.panelView.focus(),n())}),e.keystrokes.set("arrowup",(t,n)=>{e.isOpen&&(e.panelView.focusLast(),n())})}(e)}(i),i}function $l(e,t){const n=e.locale,o=n.t,i=e.toolbarView=new Yl(n);i.set("ariaLabel",o("Dropdown toolbar")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>i.items.add(e)),e.panelView.children.add(i),i.items.delegate("execute").to(e)}function Gl(e,t){const n=e.locale,o=e.listView=new Bl(n);o.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Ul(n);if("button"===e||"switchbutton"===e){const o=new Fl(n);let i;return i="button"===e?new Vl(n):new Hl(n),i.bind(...Object.keys(t)).to(t),i.delegate("execute").to(o),o.children.add(i),o}}),e.panelView.children.add(o),o.items.delegate("execute").to(e)}n(35);class Yl extends wl{constructor(e,t){super(e);const n=this.bindTemplate,o=this.t;var i;this.options=t||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new qc,this.keystrokes=new Lc,this.set("class"),this.set("isCompact",!1),this.itemsView=new Kl(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new Al({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")],role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")}},children:this.children,on:{mousedown:(i=this,i.bindTemplate.to(e=>{e.target===i.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Jl(this):new Ql(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(e=>"|"==e?new Tl:t.has(e)?t.create(e):void console.warn(Object(hn.a)("toolbarview-item-unavailable: The requested toolbar item is unavailable."),{name:e})).filter(e=>void 0!==e))}}class Kl extends wl{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Ql{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 Jl{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 n=t.index;for(const e of t.removed)n>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=n;ethis.ungroupedItems.length?this.groupedItems.add(o,e-this.ungroupedItems.length):this.ungroupedItems.add(o,e)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!this.viewElement.offsetParent)return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,n=new os(e.lastChild),o=new os(e);if(!this.cachedPadding){const n=ir.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[o])}return"ltr"===t?n.right>o.right-this.cachedPadding:n.left{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 Tl),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,n=Wl(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",$l(n,[]),n.buttonView.set({label:t("Show more items"),tooltip:!0,icon:''}),n.toolbarView.items.bindTo(this.groupedItems).using(e=>e),n}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}class Zl extends vl{constructor(e,t,n={}){super(e),this.toolbar=new Yl(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.editable=new xl(e,t,n.editableElement),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.toolbar,this.editable])}}class Xl extends jc{constructor(e,t){super(t),nn(e)&&(this.sourceElement=e,function(e){const t=e.sourceElement;if(t){if(t.ckeditorInstance)throw new hn.b("editor-source-element-already-used: The DOM element cannot be used to create multiple editor instances.",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}}(this)),this.data.processor=new Fc(this.data.viewDocument),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),o=new Zl(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:n});this.ui=new Jc(this,o)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&function(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}(this.sourceElement,e)})}static create(e,t={}){return new Promise(n=>{const o=nn(e);if(o&&"TEXTAREA"===e.tagName)throw new hn.b("editor-wrong-element: This type of editor cannot be initialized inside
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).indexOf("
")>-1&&(r=`
${r}
`),i=r),i=this._htmlDataProcessor.toView(i);const s=new cn(this,"inputTransformation");this.fire(s,{content:i,dataTransfer:o}),s.stop.called&&e.stop(),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,n)=>{if(!n.content.isEmpty){const o=this.editor.data,i=this.editor.model,r=o.toModel(n.content,"$clipboardHolder");if(0==r.childCount)return;if(function(e){if(e.childCount>1)return!1;return 0==[...e.getChild(0).getAttributeKeys()].length}(r)){const e=r.getChild(0);i.change(n=>{n.setAttributes(t.selection.getAttributes(),e)})}i.insertContent(r),e.stop()}},{priority:"low"}),this.listenTo(o,"copy",i,{priority:"low"}),this.listenTo(o,"cut",(t,n)=>{e.isReadOnly?n.preventDefault():i(t,n)},{priority:"low"}),this.listenTo(o,"clipboardOutput",(n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",function e(t){let n="";if(t.is("$text")||t.is("$textProxy"))n=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))n=t.getAttribute("alt");else{let o=null;for(const i of t.getChildren()){const t=e(i);o&&(o.is("containerElement")||i.is("containerElement"))&&(id.includes(o.name)||id.includes(i.name)?n+="\n":n+="\n\n"),n+=t,o=i}}return n}(o.content))),"cut"==o.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}class sd{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,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",ad,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",ad),this.refresh())}execute(){}destroy(){this.stopListening()}}function ad(e){e.return=!1,e.stop()}function*cd(e,t){for(const n of t)n&&e.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}xn(sd,Ho);class ld extends sd{execute(){const e=this.editor.model,t=e.document;e.change(n=>{!function(e,t,n,o){const i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(i||s!=a||e.deleteContent(n));if(i){const e=cd(t.model.schema,n.getAttributes());dd(t,r.start),t.setSelectionAttribute(e)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;e.deleteContent(n,{leaveUnmerged:o}),o&&(i?dd(t,n.focus):t.setSelection(a,0))}}(this.editor.model,n,t.selection,e.schema),this.fire("afterExecute",{writer:n})})}}function dd(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}class ud extends pr{constructor(e){super(e);const t=this.document;t.on("keydown",(e,n)=>{if(this.isEnabled&&n.keyCode==gi.enter){let o;t.once("enter",e=>o=e,{priority:"highest"}),t.fire("enter",new Lr(t,n.domEvent,{isSoft:n.shiftKey})),o&&o.stop.called&&e.stop()}})}observe(){}}class hd extends ed{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,n=t.document;t.addObserver(ud),e.commands.add("enter",new ld(e)),this.listenTo(n,"enter",(n,o)=>{o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class fd extends sd{execute(){const e=this.editor.model,t=e.document;e.change(n=>{!function(e,t,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=cd(e.schema,n.getAttributes());md(e,t,i.end),t.removeSelectionAttribute(n.getAttributeKeys()),t.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);e.deleteContent(n,{leaveUnmerged:o}),a?md(e,t,n.focus):o&&t.setSelection(s,0)}}(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const n=t.anchor;if(!n||!e.checkChild(n,"softBreak"))return!1;const o=t.getFirstRange(),i=o.start.parent,r=o.end.parent;if((gd(i,e)||gd(r,e))&&i!==r)return!1;return!0}(e.schema,t.selection)}}function md(e,t,n){const o=t.createElement("softBreak");e.insertContent(o,n),t.setSelection(o,"after")}function gd(e,t){return!e.is("rootElement")&&(t.isLimit(e)||gd(e.parent,t))}class pd extends ed{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,n=e.conversion,o=e.editing.view,i=o.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),o.addObserver(ud),e.commands.add("shiftEnter",new fd(e)),this.listenTo(i,"enter",(t,n)=>{n.preventDefault(),n.isSoft&&(e.execute("shiftEnter"),o.scrollToTheSelection())},{priority:"low"})}}class bd extends sd{execute(){const e=this.editor.model,t=e.document.selection;let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!wd(e.schema,n))do{if(n=n.parent,!n)return}while(!wd(e.schema,n));e.change(e=>{e.setSelection(n,"in")})}}function wd(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const kd=bi("Ctrl+A");class _d extends ed{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new bd(e)),this.listenTo(t,"keydown",(t,n)=>{pi(n)===kd&&(e.execute("selectAll"),n.preventDefault())})}}class vd extends ed{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const n=e.commands.get("selectAll"),o=new Vl(t),i=t.t;return o.set({label:i("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),o})}}class yd extends ed{static get requires(){return[_d,vd]}static get pluginName(){return"SelectAll"}}class xd{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 Ad extends sd{constructor(e,t){super(e),this._buffer=new xd(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,n=t.document,o=e.text||"",i=o.length,r=e.range?t.createSelection(e.range):n.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),this._batches.add(this._buffer.batch),t.deleteContent(r),o&&t.insertContent(e.createText(o,n.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(i)})}}const Cd=[pi("arrowUp"),pi("arrowRight"),pi("arrowDown"),pi("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++)Cd.push(e);function Td(e){return!!e.ctrlKey||Cd.includes(e.keyCode)}function Pd(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const n=[];let o,i=0;return e.forEach(e=>{"equal"==e?(r(),i++):"insert"==e?(s("insert")?o.values.push(t[i]):(r(),o={type:"insert",index:i,values:[t[i]]}),i++):s("delete")?o.howMany++:(r(),o={type:"delete",index:i,howMany:1})}),r(),n;function r(){o&&(n.push(o),o=null)}function s(e){return o&&o.type==e}}(Qi(e.oldChildren,e.newChildren,Sd),e.newChildren);if(t.length>1)return;const n=t[0];return n.values[0]&&n.values[0].is("$text")?n:void 0}function Sd(e,t){return e&&e.is("$text")&&t&&t.is("$text")?e.data===t.data:e===t}class Ed{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&&!Pd(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const n of e)this._handleTextMutation(n,t),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(e,t){const n=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(!n)return;const o=this.editor.editing.view.domConverter.mapViewToDom(n),i=new cr(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(r.getChildren()),c=Array.from(s.getChildren()),l=a[a.length-1],d=c[c.length-1],u=l&&l.is("element","softBreak"),h=d&&!d.is("element","softBreak");u&&h&&a.pop();const f=this.editor.model.schema;if(!Md(a,f)||!Md(c,f))return;const m=a.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," "),g=c.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," ");if(g===m)return;const p=Qi(g,m),{firstChangeAt:b,insertions:w,deletions:k}=Id(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 n=e.newText.replace(/\u00A0/g," "),o=e.oldText.replace(/\u00A0/g," ");if(o===n)return;const i=Qi(o,n),{firstChangeAt:r,insertions:s,deletions:a}=Id(i);let c=null;t&&(c=this.editing.mapper.toModelRange(t.getFirstRange()));const l=this.editing.view.createPositionAt(e.node,r),d=this.editing.mapper.toModelPosition(l),u=this.editor.model.createRange(d,d.getShiftedBy(a)),h=n.substr(r,s);this.editor.execute("input",{text:h,range:u,resultRange:c})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=Pd(e),n=this.editing.view.createPositionAt(e.node,t.index),o=this.editing.mapper.toModelPosition(n),i=t.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function Md(e,t){return e.every(e=>t.isInline(e))}function Id(e){let t=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)}),e.unlock()}hi.isAndroid?o.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):o.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),o.document.on("compositionstart",(function(){const e=n.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),o.document.on("compositionend",()=>{t=n.createSelection(n.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(t,n,o)=>{new Ed(e).handle(n,o)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class Od extends sd{constructor(e,t){super(e),this.direction=t,this._buffer=new xd(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,o=>{this._buffer.lock();const i=o.createSelection(e.selection||n.selection),r=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(e.sequence||1))return void this._replaceEntireContentWithParagraph(o);if(i.isCollapsed)return;let s=0;i.getFirstRange().getMinimalFlatRanges().forEach(e=>{s+=ni(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(s),o.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,n=t.document.selection,o=t.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!t.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(e){const t=this.editor.model,n=t.document.selection,o=t.schema.getLimitElement(n),i=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(i,o),e.setSelection(i,0)}}class Rd extends pr{constructor(e){super(e);const t=e.document;let n=0;function o(e,n,o){let i;t.once("delete",e=>i=e,{priority:Number.POSITIVE_INFINITY}),t.fire("delete",new Lr(t,n,o)),i&&i.stop.called&&e.stop()}t.on("keyup",(e,t)=>{t.keyCode!=gi.delete&&t.keyCode!=gi.backspace||(n=0)}),t.on("keydown",(e,t)=>{const i={};if(t.keyCode==gi.delete)i.direction="forward",i.unit="character";else{if(t.keyCode!=gi.backspace)return;i.direction="backward",i.unit="codePoint"}const r=hi.isMac?t.altKey:t.ctrlKey;i.unit=r?"word":i.unit,i.sequence=++n,o(e,t.domEvent,i)}),hi.isAndroid&&t.on("beforeinput",(t,n)=>{if("deleteContentBackward"!=n.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=n.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=e.domConverter.domSelectionToView(r)),o(t,n.domEvent,i)})}observe(){}}class Dd extends ed{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,n=t.document;if(t.addObserver(Rd),e.commands.add("forwardDelete",new Od(e,"forward")),e.commands.add("delete",new Od(e,"backward")),this.listenTo(n,"delete",(n,o)=>{const i={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const t=e.model.createSelection(),n=[];for(const t of o.selectionToRemove.getRanges())n.push(e.editing.mapper.toModelRange(t));t.setTo(n),i.selection=t}e.execute("forward"==o.direction?"forwardDelete":"delete",i),o.preventDefault(),t.scrollToTheSelection()}),hi.isAndroid){let e=null;this.listenTo(n,"delete",(t,n)=>{const o=n.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}},{priority:"lowest"}),this.listenTo(n,"keyup",(t,n)=>{if(e){const t=n.domTarget.ownerDocument.defaultView.getSelection();t.collapse(e.anchorNode,e.anchorOffset),t.extend(e.focusNode,e.focusOffset),e=null}})}}}class Ld extends ed{static get requires(){return[Nd,Dd]}static get pluginName(){return"Typing"}}const Vd=new Map;function jd(e,t,n){let o=Vd.get(e);o||(o=new Map,Vd.set(e,o)),o.set(t,n)}function zd(e){return[e]}function Bd(e,t,n={}){const o=function(e,t){const n=Vd.get(e);return n&&n.has(t)?n.get(t):zd}(e.constructor,t.constructor);try{return o(e=e.clone(),t,n)}catch(e){throw e}}function Fd(e,t,n){e=e.slice(),t=t.slice();const o=new Ud(n.document,n.useRelations,n.forceWeakRemove);o.setOriginalOperations(e),o.setOriginalOperations(t);const i=o.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:i};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{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const o=e.range.getDifference(t.range).map(t=>new Ha(t,e.key,e.oldValue,e.newValue,0)),i=e.range.getIntersection(t.range);return i&&n.aIsStrong&&o.push(new Ha(i,t.key,t.newValue,e.newValue,0)),0==o.length?[new pc(0)]:o}return[e]}),jd(Ha,$a,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const n=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new Ha(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const o=Wd(t,e.key,e.oldValue);o&&n.unshift(o)}return n}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),jd(Ha,Qa,(e,t)=>{const n=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&n.push(Ss._createFromPositionAndShift(t.graveyardPosition,1));const o=e.range._getTransformedByMergeOperation(t);return o.isCollapsed||n.push(o),n.map(t=>new Ha(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),jd(Ha,Wa,(e,t)=>function(e,t){const n=Ss._createFromPositionAndShift(t.sourcePosition,t.howMany);let o=null,i=[];n.containsRange(e,!0)?o=e:e.start.hasSameParentAs(n.start)?(i=e.getDifference(n),o=e.getIntersection(n)):i=[e];const r=[];for(let e of i){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const n=t.getMovedRangeStart(),o=e.start.hasSameParentAs(n);e=e._getTransformedByInsertion(n,t.howMany,o),r.push(...e)}o&&r.push(o._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return r}(e.range,t).map(t=>new Ha(t,e.key,e.oldValue,e.newValue,e.baseVersion))),jd(Ha,Ja,(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 n=e.clone();return n.range=new Ss(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,n]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),jd($a,Ha,(e,t)=>{const n=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const o=Wd(e,t.key,t.newValue);o&&n.push(o)}return n}),jd($a,$a,(e,t,n)=>(e.position.isEqual(t.position)&&n.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),jd($a,Wa,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),jd($a,Ja,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),jd($a,Qa,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),jd(Ga,$a,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),jd(Ga,Ga,(e,t,n)=>{if(e.name==t.name){if(!n.aIsStrong)return[new pc(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),jd(Ga,Qa,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),jd(Ga,Wa,(e,t,n)=>{if(e.oldRange&&(e.oldRange=Ss._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(n.abRelation){const o=Ss._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==n.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=n.abRelation.path,e.newRange.end=o.end,[e];if("right"==n.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=o.start,e.newRange.end.path=n.abRelation.path,[e]}e.newRange=Ss._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]}),jd(Ga,Ja,(e,t,n)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(n.abRelation){const o=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&n.abRelation.wasStartBeforeMergedElement?e.newRange.start=As._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!n.abRelation.wasInLeftElement&&(e.newRange.start=As._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasInRightElement?e.newRange.end=As._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?e.newRange.end=As._createAt(t.insertionPosition):e.newRange.end=o.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),jd(Qa,$a,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),jd(Qa,Qa,(e,t,n)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(n.bWasUndone){const n=t.graveyardPosition.path.slice();return n.push(0),e.sourcePosition=new As(t.graveyardPosition.root,n),e.howMany=0,[e]}return[new pc(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!n.bWasUndone&&"splitAtSource"!=n.abRelation){const o="$graveyard"==e.targetPosition.root.rootName,i="$graveyard"==t.targetPosition.root.rootName,r=o&&!i;if(i&&!o||!r&&n.aIsStrong){const n=t.targetPosition._getTransformedByMergeOperation(t),o=e.targetPosition._getTransformedByMergeOperation(t);return[new Wa(n,e.howMany,o,0)]}return[new pc(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)&&n.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),jd(Qa,Wa,(e,t,n)=>{const o=Ss._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!n.bWasUndone&&!n.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.sourcePosition)?[new pc(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])}),jd(Qa,Ja,(e,t,n)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){const o=0!=t.howMany,i=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(o||i||"mergeTargetNotMoved"==n.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==n.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==n.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]}),jd(Wa,$a,(e,t)=>{const n=Ss._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),jd(Wa,Wa,(e,t,n)=>{const o=Ss._createFromPositionAndShift(e.sourcePosition,e.howMany),i=Ss._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,s=n.aIsStrong,a=!n.aIsStrong;if("insertBefore"==n.abRelation||"insertAfter"==n.baRelation?a=!0:"insertAfter"!=n.abRelation&&"insertBefore"!=n.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),$d(e,t)&&$d(t,e))return[t.getReversed()];if(o.containsPosition(t.targetPosition)&&o.containsRange(i,!0))return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Gd([o],r);if(i.containsPosition(e.targetPosition)&&i.containsRange(o,!0))return o.start=o.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),o.end=o.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Gd([o],r);const c=In(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==c||"extension"==c)return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Gd([o],r);"remove"!=e.type||"remove"==t.type||n.aWasUndone||n.forceWeakRemove?"remove"==e.type||"remove"!=t.type||n.bWasUndone||n.forceWeakRemove||(s=!1):s=!0;const l=[],d=o.getDifference(i);for(const e of d){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const n="same"==In(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),o=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,n);l.push(...o)}const u=o.getIntersection(i);return null!==u&&s&&(u.start=u.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),u.end=u.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===l.length?l.push(u):1==l.length?i.start.isBefore(o.start)||i.start.isEqual(o.start)?l.unshift(u):l.push(u):l.splice(1,0,u)),0===l.length?[new pc(e.baseVersion)]:Gd(l,r)}),jd(Wa,Ja,(e,t,n)=>{let o=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=n.abRelation||(o=e.targetPosition._getTransformedBySplitOperation(t));const i=Ss._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=o,[e];if(i.start.hasSameParentAs(t.splitPosition)&&i.containsPosition(t.splitPosition)){let e=new Ss(t.splitPosition,i.end);e=e._getTransformedBySplitOperation(t);return Gd([new Ss(i.start,t.splitPosition),e],o)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==n.abRelation&&(o=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==n.abRelation&&(o=e.targetPosition);const r=[i._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const o=i.start.isEqual(t.graveyardPosition)||i.containsPosition(t.graveyardPosition);e.howMany>1&&o&&!n.aWasUndone&&r.push(Ss._createFromPositionAndShift(t.insertionPosition,1))}return Gd(r,o)}),jd(Wa,Qa,(e,t,n)=>{const o=Ss._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&o.containsPosition(t.sourcePosition))if("remove"!=e.type||n.forceWeakRemove){if(1==e.howMany)return n.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new pc(0)]}else if(!n.aWasUndone){const n=[];let o=t.graveyardPosition.clone(),i=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(n.push(new Wa(e.sourcePosition,e.howMany-1,e.targetPosition,0)),o=o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),i=i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const r=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),s=new Wa(o,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const c=new As(s.targetPosition.root,a);i=i._getTransformedByMove(o,r,1);const l=new Wa(i,t.howMany,c,0);return n.push(s),n.push(l),n}const i=Ss._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),jd(Ya,$a,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),jd(Ya,Qa,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),jd(Ya,Wa,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),jd(Ya,Ya,(e,t,n)=>{if(e.position.isEqual(t.position)){if(!n.aIsStrong)return[new pc(0)];e.oldName=t.newName}return[e]}),jd(Ya,Ja,(e,t)=>{if("same"==In(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new Ya(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),jd(Ka,Ka,(e,t,n)=>{if(e.root===t.root&&e.key===t.key){if(!n.aIsStrong||e.newValue===t.newValue)return[new pc(0)];e.oldValue=t.newValue}return[e]}),jd(Ja,$a,(e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset{if(!e.graveyardPosition&&!n.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const n=t.graveyardPosition.path.slice();n.push(0);const o=new As(t.graveyardPosition.root,n),i=Ja.getInsertionPosition(new As(t.graveyardPosition.root,n)),r=new Ja(o,0,null,0);return r.insertionPosition=i,e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Ja.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=Ja.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),jd(Ja,Wa,(e,t,n)=>{const o=Ss._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const i=o.start.isEqual(e.graveyardPosition)||o.containsPosition(e.graveyardPosition);if(!n.bWasUndone&&i){const n=e.splitPosition._getTransformedByMoveOperation(t),o=e.graveyardPosition._getTransformedByMoveOperation(t),i=o.path.slice();i.push(0);const r=new As(o.root,i);return[new Wa(n,e.howMany,r,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.splitPosition)){const n=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=n,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new pc(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new pc(0)];if("splitBefore"==n.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const o="$graveyard"==e.splitPosition.root.rootName,i="$graveyard"==t.splitPosition.root.rootName,r=o&&!i;if(i&&!o||!r&&n.aIsStrong){const n=[];return t.howMany&&n.push(new Wa(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&n.push(new Wa(e.splitPosition,e.howMany,e.moveTargetPosition,0)),n}return[new pc(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==n.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==n.baRelation){const n=t.insertionPosition.path.slice();n.push(0);const o=new As(t.insertionPosition.root,n);return[e,new Wa(e.insertionPosition,1,o,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offsetthis.clearStack())}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const o=this.editor.model,i=o.document,r=[],s=e.map(e=>e.getTransformedByOperations(n)),a=s.flat();for(const e of s){const t=e.filter(e=>!Qd(e,a));Kd(t);const n=t.find(e=>e.root!=i.graveyard);n&&r.push(n)}r.length&&o.change(e=>{e.setSelection(r,{backward:t})})}_undo(e,t){const n=this.editor.model,o=n.document;this._createdBatches.add(t);const i=e.operations.slice().filter(e=>e.isDocumentOperation);i.reverse();for(const e of i){const i=e.baseVersion+1,r=Array.from(o.history.getOperations(i)),s=Fd([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)t.addOperation(i),n.applyOperation(i),o.history.setOperationAsUndone(e,i)}}}function Kd(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;tt!==e&&t.containsRange(e,!0))}class Jd extends Yd{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],o=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(o,()=>{this._undo(n.batch,o);const e=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,e),this.fire("revert",n.batch,o)}),this.refresh()}}class Zd extends Yd{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(t,()=>{const n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}class Xd extends ed{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new Jd(e),this._redoCommand=new Zd(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const n=t[0];if(!n.isDocumentOperation)return;const o=n.batch,i=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||"transparent"==o.type&&!i&&!r||(i?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack()),this._batchRegistry.add(o))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,n)=>{this._redoCommand.addBatch(n)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var eu='',tu='';class nu extends ed{init(){const e=this.editor,t=e.locale,n=e.t,o="ltr"==t.uiLanguageDirection?eu:tu,i="ltr"==t.uiLanguageDirection?tu:eu;this._addButton("undo",n("Undo"),"CTRL+Z",o),this._addButton("redo",n("Redo"),"CTRL+Y",i)}_addButton(e,t,n,o){const i=this.editor;i.ui.componentFactory.add(e,r=>{const s=i.commands.get(e),a=new Vl(r);return a.set({label:t,icon:o,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{i.execute(e),i.editing.view.focus()}),a})}}class ou extends ed{static get requires(){return[Xd,nu]}static get pluginName(){return"Undo"}}function iu(e){const t=e.next();return t.done?null:t.value}const ru=["left","right","center","justify"];function su(e){return ru.includes(e)}function au(e,t){return"rtl"==t.contentLanguageDirection?"right"===e:"left"===e}class cu extends sd{refresh(){const e=this.editor.locale,t=iu(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,n=t.locale,o=t.model,i=o.document,r=e.value;o.change(e=>{const t=Array.from(i.selection.getSelectedBlocks()).filter(e=>this._canBeAligned(e)),o=t[0].getAttribute("alignment");au(r,n)||o===r||!r?function(e,t){for(const n of e)t.removeAttribute("alignment",n)}(t,e):function(e,t,n){for(const o of e)t.setAttribute("alignment",n,o)}(t,e,r)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,"alignment")}}class lu extends ed{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:[...ru]})}init(){const e=this.editor,t=e.locale,n=e.model.schema,o=e.config.get("alignment.options").filter(su);n.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0});const i=function(e){const t={model:{key:"alignment",values:e.slice()},view:{}};for(const n of e)t.view[n]={key:"style",value:{"text-align":n}};return t}(o.filter(e=>!au(e,t)));e.conversion.attributeToAttribute(i),e.commands.add("alignment",new cu(e))}}var du='',uu='';const hu=new Map([["left",du],["right",uu],["center",''],["justify",'']]);class fu extends ed{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,n=e.t,o=e.config.get("alignment.options");o.filter(su).forEach(e=>this._addButton(e)),t.add("alignment",e=>{const i=Wl(e),r=o.map(e=>t.create("alignment:"+e));$l(i,r),i.buttonView.set({label:n("Text alignment"),tooltip:!0}),i.toolbarView.isVertical=!0,i.toolbarView.ariaLabel=n("Text alignment toolbar"),i.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const s="rtl"===e.contentLanguageDirection?uu:du;return i.buttonView.bind("icon").toMany(r,"isOn",(...e)=>{const t=e.findIndex(e=>e);return t<0?s:r[t].icon}),i.bind("isEnabled").toMany(r,"isEnabled",(...e)=>e.some(e=>e)),i})}_addButton(e){const t=this.editor;t.ui.componentFactory.add("alignment:"+e,n=>{const o=t.commands.get("alignment"),i=new Vl(n);return i.set({label:this.localizedOptionTitles[e],icon:hu.get(e),tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o),i.bind("isOn").to(o,"value",t=>t===e),this.listenTo(i,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),i})}}class mu extends sd{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,n=t.document.selection,o=e.value;t.change(e=>{if(n.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,o):e.removeSelectionAttribute(this.attributeKey);else{const i=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of i)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}}class gu extends Vl{constructor(e){super(e);const t=this.bindTemplate;this.set("color"),this.set("hasBorder"),this.icon='',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%)"}}n(37);class pu extends wl{constructor(e,t){super(e);const n=t&&t.colorDefinitions||[],o={};t&&t.columns&&(o.gridTemplateColumns=`repeat( ${t.columns}, 1fr)`),this.set("selectedColor"),this.items=this.createCollection(),this.focusTracker=new qc,this.keystrokes=new Lc,this._focusCycler=new Al({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}),n.forEach(e=>{const t=new gu;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})}),this.items.add(t)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:o}}),this.on("change:selectedColor",(e,t,n)=>{for(const e of this.items)e.isOn=e.color===n})}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)}}n(39);class bu extends wl{constructor(e){super(e),this.set("text"),this.set("for"),this.id="ck-editor__label_"+dn();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 wu extends An{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)}}xn(wu,Ho);n(41);class ku extends wl{constructor(e,{colors:t,columns:n,removeButtonLabel:o,documentColorsLabel:i,documentColorsCount:r}){super(e),this.items=this.createCollection(),this.colorDefinitions=t,this.focusTracker=new qc,this.keystrokes=new Lc,this.set("selectedColor"),this.removeButtonLabel=o,this.columns=n,this.documentColors=new wu,this.documentColorsCount=r,this._focusCycler=new Al({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this._documentColorsLabel=i,this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items}),this.items.add(this._removeColorButton())}updateDocumentColors(e,t){const n=e.document,o=this.documentColorsCount;this.documentColors.clear();for(const i of n.getRootNames()){const r=n.getRoot(i),s=e.createRangeIn(r);for(const e of s.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=o))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,n=this.selectedColor;t.selectedColor=n,e&&(e.selectedColor=n)}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=Xc.bind(this.documentColors,this.documentColors),t=new bu(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 Vl;return e.set({withText:!0,icon:'',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 pu(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.delegate("execute").to(this),e}_createDocumentColorsGrid(){const e=Xc.bind(this.documentColors,this.documentColors),t=new pu(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 gu;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,n,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(t=>t.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}function _u(e,t){const n={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)n.model.values.push(e.model),n.view[e.model]=e.view,e.upcastAlso&&(n.upcastAlso[e.model]=e.upcastAlso);return n}function vu(e){return t=>t.getStyle(e).replace(/\s/g,"")}function yu(e){return(t,{writer:n})=>n.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class xu extends mu{constructor(e){super(e,"fontSize")}}function Au(e){return e.map(e=>function(e){if(t=e,"object"==typeof t&&t.title&&t.model&&t.view)return Tu(e);var t;const n=function(e){return Cu[e]||Cu[e.model]}(e);if(n)return Tu(n);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new hn.b("font-size-invalid-definition: Provided font size definition is invalid.",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}},Tu(e)}(e)}(e)).filter(e=>!!e)}const Cu={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 Tu(e){return e.view.priority||(e.view.priority=7),e}class Pu extends ed{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"),n=_u("fontSize",Au(this.editor.config.get("fontSize.options")).filter(e=>e.model));t?this._prepareAnyValueConverters(n):e.conversion.attributeToElement(n),e.commands.add("fontSize",new xu(e))}_prepareAnyValueConverters(e){const t=this.editor,n=e.model.values.filter(e=>!String(e).match(/[\d.]+[\w%]+/));if(n.length)throw new hn.b("font-size-invalid-use-of-named-presets: If config.fontSize.supportAllValues is set to true, you need to use numerical values as font size options.",null,{presets:n});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"}})}}class Su{constructor(e,t){t&&jo(this,t),e&&this.set(e)}}xn(Su,Ho);n(43);class Eu extends ed{init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),o=e.commands.get("fontSize");e.ui.componentFactory.add("fontSize",i=>{const r=Wl(i);return Gl(r,function(e,t){const n=new An;for(const o of e){const e={type:"button",model:new Su({commandName:"fontSize",commandParam:o.model,label:o.title,class:"ck-fontsize-option",withText:!0})};o.view&&o.view.styles&&e.model.set("labelStyle","font-size:"+o.view.styles["font-size"]),o.view&&o.view.classes&&e.model.set("class",`${e.model.class} ${o.view.classes}`),e.model.bind("isOn").to(t,"value",e=>e===o.model),n.add(e)}return n}(n,o)),r.buttonView.set({label:t("Font Size"),icon:'',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t,n={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return Au(e.config.get("fontSize").options).map(e=>{const t=n[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class Mu extends mu{constructor(e){super(e,"fontFamily")}}function Iu(e){return e.map(Nu).filter(e=>!!e)}function Nu(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),n=t[0],o=t.map(Ou).join(", ");return{title:n,model:o,view:{name:"span",styles:{"font-family":o},priority:7}}}(e):void 0}function Ou(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class Ru extends ed{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=_u("fontFamily",Iu(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 Mu(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 Du extends ed{init(){const e=this.editor,t=e.t,n=this._getLocalizedOptions(),o=e.commands.get("fontFamily");e.ui.componentFactory.add("fontFamily",i=>{const r=Wl(i);return Gl(r,function(e,t){const n=new An;for(const o of e){const e={type:"button",model:new Su({commandName:"fontFamily",commandParam:o.model,label:o.title,withText:!0})};e.model.bind("isOn").to(t,"value",e=>e===o.model||!(!e||!o.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===o.model.toLowerCase()),o.view&&o.view.styles&&e.model.set("labelStyle","font-family: "+o.view.styles["font-family"]),n.add(e)}return n}(n,o)),r.buttonView.set({label:t("Font Family"),icon:'',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t;return Iu(e.config.get("fontFamily").options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class Lu extends mu{constructor(e){super(e,"fontColor")}}class Vu extends ed{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:vu("color")}}),e.conversion.for("downcast").attributeToElement({model:"fontColor",view:yu("color")}),e.commands.add("fontColor",new Lu(e)),e.model.schema.extend("$text",{allowAttributes:"fontColor"}),e.model.schema.setAttributeProperties("fontColor",{isFormatting:!0,copyOnEnter:!0})}}function ju(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 zu extends ed{constructor(e,{commandName:t,icon:n,componentName:o,dropdownLabel:i}){super(e),this.commandName=t,this.componentName=o,this.icon=n,this.dropdownLabel=i,this.columns=e.config.get(this.componentName+".columns"),this.colorTableView}init(){const e=this.editor,t=e.locale,n=t.t,o=e.commands.get(this.commandName);const i=function(e,t){const n=e.t,o={Black:n("Black"),"Dim grey":n("Dim grey"),Grey:n("Grey"),"Light grey":n("Light grey"),White:n("White"),Red:n("Red"),Orange:n("Orange"),Yellow:n("Yellow"),"Light green":n("Light green"),Green:n("Green"),Aquamarine:n("Aquamarine"),Turquoise:n("Turquoise"),"Light blue":n("Light blue"),Blue:n("Blue"),Purple:n("Purple")};return t.map(e=>{const t=o[e.label];return t&&t!=e.label&&(e.label=t),e})}(t,e.config.get(this.componentName).colors.map(ju).filter(e=>!!e)),r=e.config.get(this.componentName+".documentColors");e.ui.componentFactory.add(this.componentName,t=>{const s=Wl(t);return this.colorTableView=function({dropdownView:e,colors:t,columns:n,removeButtonLabel:o,documentColorsLabel:i,documentColorsCount:r}){const s=e.locale,a=new ku(s,{colors:t,columns:n,removeButtonLabel:o,documentColorsLabel:i,documentColorsCount:r});return e.colorTableView=a,e.panelView.children.add(a),a.delegate("execute").to(e,"execute"),a}({dropdownView:s,colors:i.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),documentColorsLabel:0!==r?n("Document colors"):void 0,documentColorsCount:void 0===r?this.columns:r}),this.colorTableView.bind("selectedColor").to(o,"value"),s.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),s.bind("isEnabled").to(o),s.on("execute",(t,n)=>{e.execute(this.commandName,n),e.editing.view.focus()}),s.on("change:isOpen",(t,n,o)=>{s.colorTableView.appendGrids(),o&&(0!==r&&this.colorTableView.updateDocumentColors(e.model,this.componentName),this.colorTableView.updateSelectedColors())}),s})}}class Bu extends zu{constructor(e){super(e,{commandName:"fontColor",componentName:"fontColor",icon:'',dropdownLabel:(0,e.locale.t)("Font Color")})}static get pluginName(){return"FontColorUI"}}class Fu extends mu{constructor(e){super(e,"fontBackgroundColor")}}const Uu=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Hu=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,qu=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Wu=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,$u=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Gu=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 Yu(e){return e.startsWith("#")?Uu.test(e):e.startsWith("rgb")?Hu.test(e)||qu.test(e):e.startsWith("hsl")?Wu.test(e)||$u.test(e):Gu.has(e.toLowerCase())}const Ku=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const Qu=["center","top","bottom","left","right"];function Ju(e){return Qu.includes(e)}const Zu=["fixed","scroll","local"];function Xu(e){return Zu.includes(e)}const eh=/^url\(/;function th(e){return eh.test(e)}function nh(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=ih(e),n=t[0],o=t[2]||n,i=t[1]||n;return{top:n,bottom:o,right:i,left:t[3]||i}}function oh({top:e,right:t,bottom:n,left:o}){const i=[];return o!==t?i.push(e,t,n,o):n!==e?i.push(e,t,n):t!==e?i.push(e,t):i.push(e),i.join(" ")}function ih(e){return e.replace(/, /g,",").split(" ").map(e=>e.replace(/,/g,", "))}function rh(e){e.setNormalizer("background",sh),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 sh(e){const t={},n=ih(e);for(const e of n)o=e,Ku.includes(o)?(t.repeat=t.repeat||[],t.repeat.push(e)):Ju(e)?(t.position=t.position||[],t.position.push(e)):Xu(e)?t.attachment=e:Yu(e)?t.color=e:th(e)&&(t.image=e);var o;return{path:"background",value:t}}class ah extends ed{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(rh),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:"fontBackgroundColor",value:vu("background-color")}}),e.conversion.for("downcast").attributeToElement({model:"fontBackgroundColor",view:yu("background-color")}),e.commands.add("fontBackgroundColor",new Fu(e)),e.model.schema.extend("$text",{allowAttributes:"fontBackgroundColor"}),e.model.schema.setAttributeProperties("fontBackgroundColor",{isFormatting:!0,copyOnEnter:!0})}}class ch extends zu{constructor(e){super(e,{commandName:"fontBackgroundColor",componentName:"fontBackgroundColor",icon:'',dropdownLabel:(0,e.locale.t)("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class lh{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}xn(lh,Ho);class dh extends lh{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new An({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new hn.b("pendingactions-add-invalid-message: The message must be a string.",this);const t=Object.create(Ho);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 uh{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((n,o)=>{t.onload=()=>{const e=t.result;this._data=e,n(e)},t.onerror=()=>{o("error")},t.onabort=()=>{o("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}xn(uh,Ho);class hh extends ed{static get pluginName(){return"FileRepository"}static get requires(){return[dh]}init(){this.loaders=new An,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 console.warn(Object(hn.a)("filerepository-no-upload-adapter: Upload adapter is not defined.")),null;const t=new fh(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 fh?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,n)=>{e===t&&this._loadersMap.delete(n)})}_updatePendingAction(){const e=this.editor.plugins.get(dh);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,n=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else e.remove(this._pendingAction),this._pendingAction=null}}xn(hh,Ho);class fh{constructor(e,t){this.id=dn(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new uh,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 hn.b("filerepository-read-wrong-status: You cannot call read if the status is different than idle.",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 hn.b("filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.",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((n,o)=>{t.rejecter=o,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,n(e)}).catch(e=>{t.isFulfilled=!0,o(e)})}),t}}xn(fh,Ho);function mh(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const n of t){const t=n.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,n;return e&&40==e.length||(e=function(e){let t="";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let e=0;e.5?o.toUpperCase():o}return t}(40),t="ckCsrfToken",n=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(n)+";path=/"),e}class gh extends ed{static get requires(){return[hh]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(hh).createUploadAdapter=t=>new ph(t,e,this.editor.t))}}class ph{constructor(e,t,n){this.loader=e,this.url=t,this.t=n}upload(){return this.loader.file.then(e=>new Promise((t,n)=>{this._initRequest(),this._initListeners(t,n,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,n){const o=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${n.name}.`;o.addEventListener("error",()=>t(r)),o.addEventListener("abort",()=>t()),o.addEventListener("load",()=>{const n=o.response;if(!n||!n.uploaded)return t(n&&n.error&&n.error.message?n.error.message:r);e({default:n.url})}),o.upload&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&(i.uploadTotal=e.total,i.uploaded=e.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",mh()),this.xhr.send(t)}}function bh(e,t,n,o){let i,r=null;"function"==typeof o?i=o:(r=e.commands.get(o),i=()=>{e.execute(o)}),e.model.document.on("change:data",(o,s)=>{if(r&&!r.isEnabled||!t.isEnabled)return;const a=iu(e.model.document.selection.getRanges());if(!a.isCollapsed)return;if("transparent"==s.type)return;const c=Array.from(e.model.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=l.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=n.exec(u.data.substr(0,a.end.offset));f&&e.model.enqueueChange(e=>{const t=e.createPositionAt(d,0),n=e.createPositionAt(d,f[0].length),o=new zs(t,n);!1!==i({match:f})&&e.remove(o),o.detach()})})}function wh(e,t,n,o){let i,r;n instanceof RegExp?i=n:r=n,r=r||(e=>{let t;const n=[],o=[];for(;null!==(t=i.exec(e))&&!(t&&t.length<4);){let{index:e,1:i,2:r,3:s}=t;const a=i+r+s;e+=t[0].length-a.length;const c=[e,e+i.length],l=[e+i.length+r.length,e+i.length+r.length+s.length];n.push(c),n.push(l),o.push([e+i.length,e+i.length+r.length])}return{remove:n,format:o}}),e.model.document.on("change:data",(n,i)=>{if("transparent"==i.type||!t.isEnabled)return;const s=e.model,a=s.document.selection;if(!a.isCollapsed)return;const c=Array.from(s.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const d=a.focus,u=d.parent,{text:h,range:f}=function(e,t){let n=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(n=t.createPositionAfter(o),""):e+o.data,""),range:t.createRange(n,e.end)}}(s.createRange(s.createPositionAt(u,0),d),s),m=r(h),g=kh(f.start,m.format,s),p=kh(f.start,m.remove,s);g.length&&p.length&&s.enqueueChange(e=>{if(!1!==o(e,g))for(const t of p.reverse())e.remove(t)})})}function kh(e,t,n){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>n.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}function _h(e,t){return(n,o)=>{if(!e.commands.get(t).isEnabled)return!1;const i=e.model.schema.getValidRanges(o,t);for(const e of i)n.setAttribute(t,!0,e);n.removeSelectionAttribute(t)}}class vh extends sd{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,n=t.document.selection,o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(n.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const i=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const t of i)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const e of n.getRanges())for(const n of e.getItems())if(t.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}class yh extends ed{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 vh(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class xh extends ed{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",n=>{const o=e.commands.get("bold"),i=new Vl(n);return i.set({label:t("Bold"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),i})}}class Ah extends ed{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 vh(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class Ch extends ed{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",n=>{const o=e.commands.get("italic"),i=new Vl(n);return i.set({label:t("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),i})}}class Th extends ed{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"strikethrough"}),e.model.schema.setAttributeProperties("strikethrough",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"strikethrough",view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add("strikethrough",new vh(e,"strikethrough")),e.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}class Ph extends ed{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("strikethrough",n=>{const o=e.commands.get("strikethrough"),i=new Vl(n);return i.set({label:t("Strikethrough"),icon:'',keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("strikethrough"),e.editing.view.focus()}),i})}}class Sh extends ed{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 vh(e,"underline")),e.keystrokes.set("CTRL+U","underline")}}class Eh extends ed{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("underline",n=>{const o=e.commands.get("underline"),i=new Vl(n);return i.set({label:t("Underline"),icon:'',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("underline"),e.editing.view.focus()}),i})}}class Mh extends sd{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,o=t.document.selection,i=Array.from(o.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=i.filter(e=>Ih(e)||Oh(n,e));this._applyQuote(e,t)}else this._removeQuote(e,i.filter(Ih))})}_getValue(){const e=iu(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Ih(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=iu(e.getSelectedBlocks());return!!n&&Oh(t,n)}_removeQuote(e,t){Nh(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const n=e.createPositionBefore(t.start.parent);return void e.move(t,n)}t.end.isAtEnd||e.split(t.end);const n=e.createPositionAfter(t.end.parent);e.move(t,n)})}_applyQuote(e,t){const n=[];Nh(e,t).reverse().forEach(t=>{let o=Ih(t.start);o||(o=e.createElement("blockQuote"),e.wrap(t,o)),n.push(o)}),n.reverse().reduce((t,n)=>t.nextSibling==n?(e.merge(e.createPositionAfter(t)),t):n)}}function Ih(e){return"blockQuote"==e.parent.name?e.parent:null}function Nh(e,t){let n,o=0;const i=[];for(;o{if(e.endsWith("blockQuote")&&"blockQuote"==t.name)return!1}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(n=>{const o=e.model.document.differ.getChanges();for(const e of o)if("insert"==e.type){const o=e.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return n.remove(o),!0;if(o.is("element","blockQuote")&&!t.checkChild(e.position,o))return n.unwrap(o),!0;if(o.is("element")){const e=n.createRangeIn(o);for(const o of e.getItems())if(o.is("element","blockQuote")&&!t.checkChild(n.createPositionBefore(o),o))return n.unwrap(o),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return n.remove(t),!0}return!1})}afterInit(){const e=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(t,n)=>{const o=this.editor.model.document,i=o.selection.getLastPosition().parent;o.selection.isCollapsed&&i.isEmpty&&e.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())})}}n(45);class Dh extends ed{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",n=>{const o=e.commands.get("blockQuote"),i=new Vl(n);return i.set({label:t("Block quote"),icon:'',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),i})}}class Lh extends ed{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,t=e.ui.componentFactory,n=e.t;t.add("ckfinder",t=>{const o=e.commands.get("ckfinder"),i=new Vl(t);return i.set({label:n("Insert image or file"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o),i.on("execute",()=>{e.execute("ckfinder"),e.editing.view.focus()}),i})}}class Vh extends pr{observe(e){this.listenTo(e,"load",(e,t)=>{"IMG"==t.target.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class jh{constructor(){this._stack=[]}add(e,t){const n=this._stack,o=n[0];this._insertDescriptor(e);const i=n[0];o===i||zh(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:t})}remove(e,t){const n=this._stack,o=n[0];this._removeDescriptor(e);const i=n[0];o===i||zh(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex(t=>t.id===e.id);if(zh(e,t[n]))return;n>-1&&t.splice(n,1);let o=0;for(;t[o]&&Bh(t[o],e);)o++;t.splice(o,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex(t=>t.id===e);n>-1&&t.splice(n,1)}}function zh(e,t){return e&&t&&e.priority==t.priority&&Fh(e.classes)==Fh(t.classes)}function Bh(e,t){return e.priority>t.priority||!(e.priorityFh(t.classes)}function Fh(e){return Array.isArray(e)?e.sort().join(","):e}function Uh(e){return t=>t+e}xn(jh,gn);n(47);const Hh=Uh("px"),qh=ir.document.body;class Wh extends wl{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",Hh),left:t.to("left",Hh)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=Wh.defaultPositions,n=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:qh,fitInViewport:!0},e),o=Wh._getOptimalPosition(n),i=parseInt(o.left),r=parseInt(o.top),s=o.name;Object.assign(this,{top:r,left:i,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=$h(e.target),n=e.limiter?$h(e.limiter):qh;this.listenTo(ir.document,"scroll",(o,i)=>{const r=i.target,s=t&&r.contains(t),a=n&&r.contains(n);!s&&!a&&t&&n||this.attachTo(e)},{useCapture:!0}),this.listenTo(ir.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(ir.document,"scroll"),this.stopListening(ir.window,"resize")}}function $h(e){return nn(e)?e:es(e)?e.commonAncestorContainer:"function"==typeof e?$h(e()):null}function Gh(e,t){return e.top-t.height-Wh.arrowVerticalOffset}function Yh(e){return e.bottom+Wh.arrowVerticalOffset}Wh.arrowHorizontalOffset=25,Wh.arrowVerticalOffset=10,Wh._getOptimalPosition=Ml,Wh.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:Gh(e,t),left:e.left-Wh.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:Gh(e,t),left:e.left-.25*t.width-Wh.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:Gh(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:Gh(e,t),left:e.left-.75*t.width+Wh.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:Gh(e,t),left:e.left-t.width+Wh.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:Gh(e,t),left:e.left+e.width/2-Wh.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:Gh(e,t),left:e.left+e.width/2-.25*t.width-Wh.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:Gh(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:Gh(e,t),left:e.left+e.width/2-.75*t.width+Wh.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:Gh(e,t),left:e.left+e.width/2-t.width+Wh.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:Gh(e,t),left:e.right-Wh.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:Gh(e,t),left:e.right-.25*t.width-Wh.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:Gh(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:Gh(e,t),left:e.right-.75*t.width+Wh.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:Gh(e,t),left:e.right-t.width+Wh.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:Yh(e),left:e.left-Wh.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:Yh(e),left:e.left-.25*t.width-Wh.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:Yh(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:Yh(e),left:e.left-.75*t.width+Wh.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:Yh(e),left:e.left-t.width+Wh.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:Yh(e),left:e.left+e.width/2-Wh.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:Yh(e),left:e.left+e.width/2-.25*t.width-Wh.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:Yh(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:Yh(e),left:e.left+e.width/2-.75*t.width+Wh.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:Yh(e),left:e.left+e.width/2-t.width+Wh.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:Yh(e),left:e.right-Wh.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:Yh(e),left:e.right-.25*t.width-Wh.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:Yh(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:Yh(e),left:e.right-.75*t.width+Wh.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:Yh(e),left:e.right-t.width+Wh.arrowHorizontalOffset,name:"arrow_ne"})};function Kh(e,t,n){return e&&Jh(e)&&!n.isInline(t)}function Qh(e){return e.getAttribute("widget-type-around")}function Jh(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function Zh(e,t,n={}){if(!e.is("containerElement"))throw new hn.b("widget-to-widget-wrong-element-type: The element passed to toWidget() must be a container element instance.",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=rf,n.label&&function(e,t,n){n.setCustomProperty("widgetLabel",t,e)}(e,n.label,t),n.hasSelectionHandle&&function(e,t){const n=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),n=new Dl;return n.set("content",''),n.render(),t.appendChild(n.element),t}));t.insert(t.createPositionAt(e,0),n),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),Xh(e,t,(e,t,n)=>n.addClass(o(t.classes),e),(e,t,n)=>n.removeClass(o(t.classes),e)),e;function o(e){return Array.isArray(e)?e:[e]}}function Xh(e,t,n,o){const i=new jh;i.on("change:top",(t,i)=>{i.oldDescriptor&&o(e,i.oldDescriptor,i.writer),i.newDescriptor&&n(e,i.newDescriptor,i.writer)}),t.setCustomProperty("addHighlight",(e,t,n)=>i.add(t,n),e),t.setCustomProperty("removeHighlight",(e,t,n)=>i.remove(t,n),e)}function ef(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function tf(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",(n,o,i)=>{t.setAttribute("contenteditable",i?"false":"true",e)}),e.on("change:isFocused",(n,o,i)=>{i?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),e}function nf(e,t){const n=e.getSelectedElement();if(n){const o=Qh(e);if(o)return t.createPositionAt(n,o);if(t.schema.isBlock(n))return t.createPositionAfter(n)}const o=e.getSelectedBlocks().next().value;if(o){if(o.isEmpty)return t.createPositionAt(o,0);const n=t.createPositionAfter(o);return e.focus.isTouching(n)?n:t.createPositionBefore(o)}return e.focus}function of(e,t){const n=new os(ir.window),o=n.getIntersection(e),i=t.height+Wh.arrowVerticalOffset;if(e.top-i>n.top||e.bottom+i!e.is("element","image"))}(n)}function df(e){const t=[];for(const n of e.getChildren())t.push(n),n.is("element")&&t.push(...n.getChildren());return t.find(e=>e.is("element","img"))}function uf(e){return n=>{n.on(`attribute:${e}:image`,t)};function t(e,t,n){if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,i=df(n.mapper.toViewElement(t.item));o.setAttribute(t.attributeKey,t.attributeNewValue||"",i)}}class hf extends sd{refresh(){this.isEnabled=lf(this.editor.model)}execute(e){const t=this.editor.model;t.change(n=>{const o=Array.isArray(e.source)?e.source:[e.source];for(const e of o)cf(n,t,{src:e})})}}class ff extends ed{static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.model.schema,n=e.t,o=e.conversion;e.editing.view.addObserver(Vh),t.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),o.for("dataDowncast").elementToElement({model:"image",view:(e,{writer:t})=>mf(t)}),o.for("editingDowncast").elementToElement({model:"image",view:(e,{writer:t})=>function(e,t,n){return t.setCustomProperty("image",!0,e),Zh(e,t,{label:function(){const t=df(e).getAttribute("alt");return t?`${t} ${n}`:n}})}(mf(t),t,n("image widget"))}),o.for("downcast").add(uf("src")).add(uf("alt")).add(function(){return t=>{t.on("attribute:srcset:image",e)};function e(e,t,n){if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,i=df(n.mapper.toViewElement(t.item));if(null===t.attributeNewValue){const e=t.attributeOldValue;e.data&&(o.removeAttribute("srcset",i),o.removeAttribute("sizes",i),e.width&&o.removeAttribute("width",i))}else{const e=t.attributeNewValue;e.data&&(o.setAttribute("srcset",e.data,i),o.setAttribute("sizes","100vw",i),e.width&&o.setAttribute("width",e.width,i))}}}()),o.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,n){if(!n.consumable.test(t.viewItem,{name:!0,classes:"image"}))return;const o=df(t.viewItem);if(!o||!o.hasAttribute("src")||!n.consumable.test(o,{name:!0}))return;const i=iu(n.convertItem(o,t.modelCursor).modelRange.getItems());i&&(n.convertChildren(t.viewItem,i),n.updateConversionResult(i,t))}}()),e.commands.add("imageInsert",new hf(e))}}function mf(e){const t=e.createEmptyElement("img"),n=e.createContainerElement("figure",{class:"image"});return e.insert(e.createPositionAt(n,0),t),n}class gf extends Vr{constructor(e){super(e),this.domEventType="mousedown"}onDomEvent(e){this.fire(e.type,e)}}class pf extends ed{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,o=e.locale,i=t.document.selection;this.listenTo(n.document,"keydown",(e,t)=>{if(!i.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const n=t.keyCode==gi.arrowright,r=t.keyCode==gi.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{priority:un.get("high")+1}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&_f(i.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!bf(n,t))&&(_f(o,t)?(kf(e),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(kf(e),this._restoreGravity(),wf(n,t,i),!0):i.isAtStart?!!bf(o,t)&&(kf(e),wf(n,t,i),!0):function(e,t){return _f(e.getShiftedBy(-1),t)}(i,t)?i.isAtEnd&&!bf(o,t)&&_f(i,t)?(kf(e),wf(n,t,i),!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 bf(e,t){for(const n of t)if(e.hasAttribute(n))return!0;return!1}function wf(e,t,n){const o=n.nodeBefore;e.change(e=>{o?e.setSelectionAttribute(o.getAttributes()):e.removeSelectionAttribute(t)})}function kf(e){e.preventDefault()}function _f(e,t){const{nodeBefore:n,nodeAfter:o}=e;for(const e of t){const t=n?n.getAttribute(e):void 0;if((o?o.getAttribute(e):void 0)!==t)return!0}return!1}function vf(e,t,n,o){return o.createRange(yf(e,t,n,!0,o),yf(e,t,n,!1,o))}function yf(e,t,n,o,i){let r=e.textNode||(o?e.nodeBefore:e.nodeAfter),s=null;for(;r&&r.getAttribute(t)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):e}class xf{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,n)=>{if(!n.consumable.test(t.item,"attribute:linkHref"))return;const o=n.writer,i=o.document.selection;for(const e of this._definitions){const r=o.createAttributeElement("a",e.attributes,{priority:5});o.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?o.wrap(i.getFirstRange(),r):o.wrap(n.mapper.toViewRange(t.range),r):o.unwrap(n.mapper.toViewRange(t.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:image",(e,t,n)=>{const o=n.mapper.toViewElement(t.item),i=Array.from(o.getChildren()).find(e=>"a"===e.name);for(const e of this._definitions){const o=Ln(e.attributes);if(e.callback(t.attributeNewValue))for(const[e,t]of o)"class"===e?n.writer.addClass(t,i):n.writer.setAttribute(e,t,i);else for(const[e,t]of o)"class"===e?n.writer.removeClass(t,i):n.writer.removeAttribute(e,i)}})}}}var Af=function(e,t,n){var o=e.length;return n=void 0===n?o:n,!t&&n>=o?e:oo(e,t,n)},Cf=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Tf=function(e){return Cf.test(e)};var Pf=function(e){return e.split("")},Sf="[\\ud800-\\udfff]",Ef="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Mf="\\ud83c[\\udffb-\\udfff]",If="[^\\ud800-\\udfff]",Nf="(?:\\ud83c[\\udde6-\\uddff]){2}",Of="[\\ud800-\\udbff][\\udc00-\\udfff]",Rf="(?:"+Ef+"|"+Mf+")"+"?",Df="[\\ufe0e\\ufe0f]?"+Rf+("(?:\\u200d(?:"+[If,Nf,Of].join("|")+")[\\ufe0e\\ufe0f]?"+Rf+")*"),Lf="(?:"+[If+Ef+"?",Ef,Nf,Of,Sf].join("|")+")",Vf=RegExp(Mf+"(?="+Mf+")|"+Lf+Df,"g");var jf=function(e){return e.match(Vf)||[]};var zf=function(e){return Tf(e)?jf(e):Pf(e)};var Bf=function(e){return function(t){t=Zn(t);var n=Tf(t)?zf(t):void 0,o=n?n[0]:t.charAt(0),i=n?Af(n,1).join(""):t.slice(1);return o[e]()+i}}("toUpperCase");const Ff=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Uf=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;function Hf(e,{writer:t}){const n=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,n),n}function qf(e){return function(e){return e.replace(Ff,"").match(Uf)}(e=String(e))?e:"#"}function Wf(e,t){return!!e&&(e.is("element","image")&&t.checkAttribute("image","linkHref"))}class $f extends sd{constructor(e){super(e),this.manualDecorators=new An,this.automaticDecorators=new xf}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document,n=iu(t.selection.getSelectedBlocks());Wf(n,e.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(n,"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 n=this.editor.model,o=n.document.selection,i=[],r=[];for(const e in t)t[e]?i.push(e):r.push(e);n.change(t=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=vf(s,"linkHref",o.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,a),i.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=Ln(o.getAttributes());r.set("linkHref",e),i.forEach(e=>{r.set(e,!0)});const a=t.createText(e,r);n.insertContent(a,s),t.setSelection(t.createPositionAfter(a))}["linkHref",...i,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=n.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const e of o.getSelectedBlocks())n.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const c=a.slice();for(const e of s)this._isRangeToUpdate(e,a)&&c.push(e);for(const n of c)t.setAttribute("linkHref",e,n),i.forEach(e=>{t.setAttribute(e,!0,n)}),r.forEach(e=>{t.removeAttribute(e,n)})}})}_getDecoratorStateFromModel(e){const t=this.editor.model,n=t.document,o=iu(n.selection.getSelectedBlocks());return Wf(o,t.schema)?o.getAttribute(e):n.selection.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t)if(n.containsRange(e))return!1;return!0}}class Gf extends sd{refresh(){const e=this.editor.model,t=e.document,n=iu(t.selection.getSelectedBlocks());Wf(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,o=e.commands.get("link");t.change(e=>{const i=n.isCollapsed?[vf(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),t)]:n.getRanges();for(const t of i)if(e.removeAttribute("linkHref",t),o)for(const n of o.manualDecorators)e.removeAttribute(n.id,t)})}}class Yf{constructor({id:e,label:t,attributes:n,defaultValue:o}){this.id=e,this.set("value"),this.defaultValue=o,this.label=t,this.attributes=n}}xn(Yf,Ho);n(49);const Kf=/^(https?:)?\/\//;class Qf extends ed{static get pluginName(){return"LinkEditing"}static get requires(){return[pf,Nd,rd]}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:Hf}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>Hf(qf(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 $f(e)),e.commands.add("unlink",new Gf(e));const t=function(e,t){const n={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>(e.label&&n[e.label]&&(e.label=n[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[n,o]of Object.entries(e)){const e=Object.assign({},o,{id:"link"+Bf(n)});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(pf).registerAttribute("linkHref"),function(e,t,n,o){const i=e.editing.view,r=new Set;i.document.registerPostFixer(i=>{const s=e.model.document.selection;let a=!1;if(s.hasAttribute(t)){const c=vf(s.getFirstPosition(),t,s.getAttribute(t),e.model),l=e.editing.mapper.toViewRange(c);for(const e of l.getItems())e.is("element",n)&&!e.hasClass(o)&&(i.addClass(o,e),r.add(e),a=!0)}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){i.change(e=>{for(const t of r.values())e.removeClass(o,t),r.delete(t)})}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor,n=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:"automatic",callback:e=>Kf.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),n.add(new Yf(e)),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,{writer:o})=>{if(t){const t=n.get(e.id).attributes,i=o.createAttributeElement("a",t,{priority:5});return o.setCustomProperty("link",!0,i),i}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:n.get(e.id).attributes},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor,t=e.model,n=t.document.selection,o=e.commands.get("link");this.listenTo(t,"insertContent",()=>{const e=n.anchor.nodeBefore,i=n.anchor.nodeAfter;n.hasAttribute("linkHref")&&e&&e.hasAttribute("linkHref")&&(i&&i.hasAttribute("linkHref")||t.change(e=>{Jf(e,o.manualDecorators)}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.commands.get("link");e.editing.view.addObserver(gf);let n=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{n=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!n)return;n=!1;const o=e.model.document.selection;if(!o.isCollapsed)return;if(!o.hasAttribute("linkHref"))return;const i=o.getFirstPosition(),r=vf(i,"linkHref",o.getAttribute("linkHref"),e.model);(i.isTouching(r.start)||i.isTouching(r.end))&&e.model.change(e=>{Jf(e,t.manualDecorators)})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let n,o;this.listenTo(t.document,"delete",()=>{o=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const t=e.model.document.selection;t.isCollapsed||(o?o=!1:Zf(e)&&function(e){const t=e.document.selection,n=t.getFirstPosition(),o=t.getLastPosition(),i=n.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(i===r)return!0;return vf(n,"linkHref",i.getAttribute("linkHref"),e).containsRange(e.createRange(n,o),!0)}(e.model)&&(n=t.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(t,[i])=>{o=!1,Zf(e)&&n&&(e.model.change(e=>{for(const[t,o]of n)e.setAttribute(t,o,i)}),n=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,n=t.document.selection,o=e.editing.view,i=e.commands.get("link");let r=!1,s=!1;this.listenTo(o.document,"delete",(e,t)=>{s=t.domEvent.keyCode===gi.backspace},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const e=n.getFirstPosition(),o=n.getAttribute("linkHref");if(!o)return;const i=vf(e,"linkHref",o,t);r=i.containsPosition(e)||i.end.isEqual(e)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,r||e.model.enqueueChange(e=>{Jf(e,i.manualDecorators)}))},{priority:"low"})}}function Jf(e,t){e.removeSelectionAttribute("linkHref");for(const n of t)e.removeSelectionAttribute(n.id)}function Zf(e){return e.plugins.get("Input").isInput(e.model.change(e=>e.batch))}class Xf extends lh{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 em extends sd{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 hn.b('ckfinder-unknown-openerMethod: The openerMethod config option must by "popup" or "modal".',e);const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const o=n.onInit;n.language||(n.language=e.locale.uiLanguage),n.onInit=t=>{o&&o(t),t.on("files:choose",n=>{const o=n.data.files.toArray(),i=o.filter(e=>!e.isImage()),r=o.filter(e=>e.isImage());for(const t of i)e.execute("link",t.getUrl());const s=[];for(const e of r){const n=e.getUrl();s.push(n||t.request("file:getProxyUrl",{file:e}))}s.length&&tm(e,s)}),t.on("file:choose:resizedImage",t=>{const n=t.data.resizedUrl;if(n)tm(e,[n]);else{const t=e.plugins.get("Notification"),n=e.locale.t;t.showWarning(n("Could not obtain resized image URL."),{title:n("Selecting resized image failed"),namespace:"ckfinder"})}})},window.CKFinder[t](n)}}function tm(e,t){if(e.commands.get("imageInsert").isEnabled)e.execute("imageInsert",{source:t});else{const t=e.plugins.get("Notification"),n=e.locale.t;t.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"})}}class nm extends ed{static get pluginName(){return"CKFinderEditing"}static get requires(){return[Xf,ff,Qf]}init(){const e=this.editor;e.commands.add("ckfinder",new em(e))}}const om=/^data:(\S*?);base64,/;class im{constructor(e,t,n){if(!e)throw new hn.b("fileuploader-missing-file: File must be provided as the first argument",null);if(!t)throw new hn.b("fileuploader-missing-token: Token must be provided as the second argument.",null);if(!n)throw new hn.b("fileuploader-missing-api-address: Api address must be provided as the third argument.",null);this.file=function(e){if("string"!=typeof e)return!1;const t=e.match(om);return!(!t||!t.length)}(e)?function(e,t=512){try{const n=e.match(om)[1],o=atob(e.replace(om,"")),i=[];for(let e=0;ee(n)),this}onError(e){return this.once("error",(t,n)=>e(n)),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 n(t){return()=>e.fire("error",t)}t.addEventListener("error",n("Network Error")),t.addEventListener("abort",n("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,n=t.response;if(e<200||e>299)return this.fire("error",n.message||n.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((n,o)=>{t.addEventListener("load",()=>{const e=t.status,i=t.response;return e<200||e>299?i.message?o(new hn.b("fileuploader-uploading-data-failed: Uploading file failed.",this,{message:i.message})):o(i.error):n(i)}),t.addEventListener("error",()=>o(new Error("Network Error"))),t.addEventListener("abort",()=>o(new Error("Abort"))),t.send(e)})}}xn(im,gn);const rm={refreshInterval:36e5,autoRefresh:!0};class sm{constructor(e,t=rm){if(!e)throw new hn.b("token-missing-token-url: A `tokenUrl` must be provided as the first constructor argument.",this);this.set("value",t.initValue),this._refresh="function"==typeof e?e:()=>{return t=e,new Promise((e,n)=>{const o=new XMLHttpRequest;o.open("GET",t),o.addEventListener("load",()=>{const t=o.status,i=o.response;return t<200||t>299?n(new hn.b("token-cannot-download-new-token: Cannot download new token from the provided url.",null)):e(i)}),o.addEventListener("error",()=>n(new Error("Network Error"))),o.addEventListener("abort",()=>n(new Error("Abort"))),o.send()});var t},this._options=Object.assign({},rm,t)}init(){return new Promise((e,t)=>{this._options.autoRefresh&&this._startRefreshing(),this.value?e(this):this.refreshToken().then(e).catch(t)})}refreshToken(){return this._refresh().then(e=>this.set("value",e)).then(()=>this)}destroy(){this._stopRefreshing()}_startRefreshing(){this._refreshInterval=setInterval(()=>this.refreshToken(),this._options.refreshInterval)}_stopRefreshing(){clearInterval(this._refreshInterval)}static create(e,t=rm){return new sm(e,t).init()}}xn(sm,Ho);var am=sm;class cm extends lh{static get pluginName(){return"CloudServices"}init(){const e=this.context.config.get("cloudServices")||{};for(const t in e)this[t]=e[t];if(this.tokenUrl)return this.token=new cm.Token(this.tokenUrl),this.token.init();this.token=null}destroy(){super.destroy(),this.token&&this.token.destroy()}}cm.Token=am;class lm extends ed{static get requires(){return[hh,cm]}init(){const e=this.editor,t=e.plugins.get(cm),n=t.token,o=t.uploadUrl;n&&(this._uploadGateway=new lm._UploadGateway(n,o),e.plugins.get(hh).createUploadAdapter=e=>new dm(this._uploadGateway,e))}}class dm{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()}}lm._UploadGateway=class{constructor(e,t){if(!e)throw new hn.b("uploadgateway-missing-token: Token must be provided.",null);if(!t)throw new hn.b("uploadgateway-missing-api-address: Api address must be provided.",null);this._token=e,this._apiAddress=t}upload(e){return new im(e,this._token,this._apiAddress)}};n(51);const um=["before","after"],hm=(new DOMParser).parseFromString('\n',"image/svg+xml").firstChild;class fm extends ed{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",(n,o,i)=>{t.change(e=>{for(const n of t.document.roots)i?e.removeClass("ck-widget__type-around_disabled",n):e.addClass("ck-widget__type-around_disabled",n)}),i||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 n=this.editor,o=n.editing.view;n.execute("insertParagraph",{position:n.model.createPositionAt(e,t)}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(e,t,n,o){this.listenTo(e,t,(...e)=>{this.isEnabled&&n(...e)},o)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Qh(e);if(!t)return!1;const n=e.getSelectedElement();return this._insertParagraph(n,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,n=e.locale.t,o={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,n,i)=>{const r=i.mapper.toViewElement(n.item);Kh(r,n.item,t)&&function(e,t,n){const o=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const n=this.toDomElement(e);return function(e,t){for(const n of um){const o=new Xc({tag:"div",attributes:{class:["ck","ck-widget__type-around__button","ck-widget__type-around__button_"+n],title:t[n]},children:[e.ownerDocument.importNode(hm,!0)]});e.appendChild(o.render())}}(n,t),function(e){const t=new Xc({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(n),n}));e.insert(e.createPositionAt(n,"end"),o)}(i.writer,o,r)},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,n=t.document.selection,o=t.schema,i=e.editing.view;function r(e){return"ck-widget_type-around_show-fake-caret_"+e}this._listenToIfEnabled(i.document,"keydown",(e,t)=>{ki(t.keyCode)&&this._handleArrowKeyPress(e,t)},{priority:un.get("high")+10}),this._listenToIfEnabled(n,"change:range",(t,n)=>{n.directChange&&e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=n.getSelectedElement();if(t){if(Kh(e.editing.mapper.toViewElement(t),t,o))return}e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,n)=>{const i=n.writer;if(this._currentFakeCaretModelElement){const e=n.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(i.removeClass(um.map(r),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!Kh(a,s,o))return;const c=Qh(t.selection);c&&(i.addClass(r(c),a),this._currentFakeCaretModelElement=s)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,n,o)=>{o||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})})}_handleArrowKeyPress(e,t){const n=this.editor,o=n.model,i=o.document.selection,r=o.schema,s=n.editing.view,a=vi(t.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;Kh(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed&&(l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a)),l&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,n=Qh(t.document.selection);return t.change(t=>{if(!n)return t.setSelectionAttribute("widget-type-around",e?"after":"before"),!0;if(!(n===(e?"after":"before")))return t.removeSelectionAttribute("widget-type-around"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,n=t.model,o=n.schema,i=t.plugins.get("Widget"),r=i._getObjectElementNextToSelection(e);return!!Kh(t.editing.mapper.toViewElement(r),r,o)&&(n.change(t=>{i._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",(n,o)=>{const i=o.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(e,t){const n=e.closest(".ck-widget");return t.mapDomToView(n)}(i,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),n.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"enter",(n,o)=>{const i=t.document.selection.getSelectedElement(),r=e.editing.mapper.toModelElement(i),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Kh(i,r,s)&&(this._insertParagraph(r,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),n.stop())})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view,t=[gi.enter,gi.delete,gi.backspace];this._listenToIfEnabled(e.document,"keydown",(e,n)=>{t.includes(n.keyCode)||Td(n)||this._insertParagraphAccordingToFakeCaretPosition()},{priority:un.get("high")+1})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,n=e.model,o=n.schema;this._listenToIfEnabled(t.document,"delete",(t,i)=>{const r=Qh(n.document.selection);if(!r)return;const s=i.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)e.execute("delete",{selection:n.createSelection(a,"on")});else{const t=o.getNearestSelectionRange(n.createPositionAt(a,r),s);if(t)if(t.isCollapsed){const i=n.createSelection(t.start);if(n.modifySelection(i,{direction:s}),i.focus.isEqual(t.start)){const e=function(e,t){let n=t;for(const o of t.getAncestors({parentFirst:!0})){if(o.childCount>1||e.isLimit(o))break;n=o}return n}(o,t.start.parent);n.deleteContent(n.createSelection(e,"on"),{doNotAutoparagraph:!0})}else n.change(n=>{n.setSelection(t),e.execute(c?"forwardDelete":"delete")})}else n.change(n=>{n.setSelection(t),e.execute(c?"forwardDelete":"delete")})}i.preventDefault(),t.stop()},{priority:un.get("high")+1})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[o,i])=>{if(i&&!i.is("documentSelection"))return;const r=Qh(n);return r?(e.stop(),t.change(e=>{const i=n.getSelectedElement(),s=t.createPositionAt(i,r),a=e.createSelection(s),c=t.insertContent(o,a);return e.setSelection(a),c})):void 0},{priority:"high"})}}n(53);function mm(e){const t=e.model;return(n,o)=>{const i=o.keyCode==gi.arrowup,r=o.keyCode==gi.arrowdown,s=o.shiftKey,a=t.document.selection;if(!i&&!r)return;const c=r;if(s&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,c))return;const l=function(e,t,n){const o=e.model;if(n){const e=t.isCollapsed?t.focus:t.getLastPosition(),n=gm(o,e,"forward");if(!n)return null;const i=o.createRange(e,n),r=pm(o.schema,i,"backward");return r&&e.isBefore(r)?o.createRange(e,r):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),n=gm(o,e,"backward");if(!n)return null;const i=o.createRange(n,e),r=pm(o.schema,i,"forward");return r&&e.isAfter(r)?o.createRange(r,e):null}}(e,a,c);l&&!l.isCollapsed&&function(e,t,n){const o=e.model,i=e.view.domConverter;if(n){const e=o.createSelection(t.start);o.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=o.createRange(e.focus,t.end))}const r=e.mapper.toViewRange(t),s=i.viewRangeToDom(r),a=os.getDomRangeRects(s);let c;for(const e of a)if(void 0!==c){if(Math.round(e.top)>=c)return!1;c=Math.max(c,Math.round(e.bottom))}else c=Math.round(e.bottom);return!0}(e,l,c)&&(t.change(e=>{const n=c?l.end:l.start;if(s){const o=t.createSelection(a.anchor);o.setFocus(n),e.setSelection(o)}else e.setSelection(n)}),n.stop(),o.preventDefault(),o.stopPropagation())}}function gm(e,t,n){const o=e.schema,i=e.createRangeIn(t.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of i.getWalker({startPosition:t,direction:n})){if(o.isLimit(s)&&!o.isInline(s))return e;if(a==r&&o.isBlock(s))return null}return null}function pm(e,t,n){const o="backward"==n?t.end:t.start;if(e.checkChild(o,"$text"))return o;for(const{nextPosition:o}of t.getWalker({direction:n}))if(e.checkChild(o,"$text"))return o}class bm extends ed{static get pluginName(){return"Widget"}static get requires(){return[fm]}init(){const e=this.editor.editing.view,t=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(e,t,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const o=n.writer,i=o.document.selection,r=i.getSelectedElement();let s=null;for(const e of i.getRanges())for(const t of e){const e=t.item;Jh(e)&&!wm(e,s)&&(o.addClass("ck-widget_selected",e),this._previouslySelected.add(e),s=e,e==r&&o.setSelection(i.getRanges(),{fake:!0,label:ef(r)}))}},{priority:"low"}),e.addObserver(gf),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:un.get("high")-20}),this.listenTo(t,"keydown",mm(this.editor.editing)),this.listenTo(t,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{priority:"high"})}_onMousedown(e,t){const n=this.editor,o=n.editing.view,i=o.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(Jh(e))return!1;e=e.parent}return!1}(r)){if((hi.isSafari||hi.isGecko)&&t.domEvent.detail>=3){const e=n.editing.mapper,o=r.is("attributeElement")?r.findAncestor(e=>!e.is("attributeElement")):r,i=e.toModelElement(o);t.preventDefault(),this.editor.model.change(e=>{e.setSelection(i,"in")})}return}if(!Jh(r)&&(r=r.findAncestor(Jh),!r))return;t.preventDefault(),i.isFocused||o.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(e,t){const n=t.keyCode;if(!ki(n))return;const o=this.editor.model,i=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=vi(n,this.editor.locale.contentLanguageDirection);if(s&&i.isObject(s)){const n=a?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(n,a?"forward":"backward");return void(s&&(o.change(e=>{e.setSelection(s)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed)return;const c=this._getObjectElementNextToSelection(a);c&&i.isObject(c)&&(this._setSelectionOverElement(c),t.preventDefault(),e.stop())}_preventDefaultOnArrowKeyPress(e,t){if(!ki(t.keyCode))return;const n=this.editor.model,o=n.schema,i=n.document.selection.getSelectedElement();i&&o.isObject(i)&&(t.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const n=this._getObjectElementNextToSelection(e);return n?(this.editor.model.change(e=>{let o=t.anchor.parent;for(;o.isEmpty;){const t=o;o=t.parent,e.remove(t)}this._setSelectionOverElement(n)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,o=t.document.selection,i=t.createSelection(o);t.modifySelection(i,{direction:e?"forward":"backward"});const r=e?i.focus.nodeBefore:i.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function wm(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class km extends sd{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=af(e),af(e)&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor.model,n=t.document.selection.getSelectedElement();t.change(t=>{t.setAttribute("alt",e.newValue,n)})}}class _m extends ed{static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new km(this.editor))}}n(55);class vm extends wl{constructor(e,t){super(e);const n="ck-labeled-field-view-"+dn(),o="ck-labeled-field-view-status-"+dn();this.fieldView=t(this,n,o),this.set("label"),this.set("isEnabled",!0),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const i=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",i.to("class"),i.if("isEnabled","ck-disabled",e=>!e)]},children:[this.labelView,this.fieldView,this.statusView]})}_createLabelView(e){const t=new bu(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new wl(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",e=>!e)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}n(57);class ym extends wl{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById");const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",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")}})}render(){super.render();const e=e=>{this.element.value=e||0===e?e:""};e(this.value),this.on("change:value",(t,n,o)=>{e(o)})}select(){this.element.select()}focus(){this.element.focus()}}function xm(e,t,n){const o=new ym(e.locale);return o.set({id:t,ariaDescribedById:n}),o.bind("isReadOnly").to(e,"isEnabled",e=>!e),o.bind("hasError").to(e,"errorText",e=>!!e),o.on("input",()=>{e.errorText=null}),o}function Am({view:e}){e.listenTo(e.element,"submit",(t,n)=>{n.preventDefault(),e.fire("submit")},{useCapture:!0})}var Cm='',Tm='';n(59);class Pm extends wl{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new qc,this.keystrokes=new Lc,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Cm,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Tm,"ck-button-cancel","cancel"),this._focusables=new Zc,this._focusCycler=new Al({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"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Am({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,n,o){const i=new Vl(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createLabeledInputView(){const e=this.locale.t,t=new vm(this.locale,xm);return t.label=e("Text alternative"),t.fieldView.placeholder=e("Text alternative"),t}}n(61),n(63);const Sm=Uh("px");class Em extends ed{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 Wh(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 hn.b("contextualballoon-add-view-exist: Cannot add configuration of the same view twice.",[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 n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new hn.b("contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.",[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 hn.b("contextualballoon-showstack-stack-not-exist: Cannot show a stack that does 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 Mm(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,n)=>{if(n<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,n])}),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 Im(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:n=!0,singleViewMode:o=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),o&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&!e.limiter&&(e=Object.assign({},e,{limiter:this.positionLimiter})),e}}class Mm extends wl{constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new qc,this.buttonPrevView=this._createButtonView(t("Previous"),''),this.buttonNextView=this._createButtonView(t("Next"),''),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",n.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.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 n=new Vl(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class Im extends wl{constructor(e,t){super(e);const n=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",n.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:n.to("top",Sm),left:n.to("left",Sm),width:n.to("width",Sm),height:n.to("height",Sm)}},children:this.content}),this.on("change:numberOfPanels",(e,t,n,o)=>{n>o?this._addPanels(n-o):this._removePanels(o-n),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new wl;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:n,height:o}=new os(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:o})}}}function Nm(e){const t=e.editing.view,n=Wh.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast]}}class Om extends ed{static get requires(){return[Em]}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",n=>{const o=e.commands.get("imageTextAlternative"),i=new Vl(n);return i.set({label:t("Change image text alternative"),icon:'',tooltip:!0}),i.bind("isEnabled").to(o,"isEnabled"),this.listenTo(i,"execute",()=>{this._showForm()}),i})}_createForm(){const e=this.editor,t=e.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Pm(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",()=>{sf(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(sf(e.editing.view.document.selection)){const n=Nm(e);t.updatePosition(n)}}(e):this._hideForm(!0)}),ql({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"),n=this._form.labeledInput;this._isInBalloon||this._balloon.add({view:this._form,position:Nm(e)}),n.fieldView.value=n.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select()}_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 Rm extends ed{static get requires(){return[_m,Om]}static get pluginName(){return"ImageTextAlternative"}}n(65);class Dm extends ed{static get requires(){return[ff,bm,Rm]}static get pluginName(){return"Image"}}n(67);class Lm extends wl{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 Lc,this.focusTracker=new qc,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 Vl;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 Vl,t=e.bindTemplate;return e.icon=jl,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}}n(69);class Vm extends wl{constructor(e,t={}){super(e);const n=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",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}var jm='';n(71);class zm extends wl{constructor(e,t){super(e);const{insertButtonView:n,cancelButtonView:o}=this._createActionButtons(e);if(this.insertButtonView=n,this.cancelButtonView=o,this.dropdownView=this._createDropdownView(e),this.set("imageURLInputValue",""),this.focusTracker=new qc,this.keystrokes=new Lc,this._focusables=new Zc,this._focusCycler=new Al({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.set("_integrations",new An),t)for(const[e,n]of Object.entries(t))"insertImageViaUrl"===e&&(n.fieldView.bind("value").to(this,"imageURLInputValue",e=>e||""),n.fieldView.on("input",()=>{this.imageURLInputValue=n.fieldView.element.value})),this._integrations.add(n);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-upload-form"],tabindex:"-1"},children:[...this._integrations,new Vm(e,{children:[this.insertButtonView,this.cancelButtonView],class:"ck-image-upload-form__action-row"})]})}render(){super.render(),Am({view:this});const e=[...this._integrations,this.insertButtonView,this.cancelButtonView];e.forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element);const t=e=>e.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(e[0].element,"selectstart",(e,t)=>{t.stopPropagation()},{priority:"high"})}_createDropdownView(e){const t=e.t,n=Wl(e,Lm),o=n.buttonView,i=n.panelView;return o.set({label:t("Insert image"),icon:jm,tooltip:!0}),i.extendTemplate({attributes:{class:"ck-image-upload__panel"}}),n}_createActionButtons(e){const t=e.t,n=new Vl(e),o=new Vl(e);return n.set({label:t("Insert"),icon:Cm,class:"ck-button-save",type:"submit",withText:!0,isEnabled:this.imageURLInputValue}),o.set({label:t("Cancel"),icon:Tm,class:"ck-button-cancel",withText:!0}),n.bind("isEnabled").to(this,"imageURLInputValue"),n.delegate("execute").to(this,"submit"),o.delegate("execute").to(this,"cancel"),{insertButtonView:n,cancelButtonView:o}}focus(){this._focusCycler.focusFirst()}}class Bm extends wl{constructor(e){super(e),this.buttonView=new Vl(e),this._fileInputView=new Fm(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 Fm extends wl{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 Um(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}function Hm(e){const t=e.t,n=new vm(e,xm);return n.set({label:t("Insert image via URL")}),n.fieldView.placeholder="https://example.com/src/image.png",n.infoText=t("Paste the image source URL."),n}class qm extends ed{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=!!e.config.get("image.upload.panel.items");e.ui.componentFactory.add("imageUpload",e=>t?this._createDropdownView(e):this._createFileDialogButtonView(e))}_setUpDropdown(e,t,n){const o=this.editor,i=o.t,r=t.insertButtonView;function s(){o.editing.view.focus(),e.isOpen=!1}return e.bind("isEnabled").to(n),e.on("change:isOpen",()=>{const n=o.model.document.selection.getSelectedElement();e.isOpen&&(t.focus(),af(n)?(t.imageURLInputValue=n.getAttribute("src"),r.label=i("Update")):(t.imageURLInputValue="",r.label=i("Insert")))}),t.delegate("submit","cancel").to(e),this.delegate("cancel").to(e),e.on("submit",()=>{s(),function(){const e=o.model.document.selection.getSelectedElement();af(e)?o.model.change(n=>{n.setAttribute("src",t.imageURLInputValue,e),n.removeAttribute("srcset",e),n.removeAttribute("sizes",e)}):o.execute("imageInsert",{source:t.imageURLInputValue})}()}),e.on("cancel",()=>{s()}),e}_createDropdownView(e){const t=this.editor,n=new zm(e,function(e){const t=e.config.get("image.upload.panel.items"),n=e.plugins.get("ImageUploadUI"),o={insertImageViaUrl:Hm(e.locale)};if(!t)return o;if(t.find(e=>"openCKFinder"===e)&&e.ui.componentFactory.has("ckfinder")){const t=e.ui.componentFactory.create("ckfinder");t.set({withText:!0,class:"ck-image-upload__ck-finder-button"}),t.delegate("execute").to(n,"cancel"),o.openCKFinder=t}return t.reduce((t,n)=>(o[n]?t[n]=o[n]:e.ui.componentFactory.has(n)&&(t[n]=e.ui.componentFactory.create(n)),t),{})}(t)),o=t.commands.get("imageUpload"),i=n.dropdownView,r=i.panelView;return i.buttonView.actionView=this._createFileDialogButtonView(e),r.children.add(n),this._setUpDropdown(i,n,o)}_createFileDialogButtonView(e){const t=this.editor,n=e.t,o=t.config.get("image.upload.types"),i=new Bm(e),r=Um(o),s=t.commands.get("imageUpload");return i.set({acceptedType:o.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),i.buttonView.set({label:n("Insert image"),icon:jm,tooltip:!0}),i.buttonView.bind("isEnabled").to(s),i.on("done",(e,n)=>{const o=Array.from(n).filter(e=>r.test(e.type));o.length&&t.execute("imageUpload",{file:o})}),i}}n(73),n(75),n(77);class Wm extends ed{constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('')}init(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,n){const o=this.editor,i=t.item,r=i.getAttribute("uploadId");if(!n.consumable.consume(t.item,e.name))return;const s=o.plugins.get(hh),a=r?t.attributeNewValue:null,c=this.placeholder,l=o.editing.mapper.toViewElement(i),d=n.writer;if("reading"==a)return $m(l,d),void Gm(c,l,d);if("uploading"==a){const e=s.loaders.get(r);return $m(l,d),void(e?(Ym(l,d),function(e,t,n,o){const i=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"),i),n.on("change:uploadedPercent",(e,t,n)=>{o.change(e=>{e.setStyle("width",n+"%",i)})})}(l,d,e,o.editing.view),function(e,t,n){if(n.data){const o=df(e);t.setAttribute("src",n.data,o)}}(l,d,e)):Gm(c,l,d))}"complete"==a&&s.loaders.get(r)&&function(e,t,n){const o=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),o),setTimeout(()=>{n.change(e=>e.remove(e.createRangeOn(o)))},3e3)}(l,d,o.editing.view),function(e,t){Qm(e,t,"progressBar")}(l,d),Ym(l,d),function(e,t){t.removeClass("ck-appear",e)}(l,d)}}function $m(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function Gm(e,t,n){t.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",t);const o=df(t);o.getAttribute("src")!==e&&n.setAttribute("src",e,o),Km(t,"placeholder")||n.insert(n.createPositionAfter(o),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(n))}function Ym(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Qm(e,t,"placeholder")}function Km(e,t){for(const n of e.getChildren())if(n.getCustomProperty(t))return n}function Qm(e,t,n){const o=Km(e,n);o&&t.remove(t.createRangeOn(o))}class Jm{constructor(e){this.document=e}createDocumentFragment(e){return new Si(this.document,e)}createElement(e,t,n){return new Ro(this.document,e,t,n)}createText(e){return new Rn(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const n=e.parent;if(n){const o=n.getChildIndex(e);return this.removeChildren(o,1,n),this.insertChild(o,t,n),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){const n=new Ro(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){y(e)&&void 0===n&&(n=t),n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return Xo._createAt(e,t)}createPositionAfter(e){return Xo._createAfter(e)}createPositionBefore(e){return Xo._createBefore(e)}createRange(e,t){return new ei(e,t)}createRangeOn(e){return ei._createOn(e)}createRangeIn(e){return ei._createIn(e)}createSelection(e,t,n){return new oi(e,t,n)}}class Zm extends sd{refresh(){const e=this.editor.model.document.selection.getSelectedElement(),t=e&&"image"===e.name||!1;this.isEnabled=lf(this.editor.model)||t}execute(e){const t=this.editor,n=t.model,o=t.plugins.get(hh);n.change(t=>{const i=Array.isArray(e.file)?e.file:[e.file];for(const e of i)Xm(t,n,o,e)})}}function Xm(e,t,n,o){const i=n.createLoader(o);i&&cf(e,t,{uploadId:i.id})}class eg extends ed{static get requires(){return[hh,Xf,rd]}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,n=e.model.schema,o=e.conversion,i=e.plugins.get(hh),r=Um(e.config.get("image.upload.types"));n.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),e.commands.add("imageUpload",new Zm(e)),o.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,n)=>{if(o=n.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const i=Array.from(n.dataTransfer.files).filter(e=>!!e&&r.test(e.type)),s=n.targetRanges.map(t=>e.editing.mapper.toModelRange(t));e.model.change(n=>{n.setSelection(s),i.length&&(t.stop(),e.model.enqueueChange("default",()=>{e.execute("imageUpload",{file:i})}))})}),this.listenTo(e.plugins.get(rd),"inputTransformation",(t,n)=>{const o=Array.from(e.editing.view.createRangeIn(n.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,n)=>{const o=t.getAttribute("src");fetch(o).then(e=>e.blob()).then(t=>{const n=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,o),i=n.replace("image/",""),r=new File([t],"image."+i,{type:n});e(r)}).catch(n)})),imageElement:e.item};var t});if(!o.length)return;const r=new Jm(e.editing.view.document);for(const e of o){r.setAttribute("uploadProcessed",!0,e.imageElement);const t=i.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 n=t.differ.getChanges({includeChangesInGraveyard:!0});for(const t of n)if("insert"==t.type&&"$text"!=t.name){const n=t.position.nodeAfter,o="$graveyard"==t.position.root.rootName;for(const t of tg(e,n)){const e=t.getAttribute("uploadId");if(!e)continue;const n=i.loaders.get(e);n&&(o?n.abort():"idle"==n.status&&this._readAndUpload(n,t))}}})}_readAndUpload(e,t){const n=this.editor,o=n.model,i=n.locale.t,r=n.plugins.get(hh),s=n.plugins.get(Xf);return o.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","reading",t)}),e.read().then(()=>{const i=e.upload();if(hi.isSafari){const e=df(n.editing.mapper.toViewElement(t));n.editing.view.once("render",()=>{if(!e.parent)return;const t=n.editing.view.domConverter.mapViewToDom(e.parent);if(!t)return;const o=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=o})}return o.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",t)}),i}).then(e=>{o.enqueueChange("transparent",n=>{n.setAttributes({uploadStatus:"complete",src:e.default},t),this._parseAndSetSrcsetAttributeOnImage(e,t,n)}),a()}).catch(n=>{if("error"!==e.status&&"aborted"!==e.status)throw n;"error"==e.status&&n&&s.showWarning(n,{title:i("Upload failed"),namespace:"upload"}),a(),o.enqueueChange("transparent",e=>{e.remove(t)})});function a(){o.enqueueChange("transparent",e=>{e.removeAttribute("uploadId",t),e.removeAttribute("uploadStatus",t)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let o=0;const i=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return o=Math.max(o,t),!0}).map(t=>`${e[t]} ${t}w`).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:o},t)}}function tg(e,t){return Array.from(e.model.createRangeOn(t)).filter(e=>e.item.is("element","image")).map(e=>e.item)}class ng extends ed{static get pluginName(){return"ImageUpload"}static get requires(){return[eg,qm,Wm]}}class og extends sd{refresh(){const e=this.editor.model,t=iu(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&ig(t,e.schema)}execute(e={}){const t=this.editor.model,n=t.document;t.change(o=>{const i=(e.selection||n.selection).getSelectedBlocks();for(const e of i)!e.is("element","paragraph")&&ig(e,t.schema)&&o.rename(e,"paragraph")})}}function ig(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class rg extends sd{execute(e){const t=this.editor.model;let n=e.position;t.change(e=>{const o=e.createElement("paragraph");if(!t.schema.checkChild(n.parent,o)){const i=t.schema.findAllowedParent(n,o);if(!i)return;n=e.split(n,i).position}t.insertContent(o,n),e.setSelection(o,"in")})}}class sg extends ed{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new og(e)),e.commands.add("insertParagraph",new rg(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>sg.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}sg.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class ag extends sd{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=iu(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>cg(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,n=t.document,o=e.value;t.change(e=>{const i=Array.from(n.selection.getSelectedBlocks()).filter(e=>cg(e,o,t.schema));for(const t of i)t.is("element",o)||e.rename(t,o)})}}function cg(e,t,n){return n.checkChild(e.parent,t)&&!n.isObject(e)}class lg extends ed{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[sg]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const o of t)"paragraph"!==o.model&&(e.model.schema.register(o.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(o),n.push(o.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new ag(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,o)=>{const i=e.model.document.selection.getFirstPosition().parent;n.some(e=>i.is("element",e.model))&&!i.is("element","paragraph")&&0===i.childCount&&o.writer.rename(i,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:un.get("low")+1})}}n(11);class dg extends ed{init(){const e=this.editor,t=e.t,n=function(e){const t=e.t,n={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=n[e.title];return t&&t!=e.title&&(e.title=t),e})}(e),o=t("Choose heading"),i=t("Heading");e.ui.componentFactory.add("heading",t=>{const r={},s=new An,a=e.commands.get("heading"),c=e.commands.get("paragraph"),l=[a];for(const e of n){const t={type:"button",model:new Su({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(c,"value"),t.model.set("commandName","paragraph"),l.push(c)):(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=Wl(t);return Gl(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(e=>e)),d.buttonView.bind("label").to(a,"value",c,"value",(e,t)=>{const n=e||t&&"paragraph";return r[n]?r[n]:o}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}function ug(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}function hg(e){const t=e.parent;return"figcaption"==e.name&&t&&"figure"==t.name&&t.hasClass("image")?{name:!0}:null}class fg extends ed{static get pluginName(){return"ImageCaptionEditing"}init(){const e=this.editor,t=e.editing.view,n=e.model.schema,o=e.data,i=e.editing,r=e.t;n.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),e.model.document.registerPostFixer(e=>this._insertMissingModelCaptionElement(e)),e.conversion.for("upcast").elementToElement({view:hg,model:"caption"});o.downcastDispatcher.on("insert:caption",mg(e=>e.createContainerElement("figcaption"),!1));const s=function(e,t){return n=>{const o=n.createEditableElement("figcaption");return n.setCustomProperty("imageCaption",!0,o),Gc({view:e,element:o,text:t}),tf(o,n)}}(t,r("Enter image caption"));i.downcastDispatcher.on("insert:caption",mg(s)),i.downcastDispatcher.on("insert",this._fixCaptionVisibility(e=>e.item),{priority:"high"}),i.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,n=this._lastSelectedCaption;let o;const i=this.editor.model.document.selection,r=i.getSelectedElement();if(r&&r.is("element","image")){const e=ug(r);o=t.toViewElement(e)}const s=gg(i.getFirstPosition().parent);if(s&&(o=t.toViewElement(s)),o)return n?(n===o||(pg(n,e),this._lastSelectedCaption=o),bg(o,e)):(this._lastSelectedCaption=o,bg(o,e));if(n){const t=pg(n,e);return this._lastSelectedCaption=null,t}return!1}_fixCaptionVisibility(e){return(t,n,o)=>{const i=gg(e(n)),r=this.editor.editing.mapper,s=o.writer;if(i){const e=r.toViewElement(i);e&&(i.childCount?s.removeClass("ck-hidden",e):s.addClass("ck-hidden",e))}}}_insertMissingModelCaptionElement(e){const t=this.editor.model,n=t.document.differ.getChanges(),o=[];for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter;if(n.is("element","image")&&!ug(n)&&o.push(n),!n.is("element","image")&&n.childCount)for(const e of t.createRangeIn(n).getItems())e.is("element","image")&&!ug(e)&&o.push(e)}for(const t of o)e.appendElement("caption",t);return!!o.length}}function mg(e,t=!0){return(n,o,i)=>{const r=o.item;if((r.childCount||t)&&af(r.parent)){if(!i.consumable.consume(o.item,"insert"))return;const t=i.mapper.toViewElement(o.range.start.parent),n=e(i.writer),s=i.writer;r.childCount||s.addClass("ck-hidden",n),function(e,t,n,o){const i=o.writer.createPositionAt(n,"end");o.writer.insert(i,e),o.mapper.bindElements(t,e)}(n,o.item,t,i)}}}function gg(e){const t=e.getAncestors({includeSelf:!0}).find(e=>"caption"==e.name);return t&&t.parent&&"image"==t.parent.name?t:null}function pg(e,t){return!e.childCount&&!e.hasClass("ck-hidden")&&(t.addClass("ck-hidden",e),!0)}function bg(e,t){return!!e.hasClass("ck-hidden")&&(t.removeClass("ck-hidden",e),!0)}n(80);class wg extends sd{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=af(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,n=this.editor.model,o=n.document.selection.getSelectedElement();n.change(e=>{this.styles[t].isDefault?e.removeAttribute("imageStyle",o):e.setAttribute("imageStyle",t,o)})}}function kg(e,t){for(const n of t)if(n.name===e)return n}var _g='',vg='',yg='',xg='';const Ag={full:{name:"full",title:"Full size image",icon:_g,isDefault:!0},side:{name:"side",title:"Side image",icon:xg,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:vg,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:yg,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:xg,className:"image-style-align-right"}},Cg={full:_g,left:vg,right:xg,center:yg};function Tg(e=[]){return e.map(Pg)}function Pg(e){if("string"==typeof e){const t=e;Ag[t]?e=Object.assign({},Ag[t]):(console.warn(Object(hn.a)("image-style-not-found: There is no such image style of given name."),{name:t}),e={name:t})}else if(Ag[e.name]){const t=Ag[e.name],n=Object.assign({},e);for(const o in t)Object.prototype.hasOwnProperty.call(e,o)||(n[o]=t[o]);e=n}return"string"==typeof e.icon&&Cg[e.icon]&&(e.icon=Cg[e.icon]),e}class Sg extends ed{static get pluginName(){return"ImageStyleEditing"}init(){const e=this.editor,t=e.model.schema,n=e.data,o=e.editing;e.config.define("image.styles",["full","side"]);const i=Tg(e.config.get("image.styles"));t.extend("image",{allowAttributes:"imageStyle"});const r=function(e){return(t,n,o)=>{if(!o.consumable.consume(n.item,t.name))return;const i=kg(n.attributeNewValue,e),r=kg(n.attributeOldValue,e),s=o.mapper.toViewElement(n.item),a=o.writer;r&&a.removeClass(r.className,s),i&&a.addClass(i.className,s)}}(i);o.downcastDispatcher.on("attribute:imageStyle:image",r),n.downcastDispatcher.on("attribute:imageStyle:image",r),n.upcastDispatcher.on("element:figure",function(e){const t=e.filter(e=>!e.isDefault);return(e,n,o)=>{if(!n.modelRange)return;const i=n.viewItem,r=iu(n.modelRange.getItems());if(o.schema.checkAttribute(r,"imageStyle"))for(const e of t)o.consumable.consume(i,{classes:e.className})&&o.writer.setAttribute("imageStyle",e.name,r)}}(i),{priority:"low"}),e.commands.add("imageStyle",new wg(e,i))}}n(82);class Eg extends ed{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 n of e)t[n.title]&&(n.title=t[n.title]);return e}(Tg(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const t of e)this._createButton(t)}_createButton(e){const t=this.editor,n="imageStyle:"+e.name;t.ui.componentFactory.add(n,n=>{const o=t.commands.get("imageStyle"),i=new Vl(n);return i.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(o,"isEnabled"),i.bind("isOn").to(o,"value",t=>t===e.name),this.listenTo(i,"execute",()=>{t.execute("imageStyle",{value:e.name}),t.editing.view.focus()}),i})}}class Mg extends ed{static get requires(){return[Em]}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||!Jh(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:n,getRelatedElement:o,balloonClassName:i="ck-toolbar-container"}){if(!n.length)return void console.warn(Object(hn.a)("widget-toolbar-no-items: Trying to register a toolbar without items."),{toolbarId:e});const r=this.editor,s=r.t,a=new Yl(r.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new hn.b("widget-toolbar-duplicated: Toolbar with the given id was already added.",this,{toolbarId:e});a.fillFromConfig(n,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:o,balloonClassName:i})}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(const o of this._toolbarDefinitions.values()){const i=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>e&&(e=r,t=i,n=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Ig(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:Ng(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);Ig(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Ig(e,t){const n=e.plugins.get("ContextualBalloon"),o=Ng(e,t);n.updatePosition(o)}function Ng(e,t){const n=e.editing.view,o=Wh.defaultPositions;return{target:n.domConverter.mapViewToDom(t),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,of]}}class Og extends sd{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 Rg extends ed{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Og(e)),e.commands.add("outdent",new Og(e))}}var Dg='',Lg='';class Vg extends ed{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,n=e.t,o="ltr"==t.uiLanguageDirection?Dg:Lg,i="ltr"==t.uiLanguageDirection?Lg:Dg;this._defineButton("indent",n("Increase indent"),o),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(e,t,n){const o=this.editor;o.ui.componentFactory.add(e,i=>{const r=o.commands.get(e),s=new Vl(i);return s.set({label:t,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",()=>{o.execute(e),o.editing.view.focus()}),s})}}class jg extends sd{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=iu(e.document.selection.getSelectedBlocks());t&&e.schema.checkAttribute(t,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=function(e){const t=e.document.selection,n=e.schema;return Array.from(t.getSelectedBlocks()).filter(e=>n.checkAttribute(e,"blockIndent"))}(e);e.change(e=>{for(const n of t){const t=n.getAttribute("blockIndent"),o=this._indentBehavior.getNextIndent(t);o?e.setAttribute("blockIndent",o,n):e.removeAttribute("blockIndent",n)}})}}class zg{constructor(e){this.isForward="forward"===e.direction,this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||0);return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||0);if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const n=t+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class Bg{constructor(e){this.isForward="forward"===e.direction,this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t=0}getNextIndent(e){const t=this.classes.indexOf(e),n=this.isForward?1:-1;return this.classes[t+n]}}function Fg(e){var t,n;e.setNormalizer("margin",(t="margin",e=>({path:t,value:nh(e)}))),e.setNormalizer("margin-top",e=>({path:"margin.top",value:e})),e.setNormalizer("margin-right",e=>({path:"margin.right",value:e})),e.setNormalizer("margin-bottom",e=>({path:"margin.bottom",value:e})),e.setNormalizer("margin-left",e=>({path:"margin.left",value:e})),e.setReducer("margin",(n="margin",e=>{const{top:t,right:o,bottom:i,left:r}=e,s=[];return[t,o,r,i].every(e=>!!e)?s.push([n,oh(e)]):(t&&s.push([n+"-top",t]),o&&s.push([n+"-right",o]),i&&s.push([n+"-bottom",i]),r&&s.push([n+"-left",r])),s})),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}class Ug extends Vr{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}n(84);class Hg extends wl{constructor(e,t,n){super(e);const o=e.t;this.focusTracker=new qc,this.keystrokes=new Lc,this.urlInputView=this._createUrlInput(n),this.saveButtonView=this._createButton(o("Save"),Cm,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),Tm,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusables=new Zc,this._focusCycler=new Al({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),Am({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(e="https://"){const t=this.locale.t,n=new vm(this.locale,xm);return n.label=t("Link URL"),n.fieldView.placeholder=e+"example.com",n}_createButton(e,t,n,o){const i=new Vl(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e.manualDecorators){const o=new Hl(this.locale);o.set({name:n.id,label:n.label,withText:!0}),o.bind("isOn").toMany([n,e],"value",(e,t)=>void 0===t&&void 0===e?n.defaultValue:e),o.on("execute",()=>{n.set("value",!o.isOn)}),t.add(o)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new wl;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}}n(86);class qg extends wl{constructor(e){super(e);const t=e.t;this.focusTracker=new qc,this.keystrokes=new Lc,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'',"unlink"),this.editButtonView=this._createButton(t("Edit link"),'',"edit"),this.set("href"),this._focusables=new Zc,this._focusCycler=new Al({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"],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,n){const o=new Vl(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.delegate("execute").to(this,n),o}_createPreviewButton(){const e=new Vl(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0,tooltip:n("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&qf(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||n("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}const Wg=/^((\w+:(\/{2,})?)|(\W))/i,$g=/[\w-]+@[\w-]+\.+[\w-]+/i;class Gg extends ed{static get requires(){return[Em]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(Ug),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(Em),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 qg(e.locale),n=e.commands.get("link"),o=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t()}),t.keystrokes.set("Ctrl+K",(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),o=new Hg(e.locale,t,n);return o.urlInputView.fieldView.bind("value").to(t,"value"),o.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),o.saveButtonView.bind("isEnabled").to(t),this.listenTo(o,"submit",()=>{const{value:t}=o.urlInputView.fieldView.element,i=!!n&&!Wg.test(t),r=$g.test(t),s=t&&i?(r?"mailto:":n)+t:t;e.execute("link",s,o.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),o}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),n=e.t;e.keystrokes.set("Ctrl+K",(e,t)=>{t(),this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const o=new Vl(e);return o.isEnabled=!0,o.label=n("Link"),o.icon='',o.keystroke="Ctrl+K",o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",e=>!!e),this.listenTo(o,"execute",()=>this._showUI(!0)),o})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),ql({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._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),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 n=this._getSelectedLinkElement(),o=r();const i=()=>{const e=this._getSelectedLinkElement(),t=r();n&&!e||!n&&t!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=e,o=t};function r(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}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,n=e.document,o=this._getSelectedLinkElement(),i=t.markers.has("link-ui")?this.editor.editing.mapper.toViewRange(t.markers.get("link-ui").getRange()):n.selection.getFirstRange();return{target:o?e.domConverter.mapViewToDom(o):e.domConverter.viewRangeToDom(i)}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection;if(t.isCollapsed)return Yg(t.getFirstPosition());{const n=t.getFirstRange().getTrimmed(),o=Yg(n.start),i=Yg(n.end);return o&&o==i&&e.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{e.markers.has("link-ui")?t.updateMarker("link-ui",{range:e.document.selection.getFirstRange()}):t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:e.document.selection.getFirstRange()})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has("link-ui")&&e.change(e=>{e.removeMarker("link-ui")})}}function Yg(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}class Kg extends sd{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,n=Array.from(t.selection.getSelectedBlocks()).filter(t=>Jg(t,e.schema)),o=!0===this.value;e.change(e=>{if(o){let t=n[n.length-1].nextSibling,o=Number.POSITIVE_INFINITY,i=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e=n;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&e[t?"unshift":"push"](i),i=i[t?"previousSibling":"nextSibling"]}}function Jg(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class Zg extends sd{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 n=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=n[n.length-1];let o=t.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>t.getAttribute("listIndent");)n.push(o),o=o.nextSibling;this._indentBy<0&&(n=n.reverse());for(const t of n){const n=t.getAttribute("listIndent")+this._indentBy;n<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",n,t)}this.fire("_executeCleanup",n)})}_checkEnabled(){const e=iu(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),n=e.getAttribute("listType");let o=e.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=t;){if(o.getAttribute("listIndent")==t)return o.getAttribute("listType")==n;o=o.previousSibling}return!1}return!0}}function Xg(e,t){const n=t.mapper,o=t.writer,i="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=rp,t}(o),s=o.createContainerElement(i,null);return o.insert(o.createPositionAt(s,0),r),n.bindElements(e,r),r}function ep(e,t,n,o){const i=t.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(o.createPositionBefore(e));const c=op(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),l=e.previousSibling;if(c&&c.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=r.toViewElement(c);a=s.breakContainer(s.createPositionAfter(e))}else if(l&&"listItem"==l.name){a=r.toViewPosition(o.createPositionAt(l,"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(o.createPositionBefore(e));if(a=np(a),s.insert(a,i),l&&"listItem"==l.name){const e=r.toViewElement(l),n=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of n)if(e.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(e.item)),i=e.item.parent,r=s.createPositionAt(t,"end");tp(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),n.position=o}}else{const n=i.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let o=null;for(const t of n.getChildren()){const n=r.toModelElement(t);if(!(n&&n.getAttribute("listIndent")>e.getAttribute("listIndent")))break;o=t}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(t,"end")))}}tp(s,i,i.nextSibling),tp(s,i.previousSibling,i)}function tp(e,t,n){return!t||!n||"ul"!=t.name&&"ol"!=t.name||t.name!=n.name||t.getAttribute("class")!==n.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function np(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function op(e,t){const n=!!t.sameIndent,o=!!t.smallerIndent,i=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(n&&i==e||o&&i>e)return r;r=r.previousSibling}return null}function ip(e,t,n,o){e.ui.componentFactory.add(t,i=>{const r=e.commands.get(t),s=new Vl(i);return s.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function rp(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Vo.call(this)}function sp(e){return(t,n,o)=>{const i=o.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const r=n.item;ep(r,Xg(r,o),o,e)}}function ap(e,t,n){if(!n.consumable.consume(t.item,"attribute:listType"))return;const o=n.mapper.toViewElement(t.item),i=n.writer;i.breakContainer(i.createPositionBefore(o)),i.breakContainer(i.createPositionAfter(o));const r=o.parent,s="numbered"==t.attributeNewValue?"ol":"ul";i.rename(s,r)}function cp(e,t,n){const o=n.mapper.toViewElement(t.item).parent,i=n.writer;tp(i,o,o.nextSibling),tp(i,o.previousSibling,o);for(const e of t.item.getChildren())n.consumable.consume(e,"insert")}function lp(e,t,n){if("listItem"!=t.item.name){let e=n.mapper.toViewPosition(t.range.start);const o=n.writer,i=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=o.breakContainer(e),"li"==e.parent.name);){const t=e,n=o.createPositionAt(e.parent,"end");if(!t.isEqual(n)){const e=o.remove(o.createRange(t,n));i.push(e)}e=o.createPositionAfter(e.parent)}if(i.length>0){for(let t=0;t0){const t=tp(o,n,n.nextSibling);t&&t.parent==n&&e.offset--}}tp(o,e.nodeBefore,e.nodeAfter)}}}function dp(e,t,n){const o=n.mapper.toViewPosition(t.position),i=o.nodeBefore,r=o.nodeAfter;tp(n.writer,i,r)}function up(e,t,n){if(n.consumable.consume(t.viewItem,{name:!0})){const e=n.writer,o=e.createElement("listItem"),i=function(e){let t=0,n=e.parent;for(;n;){if(n.is("element","li"))t++;else{const e=n.previousSibling;e&&e.is("element","li")&&t++}n=n.parent}return t}(t.viewItem);e.setAttribute("listIndent",i,o);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",r,o),!n.safeInsert(o,t.modelCursor))return;const s=function(e,t,n){const{writer:o,schema:i}=n;let r=o.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const t=n.convertItem(s,o.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:pp(t.modelCursor),r=o.createPositionAfter(e))}return r}(o,t.viewItem.getChildren(),n);t.modelRange=e.createRange(t.modelCursor,s),n.updateConversionResult(o,t)}}function hp(e,t,n){if(n.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||wp(t))&&t._remove()}}}function fp(e,t,n){if(n.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let n=!1,o=!0;for(const t of e)n&&!wp(t)&&t._remove(),t.is("$text")?(o&&(t._data=t.data.replace(/^\s+/,"")),t.nextSibling&&!wp(t.nextSibling)||(t._data=t.data.replace(/\s+$/,""))):wp(t)&&(n=!0),o=!1}}function mp(e){return(t,n)=>{if(n.isPhantom)return;const o=n.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const t=n.mapper.toViewElement(o),i=t.getAncestors().find(wp),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("element","li")){n.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==i){n.viewPosition=e.nextPosition;break}}}}}function gp(e,[t,n]){let o,i=t.is("documentFragment")?t.getChild(0):t;if(o=n?this.createSelection(n):this.document.selection,i&&i.is("element","listItem")){const e=o.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+e),i=i.nextSibling}}}function pp(e){const t=new ys({startPosition:e});let n;do{n=t.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function bp(e,t,n,o,i,r){const s=op(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),a=i.mapper,c=i.writer,l=s?s.getAttribute("listIndent"):null;let d;if(s)if(l==e){const e=a.toViewElement(s).parent;d=c.createPositionAfter(e)}else{const e=r.createPositionAt(s,"end");d=a.toViewPosition(e)}else d=n;d=np(d);for(const e of[...o.getChildren()])wp(e)&&(d=c.move(c.createRangeOn(e),d).end,tp(c,e,e.nextSibling),tp(c,e.previousSibling,e))}function wp(e){return e.is("element","ol")||e.is("element","ul")}class kp extends ed{static get pluginName(){return"ListEditing"}static get requires(){return[sg]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,n=e.editing;var o;e.model.document.registerPostFixer(t=>function(e,t){const n=e.document.differ.getChanges(),o=new Map;let i=!1;for(const o of n)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const n=o.position.nodeAfter;n.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",n),i=!0),n.hasAttribute("listType")&&(t.removeAttribute("listType",n),i=!0),n.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",n),i=!0);for(const t of Array.from(e.createRangeIn(n)).filter(e=>e.item.is("element","listItem")))r(t.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const e of o.values())s(e),a(e);return i;function r(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(o.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,o.has(e))return;o.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&o.set(t,t)}}function s(e){let n=0,o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(r>n){let s;null===o?(o=r-n,s=n):(o>r&&(o=r),s=r-o),t.setAttribute("listIndent",s,e),i=!0}else o=null,n=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let n=[],o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const o=n[r];e.getAttribute("listType")!=o&&(t.setAttribute("listType",o,e),i=!0)}else n[r]=e.getAttribute("listType");o=e,e=e.nextSibling}}}(e.model,t)),n.mapper.registerViewToModelLength("li",_p),t.mapper.registerViewToModelLength("li",_p),n.mapper.on("modelToViewPosition",mp(n.view)),n.mapper.on("viewToModelPosition",(o=e.model,(e,t)=>{const n=t.viewPosition,i=n.parent,r=t.mapper;if("ul"==i.name||"ol"==i.name){if(n.isAtEnd){const e=r.toModelElement(n.nodeBefore),i=r.getModelLength(n.nodeBefore);t.modelPosition=o.createPositionBefore(e).getShiftedBy(i)}else{const e=r.toModelElement(n.nodeAfter);t.modelPosition=o.createPositionBefore(e)}e.stop()}else if("li"==i.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(i);let a=1,c=n.nodeBefore;for(;c&&wp(c);)a+=r.getModelLength(c),c=c.previousSibling;t.modelPosition=o.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",mp(n.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",lp,{priority:"high"}),t.on("insert:listItem",sp(e.model)),t.on("attribute:listType:listItem",ap,{priority:"high"}),t.on("attribute:listType:listItem",cp,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,n,o)=>{if(!o.consumable.consume(n.item,"attribute:listIndent"))return;const i=o.mapper.toViewElement(n.item),r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s);r.remove(c),a&&a.nextSibling&&tp(r,a,a.nextSibling),bp(n.attributeOldValue+1,n.range.start,c.start,i,o,e),ep(n.item,i,o,e);for(const e of n.item.getChildren())o.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,n,o)=>{const i=o.mapper.toViewPosition(n.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,c=r.createRangeOn(s),l=r.remove(c);a&&a.nextSibling&&tp(r,a,a.nextSibling);bp(o.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,c.start,i,o,e);for(const e of r.createRangeIn(l).getItems())o.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",dp,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",lp,{priority:"high"}),t.on("insert:listItem",sp(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",hp,{priority:"high"}),e.on("element:ol",hp,{priority:"high"}),e.on("element:li",fp,{priority:"high"}),e.on("element:li",up)}),e.model.on("insertContent",gp,{priority:"high"}),e.commands.add("numberedList",new Kg(e,"numbered")),e.commands.add("bulletedList",new Kg(e,"bulleted")),e.commands.add("indentList",new Zg(e,"forward")),e.commands.add("outdentList",new Zg(e,"backward"));const i=n.view.document;this.listenTo(i,"enter",(e,t)=>{const n=this.editor.model.document,o=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),this.listenTo(i,"delete",(e,t)=>{if("backward"!==t.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const o=n.getFirstPosition();if(!o.isAtStart)return;const i=o.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{priority:"high"});const r=e=>(t,n)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),n())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),n=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),n&&n.registerChildCommand(e.get("outdentList"))}}function _p(e){let t=1;for(const n of e.getChildren())if("ul"==n.name||"ol"==n.name)for(const e of n.getChildren())t+=_p(e);return t}class vp extends ed{init(){const e=this.editor.t;ip(this.editor,"numberedList",e("Numbered List"),''),ip(this.editor,"bulletedList",e("Bulleted List"),'')}}function yp(e,t){return e=>{e.on("attribute:url:media",n)};function n(n,o,i){if(!i.consumable.consume(o.item,n.name))return;const r=o.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(o.item),c=[...a.getChildren()].find(e=>e.getCustomProperty("media-content"));s.remove(c);const l=e.getMediaViewElement(s,r,t);s.insert(s.createPositionAt(a,0),l)}}function xp(e,t,n,o){const i=e.createContainerElement("figure",{class:"media"});return e.insert(e.createPositionAt(i,0),t.getMediaViewElement(e,n,o)),i}function Ap(e){const t=e.getSelectedElement();return t&&t.is("element","media")?t:null}function Cp(e,t,n){e.change(o=>{const i=o.createElement("media",{url:t});e.insertContent(i,n),o.setSelection(i,"on")})}class Tp extends sd{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema,o=t.getFirstPosition(),i=Ap(t);let r=o.parent;r!=r.root&&(r=r.parent),this.value=i?i.getAttribute("url"):null,this.isEnabled=n.checkChild(r,"media")}execute(e){const t=this.editor.model,n=t.document.selection,o=Ap(n);if(o)t.change(t=>{t.setAttribute("url",e,o)});else{const o=nf(n,t);Cp(t,e,o)}}}class Pp{constructor(e,t){const n=t.providers,o=t.extraProviders||[],i=new Set(t.removeProviders),r=n.concat(o).filter(e=>{const t=e.name;return t?!i.has(t):(console.warn(Object(hn.a)("media-embed-no-provider-name: The configured media provider has no name and cannot be used."),{provider:e}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,n){return this._getMedia(t).getViewElement(e,n)}_getMedia(e){if(!e)return new Sp(this.locale);e=e.trim();for(const t of this.providerDefinitions){const n=t.html;let o=t.url;Array.isArray(o)||(o=[o]);for(const t of o){const o=this._getUrlMatches(e,t);if(o)return new Sp(this.locale,e,o,n)}}return null}_getUrlMatches(e,t){let n=e.match(t);if(n)return n;let o=e.replace(/^https?:\/\//,"");return n=o.match(t),n||(o=o.replace(/^www\./,""),n=o.match(t),n||null)}}class Sp{constructor(e,t,n,o){this.url=this._getValidUrl(t),this._t=e.t,this._match=n,this._previewRenderer=o}getViewElement(e,t){const n={};let o;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),t.renderForEditingView&&(n.class="ck-media__wrapper");const i=this._getPreviewHtml(t);o=e.createRawElement("div",n,(function(e){e.innerHTML=i}))}else this.url&&(n.url=this.url),o=e.createEmptyElement("oembed",n);return e.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new Ll,t=new Dl;e.text=this._t("Open media in new tab"),t.content='',t.viewBox="0 0 64 42";return new Xc({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}}n(88);class Ep extends ed{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:e=>``},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:e=>``},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:e=>``},{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=>``},{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 Pp(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,n=e.t,o=e.conversion,i=e.config.get("mediaEmbed.previewsInData"),r=this.registry;e.commands.add("mediaEmbed",new Tp(e)),t.register("media",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["url"]}),o.for("dataDowncast").elementToElement({model:"media",view:(e,{writer:t})=>{const n=e.getAttribute("url");return xp(t,r,n,{renderMediaPreview:n&&i})}}),o.for("dataDowncast").add(yp(r,{renderMediaPreview:i})),o.for("editingDowncast").elementToElement({model:"media",view:(e,{writer:t})=>{const o=e.getAttribute("url");return function(e,t,n){return t.setCustomProperty("media",!0,e),Zh(e,t,{label:n})}(xp(t,r,o,{renderForEditingView:!0}),t,n("media widget"))}}),o.for("editingDowncast").add(yp(r,{renderForEditingView:!0})),o.for("upcast").elementToElement({view:{name:"oembed",attributes:{url:!0}},model:(e,{writer:t})=>{const n=e.getAttribute("url");if(r.hasMedia(n))return t.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(e,{writer:t})=>{const n=e.getAttribute("data-oembed-url");if(r.hasMedia(n))return t.createElement("media",{url:n})}})}}const Mp=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$/;class Ip extends ed{static get requires(){return[rd,ou]}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(rd),"inputTransformation",()=>{const e=t.selection.getFirstRange(),n=wc.fromPosition(e.start);n.stickiness="toPrevious";const o=wc.fromPosition(e.end);o.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(n,o),n.detach(),o.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(ir.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const n=this.editor,o=n.plugins.get(Ep).registry,i=new zs(e,t),r=i.getWalker({ignoreElementEnd:!0});let s="";for(const e of r)e.item.is("$textProxy")&&(s+=e.item.data);if(s=s.trim(),!s.match(Mp))return void i.detach();if(!o.hasMedia(s))return void i.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=wc.fromPosition(e),this._timeoutId=ir.window.setTimeout(()=>{n.model.change(e=>{let t;this._timeoutId=null,e.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert),Cp(n.model,s,t),this._positionToInsert.detach(),this._positionToInsert=null})},100)):i.detach()}}n(90);class Np extends wl{constructor(e,t){super(t);const n=t.t;this.focusTracker=new qc,this.keystrokes=new Lc,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),Cm,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),Tm,"ck-button-cancel","cancel"),this._focusables=new Zc,this._focusCycler=new Al({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"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),Am({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 vm(this.locale,xm),n=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,n.placeholder="https://example.com",n.on("input",()=>{t.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault}),t}_createButton(e,t,n,o){const i=new Vl(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),o&&i.delegate("execute").to(this,o),i}}class Op extends ed{static get requires(){return[Ep]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed"),n=e.plugins.get(Ep).registry;e.ui.componentFactory.add("mediaEmbed",o=>{const i=Wl(o),r=new Np(function(e,t){return[t=>{if(!t.url.length)return e("The URL must not be empty.")},n=>{if(!t.hasMedia(n.url))return e("This media URL is not supported.")}]}(e.t,n),e.locale);return this._setUpDropdown(i,r,t,e),this._setUpForm(i,r,t),i})}_setUpDropdown(e,t,n){const o=this.editor,i=o.t,r=e.buttonView;function s(){o.editing.view.focus(),e.isOpen=!1}e.bind("isEnabled").to(n),e.panelView.children.add(t),r.set({label:i("Insert media"),icon:'',tooltip:!0}),r.on("open",()=>{t.url=n.value||"",t.urlInputView.fieldView.select(),t.focus()},{priority:"low"}),e.on("submit",()=>{t.isValid()&&(o.execute("mediaEmbed",t.url),s())}),e.on("change:isOpen",()=>t.resetFormStatus()),e.on("cancel",()=>s())}_setUpForm(e,t,n){t.delegate("submit","cancel").to(e),t.urlInputView.bind("value").to(n,"value"),t.urlInputView.bind("isReadOnly").to(n,"isEnabled",e=>!e),t.saveButtonView.bind("isEnabled").to(n)}}n(92);function Rp(e,t){if(!e.childCount)return;const n=new Jm(e.document),o=function(e,t){const n=t.createRangeIn(e),o=new Vn({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const e of n)if("elementStart"===e.type&&o.match(e.item)){const t=Lp(e.item);i.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return i}(e,n);if(!o.length)return;let i=null,r=1;o.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return!0;const n=t.element.previousSibling;if(!n)return!0;return o=n,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],e),c=a?null:o[s-1],l=(u=e,(d=c)?u.indent-d.indent:u.indent-1);var d,u;if(a&&(i=null,r=1),!i||0!==l){const o=function(e,t){const n=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]*);/gi,i=n.exec(t);let r="decimal";if(i&&i[1]){const e=o.exec(i[1]);e&&e[1]&&(r=e[1].trim())}return{type:"bullet"!==r&&"image"!==r?"ol":"ul",style:r}}(e,t);if(i){if(e.indent>r){const e=i.getChild(i.childCount-1),t=e.getChild(e.childCount-1);i=Dp(o,t,n),r+=1}else if(e.indent(\s+)<\/span>/g,(e,t)=>1===t.length?" ":Array(t.length+1).join(" ").substr(0,t.length))}function Bp(e,t){const n=new DOMParser,o=function(e){return zp(zp(e)).replace(/([\s]*?)[\r\n]+(\s*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>(\s*[\r\n]\s*)<")}(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(/