(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CKEDITOR = {}));
})(this, (function (exports) { 'use strict';
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}});}}));})),Object.freeze(e)}let t;try{t={window:window,document:document};}catch(e){t={window:{},document:{}};}var i=t;function n(){try{return navigator.userAgent.toLowerCase()}catch(e){return ""}}const s=n(),o={isMac:r(s),isWindows:a(s),isGecko:l(s),isSafari:c(s),isiOS:d(s),isAndroid:u(s),isBlink:h(s),get isMediaForcedColors(){return !!i.window.matchMedia&&i.window.matchMedia("(forced-colors: active)").matches},get isMotionReduced(){return !!i.window.matchMedia&&i.window.matchMedia("(prefers-reduced-motion)").matches},features:{isRegExpUnicodePropertySupported:m()}};function r(e){return e.indexOf("macintosh")>-1}function a(e){return e.indexOf("windows")>-1}function l(e){return !!e.match(/gecko\/\d+/)}function c(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}function d(e){return !!e.match(/iphone|ipad/i)||r(e)&&navigator.maxTouchPoints>0}function u(e){return e.indexOf("android")>-1}function h(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function m(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"));}catch(e){}return e}function g(e,t,i,n){i=i||function(e,t){return e===t};const s=Array.isArray(e)?e:Array.prototype.slice.call(e),o=Array.isArray(t)?t:Array.prototype.slice.call(t),r=function(e,t,i){const n=f(e,t,i);if(-1===n)return {firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=p(e,n),o=p(t,n),r=f(s,o,i),a=e.length-r,l=t.length-r;return {firstIndex:n,lastIndexOld:a,lastIndexNew:l}}(s,o,i),a=n?function(e,t){const{firstIndex:i,lastIndexOld:n,lastIndexNew:s}=e;if(-1===i)return Array(t).fill("equal");let o=[];i>0&&(o=o.concat(Array(i).fill("equal")));s-i>0&&(o=o.concat(Array(s-i).fill("insert")));n-i>0&&(o=o.concat(Array(n-i).fill("delete")));s>1;C.get(e[t].priority){if("object"==typeof t&&null!==t){if(i.has(t))return `[object ${t.constructor.name}]`;i.add(t);}return t},s=t?` ${JSON.stringify(t,n)}`:"",o=P(e);return e+s+o}(e,i)),this.name="CKEditorError",this.context=t,this.data=i;}is(e){return "CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new A(e.message,t);throw i.stack=e.stack,i}}function E(e,t){console.warn(...S(e,t));}function T(e,t){console.error(...S(e,t));}function P(e){return `\nRead more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-${e}`}function S(e,t){const i=P(e);return t?[e,t,i]:[e,i]}const I="44.1.0",V=new Date(2024,11,16);if(globalThis.CKEDITOR_VERSION)throw new A("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=I;const R=Symbol("listeningTo"),O=Symbol("emitterId"),B=Symbol("delegations"),M=L(Object);function L(e){if(!e)return M;return class extends e{on(e,t,i){this.listenTo(this,e,t,i);}once(e,t,i){let n=!1;this.listenTo(this,e,((e,...i)=>{n||(n=!0,e.off(),t.call(this,e,...i));}),i);}off(e,t){this.stopListening(this,e,t);}listenTo(e,t,i,n={}){let s,o;this[R]||(this[R]={});const r=this[R];F(e)||N(e);const a=F(e);(s=r[a])||(s=r[a]={emitter:e,callbacks:{}}),(o=s.callbacks[t])||(o=s.callbacks[t]=[]),o.push(i),function(e,t,i,n,s){t._addEventListener?t._addEventListener(i,n,s):e._addEventListener.call(t,i,n,s);}(this,e,t,i,n);}stopListening(e,t,i){const n=this[R];let s=e&&F(e);const o=n&&s?n[s]:void 0,r=o&&t?o.callbacks[t]:void 0;if(!(!n||e&&!o||t&&!r))if(i){$(this,e,t,i);-1!==r.indexOf(i)&&(1===r.length?delete o.callbacks[t]:$(this,e,t,i));}else if(r){for(;i=r.pop();)$(this,e,t,i);delete o.callbacks[t];}else if(o){for(t in o.callbacks)this.stopListening(e,t);delete n[s];}else {for(s in n)this.stopListening(n[s].emitter);delete this[R];}}fire(e,...t){try{const i=e instanceof v?e:new v(this,e),n=i.name;let s=function(e,t){if(!e._events)return null;let i=t;do{const t=e._events[i];if(t&&t.callbacks&&t.callbacks.length)return t.callbacks;const n=i.lastIndexOf(":");i=n>-1?i.substring(0,n):"";}while(i);return null}(this,n);if(i.path.push(this),s){s=s.slice();for(let e=0;e-1},Ot.prototype.set=function(e,t){var i=this.__data__,n=Vt(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};var Bt=Se(j,"Map");function Mt(e,t){var i,n,s=e.__data__;return ("string"==(n=typeof(i=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?s["string"==typeof t?"string":"hash"]:s.map}function Lt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++ts?0:s+t),(i=i>s?s:i)<0&&(i+=s),s=t>i?0:i-t>>>0,t>>>=0;for(var o=Array(s);++n=s?t:ei(t,i,n)).join(""):e.slice(1);return r[pi]()+a});function wi(e){return function(t){return null==e?void 0:e[t]}}var _i=wi({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),vi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yi=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var ki=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Ci=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var xi="\\ud800-\\udfff",Ai="\\u2700-\\u27bf",Ei="a-z\\xdf-\\xf6\\xf8-\\xff",Ti="A-Z\\xc0-\\xd6\\xd8-\\xde",Pi="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Si="["+Pi+"]",Ii="\\d+",Vi="["+Ai+"]",Ri="["+Ei+"]",Oi="[^"+xi+Pi+Ii+Ai+Ei+Ti+"]",Bi="(?:\\ud83c[\\udde6-\\uddff]){2}",Mi="[\\ud800-\\udbff][\\udc00-\\udfff]",Li="["+Ti+"]",Ni="(?:"+Ri+"|"+Oi+")",Fi="(?:"+Li+"|"+Oi+")",Di="(?:['’](?:d|ll|m|re|s|t|ve))?",zi="(?:['’](?:D|LL|M|RE|S|T|VE))?",Hi="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",$i="[\\ufe0e\\ufe0f]?",Ui=$i+Hi+("(?:\\u200d(?:"+["[^"+xi+"]",Bi,Mi].join("|")+")"+$i+Hi+")*"),Wi="(?:"+[Vi,Bi,Mi].join("|")+")"+Ui,ji=RegExp([Li+"?"+Ri+"+"+Di+"(?="+[Si,Li,"$"].join("|")+")",Fi+"+"+zi+"(?="+[Si,Li+Ni,"$"].join("|")+")",Li+"?"+Ni+"+"+Di,Li+"+"+zi,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ii,Wi].join("|"),"g");function qi(e,t,i){return e=Ht(e),void 0===t?function(e){return Ci.test(e)}(e)?function(e){return e.match(ji)||[]}(e):function(e){return e.match(ki)||[]}(e):e.match(t)||[]}var Gi=RegExp("['’]","g");function Ki(e){var t=this.__data__=new Ot(e);this.size=t.size;}Ki.prototype.clear=function(){this.__data__=new Ot,this.size=0;},Ki.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},Ki.prototype.get=function(e){return this.__data__.get(e)},Ki.prototype.has=function(e){return this.__data__.has(e)},Ki.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Ot){var n=i.__data__;if(!Bt||n.length<199)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new Lt(n);}return i.set(e,t),this.size=i.size,this};var Zi="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ji=Zi&&"object"==typeof module&&module&&!module.nodeType&&module,Qi=Ji&&Ji.exports===Zi?j.Buffer:void 0,Yi=Qi?Qi.allocUnsafe:void 0;function Xi(e,t){if(t)return e.slice();var i=e.length,n=Yi?Yi(i):new e.constructor(i);return e.copy(n),n}function en(){return []}var tn=Object.prototype.propertyIsEnumerable,nn=Object.getOwnPropertySymbols,sn=nn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,n=null==e?0:e.length,s=0,o=[];++i{this.set(t,e[t]);}),this);Zs(this);const i=this[$s];if(e in this&&!i.has(e))throw new A("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>i.get(e),set(t){const n=i.get(e);let s=this.fire(`set:${e}`,e,t,n);void 0===s&&(s=t),n===s&&i.has(e)||(i.set(e,s),this.fire(`change:${e}`,e,s,n));}}),this[e]=t;}bind(...e){if(!e.length||!Ys(e))throw new A("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new A("observable-bind-duplicate-properties",this);Zs(this);const t=this[Ws];e.forEach((e=>{if(t.has(e))throw new A("observable-bind-rebind",this)}));const i=new Map;return e.forEach((e=>{const n={property:e,to:[]};t.set(e,n),i.set(e,n);})),{to:Js,toMany:Qs,_observable:this,_bindProperties:e,_to:[],_bindings:i}}unbind(...e){if(!this[$s])return;const t=this[Ws],i=this[Us];if(e.length){if(!Ys(e))throw new A("observable-unbind-wrong-properties",this);e.forEach((e=>{const n=t.get(e);n&&(n.to.forEach((([e,t])=>{const s=i.get(e),o=s[t];o.delete(n),o.size||delete s[t],Object.keys(s).length||(i.delete(e),this.stopListening(e,"change"));})),t.delete(e));}));}else i.forEach(((e,t)=>{this.stopListening(t,"change");})),i.clear(),t.clear();}decorate(e){Zs(this);const t=this[e];if(!t)throw new A("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,((e,i)=>{e.return=t.apply(this,i);})),this[e]=function(...t){return this.fire(e,t)},this[e][qs]=t,this[js]||(this[js]=[]),this[js].push(e);}stopListening(e,t,i){if(!e&&this[js]){for(const e of this[js])this[e]=this[e][qs];delete this[js];}super.stopListening(e,t,i);}[$s];[js];[Ws];[Us]}}function Zs(e){e[$s]||(Object.defineProperty(e,$s,{value:new Map}),Object.defineProperty(e,Us,{value:new Map}),Object.defineProperty(e,Ws,{value:new Map}));}function Js(...e){const t=function(...e){if(!e.length)throw new A("observable-bind-to-parse-error",null);const t={to:[]};let i;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach((e=>{if("string"==typeof e)i.properties.push(e);else {if("object"!=typeof e)throw new A("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i);}})),t}(...e),i=Array.from(this._bindings.keys()),n=i.length;if(!t.callback&&t.to.length>1)throw new A("observable-bind-to-no-callback",this);if(n>1&&t.callback)throw new A("observable-bind-to-extra-callback",this);var s;t.to.forEach((e=>{if(e.properties.length&&e.properties.length!==n)throw new A("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties);})),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),s=this._observable,this._to.forEach((e=>{const t=s[Us];let i;t.get(e.observable)||s.listenTo(e.observable,"change",((n,o)=>{i=t.get(e.observable)[o],i&&i.forEach((e=>{Xs(s,e.property);}));}));})),function(e){let t;e._bindings.forEach(((i,n)=>{e._to.forEach((s=>{t=s.properties[i.callback?0:e._bindProperties.indexOf(n)],i.to.push([s.observable,t]),function(e,t,i,n){const s=e[Us],o=s.get(i),r=o||{};r[n]||(r[n]=new Set);r[n].add(t),o||s.set(i,r);}(e._observable,i,s.observable,t);}));}));}(this),this._bindProperties.forEach((e=>{Xs(this._observable,e);}));}function Qs(e,t,i){if(this._bindings.size>1)throw new A("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map((e=>[e,t]));return Array.prototype.concat.apply([],i)}(e,t),i);}function Ys(e){return e.every((e=>"string"==typeof e))}function Xs(e,t){const i=e[Ws].get(t);let n;i.callback?n=i.callback.apply(e,i.to.map((e=>e[0][e[1]]))):(n=i.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n);}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{Ks[e]=Gs.prototype[e];}));class eo{_replacedElements;constructor(){this._replacedElements=[];}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling);}restore(){this._replacedElements.forEach((({element:e,newElement:t})=>{e.style.display="",t&&t.remove();})),this._replacedElements=[];}}function to(e){let t=new AbortController;function i(...i){return t.abort(),t=new AbortController,e(t.signal,...i)}return i.abort=()=>t.abort(),i}function io(e){let t=0;for(const i of e)t++;return t}function no(e,t){const i=Math.min(e.length,t.length);for(let n=0;n{this._setToTarget(e,n,t[n],i);}));}}function ao(e){return Un(e,lo)}function lo(e){return Bs(e)||"function"==typeof e?e:void 0}function co(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}function uo(e){const t=Object.prototype.toString.apply(e);return "[object Window]"==t||"[object global]"==t}const ho=mo(L());function mo(e){if(!e)return ho;return class extends e{listenTo(e,t,i,n={}){if(co(e)||uo(e)){const s={capture:!!n.useCapture,passive:!!n.usePassive},o=this._getProxyEmitter(e,s)||new go(e,s);this.listenTo(o,t,i,n);}else super.listenTo(e,t,i,n);}stopListening(e,t,i){if(co(e)||uo(e)){const n=this._getAllProxyEmitters(e);for(const e of n)this.stopListening(e,t,i);}else super.stopListening(e,t,i);}_getProxyEmitter(e,t){return function(e,t){const i=e[R];return i&&i[t]?i[t].emitter:null}(this,fo(e,t))}_getAllProxyEmitters(e){return [{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map((t=>this._getProxyEmitter(e,t))).filter((e=>!!e))}}}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{mo[e]=ho.prototype[e];}));class go extends(L()){_domNode;_options;constructor(e,t){super(),N(this,fo(e,t)),this._domNode=e,this._options=t;}_domListeners;attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t;}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener();}_addEventListener(e,t,i){this.attach(e),L().prototype._addEventListener.call(this,e,t,i);}_removeEventListener(e,t){L().prototype._removeEventListener.call(this,e,t),this.detach(e);}_createDomListener(e){const t=t=>{this.fire(e,t);};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e];},t}}function fo(e,t){let i=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=k())}(e);for(const e of Object.keys(t).sort())t[e]&&(i+="-"+e);return i}function po(e){let t=e.parentElement;if(!t)return null;for(;"BODY"!=t.tagName;){const e=t.style.overflowY||i.window.getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)break;if(t=t.parentElement,!t)return null}return t}function bo(e){const t=[];let i=e;for(;i&&i.nodeType!=Node.DOCUMENT_NODE;)t.unshift(i),i=i.parentNode;return t}function wo(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function _o(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)}}function vo(e){if(!e.target)return null;const t=e.target.ownerDocument,i=e.clientX,n=e.clientY;let s=null;return t.caretRangeFromPoint&&t.caretRangeFromPoint(i,n)?s=t.caretRangeFromPoint(i,n):e.rangeParent&&(s=t.createRange(),s.setStart(e.rangeParent,e.rangeOffset),s.collapse(!0)),s}function yo(e){return "[object Text]"==Object.prototype.toString.call(e)}function ko(e){return "[object Range]"==Object.prototype.toString.apply(e)}function Co(e){return e&&e.parentNode?e.offsetParent===i.document.body?null:e.offsetParent:null}const xo=["top","right","bottom","left","width","height"];class Ao{top;right;bottom;left;width;height;_source;constructor(e){const t=ko(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),Po(e)||t)if(t){const t=Ao.getDomRangeRects(e);Eo(this,Ao.getBoundingRect(t));}else Eo(this,e.getBoundingClientRect());else if(uo(e)){const{innerWidth:t,innerHeight:i}=e;Eo(this,{top:0,right:t,bottom:i,left:0,width:t,height:i});}else Eo(this,e);}clone(){return new Ao(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),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const e=new Ao(t);return e._source=this._source,e}}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(To(e))return t;let i,n=e,s=e.parentNode||e.commonAncestorContainer;for(;s&&!To(s);){const e="visible"===((o=s)instanceof HTMLElement?o.ownerDocument.defaultView.getComputedStyle(o).overflow:"visible");n instanceof HTMLElement&&"absolute"===So(n)&&(i=n);const r=So(s);if(e||i&&("relative"===r&&e||"relative"!==r)){n=s,s=s.parentNode;continue}const a=new Ao(s),l=t.getIntersection(a);if(!l)return null;l.getArea()e(...s)),t);}return n.cancel=()=>{clearTimeout(i);},n}function Sr(e){try{if(!e.startsWith("ey"))return null;const t=atob(e.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(t)}catch(e){return null}}function Ir(e){const t=Array.isArray(e)?e:[e],i=function(){const e=[];for(let t=0;t<256;t++){let i=t;for(let e=0;e<8;e++)1&i?i=3988292384^i>>>1:i>>>=1;e[t]=i;}return e}();let n=~0;const s=t.map((e=>Array.isArray(e)?e.join(""):String(e))).join("");for(let e=0;ei.offset){if(n>s){const e={type:"attribute",offset:s,howMany:n-s,count:this._changeCount++};this._handleChange(e,t),t.push(e);}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle;}else e.offset>=i.offset&&e.offsets?(e.nodesToHandle=n-s,e.offset=s):e.nodesToHandle=0);if("remove"==i.type&&e.offset<br> element)"),keystroke:"Shift+Enter"}]});}}class lv extends Hr{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor.model,i=t.schema,n=t.document.selection,s=Array.from(n.getSelectedBlocks()),o=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(o){const t=s.filter((e=>cv(e)||uv(i,e)));this._applyQuote(e,t);}else this._removeQuote(e,s.filter(cv));}));}_getValue(){const e=br(this.editor.model.document.selection.getSelectedBlocks());return !(!e||!cv(e))}_checkEnabled(){if(this.value)return !0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=br(e.getSelectedBlocks());return !!i&&uv(t,i)}_removeQuote(e,t){dv(e,t).reverse().forEach((t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i);}));}_applyQuote(e,t){const i=[];dv(e,t).reverse().forEach((t=>{let n=cv(t.start);n||(n=e.createElement("blockQuote"),e.wrap(t,n)),i.push(n);})),i.reverse().reduce(((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i));}}function cv(e){return "blockQuote"==e.parent.name?e.parent:null}function dv(e,t){let i,n=0;const s=[];for(;n
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||e.includes("
"))&&(e=`
${e}
`),e}const Yy=["figcaption","li"],Xy=["ol","ul"];function ek(e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return "\n";let t="",i=null;for(const n of e.getChildren())t+=tk(n,i)+ek(n),i=n;return t}function tk(e,t){return t?e.is("element","li")&&!e.isEmpty&&e.getChild(0).is("containerElement")||Xy.includes(e.name)&&Xy.includes(t.name)?"\n\n":e.is("containerElement")||t.is("containerElement")?Yy.includes(e.name)||Yy.includes(t.name)?"\n":e.is("element")&&e.getCustomProperty("dataPipeline:transparentRendering")||t.is("element")&&t.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":""}class ik extends Dr{_markersToCopy=new Map;static get pluginName(){return "ClipboardMarkersUtils"}static get isOfficialPlugin(){return !0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t);}_copySelectedFragmentWithMarkers(e,t,i=e=>e.model.getSelectedContent(e.model.document.selection)){return this.editor.model.change((n=>{const s=n.model.document.selection;n.setSelection(t);const o=this._insertFakeMarkersIntoSelection(n,n.model.document.selection,e),r=i(n),a=this._removeFakeMarkersInsideElement(n,r);for(const[e,t]of Object.entries(o)){a[e]||=n.createRangeIn(r);for(const e of t)n.remove(e);}r.markers.clear();for(const[e,t]of Object.entries(a))r.markers.set(e,t);return n.setSelection(s),r}))}_pasteMarkersIntoTransformedElement(e,t){const i=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change((e=>{const n=this._insertFakeMarkersElements(e,i),s=t(e),o=this._removeFakeMarkersInsideElement(e,s);for(const t of Object.values(n).flat())e.remove(t);for(const[t,i]of Object.entries(o))e.model.markers.has(t)||e.addMarker(t,{usingOperation:!0,affectsData:!0,range:i});return s}))}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const i of t)e.markers.set(i.name,i.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,i={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const n=this._markersToCopy.get(e);this._markersToCopy.set(e,i),t(),n?this._markersToCopy.set(e,n):this._markersToCopy.delete(e);}_isMarkerCopyable(e,t){const i=this._getMarkerClipboardConfig(e);if(!i)return !1;if(!t)return !0;const{allowedActions:n}=i;return "all"===n||n.includes(t)}_hasMarkerConfiguration(e){return !!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,i){const n=this._getCopyableMarkersFromSelection(e,t,i);return this._insertFakeMarkersElements(e,n)}_getCopyableMarkersFromSelection(e,t,i){const n=Array.from(t.getRanges()),s=new Set(n.flatMap((t=>Array.from(e.model.markers.getMarkersIntersectingRange(t)))));return Array.from(s).filter((e=>{if(!this._isMarkerCopyable(e.name,i))return !1;const{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){const t=e.getRange();return n.some((e=>e.containsRange(t,!0)))}return !0})).map((e=>({name:"dragstart"===i?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()})))}_getPasteMarkersFromRangeMap(e,t=null){const{model:i}=this.editor;return (e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap((([e,n])=>{if(!this._hasMarkerConfiguration(e))return [{name:e,range:n}];if(this._isMarkerCopyable(e,t)){const t=this._getMarkerClipboardConfig(e),s=i.markers.has(e)&&"$graveyard"===i.markers.get(e).getRange().root.rootName;return (t.duplicateOnPaste||s)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:n}]}return []}))}_insertFakeMarkersElements(e,t){const i={},n=t.flatMap((e=>{const{start:t,end:i}=e.range;return [{position:t,marker:e,type:"start"},{position:i,marker:e,type:"end"}]})).sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:t,marker:s,type:o}of n){const n=e.createElement("$marker",{"data-name":s.name,"data-type":o});i[s.name]||(i[s.name]=[]),i[s.name].push(n),e.insert(n,t);}return i}_removeFakeMarkersInsideElement(e,t){const i=this._getAllFakeMarkersFromElement(e,t).reduce(((t,i)=>{const n=i.markerElement&&e.createPositionBefore(i.markerElement);let s=t[i.name],o=!1;if(s&&s.start&&s.end){this._getMarkerClipboardConfig(i.name).duplicateOnPaste?t[this._getUniqueMarkerName(i.name)]=t[i.name]:o=!0,s=null;}return o||(t[i.name]={...s,[i.type]:n}),i.markerElement&&e.remove(i.markerElement),t}),{});return n=i,o={},s=us(s=i=>new Ql(i.start||e.createPositionFromPath(t,[0]),i.end||e.createPositionAt(t,"end"))),ms(n,(function(e,t,i){De(o,t,s(e,t,i));})),o;var n,s,o;}_getAllFakeMarkersFromElement(e,t){const i=Array.from(e.createRangeIn(t)).flatMap((({item:e})=>{if(!e.is("element","$marker"))return [];const t=e.getAttribute("data-name"),i=e.getAttribute("data-type");return [{markerElement:e,name:t,type:i}]})),n=[],s=[];for(const e of i){if("end"===e.type){i.some((t=>t.name===e.name&&"start"===t.type))||n.push({markerElement:null,name:e.name,type:"start"});}if("start"===e.type){i.some((t=>t.name===e.name&&"end"===t.type))||s.unshift({markerElement:null,name:e.name,type:"end"});}}return [...n,...i,...s]}_getUniqueMarkerName(e){const t=e.split(":"),i=k().substring(1,6);return 3===t.length?`${t.slice(0,2).join(":")}:${i}`:`${t.join(":")}:${i}`}}class nk extends Dr{static get pluginName(){return "ClipboardPipeline"}static get isOfficialPlugin(){return !0}static get requires(){return [ik]}init(){this.editor.editing.view.addObserver(Jy),this._setupPasteDrop(),this._setupCopyCut();}_fireOutputTransformationEvent(e,t,i){const n=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===i},(()=>{const s=n._copySelectedFragmentWithMarkers(i,t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:i});}));}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,n=i.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(n,"clipboardInput",((t,i)=>{"paste"!=i.method||e.model.canEditAt(e.model.document.selection)||t.stop();}),{priority:"highest"}),this.listenTo(n,"clipboardInput",((e,t)=>{const n=t.dataTransfer;let s;if(t.content)s=t.content;else {let e="";n.getData("text/html")?e=function(e){return e.replace(/(\s+)<\/span>/g,((e,t)=>1==t.length?" ":t)).replace(//g,"")}(n.getData("text/html")):n.getData("text/plain")&&(e=Qy(n.getData("text/plain"))),s=this.editor.data.htmlProcessor.toView(e);}const o=new v(this,"inputTransformation");this.fire(o,{content:s,dataTransfer:n,targetRanges:t.targetRanges,method:t.method}),o.stop.called&&e.stop(),i.scrollToTheSelection();}),{priority:"low"}),this.listenTo(this,"inputTransformation",((e,i)=>{if(i.content.isEmpty)return;const n=this.editor.data.toModel(i.content,"$clipboardHolder");0!=n.childCount&&(e.stop(),t.change((()=>{this.fire("contentInsertion",{content:n,method:i.method,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges});})));}),{priority:"low"}),this.listenTo(this,"contentInsertion",((e,t)=>{t.resultRange=s._pasteFragmentWithMarkers(t.content);}),{priority:"low"});}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,n=(e,i)=>{const n=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(n,t.selection,e.name);};this.listenTo(i,"copy",n,{priority:"low"}),this.listenTo(i,"cut",((t,i)=>{e.model.canEditAt(e.model.document.selection)?n(t,i):i.preventDefault();}),{priority:"low"}),this.listenTo(this,"outputTransformation",((t,n)=>{const s=e.data.toView(n.content);i.fire("clipboardOutput",{dataTransfer:n.dataTransfer,content:s,method:n.method});}),{priority:"low"}),this.listenTo(i,"clipboardOutput",((i,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",ek(n.content))),"cut"==n.method&&e.model.deleteContent(t.selection);}),{priority:"low"});}}const sk=Ro("px");class ok extends gg{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",(e=>!e))],style:{left:e.to("left",(e=>sk(e))),top:e.to("top",(e=>sk(e))),width:e.to("width",(e=>sk(e)))}}});}}class rk extends Dr{removeDropMarkerDelayed=Pr((()=>this.removeDropMarker()),40);_updateDropMarkerThrottled=Hs((e=>this._updateDropMarker(e)),40);_reconvertMarkerThrottled=Hs((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target");}),0);_dropTargetLineView=new ok;_domEmitter=new(mo());_scrollables=new Map;static get pluginName(){return "DragDropTarget"}static get isOfficialPlugin(){return !0}init(){this._setupDropMarker();}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,n,s,o){this.removeDropMarkerDelayed.cancel();const r=ak(this.editor,e,t,i,n,s,o);if(r)return o&&o.containsRange(r)?this.removeDropMarker():void this._updateDropMarkerThrottled(r)}getFinalDropRange(e,t,i,n,s,o){const r=ak(this.editor,e,t,i,n,s,o);return this.removeDropMarker(),r}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change((e=>{e.removeMarker("drop-target");}));}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1;}});}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change((t=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1});}));}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.append("",e.createElement("span"),""),t}))}_updateDropTargetLine(e){const t=this.editor.editing,n=e.start.nodeBefore,s=e.start.nodeAfter,o=e.start.parent,r=n?t.mapper.toViewElement(n):null,a=r?t.view.domConverter.mapViewToDom(r):null,l=s?t.mapper.toViewElement(s):null,c=l?t.view.domConverter.mapViewToDom(l):null,d=t.mapper.toViewElement(o);if(!d)return;const u=t.view.domConverter.mapViewToDom(d),h=this._getScrollableRect(d),{scrollX:m,scrollY:g}=i.window,f=a?new Ao(a):null,p=c?new Ao(c):null,b=new Ao(u).excludeScrollbarsAndBorders(),w=f?f.bottom:b.top,_=p?p.top:b.bottom,v=i.window.getComputedStyle(u),y=w<=_?(w+_)/2:_;if(h.top'+(i?e:aV(e,!0))+"\n":""+(i?e:aV(e,!0))+"\n"}blockquote(e){return "\n"+e+"\n"}html(e){return e}heading(e,t,i,n){return this.options.headerIds?"
"+e+"
\n"}table(e,t){return t&&(t=""+t+""),""+e+""}br(){return this.options.xhtml?"An error occurred:
"+aV(e.message+"",!0)+"";throw e}}LV.options=LV.setOptions=function(e){var t;return vV(LV.defaults,e),t=LV.defaults,eV=t,LV},LV.getDefaults=XI,LV.defaults=eV,LV.use=function(...e){const t=vV({},...e),i=LV.defaults.extensions||{renderers:{},childTokens:{}};let n;e.forEach((e=>{if(e.extensions&&(n=!0,e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const t=i.renderers?i.renderers[e.name]:null;i.renderers[e.name]=t?function(...i){let n=e.renderer.apply(this,i);return !1===n&&(n=t.apply(this,i)),n}:e.renderer;}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");i[e.level]?i[e.level].unshift(e.tokenizer):i[e.level]=[e.tokenizer],e.start&&("block"===e.level?i.startBlock?i.startBlock.push(e.start):i.startBlock=[e.start]:"inline"===e.level&&(i.startInline?i.startInline.push(e.start):i.startInline=[e.start]));}e.childTokens&&(i.childTokens[e.name]=e.childTokens);}))),e.renderer){const i=LV.defaults.renderer||new RV;for(const t in e.renderer){const n=i[t];i[t]=(...s)=>{let o=e.renderer[t].apply(i,s);return !1===o&&(o=n.apply(i,s)),o};}t.renderer=i;}if(e.tokenizer){const i=LV.defaults.tokenizer||new EV;for(const t in e.tokenizer){const n=i[t];i[t]=(...s)=>{let o=e.tokenizer[t].apply(i,s);return !1===o&&(o=n.apply(i,s)),o};}t.tokenizer=i;}if(e.walkTokens){const i=LV.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens.call(this,t),i&&i.call(this,t);};}n&&(t.extensions=i),LV.setOptions(t);}));},LV.walkTokens=function(e,t){for(const i of e)switch(t.call(LV,i),i.type){case"table":for(const e of i.header)LV.walkTokens(e.tokens,t);for(const e of i.rows)for(const i of e)LV.walkTokens(i.tokens,t);break;case"list":LV.walkTokens(i.items,t);break;default:LV.defaults.extensions&&LV.defaults.extensions.childTokens&&LV.defaults.extensions.childTokens[i.type]?LV.defaults.extensions.childTokens[i.type].forEach((function(e){LV.walkTokens(i[e],t);})):i.tokens&&LV.walkTokens(i.tokens,t);}},LV.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");CV(t=vV({},LV.defaults,t||{}));try{const i=VV.lexInline(e,t);return t.walkTokens&&LV.walkTokens(i,t.walkTokens),MV.parseInline(i,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return "
An error occurred:
"+aV(e.message+"",!0)+"";throw e}},LV.Parser=MV,LV.parser=MV.parse,LV.Renderer=RV,LV.TextRenderer=OV,LV.Lexer=VV,LV.lexer=VV.lex,LV.Tokenizer=EV,LV.Slugger=BV,LV.parse=LV,LV.options,LV.setOptions,LV.use,LV.walkTokens,LV.parseInline,MV.parse,VV.lex;class NV{_parser;_options={gfm:!0,breaks:!0,tables:!0,xhtml:!0,headerIds:!1};constructor(){LV.use({tokenizer:{autolink:()=>null,url:()=>null},renderer:{checkbox(...e){return Object.getPrototypeOf(this).checkbox.call(this,...e).trimRight()},code(...e){return Object.getPrototypeOf(this).code.call(this,...e).replace("\n","")}}}),this._parser=LV;}parse(e){return this._parser.parse(e,this._options)}}function FV(e,t){return Array(t+1).join(e)}var DV=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function zV(e){return WV(e,DV)}var HV=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function $V(e){return WV(e,HV)}var UV=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function WV(e,t){return t.indexOf(e.nodeName)>=0}function jV(e,t){return e.getElementsByTagName&&t.some((function(t){return e.getElementsByTagName(t).length}))}var qV={};function GV(e){return e?e.replace(/(\n+\s*)+/g,"\n"):""}function KV(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t]);}function ZV(e,t,i){for(var n=0;n