{"version":3,"file":"ckeditor.js","sources":["webpack://ClassicEditor/ckeditor.js"],"sourcesContent":["/*!\n * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md.\n */\n(function(e){const t=e[\"en\"]=e[\"en\"]||{};t.dictionary=Object.assign(t.dictionary||{},{\"%0 of %1\":\"%0 of %1\",\"Align cell text to the bottom\":\"Align cell text to the bottom\",\"Align cell text to the center\":\"Align cell text to the center\",\"Align cell text to the left\":\"Align cell text to the left\",\"Align cell text to the middle\":\"Align cell text to the middle\",\"Align cell text to the right\":\"Align cell text to the right\",\"Align cell text to the top\":\"Align cell text to the top\",\"Align table to the left\":\"Align table to the left\",\"Align table to the right\":\"Align table to the right\",Alignment:\"Alignment\",Aquamarine:\"Aquamarine\",Background:\"Background\",Big:\"Big\",Black:\"Black\",\"Block quote\":\"Block quote\",Blue:\"Blue\",\"Blue marker\":\"Blue marker\",Bold:\"Bold\",Border:\"Border\",\"Bulleted List\":\"Bulleted List\",Cancel:\"Cancel\",\"Cannot upload file:\":\"Cannot upload file:\",\"Cell properties\":\"Cell properties\",\"Center table\":\"Center table\",\"Centered image\":\"Centered image\",\"Change image text alternative\":\"Change image text alternative\",\"Characters: %0\":\"Characters: %0\",\"Choose heading\":\"Choose heading\",Color:\"Color\",\"Color picker\":\"Color picker\",Column:\"Column\",\"Could not insert image at the current position.\":\"Could not insert image at the current position.\",\"Could not obtain resized image URL.\":\"Could not obtain resized image URL.\",Dashed:\"Dashed\",\"Decrease indent\":\"Decrease indent\",Default:\"Default\",\"Delete column\":\"Delete column\",\"Delete row\":\"Delete row\",\"Dim grey\":\"Dim grey\",Dimensions:\"Dimensions\",\"Document colors\":\"Document colors\",Dotted:\"Dotted\",Double:\"Double\",Downloadable:\"Downloadable\",\"Dropdown toolbar\":\"Dropdown toolbar\",\"Edit link\":\"Edit link\",\"Editor toolbar\":\"Editor toolbar\",\"Enter image caption\":\"Enter image caption\",\"Font Background Color\":\"Font Background Color\",\"Font Color\":\"Font Color\",\"Font Size\":\"Font Size\",\"Full size image\":\"Full size image\",Green:\"Green\",\"Green marker\":\"Green marker\",\"Green pen\":\"Green pen\",Grey:\"Grey\",Groove:\"Groove\",\"Header column\":\"Header column\",\"Header row\":\"Header row\",Heading:\"Heading\",\"Heading 1\":\"Heading 1\",\"Heading 2\":\"Heading 2\",\"Heading 3\":\"Heading 3\",\"Heading 4\":\"Heading 4\",\"Heading 5\":\"Heading 5\",\"Heading 6\":\"Heading 6\",Height:\"Height\",Highlight:\"Highlight\",\"Horizontal line\":\"Horizontal line\",\"Horizontal text alignment toolbar\":\"Horizontal text alignment toolbar\",Huge:\"Huge\",\"Image resize list\":\"Image resize list\",\"Image toolbar\":\"Image toolbar\",\"image widget\":\"image widget\",\"Increase indent\":\"Increase indent\",\"Insert column left\":\"Insert column left\",\"Insert column right\":\"Insert column right\",\"Insert image\":\"Insert image\",\"Insert image or file\":\"Insert image or file\",\"Insert media\":\"Insert media\",\"Insert paragraph after block\":\"Insert paragraph after block\",\"Insert paragraph before block\":\"Insert paragraph before block\",\"Insert row above\":\"Insert row above\",\"Insert row below\":\"Insert row below\",\"Insert table\":\"Insert table\",\"Inserting image failed\":\"Inserting image failed\",Inset:\"Inset\",Italic:\"Italic\",\"Justify cell text\":\"Justify cell text\",\"Left aligned image\":\"Left aligned image\",\"Light blue\":\"Light blue\",\"Light green\":\"Light green\",\"Light grey\":\"Light grey\",Link:\"Link\",\"Link URL\":\"Link URL\",\"Media URL\":\"Media URL\",\"media widget\":\"media widget\",\"Merge cell down\":\"Merge cell down\",\"Merge cell left\":\"Merge cell left\",\"Merge cell right\":\"Merge cell right\",\"Merge cell up\":\"Merge cell up\",\"Merge cells\":\"Merge cells\",Next:\"Next\",None:\"None\",\"Numbered List\":\"Numbered List\",\"Open in a new tab\":\"Open in a new tab\",\"Open link in new tab\":\"Open link in new tab\",Orange:\"Orange\",Original:\"Original\",Outset:\"Outset\",Padding:\"Padding\",Paragraph:\"Paragraph\",\"Paste the media URL in the input.\":\"Paste the media URL in the input.\",\"Pink marker\":\"Pink marker\",Previous:\"Previous\",Purple:\"Purple\",Red:\"Red\",\"Red pen\":\"Red pen\",Redo:\"Redo\",\"Remove color\":\"Remove color\",\"Remove Format\":\"Remove Format\",\"Remove highlight\":\"Remove highlight\",\"Resize image\":\"Resize image\",\"Resize image to %0\":\"Resize image to %0\",\"Resize image to the original size\":\"Resize image to the original size\",\"Rich Text Editor\":\"Rich Text Editor\",\"Rich Text Editor, %0\":\"Rich Text Editor, %0\",Ridge:\"Ridge\",\"Right aligned image\":\"Right aligned image\",Row:\"Row\",Save:\"Save\",\"Select all\":\"Select all\",\"Select column\":\"Select column\",\"Select row\":\"Select row\",\"Selecting resized image failed\":\"Selecting resized image failed\",\"Show more items\":\"Show more items\",\"Side image\":\"Side image\",Small:\"Small\",Solid:\"Solid\",\"Split cell horizontally\":\"Split cell horizontally\",\"Split cell vertically\":\"Split cell vertically\",Style:\"Style\",Superscript:\"Superscript\",\"Table alignment toolbar\":\"Table alignment toolbar\",\"Table cell text alignment\":\"Table cell text alignment\",\"Table properties\":\"Table properties\",\"Table toolbar\":\"Table toolbar\",\"Text alternative\":\"Text alternative\",\"Text highlight toolbar\":\"Text highlight toolbar\",'The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\".':'The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\".',\"The URL must not be empty.\":\"The URL must not be empty.\",'The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".':'The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".',\"This link has no URL\":\"This link has no URL\",\"This media URL is not supported.\":\"This media URL is not supported.\",Tiny:\"Tiny\",\"Tip: Paste the URL into the content to embed faster.\":\"Tip: Paste the URL into the content to embed faster.\",Turquoise:\"Turquoise\",Undo:\"Undo\",Unlink:\"Unlink\",\"Upload failed\":\"Upload failed\",\"Upload in progress\":\"Upload in progress\",\"Vertical text alignment toolbar\":\"Vertical text alignment toolbar\",White:\"White\",\"Widget toolbar\":\"Widget toolbar\",Width:\"Width\",\"Words: %0\":\"Words: %0\",Yellow:\"Yellow\",\"Yellow marker\":\"Yellow marker\"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));(function e(t,n){if(typeof exports===\"object\"&&typeof module===\"object\")module.exports=n();else if(typeof define===\"function\"&&define.amd)define([],n);else if(typeof exports===\"object\")exports[\"ClassicEditor\"]=n();else t[\"ClassicEditor\"]=n()})(window,(function(){return function(e){var t={};function n(i){if(t[i]){return t[i].exports}var o=t[i]={i:i,l:false,exports:{}};e[i].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,i){if(!n.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:i})}};n.r=function(e){if(typeof Symbol!==\"undefined\"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"})}Object.defineProperty(e,\"__esModule\",{value:true})};n.t=function(e,t){if(t&1)e=n(e);if(t&8)return e;if(t&4&&typeof e===\"object\"&&e&&e.__esModule)return e;var i=Object.create(null);n.r(i);Object.defineProperty(i,\"default\",{enumerable:true,value:e});if(t&2&&typeof e!=\"string\")for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i};n.n=function(e){var t=e&&e.__esModule?function t(){return e[\"default\"]}:function t(){return e};n.d(t,\"a\",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p=\"\";return n(n.s=126)}([function(e,t,n){\"use strict\";n.d(t,\"b\",(function(){return o}));n.d(t,\"a\",(function(){return r}));const i=\"https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html\";class o extends Error{constructor(e,t,n){e=r(e);if(n){e+=\" \"+JSON.stringify(n)}super(e);this.name=\"CKEditorError\";this.context=t;this.data=n}is(e){return e===\"CKEditorError\"}static rethrowUnexpectedError(e,t){if(e.is&&e.is(\"CKEditorError\")){throw e}const n=new o(e.message,t);n.stack=e.stack;throw n}}function r(e){const t=e.match(/^([^:]+):/);if(!t){return e}return e+` Read more: ${i}#error-${t[1]}\\n`}},function(e,t,n){\"use strict\";var i=function e(){var t;return function e(){if(typeof t===\"undefined\"){t=Boolean(window&&document&&document.all&&!window.atob)}return t}}();var o=function e(){var t={};return function e(n){if(typeof t[n]===\"undefined\"){var i=document.querySelector(n);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement){try{i=i.contentDocument.head}catch(e){i=null}}t[n]=i}return t[n]}}();var r=[];function s(e){var t=-1;for(var n=0;n
\").replace(/^\\s/,\" \").replace(/\\s$/,\" \").replace(/\\s\\s/g,\" \");if(e.indexOf(\"
\")>-1){e=`
${e}
`}return e}function hv(e){return e.replace(/(\\s+)<\\/span>/g,(e,t)=>{if(t.length==1){return\" \"}return t})}const fv=[\"figcaption\",\"li\"];function mv(e){let t=\"\";if(e.is(\"$text\")||e.is(\"$textProxy\")){t=e.data}else if(e.is(\"element\",\"img\")&&e.hasAttribute(\"alt\")){t=e.getAttribute(\"alt\")}else{let n=null;for(const i of e.getChildren()){const e=mv(i);if(n&&(n.is(\"containerElement\")||i.is(\"containerElement\"))){if(fv.includes(n.name)||fv.includes(i.name)){t+=\"\\n\"}else{t+=\"\\n\\n\"}}t+=e;n=i}}return t}class gv extends sk{static get pluginName(){return\"Clipboard\"}init(){const e=this.editor;const t=e.model.document;const n=e.editing.view;const i=n.document;this._htmlDataProcessor=new Up(i);n.addObserver(lv);this.listenTo(i,\"clipboardInput\",t=>{if(e.isReadOnly){t.stop()}},{priority:\"highest\"});this.listenTo(i,\"clipboardInput\",(e,t)=>{const i=t.dataTransfer;let o=\"\";if(i.getData(\"text/html\")){o=hv(i.getData(\"text/html\"))}else if(i.getData(\"text/plain\")){o=uv(i.getData(\"text/plain\"))}o=this._htmlDataProcessor.toView(o);const r=new es(this,\"inputTransformation\");this.fire(r,{content:o,dataTransfer:i});if(r.stop.called){e.stop()}n.scrollToTheSelection()},{priority:\"low\"});this.listenTo(this,\"inputTransformation\",(e,t)=>{if(!t.content.isEmpty){const n=this.editor.data;const i=this.editor.model;const o=n.toModel(t.content,\"$clipboardHolder\");if(o.childCount==0){return}i.insertContent(o);e.stop()}},{priority:\"low\"});function o(n,o){const r=o.dataTransfer;o.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));i.fire(\"clipboardOutput\",{dataTransfer:r,content:s,method:n.name})}this.listenTo(i,\"copy\",o,{priority:\"low\"});this.listenTo(i,\"cut\",(t,n)=>{if(e.isReadOnly){n.preventDefault()}else{o(t,n)}},{priority:\"low\"});this.listenTo(i,\"clipboardOutput\",(n,i)=>{if(!i.content.isEmpty){i.dataTransfer.setData(\"text/html\",this._htmlDataProcessor.toData(i.content));i.dataTransfer.setData(\"text/plain\",mv(i.content))}if(i.method==\"cut\"){e.model.deleteContent(t.selection)}},{priority:\"low\"})}}class pv{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){if(Array.isArray(e)){e.forEach(e=>this._definitions.add(e))}else{this._definitions.add(e)}}getDispatcher(){return e=>{e.on(\"attribute:linkHref\",(e,t,n)=>{if(!n.consumable.test(t.item,\"attribute:linkHref\")){return}const i=n.writer;const o=i.document.selection;for(const e of this._definitions){const r=i.createAttributeElement(\"a\",e.attributes,{priority:5});i.setCustomProperty(\"link\",true,r);if(e.callback(t.attributeNewValue)){if(t.item.is(\"selection\")){i.wrap(o.getFirstRange(),r)}else{i.wrap(n.mapper.toViewRange(t.range),r)}}else{i.unwrap(n.mapper.toViewRange(t.range),r)}}},{priority:\"high\"})}}getDispatcherForLinkedImage(){return e=>{e.on(\"attribute:linkHref:image\",(e,t,n)=>{const i=n.mapper.toViewElement(t.item);const o=Array.from(i.getChildren()).find(e=>e.name===\"a\");for(const e of this._definitions){const i=Ws(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of i){if(e===\"class\"){n.writer.addClass(t,o)}else{n.writer.setAttribute(e,t,o)}}}else{for(const[e,t]of i){if(e===\"class\"){n.writer.removeClass(t,o)}else{n.writer.removeAttribute(e,o)}}}}})}}}function bv(e,t,n){var i=e.length;n=n===undefined?i:n;return!t&&n>=i?e:Na(e,t,n)}var wv=bv;var kv=\"\\\\ud800-\\\\udfff\",_v=\"\\\\u0300-\\\\u036f\",vv=\"\\\\ufe20-\\\\ufe2f\",yv=\"\\\\u20d0-\\\\u20ff\",xv=_v+vv+yv,Cv=\"\\\\ufe0e\\\\ufe0f\";var Av=\"\\\\u200d\";var Tv=RegExp(\"[\"+Av+kv+xv+Cv+\"]\");function Sv(e){return Tv.test(e)}var Pv=Sv;function Ev(e){return e.split(\"\")}var Mv=Ev;var Iv=\"\\\\ud800-\\\\udfff\",Nv=\"\\\\u0300-\\\\u036f\",Rv=\"\\\\ufe20-\\\\ufe2f\",Ov=\"\\\\u20d0-\\\\u20ff\",zv=Nv+Rv+Ov,Vv=\"\\\\ufe0e\\\\ufe0f\";var Lv=\"[\"+Iv+\"]\",Dv=\"[\"+zv+\"]\",Bv=\"\\\\ud83c[\\\\udffb-\\\\udfff]\",jv=\"(?:\"+Dv+\"|\"+Bv+\")\",Fv=\"[^\"+Iv+\"]\",Hv=\"(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}\",Wv=\"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\",Uv=\"\\\\u200d\";var qv=jv+\"?\",$v=\"[\"+Vv+\"]?\",Yv=\"(?:\"+Uv+\"(?:\"+[Fv,Hv,Wv].join(\"|\")+\")\"+$v+qv+\")*\",Gv=$v+qv+Yv,Kv=\"(?:\"+[Fv+Dv+\"?\",Dv,Hv,Wv,Lv].join(\"|\")+\")\";var Qv=RegExp(Bv+\"(?=\"+Bv+\")|\"+Kv+Gv,\"g\");function Jv(e){return e.match(Qv)||[]}var Zv=Jv;function Xv(e){return Pv(e)?Zv(e):Mv(e)}var ey=Xv;function ty(e){return function(t){t=va(t);var n=Pv(t)?ey(t):undefined;var i=n?n[0]:t.charAt(0);var o=n?wv(n,1).join(\"\"):t.slice(1);return i[e]()+o}}var ny=ty;var iy=ny(\"toUpperCase\");var oy=iy;const ry=/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205f\\u3000]/g;const sy=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;const ay=\"Ctrl+K\";function cy(e){return e.is(\"attributeElement\")&&!!e.getCustomProperty(\"link\")}function ly(e,t){const n=t.createAttributeElement(\"a\",{href:e},{priority:5});t.setCustomProperty(\"link\",true,n);return n}function dy(e){e=String(e);return uy(e)?e:\"#\"}function uy(e){const t=e.replace(ry,\"\");return t.match(sy)}function hy(e,t){const n={\"Open in a new tab\":e(\"Open in a new tab\"),Downloadable:e(\"Downloadable\")};t.forEach(e=>{if(e.label&&n[e.label]){e.label=n[e.label]}return e});return t}function fy(e){const t=[];if(e){for(const[n,i]of Object.entries(e)){const e=Object.assign({},i,{id:`link${oy(n)}`});t.push(e)}}return t}function my(e,t){if(!e){return false}return e.is(\"element\",\"image\")&&t.checkAttribute(\"image\",\"linkHref\")}class gy extends vk{constructor(e){super(e);this.manualDecorators=new xs;this.automaticDecorators=new pv}restoreManualDecoratorStates(){for(const e of this.manualDecorators){e.value=this._getDecoratorStateFromModel(e.id)}}refresh(){const e=this.editor.model;const t=e.document;const n=tk(t.selection.getSelectedBlocks());if(my(n,e.schema)){this.value=n.getAttribute(\"linkHref\");this.isEnabled=e.schema.checkAttribute(n,\"linkHref\")}else{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;const i=n.document.selection;const o=[];const r=[];for(const e in t){if(t[e]){o.push(e)}else{r.push(e)}}n.change(t=>{if(i.isCollapsed){const s=i.getFirstPosition();if(i.hasAttribute(\"linkHref\")){const a=W_(s,\"linkHref\",i.getAttribute(\"linkHref\"),n);t.setAttribute(\"linkHref\",e,a);o.forEach(e=>{t.setAttribute(e,true,a)});r.forEach(e=>{t.removeAttribute(e,a)});t.setSelection(t.createPositionAfter(a.end.nodeBefore))}else if(e!==\"\"){const r=Ws(i.getAttributes());r.set(\"linkHref\",e);o.forEach(e=>{r.set(e,true)});const a=t.createText(e,r);n.insertContent(a,s);t.setSelection(t.createPositionAfter(a))}[\"linkHref\",...o,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=n.schema.getValidRanges(i.getRanges(),\"linkHref\");const a=[];for(const e of i.getSelectedBlocks()){if(n.schema.checkAttribute(e,\"linkHref\")){a.push(t.createRangeOn(e))}}const c=a.slice();for(const e of s){if(this._isRangeToUpdate(e,a)){c.push(e)}}for(const n of c){t.setAttribute(\"linkHref\",e,n);o.forEach(e=>{t.setAttribute(e,true,n)});r.forEach(e=>{t.removeAttribute(e,n)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model;const n=t.document;const i=tk(n.selection.getSelectedBlocks());if(my(i,t.schema)){return i.getAttribute(e)}return n.selection.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t){if(n.containsRange(e)){return false}}return true}}class py extends vk{refresh(){const e=this.editor.model;const t=e.document;const n=tk(t.selection.getSelectedBlocks());if(my(n,e.schema)){this.isEnabled=e.schema.checkAttribute(n,\"linkHref\")}else{this.isEnabled=e.schema.checkAttributeInSelection(t.selection,\"linkHref\")}}execute(){const e=this.editor;const t=this.editor.model;const n=t.document.selection;const i=e.commands.get(\"link\");t.change(e=>{const o=n.isCollapsed?[W_(n.getFirstPosition(),\"linkHref\",n.getAttribute(\"linkHref\"),t)]:n.getRanges();for(const t of o){e.removeAttribute(\"linkHref\",t);if(i){for(const n of i.manualDecorators){e.removeAttribute(n.id,t)}}}})}}class by{constructor({id:e,label:t,attributes:n,defaultValue:i}){this.id=e;this.set(\"value\");this.defaultValue=i;this.label=t;this.attributes=n}}ys(by,Qc);var wy=n(49);const ky=\"ck-link_selected\";const _y=\"automatic\";const vy=\"manual\";const yy=/^(https?:)?\\/\\//;class xy extends sk{static get pluginName(){return\"LinkEditing\"}static get requires(){return[L_,sv,gv]}constructor(e){super(e);e.config.define(\"link\",{addTargetToExternalLinks:false})}init(){const e=this.editor;e.model.schema.extend(\"$text\",{allowAttributes:\"linkHref\"});e.conversion.for(\"dataDowncast\").attributeToElement({model:\"linkHref\",view:ly});e.conversion.for(\"editingDowncast\").attributeToElement({model:\"linkHref\",view:(e,t)=>ly(dy(e),t)});e.conversion.for(\"upcast\").elementToAttribute({view:{name:\"a\",attributes:{href:true}},model:{key:\"linkHref\",value:e=>e.getAttribute(\"href\")}});e.commands.add(\"link\",new gy(e));e.commands.add(\"unlink\",new py(e));const t=hy(e.t,fy(e.config.get(\"link.decorators\")));this._enableAutomaticDecorators(t.filter(e=>e.mode===_y));this._enableManualDecorators(t.filter(e=>e.mode===vy));const n=e.plugins.get(L_);n.registerAttribute(\"linkHref\");q_(e,\"linkHref\",\"a\",ky);this._enableInsertContentSelectionAttributesFixer();this._enableClickingAfterLink();this._enableTypingOverLink();this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor;const n=t.commands.get(\"link\");const i=n.automaticDecorators;if(t.config.get(\"link.addTargetToExternalLinks\")){i.add({id:\"linkIsExternal\",mode:_y,callback:e=>yy.test(e),attributes:{target:\"_blank\",rel:\"noopener noreferrer\"}})}i.add(e);if(i.length){t.conversion.for(\"downcast\").add(i.getDispatcher())}}_enableManualDecorators(e){if(!e.length){return}const t=this.editor;const n=t.commands.get(\"link\");const i=n.manualDecorators;e.forEach(e=>{t.model.schema.extend(\"$text\",{allowAttributes:e.id});i.add(new by(e));t.conversion.for(\"downcast\").attributeToElement({model:e.id,view:(t,n)=>{if(t){const t=i.get(e.id).attributes;const o=n.createAttributeElement(\"a\",t,{priority:5});n.setCustomProperty(\"link\",true,o);return o}}});t.conversion.for(\"upcast\").elementToAttribute({view:{name:\"a\",attributes:i.get(e.id).attributes},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor;const t=e.model;const n=t.document.selection;const i=e.commands.get(\"link\");this.listenTo(t,\"insertContent\",()=>{const e=n.anchor.nodeBefore;const o=n.anchor.nodeAfter;if(!n.hasAttribute(\"linkHref\")){return}if(!e){return}if(!e.hasAttribute(\"linkHref\")){return}if(o&&o.hasAttribute(\"linkHref\")){return}t.change(e=>{Cy(e,i.manualDecorators)})},{priority:\"low\"})}_enableClickingAfterLink(){const e=this.editor;const t=e.commands.get(\"link\");e.editing.view.addObserver(V_);let n=false;this.listenTo(e.editing.view.document,\"mousedown\",()=>{n=true});this.listenTo(e.editing.view.document,\"selectionChange\",()=>{if(!n){return}n=false;const i=e.model.document.selection;if(!i.isCollapsed){return}if(!i.hasAttribute(\"linkHref\")){return}const o=i.getFirstPosition();const r=W_(o,\"linkHref\",i.getAttribute(\"linkHref\"),e.model);if(o.isTouching(r.start)||o.isTouching(r.end)){e.model.change(e=>{Cy(e,t.manualDecorators)})}})}_enableTypingOverLink(){const e=this.editor;const t=e.editing.view;let n;let i;this.listenTo(t.document,\"delete\",()=>{i=true},{priority:\"high\"});this.listenTo(e.model,\"deleteContent\",()=>{const t=e.model.document.selection;if(t.isCollapsed){return}if(i){i=false;return}if(!Ty(e)){return}if(Ay(e.model)){n=t.getAttributes()}},{priority:\"high\"});this.listenTo(e.model,\"insertContent\",(t,[o])=>{i=false;if(!Ty(e)){return}if(!n){return}e.model.change(e=>{for(const[t,i]of n){e.setAttribute(t,i,o)}});n=null},{priority:\"high\"})}_handleDeleteContentAfterLink(){const e=this.editor;const t=e.model;const n=t.document.selection;const i=e.editing.view;const o=e.commands.get(\"link\");let r=false;let s=false;this.listenTo(i.document,\"delete\",(e,t)=>{s=t.domEvent.keyCode===Ol.backspace},{priority:\"high\"});this.listenTo(t,\"deleteContent\",()=>{r=false;const e=n.getFirstPosition();const i=n.getAttribute(\"linkHref\");if(!i){return}const o=W_(e,\"linkHref\",i,t);r=o.containsPosition(e)||o.end.isEqual(e)},{priority:\"high\"});this.listenTo(t,\"deleteContent\",()=>{if(!s){return}s=false;if(r){return}e.model.enqueueChange(e=>{Cy(e,o.manualDecorators)})},{priority:\"low\"})}}function Cy(e,t){e.removeSelectionAttribute(\"linkHref\");for(const n of t){e.removeSelectionAttribute(n.id)}}function Ay(e){const t=e.document.selection;const n=t.getFirstPosition();const i=t.getLastPosition();const o=n.nodeAfter;if(!o){return false}if(!o.is(\"$text\")){return false}if(!o.hasAttribute(\"linkHref\")){return false}const r=i.textNode||i.nodeBefore;if(o===r){return true}const s=W_(n,\"linkHref\",o.getAttribute(\"linkHref\"),e);return s.containsRange(e.createRange(n,i),true)}function Ty(e){const t=e.plugins.get(\"Input\");return t.isInput(e.model.change(e=>e.batch))}class Sy{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return true}}ys(Sy,Qc);class Py extends Sy{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 Ey extends vk{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\");const t=this.editor.commands.get(\"link\");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor;const t=this.editor.config.get(\"ckfinder.openerMethod\")||\"modal\";if(t!=\"popup\"&&t!=\"modal\"){throw new ss[\"b\"]('ckfinder-unknown-openerMethod: The openerMethod config option must by \"popup\" or \"modal\".',e)}const n=this.editor.config.get(\"ckfinder.options\")||{};n.chooseFiles=true;const i=n.onInit;if(!n.language){n.language=e.locale.uiLanguage}n.onInit=t=>{if(i){i(t)}t.on(\"files:choose\",n=>{const i=n.data.files.toArray();const o=i.filter(e=>!e.isImage());const r=i.filter(e=>e.isImage());for(const t of o){e.execute(\"link\",t.getUrl())}const s=[];for(const e of r){const n=e.getUrl();s.push(n?n:t.request(\"file:getProxyUrl\",{file:e}))}if(s.length){My(e,s)}});t.on(\"file:choose:resizedImage\",t=>{const n=t.data.resizedUrl;if(!n){const t=e.plugins.get(\"Notification\");const n=e.locale.t;t.showWarning(n(\"Could not obtain resized image URL.\"),{title:n(\"Selecting resized image failed\"),namespace:\"ckfinder\"});return}My(e,[n])})};window.CKFinder[t](n)}}function My(e,t){const n=e.commands.get(\"imageInsert\");if(!n.isEnabled){const t=e.plugins.get(\"Notification\");const n=e.locale.t;t.showWarning(n(\"Could not insert image at the current position.\"),{title:n(\"Inserting image failed\"),namespace:\"ckfinder\"});return}e.execute(\"imageInsert\",{source:t})}class Iy extends sk{static get pluginName(){return\"CKFinderEditing\"}static get requires(){return[Py,O_,xy]}init(){const e=this.editor;e.commands.add(\"ckfinder\",new Ey(e))}}class Ny extends Sy{static get pluginName(){return\"PendingActions\"}init(){this.set(\"hasAny\",false);this._actions=new xs({idProperty:\"_id\"});this._actions.delegate(\"add\",\"remove\").to(this)}add(e){if(typeof e!==\"string\"){throw new ss[\"b\"](\"pendingactions-add-invalid-message: The message must be a string.\",this)}const t=Object.create(Qc);t.set(\"message\",e);this._actions.add(t);this.hasAny=true;return 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 Ry{constructor(){const e=new window.FileReader;this._reader=e;this._data=undefined;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;this.total=e.size;return new Promise((n,i)=>{t.onload=()=>{const e=t.result;this._data=e;n(e)};t.onerror=()=>{i(\"error\")};t.onabort=()=>{i(\"aborted\")};this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}ys(Ry,Qc);class Oy extends sk{static get pluginName(){return\"FileRepository\"}static get requires(){return[Ny]}init(){this.loaders=new xs;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){console.warn(Object(ss[\"a\"])(\"filerepository-no-upload-adapter: Upload adapter is not defined.\"));return null}const t=new zy(Promise.resolve(e),this.createUploadAdapter);this.loaders.add(t);this._loadersMap.set(e,t);if(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){if(t.uploadTotal){e+=t.uploadTotal}}this.uploadTotal=e});return t}destroyLoader(e){const t=e instanceof zy?e:this.getLoader(e);t._destroy();this.loaders.remove(t);this._loadersMap.forEach((e,n)=>{if(e===t){this._loadersMap.delete(n)}})}_updatePendingAction(){const e=this.editor.plugins.get(Ny);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t;const 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}}}ys(Oy,Qc);class zy{constructor(e,t){this.id=ns();this._filePromiseWrapper=this._createFilePromiseWrapper(e);this._adapter=t(this);this._reader=new Ry;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(){if(!this._filePromiseWrapper){return Promise.resolve(null)}else{return this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null)}}get data(){return this._reader.data}read(){if(this.status!=\"idle\"){throw new ss[\"b\"](\"filerepository-read-wrong-status: You cannot call read if the status is different than idle.\",this)}this.status=\"reading\";return this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!==\"reading\"){throw this.status}this.status=\"idle\";return e}).catch(e=>{if(e===\"aborted\"){this.status=\"aborted\";throw\"aborted\"}this.status=\"error\";throw this._reader.error?this._reader.error:e})}upload(){if(this.status!=\"idle\"){throw new ss[\"b\"](\"filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.\",this)}this.status=\"uploading\";return this.file.then(()=>this._adapter.upload()).then(e=>{this.uploadResponse=e;this.status=\"idle\";return e}).catch(e=>{if(this.status===\"aborted\"){throw\"aborted\"}this.status=\"error\";throw e})}abort(){const e=this.status;this.status=\"aborted\";if(!this._filePromiseWrapper.isFulfilled){this._filePromiseWrapper.promise.catch(()=>{});this._filePromiseWrapper.rejecter(\"aborted\")}else if(e==\"reading\"){this._reader.abort()}else if(e==\"uploading\"&&this._adapter.abort){this._adapter.abort()}this._destroy()}_destroy(){this._filePromiseWrapper=undefined;this._reader=undefined;this._adapter=undefined;this.uploadResponse=undefined}_createFilePromiseWrapper(e){const t={};t.promise=new Promise((n,i)=>{t.rejecter=i;t.isFulfilled=false;e.then(e=>{t.isFulfilled=true;n(e)}).catch(e=>{t.isFulfilled=true;i(e)})});return t}}ys(zy,Qc);const Vy=\"ckCsrfToken\";const Ly=40;const Dy=\"abcdefghijklmnopqrstuvwxyz0123456789\";function By(){let e=jy(Vy);if(!e||e.length!=Ly){e=Hy(Ly);Fy(Vy,e)}return e}function jy(e){e=e.toLowerCase();const t=document.cookie.split(\";\");for(const n of t){const t=n.split(\"=\");const i=decodeURIComponent(t[0].trim().toLowerCase());if(i===e){return decodeURIComponent(t[1])}}return null}function Fy(e,t){document.cookie=encodeURIComponent(e)+\"=\"+encodeURIComponent(t)+\";path=/\"}function Hy(e){let t=\"\";const n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let e=0;e