(function(A,pi){typeof exports=="object"&&typeof module<"u"?pi(exports):typeof define=="function"&&define.amd?define(["exports"],pi):(A=typeof globalThis<"u"?globalThis:A||self,pi(A.CKEDITOR={}))})(this,function(A){"use strict";function pi(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const r=Object.getOwnPropertyDescriptor(i,s);r&&Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Nd(){try{return navigator.userAgent.toLowerCase()}catch{return""}}const wt=Nd(),x={isMac:bo(wt),isWindows:Ld(wt),isGecko:$d(wt),isSafari:zd(wt),isiOS:Hd(wt),isAndroid:Wd(wt),isBlink:Ud(wt),features:{isRegExpUnicodePropertySupported:jd()}};function bo(n){return n.indexOf("macintosh")>-1}function Ld(n){return n.indexOf("windows")>-1}function $d(n){return!!n.match(/gecko\/\d+/)}function zd(n){return n.indexOf(" applewebkit/")>-1&&n.indexOf("chrome")===-1}function Hd(n){return!!n.match(/iphone|ipad/i)||bo(n)&&navigator.maxTouchPoints>0}function Wd(n){return n.indexOf("android")>-1}function Ud(n){return n.indexOf("chrome/")>-1&&n.indexOf("edge/")<0}function jd(){let n=!1;try{n="ć".search(new RegExp("[\\p{L}]","u"))===0}catch{}return n}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function _o(n,e,t,i){t=t||function(l,c){return l===c};const s=Array.isArray(n)?n:Array.prototype.slice.call(n),r=Array.isArray(e)?e:Array.prototype.slice.call(e),o=qd(s,r,t);return i?Kd(o,r.length):Gd(r,o)}function qd(n,e,t){const i=vo(n,e,t);if(i===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=yo(n,i),r=yo(e,i),o=vo(s,r,t),a=n.length-o,l=e.length-o;return{firstIndex:i,lastIndexOld:a,lastIndexNew:l}}function vo(n,e,t){for(let i=0;i<Math.max(n.length,e.length);i++)if(n[i]===void 0||e[i]===void 0||!t(n[i],e[i]))return i;return-1}function yo(n,e){return n.slice(e).reverse()}function Gd(n,e){const t=[],{firstIndex:i,lastIndexOld:s,lastIndexNew:r}=e;return r-i>0&&t.push({index:i,type:"insert",values:n.slice(i,r)}),s-i>0&&t.push({index:i+(r-i),type:"delete",howMany:s-i}),t}function Kd(n,e){const{firstIndex:t,lastIndexOld:i,lastIndexNew:s}=n;if(t===-1)return Array(e).fill("equal");let r=[];return t>0&&(r=r.concat(Array(t).fill("equal"))),s-t>0&&(r=r.concat(Array(s-t).fill("insert"))),i-t>0&&(r=r.concat(Array(i-t).fill("delete"))),s<e&&(r=r.concat(Array(e-s).fill("equal"))),r}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function wi(n,e,t){t=t||function(b,E){return b===E};const i=n.length,s=e.length;if(i>200||s>200||i+s>300)return wi.fastDiff(n,e,t,!0);let r,o;if(s<i){const b=n;n=e,e=b,r="delete",o="insert"}else r="insert",o="delete";const a=n.length,l=e.length,c=l-a,u={},h={};function f(b){const E=(h[b-1]!==void 0?h[b-1]:-1)+1,T=h[b+1]!==void 0?h[b+1]:-1,de=E>T?-1:1;u[b+de]&&(u[b]=u[b+de].slice(0)),u[b]||(u[b]=[]),u[b].push(E>T?r:o);let Se=Math.max(E,T),ke=Se-b;for(;ke<a&&Se<l&&t(n[ke],e[Se]);)ke++,Se++,u[b].push("equal");return Se}let m=0,p;do{for(p=-m;p<c;p++)h[p]=f(p);for(p=c+m;p>c;p--)h[p]=f(p);h[c]=f(c),m++}while(h[c]!==l);return u[c].slice(1)}wi.fastDiff=_o;/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function ko(){return function n(){n.called=!0}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class je{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=ko(),this.off=ko()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const ce=new Array(256).fill("").map((n,e)=>("0"+e.toString(16)).slice(-2));function qe(){const n=Math.random()*4294967296>>>0,e=Math.random()*4294967296>>>0,t=Math.random()*4294967296>>>0,i=Math.random()*4294967296>>>0;return"e"+ce[n>>0&255]+ce[n>>8&255]+ce[n>>16&255]+ce[n>>24&255]+ce[e>>0&255]+ce[e>>8&255]+ce[e>>16&255]+ce[e>>24&255]+ce[t>>0&255]+ce[t>>8&255]+ce[t>>16&255]+ce[t>>24&255]+ce[i>>0&255]+ce[i>>8&255]+ce[i>>16&255]+ce[i>>24&255]}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const pe={get(n="normal"){return typeof n!="number"?this[n]||this.normal:n},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Jd(n,e){const t=pe.get(e.priority);for(let i=0;i<n.length;i++)if(pe.get(n[i].priority)<t){n.splice(i,0,e);return}n.push(e)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Zd="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class d extends Error{constructor(e,t,i){super(Yd(e,i)),this.name="CKEditorError",this.context=t,this.data=i}is(e){return e==="CKEditorError"}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new d(e.message,t);throw i.stack=e.stack,i}}function G(n,e){console.warn(...Xd(n,e))}function Co(n){return`
Read more: ${Zd}#error-${n}`}function Yd(n,e){const t=new WeakSet,s=e?` ${JSON.stringify(e,(o,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return`[object ${a.constructor.name}]`;t.add(a)}return a})}`:"",r=Co(n);return n+s+r}function Xd(n,e){const t=Co(n);return e?[n,e,t]:[n,t]}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Qd="38.1.1",ef=new Date(2023,6,11);/* istanbul ignore next -- @preserve */const Eo=typeof window=="object"?window:global;/* istanbul ignore next -- @preserve */if(Eo.CKEDITOR_VERSION)throw new d("ckeditor-duplicated-modules",null);Eo.CKEDITOR_VERSION=Qd;/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Lt=Symbol("listeningTo"),Zn=Symbol("emitterId"),Ge=Symbol("delegations"),Ao=L(Object);function L(n){if(!n)return Ao;class e extends n{on(i,s,r){this.listenTo(this,i,s,r)}once(i,s,r){let o=!1;const a=(l,...c)=>{o||(o=!0,l.off(),s.call(this,l,...c))};this.listenTo(this,i,a,r)}off(i,s){this.stopListening(this,i,s)}listenTo(i,s,r,o={}){let a,l;this[Lt]||(this[Lt]={});const c=this[Lt];Yn(i)||To(i);const u=Yn(i);(a=c[u])||(a=c[u]={emitter:i,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(r),rf(this,i,s,r,o)}stopListening(i,s,r){const o=this[Lt];let a=i&&Yn(i);const l=o&&a?o[a]:void 0,c=l&&s?l.callbacks[s]:void 0;if(!(!o||i&&!l||s&&!c))if(r)Qn(this,i,s,r),c.indexOf(r)!==-1&&(c.length===1?delete l.callbacks[s]:Qn(this,i,s,r));else if(c){for(;r=c.pop();)Qn(this,i,s,r);delete l.callbacks[s]}else if(l){for(s in l.callbacks)this.stopListening(i,s);delete o[a]}else{for(a in o)this.stopListening(o[a].emitter);delete this[Lt]}}fire(i,...s){try{const r=i instanceof je?i:new je(this,i),o=r.name;let a=So(this,o);if(r.path.push(this),a){const c=[r,...s];a=Array.from(a);for(let u=0;u<a.length&&(a[u].callback.apply(this,c),r.off.called&&(delete r.off.called,this._removeEventListener(o,a[u].callback)),!r.stop.called);u++);}const l=this[Ge];if(l){const c=l.get(o),u=l.get("*");c&&xo(c,r,s),u&&xo(u,r,s)}return r.return}catch(r){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(r,this)}}delegate(...i){return{to:(s,r)=>{this[Ge]||(this[Ge]=new Map),i.forEach(o=>{const a=this[Ge].get(o);a?a.set(s,r):this[Ge].set(o,new Map([[s,r]]))})}}}stopDelegating(i,s){if(this[Ge])if(!i)this[Ge].clear();else if(!s)this[Ge].delete(i);else{const r=this[Ge].get(i);r&&r.delete(s)}}_addEventListener(i,s,r){sf(this,i);const o=Xn(this,i),a=pe.get(r.priority),l={callback:s,priority:a};for(const c of o)Jd(c,l)}_removeEventListener(i,s){const r=Xn(this,i);for(const o of r)for(let a=0;a<o.length;a++)o[a].callback==s&&(o.splice(a,1),a--)}}return e}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{L[n]=Ao.prototype[n]});function tf(n,e){const t=n[Lt];return t&&t[e]?t[e].emitter:null}function To(n,e){n[Zn]||(n[Zn]=e||qe())}function Yn(n){return n[Zn]}function Po(n){return n._events||Object.defineProperty(n,"_events",{value:{}}),n._events}function nf(){return{callbacks:[],childEvents:[]}}function sf(n,e){const t=Po(n);if(t[e])return;let i=e,s=null;const r=[];for(;i!==""&&!t[i];)t[i]=nf(),r.push(t[i]),s&&t[i].childEvents.push(s),s=i,i=i.substr(0,i.lastIndexOf(":"));if(i!==""){for(const o of r)o.callbacks=t[i].callbacks.slice();t[i].childEvents.push(s)}}function Xn(n,e){const t=Po(n)[e];if(!t)return[];let i=[t.callbacks];for(let s=0;s<t.childEvents.length;s++){const r=Xn(n,t.childEvents[s]);i=i.concat(r)}return i}function So(n,e){let t;return!n._events||!(t=n._events[e])||!t.callbacks.length?e.indexOf(":")>-1?So(n,e.substr(0,e.lastIndexOf(":"))):null:t.callbacks}function xo(n,e,t){for(let[i,s]of n){s?typeof s=="function"&&(s=s(e.name)):s=e.name;const r=new je(e.source,s);r.path=[...e.path],i.fire(r,...t)}}function rf(n,e,t,i,s){e._addEventListener?e._addEventListener(t,i,s):n._addEventListener.call(e,t,i,s)}function Qn(n,e,t,i){e._removeEventListener?e._removeEventListener(t,i):n._removeEventListener.call(e,t,i)}var of=typeof global=="object"&&global&&global.Object===Object&&global;const Io=of;var af=typeof self=="object"&&self&&self.Object===Object&&self,lf=Io||af||Function("return this")();const xe=lf;var cf=xe.Symbol;const Be=cf;var Ro=Object.prototype,uf=Ro.hasOwnProperty,hf=Ro.toString,bi=Be?Be.toStringTag:void 0;function df(n){var e=uf.call(n,bi),t=n[bi];try{n[bi]=void 0;var i=!0}catch{}var s=hf.call(n);return i&&(e?n[bi]=t:delete n[bi]),s}var ff=Object.prototype,mf=ff.toString;function gf(n){return mf.call(n)}var pf="[object Null]",wf="[object Undefined]",Oo=Be?Be.toStringTag:void 0;function at(n){return n==null?n===void 0?wf:pf:Oo&&Oo in Object(n)?df(n):gf(n)}function Ce(n){return n!=null&&typeof n=="object"}var bf="[object Symbol]";function Gi(n){return typeof n=="symbol"||Ce(n)&&at(n)==bf}function Mo(n,e){for(var t=-1,i=n==null?0:n.length,s=Array(i);++t<i;)s[t]=e(n[t],t,n);return s}var _f=Array.isArray;const he=_f;var vf=1/0,Vo=Be?Be.prototype:void 0,Do=Vo?Vo.toString:void 0;function Bo(n){if(typeof n=="string")return n;if(he(n))return Mo(n,Bo)+"";if(Gi(n))return Do?Do.call(n):"";var e=n+"";return e=="0"&&1/n==-vf?"-0":e}var yf=/\s/;function kf(n){for(var e=n.length;e--&&yf.test(n.charAt(e)););return e}var Cf=/^\s+/;function Ef(n){return n&&n.slice(0,kf(n)+1).replace(Cf,"")}function K(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Fo=0/0,Af=/^[-+]0x[0-9a-f]+$/i,Tf=/^0b[01]+$/i,Pf=/^0o[0-7]+$/i,Sf=parseInt;function No(n){if(typeof n=="number")return n;if(Gi(n))return Fo;if(K(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=K(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Ef(n);var t=Tf.test(n);return t||Pf.test(n)?Sf(n.slice(2),t?2:8):Af.test(n)?Fo:+n}function bt(n){return n}var xf="[object AsyncFunction]",If="[object Function]",Rf="[object GeneratorFunction]",Of="[object Proxy]";function _t(n){if(!K(n))return!1;var e=at(n);return e==If||e==Rf||e==xf||e==Of}var Mf=xe["__core-js_shared__"];const es=Mf;var Lo=function(){var n=/[^.]+$/.exec(es&&es.keys&&es.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Vf(n){return!!Lo&&Lo in n}var Df=Function.prototype,Bf=Df.toString;function vt(n){if(n!=null){try{return Bf.call(n)}catch{}try{return n+""}catch{}}return""}var Ff=/[\\^$.*+?()[\]{}|]/g,Nf=/^\[object .+?Constructor\]$/,Lf=Function.prototype,$f=Object.prototype,zf=Lf.toString,Hf=$f.hasOwnProperty,Wf=RegExp("^"+zf.call(Hf).replace(Ff,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Uf(n){if(!K(n)||Vf(n))return!1;var e=_t(n)?Wf:Nf;return e.test(vt(n))}function jf(n,e){return n==null?void 0:n[e]}function yt(n,e){var t=jf(n,e);return Uf(t)?t:void 0}var qf=yt(xe,"WeakMap");const ts=qf;var $o=Object.create,Gf=function(){function n(){}return function(e){if(!K(e))return{};if($o)return $o(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();const Kf=Gf;function Jf(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function is(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var Zf=800,Yf=16,Xf=Date.now;function Qf(n){var e=0,t=0;return function(){var i=Xf(),s=Yf-(i-t);if(t=i,s>0){if(++e>=Zf)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function em(n){return function(){return n}}var tm=function(){try{var n=yt(Object,"defineProperty");return n({},"",{}),n}catch{}}();const Ki=tm;var im=Ki?function(n,e){return Ki(n,"toString",{configurable:!0,enumerable:!1,value:em(e),writable:!0})}:bt,nm=Qf(im);const sm=nm;function rm(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}function om(n,e,t,i){for(var s=n.length,r=t+(i?1:-1);i?r--:++r<s;)if(e(n[r],r,n))return r;return-1}function am(n){return n!==n}function lm(n,e,t){for(var i=t-1,s=n.length;++i<s;)if(n[i]===e)return i;return-1}function cm(n,e,t){return e===e?lm(n,e,t):om(n,am,t)}var um=9007199254740991,hm=/^(?:0|[1-9]\d*)$/;function ns(n,e){var t=typeof n;return e=e??um,!!e&&(t=="number"||t!="symbol"&&hm.test(n))&&n>-1&&n%1==0&&n<e}function ss(n,e,t){e=="__proto__"&&Ki?Ki(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function _i(n,e){return n===e||n!==n&&e!==e}var dm=Object.prototype,fm=dm.hasOwnProperty;function rs(n,e,t){var i=n[e];(!(fm.call(n,e)&&_i(i,t))||t===void 0&&!(e in n))&&ss(n,e,t)}function $t(n,e,t,i){var s=!t;t||(t={});for(var r=-1,o=e.length;++r<o;){var a=e[r],l=i?i(t[a],n[a],a,t,n):void 0;l===void 0&&(l=n[a]),s?ss(t,a,l):rs(t,a,l)}return t}var zo=Math.max;function mm(n,e,t){return e=zo(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,r=zo(i.length-e,0),o=Array(r);++s<r;)o[s]=i[e+s];s=-1;for(var a=Array(e+1);++s<e;)a[s]=i[s];return a[e]=t(o),Jf(n,this,a)}}function Ho(n,e){return sm(mm(n,e,bt),n+"")}var gm=9007199254740991;function Wo(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=gm}function Ji(n){return n!=null&&Wo(n.length)&&!_t(n)}function pm(n,e,t){if(!K(t))return!1;var i=typeof e;return(i=="number"?Ji(t)&&ns(e,t.length):i=="string"&&e in t)?_i(t[e],n):!1}function os(n){return Ho(function(e,t){var i=-1,s=t.length,r=s>1?t[s-1]:void 0,o=s>2?t[2]:void 0;for(r=n.length>3&&typeof r=="function"?(s--,r):void 0,o&&pm(t[0],t[1],o)&&(r=s<3?void 0:r,s=1),e=Object(e);++i<s;){var a=t[i];a&&n(e,a,i,r)}return e})}var wm=Object.prototype;function as(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||wm;return n===t}function bm(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var _m="[object Arguments]";function Uo(n){return Ce(n)&&at(n)==_m}var jo=Object.prototype,vm=jo.hasOwnProperty,ym=jo.propertyIsEnumerable,km=Uo(function(){return arguments}())?Uo:function(n){return Ce(n)&&vm.call(n,"callee")&&!ym.call(n,"callee")};const ls=km;function Cm(){return!1}var qo=typeof A=="object"&&A&&!A.nodeType&&A,Go=qo&&typeof module=="object"&&module&&!module.nodeType&&module,Em=Go&&Go.exports===qo,Ko=Em?xe.Buffer:void 0,Am=Ko?Ko.isBuffer:void 0,Tm=Am||Cm;const vi=Tm;var Pm="[object Arguments]",Sm="[object Array]",xm="[object Boolean]",Im="[object Date]",Rm="[object Error]",Om="[object Function]",Mm="[object Map]",Vm="[object Number]",Dm="[object Object]",Bm="[object RegExp]",Fm="[object Set]",Nm="[object String]",Lm="[object WeakMap]",$m="[object ArrayBuffer]",zm="[object DataView]",Hm="[object Float32Array]",Wm="[object Float64Array]",Um="[object Int8Array]",jm="[object Int16Array]",qm="[object Int32Array]",Gm="[object Uint8Array]",Km="[object Uint8ClampedArray]",Jm="[object Uint16Array]",Zm="[object Uint32Array]",U={};U[Hm]=U[Wm]=U[Um]=U[jm]=U[qm]=U[Gm]=U[Km]=U[Jm]=U[Zm]=!0,U[Pm]=U[Sm]=U[$m]=U[xm]=U[zm]=U[Im]=U[Rm]=U[Om]=U[Mm]=U[Vm]=U[Dm]=U[Bm]=U[Fm]=U[Nm]=U[Lm]=!1;function Ym(n){return Ce(n)&&Wo(n.length)&&!!U[at(n)]}function Zi(n){return function(e){return n(e)}}var Jo=typeof A=="object"&&A&&!A.nodeType&&A,yi=Jo&&typeof module=="object"&&module&&!module.nodeType&&module,Xm=yi&&yi.exports===Jo,cs=Xm&&Io.process,Qm=function(){try{var n=yi&&yi.require&&yi.require("util").types;return n||cs&&cs.binding&&cs.binding("util")}catch{}}();const zt=Qm;var Zo=zt&&zt.isTypedArray,eg=Zo?Zi(Zo):Ym;const us=eg;var tg=Object.prototype,ig=tg.hasOwnProperty;function Yo(n,e){var t=he(n),i=!t&&ls(n),s=!t&&!i&&vi(n),r=!t&&!i&&!s&&us(n),o=t||i||s||r,a=o?bm(n.length,String):[],l=a.length;for(var c in n)(e||ig.call(n,c))&&!(o&&(c=="length"||s&&(c=="offset"||c=="parent")||r&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ns(c,l)))&&a.push(c);return a}function Xo(n,e){return function(t){return n(e(t))}}var ng=Xo(Object.keys,Object);const sg=ng;var rg=Object.prototype,og=rg.hasOwnProperty;function ag(n){if(!as(n))return sg(n);var e=[];for(var t in Object(n))og.call(n,t)&&t!="constructor"&&e.push(t);return e}function hs(n){return Ji(n)?Yo(n):ag(n)}function lg(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var cg=Object.prototype,ug=cg.hasOwnProperty;function hg(n){if(!K(n))return lg(n);var e=as(n),t=[];for(var i in n)i=="constructor"&&(e||!ug.call(n,i))||t.push(i);return t}function Ht(n){return Ji(n)?Yo(n,!0):hg(n)}var dg=os(function(n,e){$t(e,Ht(e),n)});const Qo=dg;var fg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mg=/^\w*$/;function gg(n,e){if(he(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||Gi(n)?!0:mg.test(n)||!fg.test(n)||e!=null&&n in Object(e)}var pg=yt(Object,"create");const ki=pg;function wg(){this.__data__=ki?ki(null):{},this.size=0}function bg(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var _g="__lodash_hash_undefined__",vg=Object.prototype,yg=vg.hasOwnProperty;function kg(n){var e=this.__data__;if(ki){var t=e[n];return t===_g?void 0:t}return yg.call(e,n)?e[n]:void 0}var Cg=Object.prototype,Eg=Cg.hasOwnProperty;function Ag(n){var e=this.__data__;return ki?e[n]!==void 0:Eg.call(e,n)}var Tg="__lodash_hash_undefined__";function Pg(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=ki&&e===void 0?Tg:e,this}function kt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}kt.prototype.clear=wg,kt.prototype.delete=bg,kt.prototype.get=kg,kt.prototype.has=Ag,kt.prototype.set=Pg;function Sg(){this.__data__=[],this.size=0}function Yi(n,e){for(var t=n.length;t--;)if(_i(n[t][0],e))return t;return-1}var xg=Array.prototype,Ig=xg.splice;function Rg(n){var e=this.__data__,t=Yi(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():Ig.call(e,t,1),--this.size,!0}function Og(n){var e=this.__data__,t=Yi(e,n);return t<0?void 0:e[t][1]}function Mg(n){return Yi(this.__data__,n)>-1}function Vg(n,e){var t=this.__data__,i=Yi(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function Ke(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Ke.prototype.clear=Sg,Ke.prototype.delete=Rg,Ke.prototype.get=Og,Ke.prototype.has=Mg,Ke.prototype.set=Vg;var Dg=yt(xe,"Map");const Ci=Dg;function Bg(){this.size=0,this.__data__={hash:new kt,map:new(Ci||Ke),string:new kt}}function Fg(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function Xi(n,e){var t=n.__data__;return Fg(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ng(n){var e=Xi(this,n).delete(n);return this.size-=e?1:0,e}function Lg(n){return Xi(this,n).get(n)}function $g(n){return Xi(this,n).has(n)}function zg(n,e){var t=Xi(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function Je(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Je.prototype.clear=Bg,Je.prototype.delete=Ng,Je.prototype.get=Lg,Je.prototype.has=$g,Je.prototype.set=zg;var Hg="Expected a function";function ds(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(Hg);var t=function(){var i=arguments,s=e?e.apply(this,i):i[0],r=t.cache;if(r.has(s))return r.get(s);var o=n.apply(this,i);return t.cache=r.set(s,o)||r,o};return t.cache=new(ds.Cache||Je),t}ds.Cache=Je;var Wg=500;function Ug(n){var e=ds(n,function(i){return t.size===Wg&&t.clear(),i}),t=e.cache;return e}var jg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qg=/\\(\\)?/g,Gg=Ug(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(jg,function(t,i,s,r){e.push(s?r.replace(qg,"$1"):i||t)}),e});const Kg=Gg;function Qi(n){return n==null?"":Bo(n)}function fs(n,e){return he(n)?n:gg(n,e)?[n]:Kg(Qi(n))}var Jg=1/0;function ms(n){if(typeof n=="string"||Gi(n))return n;var e=n+"";return e=="0"&&1/n==-Jg?"-0":e}function ea(n,e){e=fs(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[ms(e[t++])];return t&&t==i?n:void 0}function en(n,e,t){var i=n==null?void 0:ea(n,e);return i===void 0?t:i}function ta(n,e){for(var t=-1,i=e.length,s=n.length;++t<i;)n[s+t]=e[t];return n}var Zg=Xo(Object.getPrototypeOf,Object);const gs=Zg;var Yg="[object Object]",Xg=Function.prototype,Qg=Object.prototype,ia=Xg.toString,ep=Qg.hasOwnProperty,tp=ia.call(Object);function fe(n){if(!Ce(n)||at(n)!=Yg)return!1;var e=gs(n);if(e===null)return!0;var t=ep.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&ia.call(t)==tp}function na(n,e,t){var i=-1,s=n.length;e<0&&(e=-e>s?0:s+e),t=t>s?s:t,t<0&&(t+=s),s=e>t?0:t-e>>>0,e>>>=0;for(var r=Array(s);++i<s;)r[i]=n[i+e];return r}function ip(n,e,t){var i=n.length;return t=t===void 0?i:t,!e&&t>=i?n:na(n,e,t)}var np="\\ud800-\\udfff",sp="\\u0300-\\u036f",rp="\\ufe20-\\ufe2f",op="\\u20d0-\\u20ff",ap=sp+rp+op,lp="\\ufe0e\\ufe0f",cp="\\u200d",up=RegExp("["+cp+np+ap+lp+"]");function sa(n){return up.test(n)}function hp(n){return n.split("")}var ra="\\ud800-\\udfff",dp="\\u0300-\\u036f",fp="\\ufe20-\\ufe2f",mp="\\u20d0-\\u20ff",gp=dp+fp+mp,pp="\\ufe0e\\ufe0f",wp="["+ra+"]",ps="["+gp+"]",ws="\\ud83c[\\udffb-\\udfff]",bp="(?:"+ps+"|"+ws+")",oa="[^"+ra+"]",aa="(?:\\ud83c[\\udde6-\\uddff]){2}",la="[\\ud800-\\udbff][\\udc00-\\udfff]",_p="\\u200d",ca=bp+"?",ua="["+pp+"]?",vp="(?:"+_p+"(?:"+[oa,aa,la].join("|")+")"+ua+ca+")*",yp=ua+ca+vp,kp="(?:"+[oa+ps+"?",ps,aa,la,wp].join("|")+")",Cp=RegExp(ws+"(?="+ws+")|"+kp+yp,"g");function Ep(n){return n.match(Cp)||[]}function Ap(n){return sa(n)?Ep(n):hp(n)}function Tp(n){return function(e){e=Qi(e);var t=sa(e)?Ap(e):void 0,i=t?t[0]:e.charAt(0),s=t?ip(t,1).join(""):e.slice(1);return i[n]()+s}}var Pp=Tp("toUpperCase");const ha=Pp;function Sp(n,e,t,i){var s=-1,r=n==null?0:n.length;for(i&&r&&(t=n[++s]);++s<r;)t=e(t,n[s],s,n);return t}function xp(n){return function(e){return n==null?void 0:n[e]}}var Ip={À:"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",Œ:"Oe",œ:"oe",ŉ:"'n",ſ:"s"},Rp=xp(Ip);const Op=Rp;var Mp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vp="\\u0300-\\u036f",Dp="\\ufe20-\\ufe2f",Bp="\\u20d0-\\u20ff",Fp=Vp+Dp+Bp,Np="["+Fp+"]",Lp=RegExp(Np,"g");function $p(n){return n=Qi(n),n&&n.replace(Mp,Op).replace(Lp,"")}var zp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Hp(n){return n.match(zp)||[]}var Wp=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Up(n){return Wp.test(n)}var da="\\ud800-\\udfff",jp="\\u0300-\\u036f",qp="\\ufe20-\\ufe2f",Gp="\\u20d0-\\u20ff",Kp=jp+qp+Gp,fa="\\u2700-\\u27bf",ma="a-z\\xdf-\\xf6\\xf8-\\xff",Jp="\\xac\\xb1\\xd7\\xf7",Zp="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Yp="\\u2000-\\u206f",Xp=" \\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",ga="A-Z\\xc0-\\xd6\\xd8-\\xde",Qp="\\ufe0e\\ufe0f",pa=Jp+Zp+Yp+Xp,wa="['’]",ba="["+pa+"]",ew="["+Kp+"]",_a="\\d+",tw="["+fa+"]",va="["+ma+"]",ya="[^"+da+pa+_a+fa+ma+ga+"]",iw="\\ud83c[\\udffb-\\udfff]",nw="(?:"+ew+"|"+iw+")",sw="[^"+da+"]",ka="(?:\\ud83c[\\udde6-\\uddff]){2}",Ca="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+ga+"]",rw="\\u200d",Ea="(?:"+va+"|"+ya+")",ow="(?:"+Wt+"|"+ya+")",Aa="(?:"+wa+"(?:d|ll|m|re|s|t|ve))?",Ta="(?:"+wa+"(?:D|LL|M|RE|S|T|VE))?",Pa=nw+"?",Sa="["+Qp+"]?",aw="(?:"+rw+"(?:"+[sw,ka,Ca].join("|")+")"+Sa+Pa+")*",lw="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",cw="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",uw=Sa+Pa+aw,hw="(?:"+[tw,ka,Ca].join("|")+")"+uw,dw=RegExp([Wt+"?"+va+"+"+Aa+"(?="+[ba,Wt,"$"].join("|")+")",ow+"+"+Ta+"(?="+[ba,Wt+Ea,"$"].join("|")+")",Wt+"?"+Ea+"+"+Aa,Wt+"+"+Ta,cw,lw,_a,hw].join("|"),"g");function fw(n){return n.match(dw)||[]}function mw(n,e,t){return n=Qi(n),e=t?void 0:e,e===void 0?Up(n)?fw(n):Hp(n):n.match(e)||[]}var gw="['’]",pw=RegExp(gw,"g");function ww(n){return function(e){return Sp(mw($p(e).replace(pw,"")),n,"")}}function bw(){this.__data__=new Ke,this.size=0}function _w(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function vw(n){return this.__data__.get(n)}function yw(n){return this.__data__.has(n)}var kw=200;function Cw(n,e){var t=this.__data__;if(t instanceof Ke){var i=t.__data__;if(!Ci||i.length<kw-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new Je(i)}return t.set(n,e),this.size=t.size,this}function Fe(n){var e=this.__data__=new Ke(n);this.size=e.size}Fe.prototype.clear=bw,Fe.prototype.delete=_w,Fe.prototype.get=vw,Fe.prototype.has=yw,Fe.prototype.set=Cw;function Ew(n,e){return n&&$t(e,hs(e),n)}function Aw(n,e){return n&&$t(e,Ht(e),n)}var xa=typeof A=="object"&&A&&!A.nodeType&&A,Ia=xa&&typeof module=="object"&&module&&!module.nodeType&&module,Tw=Ia&&Ia.exports===xa,Ra=Tw?xe.Buffer:void 0,Oa=Ra?Ra.allocUnsafe:void 0;function Ma(n,e){if(e)return n.slice();var t=n.length,i=Oa?Oa(t):new n.constructor(t);return n.copy(i),i}function Pw(n,e){for(var t=-1,i=n==null?0:n.length,s=0,r=[];++t<i;){var o=n[t];e(o,t,n)&&(r[s++]=o)}return r}function Va(){return[]}var Sw=Object.prototype,xw=Sw.propertyIsEnumerable,Da=Object.getOwnPropertySymbols,Iw=Da?function(n){return n==null?[]:(n=Object(n),Pw(Da(n),function(e){return xw.call(n,e)}))}:Va;const bs=Iw;function Rw(n,e){return $t(n,bs(n),e)}var Ow=Object.getOwnPropertySymbols,Mw=Ow?function(n){for(var e=[];n;)ta(e,bs(n)),n=gs(n);return e}:Va;const Ba=Mw;function Vw(n,e){return $t(n,Ba(n),e)}function Fa(n,e,t){var i=e(n);return he(n)?i:ta(i,t(n))}function _s(n){return Fa(n,hs,bs)}function Dw(n){return Fa(n,Ht,Ba)}var Bw=yt(xe,"DataView");const vs=Bw;var Fw=yt(xe,"Promise");const ys=Fw;var Nw=yt(xe,"Set");const ks=Nw;var Na="[object Map]",Lw="[object Object]",La="[object Promise]",$a="[object Set]",za="[object WeakMap]",Ha="[object DataView]",$w=vt(vs),zw=vt(Ci),Hw=vt(ys),Ww=vt(ks),Uw=vt(ts),Ct=at;(vs&&Ct(new vs(new ArrayBuffer(1)))!=Ha||Ci&&Ct(new Ci)!=Na||ys&&Ct(ys.resolve())!=La||ks&&Ct(new ks)!=$a||ts&&Ct(new ts)!=za)&&(Ct=function(n){var e=at(n),t=e==Lw?n.constructor:void 0,i=t?vt(t):"";if(i)switch(i){case $w:return Ha;case zw:return Na;case Hw:return La;case Ww:return $a;case Uw:return za}return e});const Ei=Ct;var jw=Object.prototype,qw=jw.hasOwnProperty;function Gw(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&qw.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var Kw=xe.Uint8Array;const tn=Kw;function Cs(n){var e=new n.constructor(n.byteLength);return new tn(e).set(new tn(n)),e}function Jw(n,e){var t=e?Cs(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var Zw=/\w*$/;function Yw(n){var e=new n.constructor(n.source,Zw.exec(n));return e.lastIndex=n.lastIndex,e}var Wa=Be?Be.prototype:void 0,Ua=Wa?Wa.valueOf:void 0;function Xw(n){return Ua?Object(Ua.call(n)):{}}function ja(n,e){var t=e?Cs(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var Qw="[object Boolean]",eb="[object Date]",tb="[object Map]",ib="[object Number]",nb="[object RegExp]",sb="[object Set]",rb="[object String]",ob="[object Symbol]",ab="[object ArrayBuffer]",lb="[object DataView]",cb="[object Float32Array]",ub="[object Float64Array]",hb="[object Int8Array]",db="[object Int16Array]",fb="[object Int32Array]",mb="[object Uint8Array]",gb="[object Uint8ClampedArray]",pb="[object Uint16Array]",wb="[object Uint32Array]";function bb(n,e,t){var i=n.constructor;switch(e){case ab:return Cs(n);case Qw:case eb:return new i(+n);case lb:return Jw(n,t);case cb:case ub:case hb:case db:case fb:case mb:case gb:case pb:case wb:return ja(n,t);case tb:return new i;case ib:case rb:return new i(n);case nb:return Yw(n);case sb:return new i;case ob:return Xw(n)}}function qa(n){return typeof n.constructor=="function"&&!as(n)?Kf(gs(n)):{}}var _b="[object Map]";function vb(n){return Ce(n)&&Ei(n)==_b}var Ga=zt&&zt.isMap,yb=Ga?Zi(Ga):vb;const kb=yb;var Cb="[object Set]";function Eb(n){return Ce(n)&&Ei(n)==Cb}var Ka=zt&&zt.isSet,Ab=Ka?Zi(Ka):Eb;const Tb=Ab;var Pb=1,Sb=2,xb=4,Ja="[object Arguments]",Ib="[object Array]",Rb="[object Boolean]",Ob="[object Date]",Mb="[object Error]",Za="[object Function]",Vb="[object GeneratorFunction]",Db="[object Map]",Bb="[object Number]",Ya="[object Object]",Fb="[object RegExp]",Nb="[object Set]",Lb="[object String]",$b="[object Symbol]",zb="[object WeakMap]",Hb="[object ArrayBuffer]",Wb="[object DataView]",Ub="[object Float32Array]",jb="[object Float64Array]",qb="[object Int8Array]",Gb="[object Int16Array]",Kb="[object Int32Array]",Jb="[object Uint8Array]",Zb="[object Uint8ClampedArray]",Yb="[object Uint16Array]",Xb="[object Uint32Array]",z={};z[Ja]=z[Ib]=z[Hb]=z[Wb]=z[Rb]=z[Ob]=z[Ub]=z[jb]=z[qb]=z[Gb]=z[Kb]=z[Db]=z[Bb]=z[Ya]=z[Fb]=z[Nb]=z[Lb]=z[$b]=z[Jb]=z[Zb]=z[Yb]=z[Xb]=!0,z[Mb]=z[Za]=z[zb]=!1;function Ut(n,e,t,i,s,r){var o,a=e&Pb,l=e&Sb,c=e&xb;if(t&&(o=s?t(n,i,s,r):t(n)),o!==void 0)return o;if(!K(n))return n;var u=he(n);if(u){if(o=Gw(n),!a)return is(n,o)}else{var h=Ei(n),f=h==Za||h==Vb;if(vi(n))return Ma(n,a);if(h==Ya||h==Ja||f&&!s){if(o=l||f?{}:qa(n),!a)return l?Vw(n,Aw(o,n)):Rw(n,Ew(o,n))}else{if(!z[h])return s?n:{};o=bb(n,h,a)}}r||(r=new Fe);var m=r.get(n);if(m)return m;r.set(n,o),Tb(n)?n.forEach(function(E){o.add(Ut(E,e,t,E,n,r))}):kb(n)&&n.forEach(function(E,T){o.set(T,Ut(E,e,t,T,n,r))});var p=c?l?Dw:_s:l?Ht:hs,b=u?void 0:p(n);return rm(b||n,function(E,T){b&&(T=E,E=n[T]),rs(o,T,Ut(E,e,t,T,n,r))}),o}var Qb=4;function Xa(n){return Ut(n,Qb)}var e0=1,t0=4;function Ze(n){return Ut(n,e0|t0)}var i0=1,n0=4;function Es(n,e){return e=typeof e=="function"?e:void 0,Ut(n,i0|n0,e)}var s0="__lodash_hash_undefined__";function r0(n){return this.__data__.set(n,s0),this}function o0(n){return this.__data__.has(n)}function nn(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new Je;++e<t;)this.add(n[e])}nn.prototype.add=nn.prototype.push=r0,nn.prototype.has=o0;function a0(n,e){for(var t=-1,i=n==null?0:n.length;++t<i;)if(e(n[t],t,n))return!0;return!1}function l0(n,e){return n.has(e)}var c0=1,u0=2;function Qa(n,e,t,i,s,r){var o=t&c0,a=n.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=r.get(n),u=r.get(e);if(c&&u)return c==e&&u==n;var h=-1,f=!0,m=t&u0?new nn:void 0;for(r.set(n,e),r.set(e,n);++h<a;){var p=n[h],b=e[h];if(i)var E=o?i(b,p,h,e,n,r):i(p,b,h,n,e,r);if(E!==void 0){if(E)continue;f=!1;break}if(m){if(!a0(e,function(T,de){if(!l0(m,de)&&(p===T||s(p,T,t,i,r)))return m.push(de)})){f=!1;break}}else if(!(p===b||s(p,b,t,i,r))){f=!1;break}}return r.delete(n),r.delete(e),f}function h0(n){var e=-1,t=Array(n.size);return n.forEach(function(i,s){t[++e]=[s,i]}),t}function d0(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var f0=1,m0=2,g0="[object Boolean]",p0="[object Date]",w0="[object Error]",b0="[object Map]",_0="[object Number]",v0="[object RegExp]",y0="[object Set]",k0="[object String]",C0="[object Symbol]",E0="[object ArrayBuffer]",A0="[object DataView]",el=Be?Be.prototype:void 0,As=el?el.valueOf:void 0;function T0(n,e,t,i,s,r,o){switch(t){case A0:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case E0:return!(n.byteLength!=e.byteLength||!r(new tn(n),new tn(e)));case g0:case p0:case _0:return _i(+n,+e);case w0:return n.name==e.name&&n.message==e.message;case v0:case k0:return n==e+"";case b0:var a=h0;case y0:var l=i&f0;if(a||(a=d0),n.size!=e.size&&!l)return!1;var c=o.get(n);if(c)return c==e;i|=m0,o.set(n,e);var u=Qa(a(n),a(e),i,s,r,o);return o.delete(n),u;case C0:if(As)return As.call(n)==As.call(e)}return!1}var P0=1,S0=Object.prototype,x0=S0.hasOwnProperty;function I0(n,e,t,i,s,r){var o=t&P0,a=_s(n),l=a.length,c=_s(e),u=c.length;if(l!=u&&!o)return!1;for(var h=l;h--;){var f=a[h];if(!(o?f in e:x0.call(e,f)))return!1}var m=r.get(n),p=r.get(e);if(m&&p)return m==e&&p==n;var b=!0;r.set(n,e),r.set(e,n);for(var E=o;++h<l;){f=a[h];var T=n[f],de=e[f];if(i)var Se=o?i(de,T,f,e,n,r):i(T,de,f,n,e,r);if(!(Se===void 0?T===de||s(T,de,t,i,r):Se)){b=!1;break}E||(E=f=="constructor")}if(b&&!E){var ke=n.constructor,Ue=e.constructor;ke!=Ue&&"constructor"in n&&"constructor"in e&&!(typeof ke=="function"&&ke instanceof ke&&typeof Ue=="function"&&Ue instanceof Ue)&&(b=!1)}return r.delete(n),r.delete(e),b}var R0=1,tl="[object Arguments]",il="[object Array]",sn="[object Object]",O0=Object.prototype,nl=O0.hasOwnProperty;function M0(n,e,t,i,s,r){var o=he(n),a=he(e),l=o?il:Ei(n),c=a?il:Ei(e);l=l==tl?sn:l,c=c==tl?sn:c;var u=l==sn,h=c==sn,f=l==c;if(f&&vi(n)){if(!vi(e))return!1;o=!0,u=!1}if(f&&!u)return r||(r=new Fe),o||us(n)?Qa(n,e,t,i,s,r):T0(n,e,l,t,i,s,r);if(!(t&R0)){var m=u&&nl.call(n,"__wrapped__"),p=h&&nl.call(e,"__wrapped__");if(m||p){var b=m?n.value():n,E=p?e.value():e;return r||(r=new Fe),s(b,E,t,i,r)}}return f?(r||(r=new Fe),I0(n,e,t,i,s,r)):!1}function Ts(n,e,t,i,s){return n===e?!0:n==null||e==null||!Ce(n)&&!Ce(e)?n!==n&&e!==e:M0(n,e,t,i,Ts,s)}function V0(n){return function(e,t,i){for(var s=-1,r=Object(e),o=i(e),a=o.length;a--;){var l=o[n?a:++s];if(t(r[l],l,r)===!1)break}return e}}var D0=V0();const B0=D0;var F0=function(){return xe.Date.now()};const Ps=F0;var N0="Expected a function",L0=Math.max,$0=Math.min;function jt(n,e,t){var i,s,r,o,a,l,c=0,u=!1,h=!1,f=!0;if(typeof n!="function")throw new TypeError(N0);e=No(e)||0,K(t)&&(u=!!t.leading,h="maxWait"in t,r=h?L0(No(t.maxWait)||0,e):r,f="trailing"in t?!!t.trailing:f);function m(k){var I=i,C=s;return i=s=void 0,c=k,o=n.apply(C,I),o}function p(k){return c=k,a=setTimeout(T,e),u?m(k):o}function b(k){var I=k-l,C=k-c,Z=e-I;return h?$0(Z,r-C):Z}function E(k){var I=k-l,C=k-c;return l===void 0||I>=e||I<0||h&&C>=r}function T(){var k=Ps();if(E(k))return de(k);a=setTimeout(T,b(k))}function de(k){return a=void 0,f&&i?m(k):(i=s=void 0,o)}function Se(){a!==void 0&&clearTimeout(a),c=0,i=l=s=a=void 0}function ke(){return a===void 0?o:de(Ps())}function Ue(){var k=Ps(),I=E(k);if(i=arguments,s=this,l=k,I){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(T,e),m(l)}return a===void 0&&(a=setTimeout(T,e)),o}return Ue.cancel=Se,Ue.flush=ke,Ue}function Ss(n,e,t){(t!==void 0&&!_i(n[e],t)||t===void 0&&!(e in n))&&ss(n,e,t)}function z0(n){return Ce(n)&&Ji(n)}function xs(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function H0(n){return $t(n,Ht(n))}function W0(n,e,t,i,s,r,o){var a=xs(n,t),l=xs(e,t),c=o.get(l);if(c){Ss(n,t,c);return}var u=r?r(a,l,t+"",n,e,o):void 0,h=u===void 0;if(h){var f=he(l),m=!f&&vi(l),p=!f&&!m&&us(l);u=l,f||m||p?he(a)?u=a:z0(a)?u=is(a):m?(h=!1,u=Ma(l,!0)):p?(h=!1,u=ja(l,!0)):u=[]:fe(l)||ls(l)?(u=a,ls(a)?u=H0(a):(!K(a)||_t(a))&&(u=qa(l))):h=!1}h&&(o.set(l,u),s(u,l,i,r,o),o.delete(l)),Ss(n,t,u)}function Is(n,e,t,i,s){n!==e&&B0(e,function(r,o){if(s||(s=new Fe),K(r))W0(n,e,o,t,Is,i,s);else{var a=i?i(xs(n,o),r,o+"",n,e,s):void 0;a===void 0&&(a=r),Ss(n,o,a)}},Ht)}var U0=os(function(n,e,t,i){Is(n,e,t,i)});const j0=U0;function q0(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var G0="[object String]";function sl(n){return typeof n=="string"||!he(n)&&Ce(n)&&at(n)==G0}function K0(n,e){return e.length<2?n:ea(n,na(e,0,-1))}function qt(n){return Ce(n)&&n.nodeType===1&&!fe(n)}function rn(n,e){return Ts(n,e)}function J0(n,e,t){t=typeof t=="function"?t:void 0;var i=t?t(n,e):void 0;return i===void 0?Ts(n,e,void 0,t):!!i}var Z0=os(function(n,e,t){Is(n,e,t)});const rl=Z0;function Y0(n,e){return e=fs(e,n),n=K0(n,e),n==null||delete n[ms(q0(e))]}function X0(n,e,t,i){if(!K(n))return n;e=fs(e,n);for(var s=-1,r=e.length,o=r-1,a=n;a!=null&&++s<r;){var l=ms(e[s]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(s!=o){var u=a[l];c=i?i(u,l,a):void 0,c===void 0&&(c=K(u)?u:ns(e[s+1])?[]:{})}rs(a,l,c),a=a[l]}return n}function Q0(n,e,t,i){for(var s=t-1,r=n.length;++s<r;)if(i(n[s],e))return s;return-1}var e_=Array.prototype,ol=e_.splice;function t_(n,e,t,i){var s=i?Q0:cm,r=-1,o=e.length,a=n;for(n===e&&(e=is(e)),t&&(a=Mo(n,Zi(t)));++r<o;)for(var l=0,c=e[r],u=t?t(c):c;(l=s(a,u,l,i))>-1;)a!==n&&ol.call(a,l,1),ol.call(n,l,1);return n}function i_(n,e){return n&&n.length&&e&&e.length?t_(n,e):n}var n_=Ho(i_);const s_=n_;function r_(n,e,t){return n==null?n:X0(n,e,t)}var o_=ww(function(n,e,t){return n+(t?" ":"")+ha(e)});const a_=o_;var l_="Expected a function";function on(n,e,t){var i=!0,s=!0;if(typeof n!="function")throw new TypeError(l_);return K(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),jt(n,e,{leading:i,maxWait:e,trailing:s})}function c_(n,e){return n==null?!0:Y0(n,e)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const an=Symbol("observableProperties"),ln=Symbol("boundObservables"),cn=Symbol("boundProperties"),Gt=Symbol("decoratedMethods"),al=Symbol("decoratedOriginal"),ll=H(L());function H(n){if(!n)return ll;class e extends n{set(i,s){if(K(i)){Object.keys(i).forEach(o=>{this.set(o,i[o])},this);return}Rs(this);const r=this[an];if(i in this&&!r.has(i))throw new d("observable-set-cannot-override",this);Object.defineProperty(this,i,{enumerable:!0,configurable:!0,get(){return r.get(i)},set(o){const a=r.get(i);let l=this.fire(`set:${i}`,i,o,a);l===void 0&&(l=o),(a!==l||!r.has(i))&&(r.set(i,l),this.fire(`change:${i}`,i,l,a))}}),this[i]=s}bind(...i){if(!i.length||!cl(i))throw new d("observable-bind-wrong-properties",this);if(new Set(i).size!==i.length)throw new d("observable-bind-duplicate-properties",this);Rs(this);const s=this[cn];i.forEach(o=>{if(s.has(o))throw new d("observable-bind-rebind",this)});const r=new Map;return i.forEach(o=>{const a={property:o,to:[]};s.set(o,a),r.set(o,a)}),{to:u_,toMany:h_,_observable:this,_bindProperties:i,_to:[],_bindings:r}}unbind(...i){if(!this[an])return;const s=this[cn],r=this[ln];if(i.length){if(!cl(i))throw new d("observable-unbind-wrong-properties",this);i.forEach(o=>{const a=s.get(o);a&&(a.to.forEach(([l,c])=>{const u=r.get(l),h=u[c];h.delete(a),h.size||delete u[c],Object.keys(u).length||(r.delete(l),this.stopListening(l,"change"))}),s.delete(o))})}else r.forEach((o,a)=>{this.stopListening(a,"change")}),r.clear(),s.clear()}decorate(i){Rs(this);const s=this[i];if(!s)throw new d("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:i});this.on(i,(r,o)=>{r.return=s.apply(this,o)}),this[i]=function(...r){return this.fire(i,r)},this[i][al]=s,this[Gt]||(this[Gt]=[]),this[Gt].push(i)}stopListening(i,s,r){if(!i&&this[Gt]){for(const o of this[Gt])this[o]=this[o][al];delete this[Gt]}super.stopListening(i,s,r)}}return e}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{H[n]=ll.prototype[n]});function Rs(n){n[an]||(Object.defineProperty(n,an,{value:new Map}),Object.defineProperty(n,ln,{value:new Map}),Object.defineProperty(n,cn,{value:new Map}))}function u_(...n){const e=f_(...n),t=Array.from(this._bindings.keys()),i=t.length;if(!e.callback&&e.to.length>1)throw new d("observable-bind-to-no-callback",this);if(i>1&&e.callback)throw new d("observable-bind-to-extra-callback",this);e.to.forEach(s=>{if(s.properties.length&&s.properties.length!==i)throw new d("observable-bind-to-properties-length",this);s.properties.length||(s.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(t[0]).callback=e.callback),p_(this._observable,this._to),g_(this),this._bindProperties.forEach(s=>{ul(this._observable,s)})}function h_(n,e,t){if(this._bindings.size>1)throw new d("observable-bind-to-many-not-one-binding",this);this.to(...d_(n,e),t)}function d_(n,e){const t=n.map(i=>[i,e]);return Array.prototype.concat.apply([],t)}function cl(n){return n.every(e=>typeof e=="string")}function f_(...n){if(!n.length)throw new d("observable-bind-to-parse-error",null);const e={to:[]};let t;return typeof n[n.length-1]=="function"&&(e.callback=n.pop()),n.forEach(i=>{if(typeof i=="string")t.properties.push(i);else if(typeof i=="object")t={observable:i,properties:[]},e.to.push(t);else throw new d("observable-bind-to-parse-error",null)}),e}function m_(n,e,t,i){const s=n[ln],r=s.get(t),o=r||{};o[i]||(o[i]=new Set),o[i].add(e),r||s.set(t,o)}function g_(n){let e;n._bindings.forEach((t,i)=>{n._to.forEach(s=>{e=s.properties[t.callback?0:n._bindProperties.indexOf(i)],t.to.push([s.observable,e]),m_(n._observable,t,s.observable,e)})})}function ul(n,e){const i=n[cn].get(e);let s;i.callback?s=i.callback.apply(n,i.to.map(r=>r[0][r[1]])):(s=i.to[0],s=s[0][s[1]]),Object.prototype.hasOwnProperty.call(n,e)?n[e]=s:n.set(e,s)}function p_(n,e){e.forEach(t=>{const i=n[ln];let s;i.get(t.observable)||n.listenTo(t.observable,"change",(r,o)=>{s=i.get(t.observable)[o],s&&s.forEach(a=>{ul(n,a.property)})})})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Os(n){let e=0;for(const t of n)e++;return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function ue(n,e){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)if(n[i]!=e[i])return i;return n.length==e.length?"same":n.length<e.length?"prefix":"extension"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function we(n){return!!(n&&n[Symbol.iterator])}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function w_(n,e,t={},i=[]){const s=t&&t.xmlns,r=s?n.createElementNS(s,e):n.createElement(e);for(const o in t)r.setAttribute(o,t[o]);(sl(i)||!we(i))&&(i=[i]);for(let o of i)sl(o)&&(o=n.createTextNode(o)),r.appendChild(o);return r}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class hl{constructor(e,t){this._config={},t&&this.define(dl(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,s=!1){if(fe(t)){this._setObjectToTarget(e,t,s);return}const r=t.split(".");t=r.pop();for(const o of r)fe(e[o])||(e[o]={}),e=e[o];if(fe(i)){fe(e[t])||(e[t]={}),e=e[t],this._setObjectToTarget(e,i,s);return}s&&typeof e[t]<"u"||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const s of i){if(!fe(e[s])){e=null;break}e=e[s]}return e?dl(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(s=>{this._setToTarget(e,s,t[s],i)})}}function dl(n){return Es(n,b_)}function b_(n){return qt(n)?n:void 0}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function lt(n){if(n){if(n.defaultView)return n instanceof n.defaultView.Document;if(n.ownerDocument&&n.ownerDocument.defaultView)return n instanceof n.ownerDocument.defaultView.Node}return!1}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function un(n){const e=Object.prototype.toString.apply(n);return e=="[object Window]"||e=="[object global]"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const fl=Ye(L());function Ye(n){if(!n)return fl;class e extends n{listenTo(i,s,r,o={}){if(lt(i)||un(i)){const a={capture:!!o.useCapture,passive:!!o.usePassive},l=this._getProxyEmitter(i,a)||new __(i,a);this.listenTo(l,s,r,o)}else super.listenTo(i,s,r,o)}stopListening(i,s,r){if(lt(i)||un(i)){const o=this._getAllProxyEmitters(i);for(const a of o)this.stopListening(a,s,r)}else super.stopListening(i,s,r)}_getProxyEmitter(i,s){return tf(this,ml(i,s))}_getAllProxyEmitters(i){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(s=>this._getProxyEmitter(i,s)).filter(s=>!!s)}}return e}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{Ye[n]=fl.prototype[n]});class __ extends L(){constructor(e,t){super(),To(this,ml(e,t)),this._domNode=e,this._options=t}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=i=>{this.fire(e,i)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function v_(n){return n["data-ck-expando"]||(n["data-ck-expando"]=qe())}function ml(n,e){let t=v_(n);for(const i of Object.keys(e).sort())e[i]&&(t+="-"+i);return t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Ms;try{Ms={window,document}}catch{/* istanbul ignore next -- @preserve */Ms={window:{},document:{}}}const R=Ms;/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function y_(n){let e=n.parentElement;if(!e)return null;for(;e.tagName!="BODY";){const t=e.style.overflowY||R.window.getComputedStyle(e).overflowY;if(t==="auto"||t==="scroll")break;if(e=e.parentElement,!e)return null}return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function gl(n){const e=[];let t=n;for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function k_(n){return n instanceof HTMLTextAreaElement?n.value:n.innerHTML}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Y(n){return Object.prototype.toString.call(n)=="[object Text]"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function hn(n){return Object.prototype.toString.apply(n)=="[object Range]"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function pl(n){const e=n.ownerDocument.defaultView.getComputedStyle(n);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const wl=["top","right","bottom","left","width","height"];class D{constructor(e){const t=hn(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),_l(e)||t)if(t){const i=D.getDomRangeRects(e);dn(this,D.getBoundingRect(i))}else dn(this,e.getBoundingClientRect());else if(un(e)){const{innerWidth:i,innerHeight:s}=e;dn(this,{top:0,right:i,bottom:s,left:0,width:i,height:s})}else dn(this,e)}clone(){return new D(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};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new D(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(bl(e))return t;let i=e,s=e.parentNode||e.commonAncestorContainer,r;for(;s&&!bl(s);){if(i instanceof HTMLElement&&vl(i)==="absolute"&&(r=i),r&&(vl(s)!=="relative"||C_(s)==="visible")){i=s,s=s.parentNode;continue}const o=new D(s),a=t.getIntersection(o);if(a)a.getArea()<t.getArea()&&(t=a);else return null;i=s,s=s.parentNode}return t}isEqual(e){for(const t of wl)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!!(t&&t.isEqual(e))}excludeScrollbarsAndBorders(){const e=this._source;let t,i,s;if(un(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,s=e.getComputedStyle(e.document.documentElement).direction;else{const r=pl(e);t=e.offsetWidth-e.clientWidth-r.left-r.right,i=e.offsetHeight-e.clientHeight-r.top-r.bottom,s=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=r.left,this.top+=r.top,this.right-=r.right,this.bottom-=r.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,s==="ltr"?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const s of i)t.push(new D(s));else{let s=e.startContainer;Y(s)&&(s=s.parentNode);const r=new D(s.getBoundingClientRect());r.right=r.left,r.width=0,t.push(r)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let i=0;for(const s of e)i++,t.left=Math.min(t.left,s.left),t.top=Math.min(t.top,s.top),t.right=Math.max(t.right,s.right),t.bottom=Math.max(t.bottom,s.bottom);return i==0?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new D(t))}}function dn(n,e){for(const t of wl)n[t]=e[t]}function bl(n){return _l(n)?n===n.ownerDocument.body:!1}function _l(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&typeof n.getBoundingClientRect=="function"}function vl(n){return n.ownerDocument.defaultView.getComputedStyle(n).position}function C_(n){return n.ownerDocument.defaultView.getComputedStyle(n).overflow}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class W{constructor(e,t){W._observerInstance||W._createObserver(),this._element=e,this._callback=t,W._addElementCallback(e,t),W._observerInstance.observe(e)}get element(){return this._element}destroy(){W._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){W._elementCallbacks||(W._elementCallbacks=new Map);let i=W._elementCallbacks.get(e);i||(i=new Set,W._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=W._getElementCallbacks(e);i&&(i.delete(t),i.size||(W._elementCallbacks.delete(e),W._observerInstance.unobserve(e))),W._elementCallbacks&&!W._elementCallbacks.size&&(W._observerInstance=null,W._elementCallbacks=null)}static _getElementCallbacks(e){return W._elementCallbacks?W._elementCallbacks.get(e):null}static _createObserver(){W._observerInstance=new R.window.ResizeObserver(e=>{for(const t of e){const i=W._getElementCallbacks(t.target);if(i)for(const s of i)s(t)}})}}W._observerInstance=null,W._elementCallbacks=null;/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function yl(n,e){n instanceof HTMLTextAreaElement&&(n.value=e),n.innerHTML=e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Vs(n){return e=>e+n}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function fn(n){let e=0;for(;n.previousSibling;)n=n.previousSibling,e++;return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function kl(n,e,t){n.insertBefore(t,n.childNodes[e]||null)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Kt(n){return n&&n.nodeType===Node.COMMENT_NODE}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Cl(n){try{R.document.createAttribute(n)}catch{return!1}return!0}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Et(n){return!!(n&&n.getClientRects&&n.getClientRects().length)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function E_(n){return!n||!n.parentNode||n.offsetParent===R.document.body?null:n.offsetParent}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function El({element:n,target:e,positions:t,limiter:i,fitInViewport:s,viewportOffsetConfig:r}){_t(e)&&(e=e()),_t(i)&&(i=i());const o=E_(n),a=new D(n),l=new D(e);let c;const u=s&&A_(r)||null,h={targetRect:l,elementRect:a,positionedElementAncestor:o,viewportRect:u};if(!i&&!s)c=new Ds(t[0],h);else{const f=i&&new D(i).getVisible();Object.assign(h,{limiterRect:f,viewportRect:u}),c=T_(t,h)||new Ds(t[0],h)}return c}function A_(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const e=new D(R.window);return e.top+=n.top,e.height-=n.top,e.bottom-=n.bottom,e.height-=n.bottom,e}function T_(n,e){const{elementRect:t}=e,i=t.getArea(),s=n.map(a=>new Ds(a,e)).filter(a=>!!a.name);let r=0,o=null;for(const a of s){const{limiterIntersectionArea:l,viewportIntersectionArea:c}=a;if(l===i)return a;const u=c**2+l**2;u>r&&(r=u,o=a)}return o}function P_(n,e){const t=Al(new D(e)),i=pl(e);let s=0,r=0;s-=t.left,r-=t.top,s+=e.scrollLeft,r+=e.scrollTop,s-=i.left,r-=i.top,n.moveBy(s,r)}function Al(n){const{scrollX:e,scrollY:t}=R.window;return n.clone().moveBy(e,t)}class Ds{constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect);if(!i)return;const{left:s,top:r,name:o,config:a}=i;this.name=o,this.config=a,this._positioningFunctionCorrdinates={left:s,top:r},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;if(e){const t=this._options.viewportRect;if(t){const i=e.getIntersection(t);if(i)return i.getIntersectionArea(this._rect)}else return e.getIntersectionArea(this._rect)}return 0}get viewportIntersectionArea(){const e=this._options.viewportRect;return e?e.getIntersectionArea(this._rect):0}get _rect(){return this._cachedRect?this._cachedRect:(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left,this._positioningFunctionCorrdinates.top),this._cachedRect)}get _absoluteRect(){return this._cachedAbsoluteRect?this._cachedAbsoluteRect:(this._cachedAbsoluteRect=Al(this._rect),this._options.positionedElementAncestor&&P_(this._cachedAbsoluteRect,this._options.positionedElementAncestor),this._cachedAbsoluteRect)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Tl(n){const e=n.parentNode;e&&e.removeChild(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function S_({target:n,viewportOffset:e=0,ancestorOffset:t=0,alignToTop:i,forceScroll:s}){const r=Bs(n);let o=r,a=null;for(e=R_(e);o;){let l;o==r?l=Rl(n):l=Rl(a),I_({parent:l,getRect:()=>Ol(n,o),alignToTop:i,ancestorOffset:t,forceScroll:s});const c=Ol(n,o);if(x_({window:o,rect:c,viewportOffset:e,alignToTop:i,forceScroll:s}),o.parent!=o){if(a=o.frameElement,o=o.parent,!a)return}else o=null}}function x_({window:n,rect:e,alignToTop:t,forceScroll:i,viewportOffset:s}){const r=e.clone().moveBy(0,s.bottom),o=e.clone().moveBy(0,-s.top),a=new D(n).excludeScrollbarsAndBorders(),l=[o,r],c=t&&i,u=l.every(b=>a.contains(b));let{scrollX:h,scrollY:f}=n;const m=h,p=f;c?f-=a.top-e.top+s.top:u||(Sl(o,a)?f-=a.top-e.top+s.top:Pl(r,a)&&(t?f+=e.top-a.top-s.top:f+=e.bottom-a.bottom+s.bottom)),u||(xl(e,a)?h-=a.left-e.left+s.left:Il(e,a)&&(h+=e.right-a.right+s.right)),(h!=m||f!==p)&&n.scrollTo(h,f)}function I_({parent:n,getRect:e,alignToTop:t,forceScroll:i,ancestorOffset:s=0}){const r=Bs(n),o=t&&i;let a,l,c;for(;n!=r.document.body;)l=e(),a=new D(n).excludeScrollbarsAndBorders(),c=a.contains(l),o?n.scrollTop-=a.top-l.top+s:c||(Sl(l,a)?n.scrollTop-=a.top-l.top+s:Pl(l,a)&&(t?n.scrollTop+=l.top-a.top-s:n.scrollTop+=l.bottom-a.bottom+s)),c||(xl(l,a)?n.scrollLeft-=a.left-l.left+s:Il(l,a)&&(n.scrollLeft+=l.right-a.right+s)),n=n.parentNode}function Pl(n,e){return n.bottom>e.bottom}function Sl(n,e){return n.top<e.top}function xl(n,e){return n.left<e.left}function Il(n,e){return n.right>e.right}function Bs(n){return hn(n)?n.startContainer.ownerDocument.defaultView:n.ownerDocument.defaultView}function Rl(n){if(hn(n)){let e=n.commonAncestorContainer;return Y(e)&&(e=e.parentNode),e}else return n.parentNode}function Ol(n,e){const t=Bs(n),i=new D(n);if(t===e)return i;{let s=t;for(;s!=e;){const r=s.frameElement,o=new D(r).excludeScrollbarsAndBorders();i.moveBy(o.left,o.top),s=s.parent}}return i}function R_(n){return typeof n=="number"?{top:n,bottom:n,left:n,right:n}:n}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const O_={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},M_={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},O=N_(),V_=Object.fromEntries(Object.entries(O).map(([n,e])=>[e,n.charAt(0).toUpperCase()+n.slice(1)]));function Jt(n){let e;if(typeof n=="string"){if(e=O[n.toLowerCase()],!e)throw new d("keyboard-unknown-key",null,{key:n})}else e=n.keyCode+(n.altKey?O.alt:0)+(n.ctrlKey?O.ctrl:0)+(n.shiftKey?O.shift:0)+(n.metaKey?O.cmd:0);return e}function Fs(n){return typeof n=="string"&&(n=L_(n)),n.map(e=>typeof e=="string"?B_(e):e).reduce((e,t)=>t+e,0)}function Ml(n){let e=Fs(n);return Object.entries(x.isMac?O_:M_).reduce((s,[r,o])=>(e&O[r]&&(e&=~O[r],s+=o),s),"")+(e?V_[e]:"")}function D_(n){return n==O.arrowright||n==O.arrowleft||n==O.arrowup||n==O.arrowdown}function Vl(n,e){const t=e==="ltr";switch(n){case O.arrowleft:return t?"left":"right";case O.arrowright:return t?"right":"left";case O.arrowup:return"up";case O.arrowdown:return"down"}}function B_(n){if(n.endsWith("!"))return Jt(n.slice(0,-1));const e=Jt(n);return x.isMac&&e==O.ctrl?O.cmd:e}function F_(n,e){const t=Vl(n,e);return t==="down"||t==="right"}function N_(){const n={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++){const t=String.fromCharCode(e);n[t.toLowerCase()]=e}for(let e=48;e<=57;e++)n[e-48]=e;for(let e=112;e<=123;e++)n["f"+(e-111)]=e;for(const e of"`-=[];',./\\")n[e]=e.charCodeAt(0);return n}function L_(n){return n.split("+").map(e=>e.trim())}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const $_=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function Dl(n){return $_.includes(n)?"rtl":"ltr"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function X(n){return Array.isArray(n)?n:[n]}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 *//* istanbul ignore else -- @preserve */R.window.CKEDITOR_TRANSLATIONS||(R.window.CKEDITOR_TRANSLATIONS={});function z_(n,e,t=1){if(typeof t!="number")throw new d("translation-service-quantity-not-a-number",null,{quantity:t});const i=W_();i===1&&(n=Object.keys(R.window.CKEDITOR_TRANSLATIONS)[0]);const s=e.id||e.string;if(i===0||!H_(n,s))return t!==1?e.plural:e.string;const r=R.window.CKEDITOR_TRANSLATIONS[n].dictionary,o=R.window.CKEDITOR_TRANSLATIONS[n].getPluralForm||(c=>c===1?0:1),a=r[s];if(typeof a=="string")return a;const l=Number(o(t));return a[l]}function H_(n,e){return!!R.window.CKEDITOR_TRANSLATIONS[n]&&!!R.window.CKEDITOR_TRANSLATIONS[n].dictionary[e]}function W_(){return Object.keys(R.window.CKEDITOR_TRANSLATIONS).length}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class U_{constructor({uiLanguage:e="en",contentLanguage:t}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=Dl(this.uiLanguage),this.contentLanguageDirection=Dl(this.contentLanguage),this.t=(i,s)=>this._t(i,s)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=X(t),typeof e=="string"&&(e={string:e});const s=!!e.plural?t[0]:1,r=z_(this.uiLanguage,e,s);return j_(r,t)}}function j_(n,e){return n.replace(/%(\d+)/g,(t,i)=>i<e.length?e[i]:t)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ie extends L(){constructor(e={},t={}){super();const i=we(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const s of e)this._items.push(s),this._itemMap.set(this._getItemIdBeforeAdding(s),s)}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(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new d("collection-add-item-invalid-index",this);let i=0;for(const s of e){const r=this._getItemIdBeforeAdding(s),o=t+i;this._items.splice(o,0,s),this._itemMap.set(r,s),this.fire("add",s,o),i++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if(typeof e=="string")t=this._itemMap.get(e);else if(typeof e=="number")t=this._items[e];else throw new d("collection-get-invalid-arg",this);return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=this._idProperty,i=e[t];return i&&this._itemMap.has(i)}}getIndex(e){let t;return typeof e=="string"?t=this._itemMap.get(e):t=e,t?this._items.indexOf(t):-1}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new d("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(i=>new t(i))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(i=>i[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(s,r,o)=>{const a=t._bindToCollection==this,l=t._bindToInternalToExternalMap.get(r);if(a&&l)this._bindToExternalToInternalMap.set(r,l),this._bindToInternalToExternalMap.set(l,r);else{const c=e(r);if(!c){this._skippedIndexesFromExternal.push(o);return}let u=o;for(const h of this._skippedIndexesFromExternal)o>h&&u--;for(const h of t._skippedIndexesFromExternal)u>=h&&u++;this._bindToExternalToInternalMap.set(r,c),this._bindToInternalToExternalMap.set(c,r),this.add(c,u);for(let h=0;h<t._skippedIndexesFromExternal.length;h++)u<=t._skippedIndexesFromExternal[h]&&t._skippedIndexesFromExternal[h]++}};for(const s of t)i(null,s,t.getIndex(s));this.listenTo(t,"add",i),this.listenTo(t,"remove",(s,r,o)=>{const a=this._bindToExternalToInternalMap.get(r);a&&this.remove(a),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((l,c)=>(o<c&&l.push(c-1),o>c&&l.push(c),l),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],typeof i!="string")throw new d("collection-add-invalid-id",this);if(this.get(i))throw new d("collection-add-item-already-exists",this)}else e[t]=i=qe();return i}_remove(e){let t,i,s,r=!1;const o=this._idProperty;if(typeof e=="string"?(i=e,s=this._itemMap.get(i),r=!s,s&&(t=this._items.indexOf(s))):typeof e=="number"?(t=e,s=this._items[t],r=!s,s&&(i=s[o])):(s=e,i=s[o],t=this._items.indexOf(s),r=t==-1||!this._itemMap.get(i)),r)throw new d("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const a=this._bindToInternalToExternalMap.get(s);return this._bindToInternalToExternalMap.delete(s),this._bindToExternalToInternalMap.delete(a),this.fire("remove",s,t),[s,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Ee(n){const e=n.next();return e.done?null:e.value}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class be extends Ye(H()){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new d("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),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)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Re{constructor(){this._listener=new(Ye())}listenTo(e){this._listener.listenTo(e,"keydown",(t,i)=>{this._listener.fire("_keydown:"+Jt(i),i)})}set(e,t,i={}){const s=Fs(e),r=i.priority;this._listener.listenTo(this._listener,"_keydown:"+s,(o,a)=>{t(a,()=>{a.preventDefault(),a.stopPropagation(),o.stop()}),o.return=!0},{priority:r})}press(e){return!!this._listener.fire("_keydown:"+Jt(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function q_(n){const e=new Map;for(const t in n)e.set(t,n[t]);return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Xe(n){return we(n)?new Map(n):q_(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const G_=1e4;function K_(n,e,t,i){if(Math.max(e.length,n.length)>G_)return n.slice(0,t).concat(e).concat(n.slice(t+i,n.length));{const s=Array.from(n);return s.splice(t,i,...e),s}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Ns(n,e){let t;function i(...s){i.cancel(),t=setTimeout(()=>n(...s),e)}return i.cancel=()=>{clearTimeout(t)},i}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function J_(n){function e(h){return h.length>=40&&h.length<=255?"VALID":"INVALID"}if(!n)return"INVALID";let t="";try{t=atob(n)}catch{return"INVALID"}const i=t.split("-"),s=i[0],r=i[1];if(!r)return e(n);try{atob(r)}catch{try{if(atob(s),!atob(s).length)return e(n)}catch{return e(n)}}if(s.length<40||s.length>255)return"INVALID";let o="";try{atob(s),o=atob(r)}catch{return"INVALID"}if(o.length!==8)return"INVALID";const a=Number(o.substring(0,4)),l=Number(o.substring(4,6))-1,c=Number(o.substring(6,8)),u=new Date(a,l,c);return u<ef||isNaN(Number(u))?"INVALID":"VALID"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Z_(n){return!!n&&n.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n)}function Y_(n){return!!n&&n.length==1&&/[\ud800-\udbff]/.test(n)}function X_(n){return!!n&&n.length==1&&/[\udc00-\udfff]/.test(n)}function Ls(n,e){return Y_(n.charAt(e-1))&&X_(n.charAt(e))}function $s(n,e){return Z_(n.charAt(e))}const Q_=e1();function Bl(n,e){const t=String(n).matchAll(Q_);return Array.from(t).some(i=>i.index<e&&e<i.index+i[0].length)}function e1(){const n=[/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u,/\p{Emoji}\u{FE0F}?\u{20E3}/u,/\p{Emoji}\u{FE0F}/u,/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u],e=/\p{Regional_Indicator}{2}/u.source,t="(?:"+n.map(s=>s.source).join("|")+")",i=`${e}|${t}(?:‍${t})*`;return new RegExp(i,"ug")}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class _ extends H(){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Fl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Fl),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Fl(n){n.return=!1,n.stop()}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Q extends H(){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{this.affectsData&&(e.isReadOnly||this._isEnabledBasedOnSelection&&!e.model.canEditAt(e.model.document.selection))&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Nl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Nl),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Nl(n){n.return=!1,n.stop()}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ll extends L(){constructor(e,t=[],i=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(const[s,r]of i)this._contextPlugins.set(s,r),this._contextPlugins.set(r,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new d("plugincollection-plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const s=this,r=this._context;m(e),b(e);const o=e.filter(k=>!h(k,t)),a=[...p(o)];Ue(a,i);const l=Se(a);return ke(l,"init").then(()=>ke(l,"afterInit")).then(()=>l);function c(k){return typeof k=="function"}function u(k){return c(k)&&!!k.isContextPlugin}function h(k,I){return I.some(C=>C===k||f(k)===C||f(C)===k)}function f(k){return c(k)?k.pluginName||k.name:k}function m(k,I=new Set){k.forEach(C=>{c(C)&&(I.has(C)||(I.add(C),C.pluginName&&!s._availablePlugins.has(C.pluginName)&&s._availablePlugins.set(C.pluginName,C),C.requires&&m(C.requires,I)))})}function p(k,I=new Set){return k.map(C=>c(C)?C:s._availablePlugins.get(C)).reduce((C,Z)=>I.has(Z)?C:(I.add(Z),Z.requires&&(b(Z.requires,Z),p(Z.requires,I).forEach(Nt=>C.add(Nt))),C.add(Z)),new Set)}function b(k,I=null){k.map(C=>c(C)?C:s._availablePlugins.get(C)||C).forEach(C=>{E(C,I),T(C,I),de(C,I)})}function E(k,I){if(!c(k))throw I?new d("plugincollection-soft-required",r,{missingPlugin:k,requiredBy:f(I)}):new d("plugincollection-plugin-not-found",r,{plugin:k})}function T(k,I){if(u(I)&&!u(k))throw new d("plugincollection-context-required",r,{plugin:f(k),requiredBy:f(I)})}function de(k,I){if(I&&h(k,t))throw new d("plugincollection-required",r,{plugin:f(k),requiredBy:f(I)})}function Se(k){return k.map(I=>{let C=s._contextPlugins.get(I);return C=C||new I(r),s._add(I,C),C})}function ke(k,I){return k.reduce((C,Z)=>!Z[I]||s._contextPlugins.has(Z)?C:C.then(Z[I].bind(Z)),Promise.resolve())}function Ue(k,I){for(const C of I){if(typeof C!="function")throw new d("plugincollection-replace-plugin-invalid-type",null,{pluginItem:C});const Z=C.pluginName;if(!Z)throw new d("plugincollection-replace-plugin-missing-name",null,{pluginItem:C});if(C.requires&&C.requires.length)throw new d("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:Z});const Nt=s._availablePlugins.get(Z);if(!Nt)throw new d("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:Z});const Dd=k.indexOf(Nt);if(Dd===-1){if(s._contextPlugins.has(Nt))return;throw new d("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:Z})}if(Nt.requires&&Nt.requires.length)throw new d("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:Z});k.splice(Dd,1,C),s._availablePlugins.set(Z,C)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new d("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class $l{constructor(e){this._contextOwner=null,this.config=new hl(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new Ll(this,t);const i=this.config.get("language")||{};this.locale=new U_({uiLanguage:typeof i=="string"?i:i.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new Ie}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if(typeof i!="function")throw new d("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new d("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new d("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}const D5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const mn=new WeakMap;function t1({view:n,element:e,text:t,isDirectHost:i=!0,keepOnFocus:s=!1}){const r=n.document;mn.has(r)||(mn.set(r,new Map),r.registerPostFixer(o=>zs(r,o)),r.on("change:isComposing",()=>{n.change(o=>zs(r,o))},{priority:"high"})),mn.get(r).set(e,{text:t,isDirectHost:i,keepOnFocus:s,hostElement:i?e:null}),n.change(o=>zs(r,o))}function i1(n,e){return e.hasClass("ck-placeholder")?!1:(n.addClass("ck-placeholder",e),!0)}function n1(n,e){return e.hasClass("ck-placeholder")?(n.removeClass("ck-placeholder",e),!0):!1}function s1(n,e){if(!n.isAttached()||Array.from(n.getChildren()).some(o=>!o.is("uiElement")))return!1;const i=n.document,r=i.selection.anchor;return i.isComposing&&r&&r.parent===n?!1:e||!i.isFocused?!0:!!r&&r.parent!==n}function zs(n,e){const t=mn.get(n),i=[];let s=!1;for(const[r,o]of t)o.isDirectHost&&(i.push(r),zl(e,r,o)&&(s=!0));for(const[r,o]of t){if(o.isDirectHost)continue;const a=r1(r);a&&(i.includes(a)||(o.hostElement=a,zl(e,r,o)&&(s=!0)))}return s}function zl(n,e,t){const{text:i,isDirectHost:s,hostElement:r}=t;let o=!1;return r.getAttribute("data-placeholder")!==i&&(n.setAttribute("data-placeholder",i,r),o=!0),(s||e.childCount==1)&&s1(r,t.keepOnFocus)?i1(n,r)&&(o=!0):n1(n,r)&&(o=!0),o}function r1(n){if(n.childCount){const e=n.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let At=class{is(){throw new Error("is() method is abstract")}};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Tt=class extends L(At){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new d("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),s=e.getAncestors(t);let r=0;for(;i[r]==s[r]&&i[r];)r++;return r===0?null:i[r-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),s=ue(t,i);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<i[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=Xa(this);return delete e.parent,e}};Tt.prototype.is=function(n){return n==="node"||n==="view:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let j=class po extends Tt{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof po?this===e||this.data===e.data:!1}_clone(){return new po(this.document,this.data)}};j.prototype.is=function(n){return n==="$text"||n==="view:$text"||n==="text"||n==="view:text"||n==="node"||n==="view:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Ne=class extends At{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new d("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new d("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;i!==null;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}};Ne.prototype.is=function(n){return n==="$textProxy"||n==="view:$textProxy"||n==="textProxy"||n==="view:textProxy"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Zt{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)(typeof t=="string"||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const i of this._patterns){const s=Hl(t,i);if(s)return{element:t,pattern:i,match:s}}return null}matchAll(...e){const t=[];for(const i of e)for(const s of this._patterns){const r=Hl(i,s);r&&t.push({element:i,pattern:s,match:r})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;const e=this._patterns[0],t=e.name;return typeof e!="function"&&t&&!(t instanceof RegExp)?t:null}}function Hl(n,e){if(typeof e=="function")return e(n);const t={};return e.name&&(t.name=o1(e.name,n.name),!t.name)||e.attributes&&(t.attributes=u1(e.attributes,n),!t.attributes)||e.classes&&(t.classes=h1(e.classes,n),!t.classes)||e.styles&&(t.styles=d1(e.styles,n),!t.styles)?null:t}function o1(n,e){return n instanceof RegExp?!!e.match(n):n===e}function Hs(n,e,t){const i=a1(n),s=Array.from(e),r=[];if(i.forEach(([o,a])=>{s.forEach(l=>{l1(o,l)&&c1(a,l,t)&&r.push(l)})}),!(!i.length||r.length<i.length))return r}function a1(n){return Array.isArray(n)?n.map(e=>fe(e)?((e.key===void 0||e.value===void 0)&&G("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]):fe(n)?Object.entries(n):[[n,!0]]}function l1(n,e){return n===!0||n===e||n instanceof RegExp&&e.match(n)}function c1(n,e,t){if(n===!0)return!0;const i=t(e);return n===i||n instanceof RegExp&&!!String(i).match(n)}function u1(n,e){const t=new Set(e.getAttributeKeys());return fe(n)?(n.style!==void 0&&G("matcher-pattern-deprecated-attributes-style-key",n),n.class!==void 0&&G("matcher-pattern-deprecated-attributes-class-key",n)):(t.delete("style"),t.delete("class")),Hs(n,t,i=>e.getAttribute(i))}function h1(n,e){return Hs(n,e.getClassNames(),()=>{})}function d1(n,e){return Hs(n,e.getStyleNames(!0),t=>e.getStyle(t))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class f1{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){const e=Object.entries(this._styles);return!Array.from(e).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=Array.from(g1(e).entries());for(const[i,s]of t)this._styleProcessor.toNormalizedForm(i,s,this._styles)}has(e){if(this.isEmpty)return!1;const i=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);return Array.isArray(i)}set(e,t){if(K(e))for(const[i,s]of Object.entries(e))this._styleProcessor.toNormalizedForm(i,s,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=Ws(e);c_(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]&&!K(this._styles[e]))return this._styles[e];const i=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);if(Array.isArray(i))return i[1]}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this._getStylesEntries().map(([i])=>i)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const s=t.splice(0,t.length-1).join("."),r=en(this._styles,s);if(!r)return;!Array.from(Object.keys(r)).length&&this.remove(s)}}class m1{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(K(t)){Us(i,Ws(e),t);return}if(this._normalizers.has(e)){const s=this._normalizers.get(e),{path:r,value:o}=s(t);Us(i,r,o)}else Us(i,e,t)}getNormalized(e,t){if(!e)return rl({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if(typeof i=="string")return en(t,i);const s=i(e,t);if(s)return s}return en(t,Ws(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);return i===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(i):[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(s=>{const r=this.getNormalized(s,e);return r&&typeof r=="object"?Object.keys(r).length:r}),i=new Set([...t,...Object.keys(e)]);return Array.from(i.values())}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function g1(n){let e=null,t=0,i=0,s=null;const r=new Map;if(n==="")return r;n.charAt(n.length-1)!=";"&&(n=n+";");for(let o=0;o<n.length;o++){const a=n.charAt(o);if(e===null)switch(a){case":":s||(s=n.substr(t,o-t),i=o+1);break;case'"':case"'":e=a;break;case";":{const l=n.substr(i,o-i);s&&r.set(s.trim(),l.trim()),s=null,t=o+1;break}}else a===e&&(e=null)}return r}function Ws(n){return n.replace("-",".")}function Us(n,e,t){let i=t;K(t)&&(i=rl({},en(n,e),t)),r_(n,e,i)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Oe=class Bd extends Tt{constructor(e,t,i,s){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=p1(i),this._children=[],s&&this._insertChild(0,s),this._classes=new Set,this._attrs.has("class")){const r=this._attrs.get("class");Wl(this._classes,r),this._attrs.delete("class")}this._styles=new f1(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}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(e=="class")return this._classes.size>0?[...this._classes].join(" "):void 0;if(e=="style"){const t=this._styles.toString();return t==""?void 0:t}return this._attrs.get(e)}hasAttribute(e){return e=="class"?this._classes.size>0:e=="style"?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof Bd))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Zt(...e);let i=this.parent;for(;i&&!i.is("documentFragment");){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map(s=>`${s[0]}="${s[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(i==""?"":` ${i}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const s of this.getChildren())t.push(s._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._unsafeAttributesToRender=this._unsafeAttributesToRender,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const s=w1(this.document,t);for(const r of s)r.parent!==null&&r._remove(),r.parent=this,r.document=this.document,this._children.splice(e,0,r),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const i=String(t);this._fireChange("attributes",this),e=="class"?Wl(this._classes,i):e=="style"?this._styles.setTo(i):this._attrs.set(e,i)}_removeAttribute(e){return this._fireChange("attributes",this),e=="class"?this._classes.size>0?(this._classes.clear(),!0):!1:e=="style"?this._styles.isEmpty?!1:(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of X(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of X(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),typeof e!="string"?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of X(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};Oe.prototype.is=function(n,e){return e?e===this.name&&(n==="element"||n==="view:element"):n==="element"||n==="view:element"||n==="node"||n==="view:node"};function p1(n){const e=Xe(n);for(const[t,i]of e)i===null?e.delete(t):typeof i!="string"&&e.set(t,String(i));return e}function Wl(n,e){const t=e.split(/\s+/);n.clear(),t.forEach(i=>n.add(i))}function w1(n,e){return typeof e=="string"?[new j(n,e)]:(we(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new j(n,t):t instanceof Ne?new j(n,t.data):t))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ai extends Oe{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=b1}}Ai.prototype.is=function(n,e){return e?e===this.name&&(n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function b1(){const n=[...this.getChildren()],e=n[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const t of n)if(!t.is("uiElement"))return null;return this.childCount}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class gn extends H(Ai){constructor(e,t,i,s){super(e,t,i,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",r=>r&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}gn.prototype.is=function(n,e){return e?e===this.name&&(n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Ul=Symbol("rootName");class jl extends gn{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Ul)}set rootName(e){this._setCustomProperty(Ul,e)}set _name(e){this.name=e}}jl.prototype.is=function(n,e){return e?e===this.name&&(n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Pt=class{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new d("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new d("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=v._createAt(e.startPosition):this._position=v._createAt(e.boundaries[e.direction=="backward"?"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}get position(){return this._position}skip(e){let t,i;do i=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=i)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(i.parent===null&&e.offset===i.childCount)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;if(i instanceof j){if(e.isAtEnd)return this._position=v._createAfter(i),this._next();s=i.data[e.offset]}else s=i.getChild(e.offset);if(s instanceof Oe){if(!this.shallow)e=new v(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}return this._position=e,this._formatReturnValue("elementStart",s,t,e,1)}if(s instanceof j){if(this.singleCharacters)return e=new v(s,0),this._position=e,this._next();let r=s.data.length,o;return s==this._boundaryEndParent?(r=this.boundaries.end.offset,o=new Ne(s,0,r),e=v._createAfter(o)):(o=new Ne(s,0,s.data.length),e.offset++),this._position=e,this._formatReturnValue("text",o,t,e,r)}if(typeof s=="string"){let r;this.singleCharacters?r=1:r=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;const o=new Ne(i,e.offset,r);return e.offset+=r,this._position=e,this._formatReturnValue("text",o,t,e,r)}return e=v._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(i.parent===null&&e.offset===0)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(i instanceof j){if(e.isAtStart)return this._position=v._createBefore(i),this._previous();s=i.data[e.offset-1]}else s=i.getChild(e.offset-1);if(s instanceof Oe)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",s,t,e,1)):(e=new v(s,s.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,t,e));if(s instanceof j){if(this.singleCharacters)return e=new v(s,s.data.length),this._position=e,this._previous();let r=s.data.length,o;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;o=new Ne(s,a,s.data.length-a),r=o.data.length,e=v._createBefore(o)}else o=new Ne(s,0,s.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",o,t,e,r)}if(typeof s=="string"){let r;if(this.singleCharacters)r=1;else{const a=i===this._boundaryStartParent?this.boundaries.start.offset:0;r=e.offset-a}e.offset-=r;const o=new Ne(i,e.offset,r);return this._position=e,this._formatReturnValue("text",o,t,e,r)}return e=v._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,s,r){return t instanceof Ne&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=v._createAfter(t.textNode),this._position=s):i=v._createAfter(t.textNode)),t.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=v._createBefore(t.textNode),this._position=s):i=v._createBefore(t.textNode))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:s,length:r}}}};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let v=class ot extends At{constructor(e,t){super(),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 this.offset===0}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 gn);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const t=ot._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new Pt(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]==i[s]&&t[s];)s++;return s===0?null:t[s-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const s=ue(t,i);switch(s){case"prefix":return"before";case"extension":return"after";default:return t[s]<i[s]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new Pt(e)}clone(){return new ot(this.parent,this.offset)}static _createAt(e,t){if(e instanceof ot)return new this(e.parent,e.offset);{const i=e;if(t=="end")t=i.is("$text")?i.data.length:i.childCount;else{if(t=="before")return this._createBefore(i);if(t=="after")return this._createAfter(i);if(t!==0&&!t)throw new d("view-createpositionat-offset-required",i)}return new ot(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new ot(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new d("view-position-after-root",e,{root:e});return new ot(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new ot(e.textNode,e.offsetInText);if(!e.parent)throw new d("view-position-before-root",e,{root:e});return new ot(e.parent,e.index)}};v.prototype.is=function(n){return n==="position"||n==="view:position"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let S=class pt extends At{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Pt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(pn,{direction:"backward"}),t=this.end.getLastMatchingPosition(pn);return e.parent.is("$text")&&e.isAtStart&&(e=v._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=v._createAfter(t.parent)),new pt(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(pn);if(e.isAfter(this.end)||e.isEqual(this.end))return new pt(e,e);let t=this.end.getLastMatchingPosition(pn,{direction:"backward"});const i=e.nodeAfter,s=t.nodeBefore;return i&&i.is("$text")&&(e=new v(i,0)),s&&s.is("$text")&&(t=new v(s,s.data.length)),new pt(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new pt(this.start,e.start)),this.containsPosition(e.end)&&t.push(new pt(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new pt(t,i)}return null}getWalker(e={}){return e.boundaries=this,new Pt(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new pt(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Pt(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new Pt(e);yield t.position;for(const i of t)yield i.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,s){return new this(new v(e,t),new v(i,s))}static _createFromPositionAndShift(e,t){const i=e,s=e.getShiftedBy(t);return t>0?new this(i,s):new this(s,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(v._createBefore(e),t)}};S.prototype.is=function(n){return n==="range"||n==="view:range"};function pn(n){return!!(n.item.is("attributeElement")||n.item.is("uiElement"))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let ct=class Fd extends L(At){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}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 this.rangeCount===1&&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||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const s of e._ranges)if(t.isEqual(s)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=Os(this.getRanges()),i=Os(e.getRanges());if(t!=i)return!1;if(t==0)return!0;for(let s of this.getRanges()){s=s.getTrimmed();let r=!1;for(let o of e.getRanges())if(o=o.getTrimmed(),s.start.isEqual(o.start)&&s.end.isEqual(o.end)){r=!0;break}if(!r)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,i,s]=e;if(typeof i=="object"&&(s=i,i=void 0),t===null)this._setRanges([]),this._setFakeOptions(s);else if(t instanceof Fd||t instanceof js)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof S)this._setRanges([t],s&&s.backward),this._setFakeOptions(s);else if(t instanceof v)this._setRanges([new S(t)]),this._setFakeOptions(s);else if(t instanceof Tt){const r=!!s&&!!s.backward;let o;if(i===void 0)throw new d("view-selection-setto-required-second-parameter",this);i=="in"?o=S._createIn(t):i=="on"?o=S._createOn(t):o=new S(v._createAt(t,i)),this._setRanges([o],r),this._setFakeOptions(s)}else if(we(t))this._setRanges(t,s&&s.backward),this._setFakeOptions(s);else throw new d("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new d("view-selection-setfocus-no-ranges",this);const i=v._createAt(e,t);if(i.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.pop(),i.compareWith(s)=="before"?this._addRange(new S(i,s),!0):this._addRange(new S(s,i)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const i of e)this._addRange(i);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof S))throw new d("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new d("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new S(e.start,e.end))}};ct.prototype.is=function(n){return n==="selection"||n==="view:selection"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let js=class extends L(At){constructor(...e){super(),this._selection=new ct,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}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)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};js.prototype.is=function(n){return n==="selection"||n=="documentSelection"||n=="view:selection"||n=="view:documentSelection"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Yt extends je{constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const qs=Symbol("bubbling contexts");function Gs(n){class e extends n{fire(i,...s){try{const r=i instanceof je?i:new je(this,i),o=Ks(this);if(!o.size)return;if(Ti(r,"capturing",this),Xt(o,"$capture",r,...s))return r.return;const a=r.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,c=l?!!ql(o,l):!1;let u=l||_1(a);if(Ti(r,"atTarget",u),!c){if(Xt(o,"$text",r,...s))return r.return;Ti(r,"bubbling",u)}for(;u;){if(u.is("rootElement")){if(Xt(o,"$root",r,...s))return r.return}else if(u.is("element")&&Xt(o,u.name,r,...s))return r.return;if(Xt(o,u,r,...s))return r.return;u=u.parent,Ti(r,"bubbling",u)}return Ti(r,"bubbling",this),Xt(o,"$document",r,...s),r.return}catch(r){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(r,this)}}_addEventListener(i,s,r){const o=X(r.context||"$document"),a=Ks(this);for(const l of o){let c=a.get(l);c||(c=new(L()),a.set(l,c)),this.listenTo(c,i,s,r)}}_removeEventListener(i,s){const r=Ks(this);for(const o of r.values())this.stopListening(o,i,s)}}return e}{const n=Gs(Object);["fire","_addEventListener","_removeEventListener"].forEach(e=>{Gs[e]=n.prototype[e]})}function Ti(n,e,t){n instanceof Yt&&(n._eventPhase=e,n._currentTarget=t)}function Xt(n,e,t,...i){const s=typeof e=="string"?n.get(e):ql(n,e);return s?(s.fire(t,...i),t.stop.called):!1}function ql(n,e){for(const[t,i]of n)if(typeof t=="function"&&t(e))return i;return null}function Ks(n){return n[qs]||(n[qs]=new Map),n[qs]}function _1(n){if(!n)return null;const e=n.start.parent,t=n.end.parent,i=e.getPath(),s=t.getPath();return i.length>s.length?e:t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Gl=class extends Gs(H()){constructor(e){super(),this._postFixers=new Set,this.selection=new js,this.roots=new Ie({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const i of this._postFixers)if(t=i(e),t)break;while(t)}};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Kl=10;class St extends Oe{constructor(e,t,i,s){super(e,t,i,s),this._priority=Kl,this._id=null,this._clonesGroup=null,this.getFillerOffset=v1}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new d("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}St.DEFAULT_PRIORITY=Kl,St.prototype.is=function(n,e){return e?e===this.name&&(n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"):n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function v1(){if(Js(this))return null;let n=this.parent;for(;n&&n.is("attributeElement");){if(Js(n)>1)return null;n=n.parent}return!n||Js(n)>1?null:this.childCount}function Js(n){return Array.from(n.getChildren()).filter(e=>!e.is("uiElement")).length}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Zs extends Oe{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=y1}_insertChild(e,t){if(t&&(t instanceof Tt||Array.from(t).length>0))throw new d("view-emptyelement-cannot-add",[this,t]);return 0}}Zs.prototype.is=function(n,e){return e?e===this.name&&(n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"):n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function y1(){return null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class wn extends Oe{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=C1}_insertChild(e,t){if(t&&(t instanceof Tt||Array.from(t).length>0))throw new d("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const i of this.getAttributeKeys())t.setAttribute(i,this.getAttribute(i));return t}}wn.prototype.is=function(n,e){return e?e===this.name&&(n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"):n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function k1(n){n.document.on("arrowKey",(e,t)=>E1(e,t,n.domConverter),{priority:"low"})}function C1(){return null}function E1(n,e,t){if(e.keyCode==O.arrowright){const i=e.domTarget.ownerDocument.defaultView.getSelection(),s=i.rangeCount==1&&i.getRangeAt(0).collapsed;if(s||e.shiftKey){const r=i.focusNode,o=i.focusOffset,a=t.domPositionToView(r,o);if(a===null)return;let l=!1;const c=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){const u=t.viewPositionToDom(c);s?i.collapse(u.parent,u.offset):i.extend(u.parent,u.offset)}}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ys extends Oe{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=A1}_insertChild(e,t){if(t&&(t instanceof Tt||Array.from(t).length>0))throw new d("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}Ys.prototype.is=function(n,e){return e?e===this.name&&(n==="rawElement"||n==="view:rawElement"||n==="element"||n==="view:element"):n==="rawElement"||n==="view:rawElement"||n===this.name||n==="view:"+this.name||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function A1(){return null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let xt=class extends L(At){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const s=T1(this.document,t);for(const r of s)r.parent!==null&&r._remove(),r.parent=this,this._children.splice(e,0,r),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};xt.prototype.is=function(n){return n==="documentFragment"||n==="view:documentFragment"};function T1(n,e){return typeof e=="string"?[new j(n,e)]:(we(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new j(n,t):t instanceof Ne?new j(n,t.data):t))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Jl{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new xt(this.document,e)}createText(e){return new j(this.document,e)}createAttributeElement(e,t,i={}){const s=new St(this.document,e,t);return typeof i.priority=="number"&&(s._priority=i.priority),i.id&&(s._id=i.id),i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createContainerElement(e,t,i={},s={}){let r=null;fe(i)?s=i:r=i;const o=new Ai(this.document,e,t,r);return s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}createEditableElement(e,t,i={}){const s=new gn(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEmptyElement(e,t,i={}){const s=new Zs(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createUIElement(e,t,i){const s=new wn(this.document,e,t);return i&&(s.render=i),s}createRawElement(e,t,i,s={}){const r=new Ys(this.document,e,t);return i&&(r.render=i),s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){fe(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof v?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new d("view-writer-break-non-container-element",this.document);if(!t.parent)throw new d("view-writer-break-root",this.document);if(e.isAtStart)return v._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(v._createAfter(t),i);const s=new S(e,v._createAt(t,"end")),r=new v(i,0);this.move(s,r)}return v._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&i.childCount===0){const o=i.parent,a=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new v(o,a))}const s=i.getChild(t-1),r=i.getChild(t);if(!s||!r)return e;if(s.is("$text")&&r.is("$text"))return Yl(s,r);if(s.is("attributeElement")&&r.is("attributeElement")&&s.isSimilar(r)){const o=s.childCount;return s._appendChild(r.getChildren()),r._remove(),this._removeFromClonedElementsGroup(r),this.mergeAttributes(new v(s,o))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!t||!i||!t.is("containerElement")||!i.is("containerElement"))throw new d("view-writer-merge-containers-invalid-position",this.document);const s=t.getChild(t.childCount-1),r=s instanceof j?v._createAt(s,"end"):v._createAt(t,"end");return this.move(S._createIn(i),v._createAt(t,"end")),this.remove(S._createOn(i)),r}insert(e,t){t=we(t)?[...t]:[t],Xl(t,this.document);const i=t.reduce((o,a)=>{const l=o[o.length-1],c=!a.is("uiElement");return!l||l.breakAttributes!=c?o.push({breakAttributes:c,nodes:[a]}):l.nodes.push(a),o},[]);let s=null,r=e;for(const{nodes:o,breakAttributes:a}of i){const l=this._insertNodes(r,o,a);s||(s=l.start),r=l.end}return s?new S(s,r):new S(e)}remove(e){const t=e instanceof S?e:S._createOn(e);if(Pi(t,this.document),t.isCollapsed)return new xt(this.document);const{start:i,end:s}=this._breakAttributesRange(t,!0),r=i.parent,o=s.offset-i.offset,a=r._removeChildren(i.offset,o);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(i);return t.start=l,t.end=l.clone(),new xt(this.document,a)}clear(e,t){Pi(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of i){const r=s.item;let o;if(r.is("element")&&t.isSimilar(r))o=S._createOn(r);else if(!s.nextPosition.isAfter(e.start)&&r.is("$textProxy")){const a=r.getAncestors().find(l=>l.is("element")&&t.isSimilar(l));a&&(o=S._createIn(a))}o&&(o.end.isAfter(e.end)&&(o.end=e.end),o.start.isBefore(e.start)&&(o.start=e.start),this.remove(o))}}move(e,t){let i;if(t.isAfter(e.end)){t=this._breakAttributes(t,!0);const s=t.parent,r=s.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=s.childCount-r}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof St))throw new d("view-writer-wrap-invalid-attribute",this.document);if(Pi(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&!P1(i.parent)&&(i=i.getLastMatchingPosition(r=>r.item.is("uiElement"))),i=this._wrapPosition(i,t);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new S(i)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof St))throw new d("view-writer-unwrap-invalid-attribute",this.document);if(Pi(e,this.document),e.isCollapsed)return e;const{start:i,end:s}=this._breakAttributesRange(e,!0),r=i.parent,o=this._unwrapChildren(r,i.offset,s.offset,t),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new S(a,l)}rename(e,t){const i=new Ai(this.document,e,t.getAttributes());return this.insert(v._createAfter(t),i),this.move(S._createIn(t),v._createAt(i,0)),this.remove(S._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return v._createAt(e,t)}createPositionAfter(e){return v._createAfter(e)}createPositionBefore(e){return v._createBefore(e)}createRange(e,t){return new S(e,t)}createRangeOn(e){return S._createOn(e)}createRangeIn(e){return S._createIn(e)}createSelection(...e){return new ct(...e)}createSlot(e="children"){if(!this._slotFactory)throw new d("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,i){let s;if(i?s=Xs(e):s=e.parent.is("$text")?e.parent.parent:e.parent,!s)throw new d("view-writer-invalid-position-container",this.document);let r;i?r=this._breakAttributes(e,!0):r=e.parent.is("$text")?Qs(e):e;const o=s._insertChild(r.offset,t);for(const u of t)this._addToClonedElementsGroup(u);const a=r.getShiftedBy(o),l=this.mergeAttributes(r);l.isEqual(r)||a.offset--;const c=this.mergeAttributes(a);return new S(l,c)}_wrapChildren(e,t,i,s){let r=t;const o=[];for(;r<i;){const l=e.getChild(r),c=l.is("$text"),u=l.is("attributeElement");if(u&&this._wrapAttributeElement(s,l))o.push(new v(e,r));else if(c||!u||S1(s,l)){const h=s._clone();l._remove(),h._appendChild(l),e._insertChild(r,h),this._addToClonedElementsGroup(h),o.push(new v(e,r))}else this._wrapChildren(l,0,l.childCount,s);r++}let a=0;for(const l of o){if(l.offset-=a,l.offset==t)continue;this.mergeAttributes(l).isEqual(l)||(a++,i--)}return S._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,s){let r=t;const o=[];for(;r<i;){const l=e.getChild(r);if(!l.is("attributeElement")){r++;continue}if(l.isSimilar(s)){const c=l.getChildren(),u=l.childCount;l._remove(),e._insertChild(r,c),this._removeFromClonedElementsGroup(l),o.push(new v(e,r),new v(e,r+u)),r+=u,i+=u-1;continue}if(this._unwrapAttributeElement(s,l)){o.push(new v(e,r),new v(e,r+1)),r++;continue}this._unwrapChildren(l,0,l.childCount,s),r++}let a=0;for(const l of o){if(l.offset-=a,l.offset==t||l.offset==i)continue;this.mergeAttributes(l).isEqual(l)||(a++,i--)}return S._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:s}=this._breakAttributesRange(e,!0),r=i.parent,o=this._wrapChildren(r,i.offset,s.offset,t),a=this.mergeAttributes(o.start);a.isEqual(o.start)||o.end.offset--;const l=this.mergeAttributes(o.end);return new S(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Zl(e.clone());e.parent.is("$text")&&(e=Qs(e));const i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const s=new S(e,e.getShiftedBy(1));this.wrap(s,t);const r=new v(i.parent,i.index);i._remove();const o=r.nodeBefore,a=r.nodeAfter;return o instanceof j&&a instanceof j?Yl(o,a):Zl(r)}_wrapAttributeElement(e,t){if(!Ql(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if(!(i==="class"||i==="style")&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())i==="class"||i==="style"||t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t);for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!Ql(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if(!(i==="class"||i==="style")&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())i==="class"||i==="style"||this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,s=e.end;if(Pi(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new S(l,l)}const r=this._breakAttributes(s,t),o=r.parent.childCount,a=this._breakAttributes(i,t);return r.offset+=r.parent.childCount-o,new S(a,r)}_breakAttributes(e,t=!1){const i=e.offset,s=e.parent;if(e.parent.is("emptyElement"))throw new d("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new d("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new d("view-writer-cannot-break-raw-element",this.document);if(!t&&s.is("$text")&&er(s.parent)||er(s))return e.clone();if(s.is("$text"))return this._breakAttributes(Qs(e),t);const r=s.childCount;if(i==r){const o=new v(s.parent,s.index+1);return this._breakAttributes(o,t)}else if(i===0){const o=new v(s.parent,s.index);return this._breakAttributes(o,t)}else{const o=s.index+1,a=s._clone();s.parent._insertChild(o,a),this._addToClonedElementsGroup(a);const l=s.childCount-i,c=s._removeChildren(i,l);a._appendChild(c);const u=new v(s.parent,o);return this._breakAttributes(u,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const s of e.getChildren())this._addToClonedElementsGroup(s);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const s of e.getChildren())this._removeFromClonedElementsGroup(s);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function P1(n){return Array.from(n.getChildren()).some(e=>!e.is("uiElement"))}function Xs(n){let e=n.parent;for(;!er(e);){if(!e)return;e=e.parent}return e}function S1(n,e){return n.priority<e.priority?!0:n.priority>e.priority?!1:n.getIdentity()<e.getIdentity()}function Zl(n){const e=n.nodeBefore;if(e&&e.is("$text"))return new v(e,e.data.length);const t=n.nodeAfter;return t&&t.is("$text")?new v(t,0):n}function Qs(n){if(n.offset==n.parent.data.length)return new v(n.parent.parent,n.parent.index+1);if(n.offset===0)return new v(n.parent.parent,n.parent.index);const e=n.parent.data.slice(n.offset);return n.parent._data=n.parent.data.slice(0,n.offset),n.parent.parent._insertChild(n.parent.index+1,new j(n.root.document,e)),new v(n.parent.parent,n.parent.index+1)}function Yl(n,e){const t=n.data.length;return n._data+=e.data,e._remove(),new v(n,t)}const x1=[j,St,Ai,Zs,Ys,wn];function Xl(n,e){for(const t of n){if(!x1.some(i=>t instanceof i))throw new d("view-writer-insert-invalid-node-type",e);t.is("$text")||Xl(t.getChildren(),e)}}function er(n){return n&&(n.is("containerElement")||n.is("documentFragment"))}function Pi(n,e){const t=Xs(n.start),i=Xs(n.end);if(!t||!i||t!==i)throw new d("view-writer-invalid-range-container",e)}function Ql(n,e){return n.id===null&&e.id===null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const ec=n=>n.createTextNode(" "),tc=n=>{const e=n.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},ic=n=>{const e=n.createElement("br");return e.dataset.ckeFiller="true",e},Le=7,bn="⁠".repeat(Le);function _e(n){return Y(n)&&n.data.substr(0,Le)===bn}function Si(n){return n.data.length==Le&&_e(n)}function nc(n){return _e(n)?n.data.slice(Le):n.data}function I1(n){n.document.on("arrowKey",R1,{priority:"low"})}function R1(n,e){if(e.keyCode==O.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(t.rangeCount==1&&t.getRangeAt(0).collapsed){const i=t.getRangeAt(0).startContainer,s=t.getRangeAt(0).startOffset;_e(i)&&s<=Le&&t.collapse(i,0)}}}const B5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class O1 extends H(){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),x.isBlink&&!x.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()}),this.set("isComposing",!1),this.on("change:isComposing",()=>{this.isComposing||this.render()})}markToSync(e,t){if(e==="text")this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e==="attributes")this.markedAttributes.add(t);else if(e==="children")this.markedChildren.add(t);else throw new d("view-renderer-unknown-type",this)}}render(){if(this.isComposing&&!x.isAndroid)return;let e=null;const t=x.isBlink&&!x.isAndroid?!this.isSelecting:!0;for(const i of this.markedChildren)this._updateChildrenMappings(i);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=v._createBefore(e.parent)));for(const i of this.markedAttributes)this._updateAttrs(i);for(const i of this.markedChildren)this._updateChildren(i,{inlineFillerPosition:e});for(const i of this.markedTexts)!this.markedChildren.has(i.parent)&&this.domConverter.mapViewToDom(i.parent)&&this._updateText(i,{inlineFillerPosition:e});if(t)if(e){const i=this.domConverter.viewPositionToDom(e),s=i.parent.ownerDocument;_e(i.parent)?this._inlineFiller=i.parent:this._inlineFiller=sc(s,i.parent,i.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){if(!this.domConverter.mapViewToDom(e))return;const i=Array.from(this.domConverter.mapViewToDom(e).childNodes),s=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),r=this._diffNodeLists(i,s),o=this._findUpdateActions(r,i,s,V1);if(o.indexOf("update")!==-1){const a={equal:0,insert:0,delete:0};for(const l of o)if(l==="update"){const c=a.equal+a.insert,u=a.equal+a.delete,h=e.getChild(c);h&&!(h.is("uiElement")||h.is("rawElement"))&&this._updateElementMappings(h,i[u]),Tl(s[c]),a.equal++}else a[l]++}}_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")?v._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&Y(t.parent)&&_e(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!_e(e))throw new d("view-renderer-filler-was-lost",this);Si(e)?e.remove():e.data=e.data.substr(Le),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!M1(t)||i===t.getFillerOffset())return!1;const s=e.nodeBefore,r=e.nodeAfter;return!(s instanceof j||r instanceof j||x.isAndroid&&(s||r))}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e);let r=this.domConverter.viewToDom(e).data;const o=t.inlineFillerPosition;o&&o.parent==e.parent&&o.offset==e.index&&(r=bn+r),rc(i,r)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map(r=>r.name),s=e.getAttributeKeys();for(const r of s)this.domConverter.setDomElementAttribute(t,r,e.getAttribute(r),e);for(const r of i)e.hasAttribute(r)||this.domConverter.removeDomElementAttribute(t,r)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;if(x.isAndroid){let h=null;for(const f of Array.from(i.childNodes)){if(h&&Y(h)&&Y(f)){i.normalize();break}h=f}}const s=t.inlineFillerPosition,r=i.childNodes,o=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));s&&s.parent===e&&sc(i.ownerDocument,o,s.offset);const a=this._diffNodeLists(r,o),l=this._findUpdateActions(a,r,o,D1);let c=0;const u=new Set;for(const h of l)h==="delete"?(u.add(r[c]),Tl(r[c])):(h==="equal"||h==="update")&&c++;c=0;for(const h of l)h==="insert"?(kl(i,c,o[c]),c++):h==="update"?(rc(r[c],o[c].data),c++):h==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(o[c])),c++);for(const h of u)h.parentNode||this.domConverter.unbindDomElement(h)}_diffNodeLists(e,t){return e=N1(e,this._fakeSelectionContainer),wi(e,t,B1.bind(null,this.domConverter))}_findUpdateActions(e,t,i,s){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let r=[],o=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)c==="insert"?a.push(i[l.equal+l.insert]):c==="delete"?o.push(t[l.equal+l.delete]):(r=r.concat(wi(o,a,s).map(u=>u==="equal"?"update":u)),r.push("equal"),o=[],a=[]),l[c]++;return r.concat(wi(o,a,s).map(c=>c==="equal"?"update":c))}_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(x.isBlink&&!x.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}const e=this.domConverter.mapViewToDom(this.selection.editableElement);!this.isFocused||!e||(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&x.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=L1(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!i.parentElement||i.parentElement!=e)&&e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const s=t.getSelection(),r=t.createRange();s.removeAllRanges(),r.selectNodeContents(i),s.addRange(r)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),s=this.domConverter.viewPositionToDom(this.selection.focus);t.collapse(i.parent,i.offset),t.extend(s.parent,s.offset),x.isGecko&&F1(s,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||i.anchorNode!==t&&!t.contains(i.anchorNode)?!0:t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const i=e.activeElement,s=this.domConverter.mapDomToView(i);i&&s&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function M1(n){if(n.getAttribute("contenteditable")=="false")return!1;const e=n.findAncestor(t=>t.hasAttribute("contenteditable"));return!e||e.getAttribute("contenteditable")=="true"}function sc(n,e,t){const i=e instanceof Array?e:e.childNodes,s=i[t];if(Y(s))return s.data=bn+s.data,s;{const r=n.createTextNode(bn);return Array.isArray(e)?i.splice(t,0,r):kl(e,t,r),r}}function V1(n,e){return lt(n)&&lt(e)&&!Y(n)&&!Y(e)&&!Kt(n)&&!Kt(e)&&n.tagName.toLowerCase()===e.tagName.toLowerCase()}function D1(n,e){return lt(n)&&lt(e)&&Y(n)&&Y(e)}function B1(n,e,t){return e===t?!0:Y(e)&&Y(t)?e.data===t.data:!!(n.isBlockFiller(e)&&n.isBlockFiller(t))}function F1(n,e){const t=n.parent;if(t.nodeType!=Node.ELEMENT_NODE||n.offset!=t.childNodes.length-1)return;const i=t.childNodes[n.offset];i&&i.tagName=="BR"&&e.addRange(e.getRangeAt(0))}function N1(n,e){const t=Array.from(n);return t.length==0||!e||t[t.length-1]==e&&t.pop(),t}function L1(n){const e=n.createElement("div");return e.className="ck-fake-selection-container",Object.assign(e.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),e.textContent=" ",e}function rc(n,e){const t=n.data;if(t==e)return;const i=_o(t,e);for(const s of i)s.type==="insert"?n.insertData(s.index,s.values.join("")):n.deleteData(s.index,s.howMany)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const $1=ic(R.document),z1=ec(R.document),H1=tc(R.document),_n="data-ck-unsafe-attribute-",oc="data-ck-unsafe-element";class ac{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Zt,this._encounteredRawContentDomNodes=new WeakSet,this.document=e,this.renderingMode=i,this.blockFillerMode=t||(i==="editing"?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?R.document:R.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new ct(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 i of Array.from(e.children))this.unbindDomElement(i)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,i){return this.renderingMode==="data"?!0:(e=e.toLowerCase(),e.startsWith("on")||e==="srcdoc"&&t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:i==="img"&&(e==="src"||e==="srcset")||i==="source"&&e==="srcset"?!0:!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data"){e.innerHTML=t;return}const i=new DOMParser().parseFromString(t,"text/html"),s=i.createDocumentFragment(),r=i.body.childNodes;for(;r.length>0;)s.appendChild(r[0]);const o=i.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=o.nextNode();)a.push(l);for(const c of a){for(const h of c.getAttributeNames())this.setDomElementAttribute(c,h,c.getAttribute(h));const u=c.tagName.toLowerCase();this._shouldRenameElement(u)&&(uc(u),c.replaceWith(this._createReplacementDomElement(u,c)))}for(;e.firstChild;)e.firstChild.remove();e.append(s)}viewToDom(e,t={}){if(e.is("$text")){const i=this._processDataFromViewText(e);return this._domDocument.createTextNode(i)}else{if(this.mapViewToDom(e))return this.mapViewToDom(e);let i;if(e.is("documentFragment"))i=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(i,e);else{if(e.is("uiElement"))return e.name==="$comment"?i=this._domDocument.createComment(e.getCustomProperty("$rawContent")):i=e.render(this._domDocument,this),t.bind&&this.bindElements(i,e),i;this._shouldRenameElement(e.name)?(uc(e.name),i=this._createReplacementDomElement(e.name)):e.hasAttribute("xmlns")?i=this._domDocument.createElementNS(e.getAttribute("xmlns"),e.name):i=this._domDocument.createElement(e.name),e.is("rawElement")&&e.render(i,this),t.bind&&this.bindElements(i,e);for(const s of e.getAttributeKeys())this.setDomElementAttribute(i,s,e.getAttribute(s),e)}if(t.withChildren!==!1)for(const s of this.viewChildrenToDom(e,t))i.appendChild(s);return i}}setDomElementAttribute(e,t,i,s){const r=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(t);if(r||G("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),!Cl(t)){G("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});return}e.hasAttribute(t)&&!r?e.removeAttribute(t):e.hasAttribute(_n+t)&&r&&e.removeAttribute(_n+t),e.setAttribute(r?t:_n+t,i)}removeDomElementAttribute(e,t){t!=oc&&(e.removeAttribute(t),e.removeAttribute(_n+t))}*viewChildrenToDom(e,t={}){const i=e.getFillerOffset&&e.getFillerOffset();let s=0;for(const r of e.getChildren()){i===s&&(yield this._getBlockFiller());const o=r.is("element")&&!!r.getCustomProperty("dataPipeline:transparentRendering")&&!Ee(r.getAttributes());o&&this.renderingMode=="data"?yield*this.viewChildrenToDom(r,t):(o&&G("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:r}),yield this.viewToDom(r,t)),s++}i===s&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),s=this._domDocument.createRange();return s.setStart(t.parent,t.offset),s.setEnd(i.parent,i.offset),s}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let s=e.offset;return _e(i)&&(s+=Le),{parent:i,offset:s}}else{let i,s,r;if(e.offset===0){if(i=this.mapViewToDom(t),!i)return null;r=i.childNodes[0]}else{const a=e.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;i=s.parentNode,r=s.nextSibling}if(Y(r)&&_e(r))return{parent:r,offset:Le};const o=s?fn(s)+1:0;return{parent:i,offset:o}}}domToView(e,t={}){if(this.isBlockFiller(e))return null;const i=this.getHostViewElement(e);if(i)return i;if(Kt(e)&&t.skipComments)return null;if(Y(e)){if(Si(e))return null;{const s=this._processDataFromDomText(e);return s===""?null:new j(this.document,s)}}else{if(this.mapDomToView(e))return this.mapDomToView(e);let s;if(this.isDocumentFragment(e))s=new xt(this.document),t.bind&&this.bindDocumentFragments(e,s);else{s=this._createViewElement(e,t),t.bind&&this.bindElements(e,s);const r=e.attributes;if(r)for(let o=r.length,a=0;a<o;a++)s._setAttribute(r[a].name,r[a].value);if(this._isViewElementWithRawContent(s,t)||Kt(e)){const o=Kt(e)?e.data:e.innerHTML;return s._setCustomProperty("$rawContent",o),this._encounteredRawContentDomNodes.add(e),s}}if(t.withChildren!==!1)for(const r of this.domChildrenToView(e,t))s._appendChild(r);return s}}*domChildrenToView(e,t){for(let i=0;i<e.childNodes.length;i++){const s=e.childNodes[i],r=this.domToView(s,t);r!==null&&(yield r)}}domSelectionToView(e){if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;Y(s)&&(s=s.parentNode);const r=this.fakeSelectionToView(s);if(r)return r}const t=this.isDomSelectionBackward(e),i=[];for(let s=0;s<e.rangeCount;s++){const r=e.getRangeAt(s),o=this.domRangeToView(r);o&&i.push(o)}return new ct(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new S(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,fn(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return v._createBefore(i);if(Y(e)){if(Si(e))return this.domPositionToView(e.parentNode,fn(e));const s=this.findCorrespondingViewText(e);let r=t;return s?(_e(e)&&(r-=Le,r=r<0?0:r),new v(s,r)):null}else{if(t===0){const s=this.mapDomToView(e);if(s)return new v(s,0)}else{const s=e.childNodes[t-1];if(Y(s)&&Si(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,fn(s));const r=Y(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(r&&r.parent)return new v(r.parent,r.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Si(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const s=this.mapDomToView(i);if(s){const r=s.nextSibling;return r instanceof j?r:null}}else{const s=this.mapDomToView(e.parentNode);if(s){const r=s.getChild(0);return r instanceof j?r:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:i,scrollY:s}=R.window,r=[];lc(t,o=>{const{scrollLeft:a,scrollTop:l}=o;r.push([a,l])}),t.focus(),lc(t,o=>{const[a,l]=r.shift();o.scrollLeft=a,o.scrollTop=l}),R.window.scrollTo(i,s)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return this.blockFillerMode=="br"?e.isEqualNode($1):e.tagName==="BR"&&cc(e,this.blockElements)&&e.parentNode.childNodes.length===1?!0:e.isEqualNode(H1)||U1(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=gl(e);for(t.pop();t.length;){const i=t.pop(),s=this._domToViewMapping.get(i);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return ec(this._domDocument);case"markedNbsp":return tc(this._domDocument);case"br":return ic(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(Y(e)&&_e(e)&&t<Le||this.isElement(e)&&_e(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!(i&&(i.is("uiElement")||i.is("rawElement")))}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(i=>this.preElements.includes(i.name)))return t;if(t.charAt(0)==" "){const i=this._getTouchingInlineViewNode(e,!1);(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i)||!i)&&(t=" "+t.substr(1))}if(t.charAt(t.length-1)==" "){const i=this._getTouchingInlineViewNode(e,!0),s=i&&i.is("$textProxy")&&i.data.charAt(0)==" ";(t.charAt(t.length-2)==" "||!i||s)&&(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(i=>this.preElements.includes(i.name)))return!1;const t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_processDataFromDomText(e){let t=e.data;if(W1(e,this.preElements))return nc(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const i=this._getTouchingInlineDomNode(e,!1),s=this._getTouchingInlineDomNode(e,!0),r=this._checkShouldLeftTrimDomText(e,i),o=this._checkShouldRightTrimDomText(e,s);r&&(t=t.replace(/^ /,"")),o&&(t=t.replace(/ $/,"")),t=nc(new Text(t)),t=t.replace(/ \u00A0/g,"  ");const a=s&&this.isElement(s)&&s.tagName!="BR",l=s&&Y(s)&&s.data.charAt(0)==" ";return(/( |\u00A0)\u00A0$/.test(t)||!s||a||l)&&(t=t.replace(/\u00A0$/," ")),(r||i&&this.isElement(i)&&i.tagName!="BR")&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return t?this.isElement(t)?t.tagName==="BR":this._encounteredRawContentDomNodes.has(e.previousSibling)?!1:/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)):!0}_checkShouldRightTrimDomText(e,t){return t?!1:!_e(e)}_getTouchingInlineViewNode(e,t){const i=new Pt({startPosition:t?v._createAfter(e):v._createBefore(e),direction:t?"forward":"backward"});for(const s of i){if(s.item.is("element")&&this.inlineObjectElements.includes(s.item.name))return s.item;if(s.item.is("containerElement"))return null;if(s.item.is("element","br"))return null;if(s.item.is("$textProxy"))return s.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const i=t?"firstChild":"lastChild",s=t?"nextSibling":"previousSibling";let r=!0,o=e;do if(!r&&o[i]?o=o[i]:o[s]?(o=o[s],r=!1):(o=o.parentNode,r=!0),!o||this._isBlockElement(o))return null;while(!(Y(o)||o.tagName=="BR"||this._isInlineObjectElement(o)));return o}_isBlockElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isInlineObjectElement(e){return this.isElement(e)&&this.inlineObjectElements.includes(e.tagName.toLowerCase())}_createViewElement(e,t){if(Kt(e))return new wn(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new Oe(this.document,i)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const i=this._domDocument.createElement("span");if(i.setAttribute(oc,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const s of t.getAttributeNames())i.setAttribute(s,t.getAttribute(s))}return i}}function W1(n,e){return gl(n).some(i=>i.tagName&&e.includes(i.tagName.toLowerCase()))}function lc(n,e){let t=n;for(;t;)e(t),t=t.parentElement}function U1(n,e){return n.isEqualNode(z1)&&cc(n,e)&&n.parentNode.childNodes.length===1}function cc(n,e){const t=n.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function uc(n){n==="script"&&G("domconverter-unsafe-script-element-detected"),n==="style"&&G("domconverter-unsafe-style-element-detected")}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Me extends Ye(){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Qt{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Qo(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class It extends Me{constructor(){super(...arguments),this.useCapture=!1}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(i=>{this.listenTo(e,i,(s,r)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(r.target)&&this.onDomEvent(r)},{useCapture:this.useCapture})})}stopObserving(e){this.stopListening(e)}fire(e,t,i){this.isEnabled&&this.document.fire(e,new Qt(this.view,t,i))}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class j1 extends It{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Jt(this)}};this.fire(e.type,e,t)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class q1 extends Me{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=jt(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new ct(t.getRanges(),{backward:t.isBackward,fake:!1});(e==O.arrowleft||e==O.arrowup)&&i.setTo(i.getFirstPosition()),(e==O.arrowright||e==O.arrowdown)&&i.setTo(i.getLastPosition());const s={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",s),this._fireSelectionChangeDoneDebounced(s)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class hc extends Me{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const t=this.domConverter,i=new Set,s=new Set;for(const o of e){const a=t.mapDomToView(o.target);a&&(a.is("uiElement")||a.is("rawElement")||o.type==="childList"&&!this._isBogusBrMutation(o)&&s.add(a))}for(const o of e){const a=t.mapDomToView(o.target);if(!(a&&(a.is("uiElement")||a.is("rawElement")))&&o.type==="characterData"){const l=t.findCorrespondingViewText(o.target);l&&!s.has(l.parent)?i.add(l):!l&&_e(o.target)&&s.add(t.mapDomToView(o.target.parentNode))}}let r=!1;for(const o of i)r=!0,this.renderer.markToSync("text",o);for(const o of s){const a=t.mapViewToDom(o),l=Array.from(o.getChildren()),c=Array.from(t.domChildrenToView(a,{withChildren:!1}));J0(l,c,G1)||(r=!0,this.renderer.markToSync("children",o))}r&&this.view.forceRender()}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function G1(n,e){if(!Array.isArray(n))return n===e?!0:n.is("$text")&&e.is("$text")?n.data===e.data:!1}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class tr extends It{constructor(e){super(e),this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this.flush(),e.change(()=>{})},50)}),t.on("blur",(i,s)=>{const r=t.selection.editableElement;(r===null||r===s.target)&&(t.isFocused=!1,this._isFocusChanging=!1,e.change(()=>{}))})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class K1 extends Me{constructor(e){super(e),this.mutationObserver=e.getObserver(hc),this.focusObserver=e.getObserver(tr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=jt(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=jt(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,i=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},s=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",i,{priority:"highest"}),this.listenTo(e,"keydown",s,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",s,{priority:"highest",useCapture:!0}),!this._documents.has(t)&&(this.listenTo(t,"mouseup",s,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(r,o)=>{this.document.isComposing&&!x.isAndroid||(this._handleSelectionChange(o,t),this._documentIsSelectingInactivityTimeoutDebounced())}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const i=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(i.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(i);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(i))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(this.focusObserver.flush(),this.selection.isSimilar(s))this.view.forceRender();else{const r={oldSelection:this.selection,newSelection:s,domSelection:i};this.document.fire("selectionChange",r),this._fireSelectionChangeDoneDebounced(r)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class J1 extends It{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class dc{constructor(e,t={}){this._files=t.cacheFiles?fc(e):null,this._native=e}get files(){return this._files||(this._files=fc(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,i){this._native.setDragImage(e,t,i)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function fc(n){const e=Array.from(n.files||[]),t=Array.from(n.items||[]);return e.length?e:t.filter(i=>i.kind==="file").map(i=>i.getAsFile())}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Z1 extends It{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),i=this.view,s=i.document;let r=null,o=null,a=[];if(e.dataTransfer&&(r=new dc(e.dataTransfer)),e.data!==null?o=e.data:r&&(o=r.getData("text/plain")),s.selection.isFake)a=Array.from(s.selection.getRanges());else if(t.length)a=t.map(l=>{const c=i.domConverter.domPositionToView(l.startContainer,l.startOffset),u=i.domConverter.domPositionToView(l.endContainer,l.endOffset);if(c)return i.createRange(c,u);if(u)return i.createRange(u)}).filter(l=>!!l);else if(x.isAndroid){const l=e.target.ownerDocument.defaultView.getSelection();a=Array.from(i.domConverter.domSelectionToView(l).getRanges())}if(x.isAndroid&&e.inputType=="insertCompositionText"&&o&&o.endsWith(`
`)){this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(a[0].end)]});return}if(e.inputType=="insertText"&&o&&o.includes(`
`)){const l=o.split(/\n{1,2}/g);let c=a;for(let u=0;u<l.length;u++){const h=l[u];h!=""&&(this.fire(e.type,e,{data:h,dataTransfer:r,targetRanges:c,inputType:e.inputType,isComposing:e.isComposing}),c=[s.selection.getFirstRange()]),u+1<l.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:c}),c=[s.selection.getFirstRange()])}return}this.fire(e.type,e,{data:o,dataTransfer:r,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Y1 extends Me{constructor(e){super(e),this.document.on("keydown",(t,i)=>{if(this.isEnabled&&D_(i.keyCode)){const s=new Yt(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(s,i),s.stop.called&&t.stop()}})}observe(){}stopObserving(){}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class X1 extends Me{constructor(e){super(e);const t=this.document;t.on("keydown",(i,s)=>{if(!this.isEnabled||s.keyCode!=O.tab||s.ctrlKey)return;const r=new Yt(t,"tab",t.selection.getFirstRange());t.fire(r,s),r.stop.called&&i.stop()})}observe(){}stopObserving(){}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Q1=class extends H(){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new Gl(e),this.domConverter=new ac(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new O1(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Jl(this.document),this.addObserver(hc),this.addObserver(tr),this.addObserver(K1),this.addObserver(j1),this.addObserver(q1),this.addObserver(J1),this.addObserver(Y1),this.addObserver(Z1),this.addObserver(X1),I1(this),k1(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0}),this.listenTo(this.document,"change:isFocused",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const s={};for(const{name:o,value:a}of Array.from(e.attributes))s[o]=a,o==="class"?this._writer.addClass(a.split(" "),i):this._writer.setAttribute(o,a,i);this._initialDomRootAttributes.set(e,s);const r=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};r(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",(o,a)=>this._renderer.markToSync("children",a)),i.on("change:attributes",(o,a)=>this._renderer.markToSync("attributes",a)),i.on("change:text",(o,a)=>this._renderer.markToSync("text",a)),i.on("change:isReadOnly",()=>this.change(r)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:s})=>t.removeAttribute(s));const i=this._initialDomRootAttributes.get(t);for(const s in i)t.setAttribute(s,i[s]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const s of this._observers.values())s.stopObserving(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[i,s]of this.domRoots)t.observe(s,i);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({alignToTop:e,forceScroll:t,viewportOffset:i=20,ancestorOffset:s=20}={}){const r=this.document.selection.getFirstRange();if(!r)return;const o=Ze({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:s});typeof i=="number"&&(i={top:i,bottom:i,left:i,right:i});const a={target:this.domConverter.viewRangeToDom(r),viewportOffset:i,ancestorOffset:s,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",a,o),S_(a)}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 d("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(t){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(tr).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return v._createAt(e,t)}createPositionAfter(e){return v._createAfter(e)}createPositionBefore(e){return v._createBefore(e)}createRange(e,t){return new S(e,t)}createRangeOn(e){return S._createOn(e)}createRangeIn(e){return S._createIn(e)}createSelection(...e){return new ct(...e)}_disableRendering(e){this._renderingDisabled=e,e==!1&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ut{is(){throw new Error("is() method is abstract")}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Rt=class extends ut{constructor(e){super(),this.parent=null,this._attrs=Xe(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))===null)throw new d("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if((e=this.parent.getChildStartOffset(this))===null)throw new d("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent===null?!1:this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),s=e.getAncestors(t);let r=0;for(;i[r]==s[r]&&i[r];)r++;return r===0?null:i[r-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),s=ue(t,i);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<i[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((t,i)=>(t[i[0]]=i[1],t),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Xe(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};Rt.prototype.is=function(n){return n==="node"||n==="model:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class xi{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 t==-1?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return t===null?null:this._nodes.slice(0,t).reduce((i,s)=>i+s.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new d("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new d("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const i of t)if(!(i instanceof Rt))throw new d("model-nodelist-insertnodes-not-node",this);this._nodes=K_(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let q=class wo extends Rt{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new wo(this.data,this.getAttributes())}static fromJSON(e){return new wo(e.data,e.attributes)}};q.prototype.is=function(n){return n==="$text"||n==="model:$text"||n==="text"||n==="model:text"||n==="node"||n==="model:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ve extends ut{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new d("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new d("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return this.textNode.startOffset!==null?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset!==null?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}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}Ve.prototype.is=function(n){return n==="$textProxy"||n==="model:$textProxy"||n==="textProxy"||n==="model:textProxy"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class F extends Rt{constructor(e,t,i){super(t),this._children=new xi,this.name=e,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(i=>i._clone(!0)):void 0;return new F(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=ev(t);for(const s of i)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const s of i)s.parent=null;return i}static fromJSON(e){let t;if(e.children){t=[];for(const i of e.children)i.name?t.push(F.fromJSON(i)):t.push(q.fromJSON(i))}return new F(e.name,e.attributes,t)}}F.prototype.is=function(n,e){return e?e===this.name&&(n==="element"||n==="model:element"):n==="element"||n==="model:element"||n==="node"||n==="model:node"};function ev(n){return typeof n=="string"?[new q(n)]:(we(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new q(e):e instanceof Ve?new q(e.data,e.getAttributes()):e))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ht{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new d("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new d("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=w._createAt(this.boundaries[this.direction=="backward"?"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}get position(){return this._position}skip(e){let t,i,s,r;do s=this.position,r=this._visitedParent,{done:t,value:i}=this.next();while(!t&&e(i));t||(this._position=s,this._visitedParent=r)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(i.parent===null&&t.offset===i.maxOffset)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const s=Ii(t,i),r=s||mc(t,i,s);if(r instanceof F){if(!this.shallow)t.path.push(0),this._visitedParent=r;else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,Ot("elementStart",r,e,t,1)}if(r instanceof q){let o;if(this.singleCharacters)o=1;else{let c=r.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),o=c-t.offset}const a=t.offset-r.startOffset,l=new Ve(r,a,o);return t.offset+=o,this._position=t,Ot("text",l,e,t,o)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():Ot("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(i.parent===null&&t.offset===0)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const s=t.parent,r=Ii(t,s),o=r||gc(t,s,r);if(o instanceof F)return t.offset--,this.shallow?(this._position=t,Ot("elementStart",o,e,t,1)):(t.path.push(o.maxOffset),this._position=t,this._visitedParent=o,this.ignoreElementEnd?this._previous():Ot("elementEnd",o,e,t));if(o instanceof q){let a;if(this.singleCharacters)a=1;else{let u=o.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>u&&(u=this.boundaries.start.offset),a=t.offset-u}const l=t.offset-o.startOffset,c=new Ve(o,l-a,a);return t.offset-=a,this._position=t,Ot("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,Ot("elementStart",i,e,t,1)}}function Ot(n,e,t,i,s){return{done:!1,value:{type:n,item:e,previousPosition:t,nextPosition:i,length:s}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class w extends ut{constructor(e,t,i="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new d("model-position-root-invalid",e);if(!(t instanceof Array)||t.length===0)throw new d("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new d("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new d("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Ii(this,this.parent)}get nodeAfter(){const e=this.parent;return mc(this,e,Ii(this,e))}get nodeBefore(){const e=this.parent;return gc(this,e,Ii(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=ue(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new ht(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=ue(this.path,e.path),i=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]==i[s]&&t[s];)s++;return s===0?null:t[s-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return this.compareWith(e)=="after"}isBefore(e){return this.compareWith(e)=="before"}isEqual(e){return this.compareWith(e)=="same"}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let i=0;i<t;i++){const s=this.path[i]-e.path[i];if(s<-1||s>1)return!1;if(s===1)return pc(e,this,i);if(s===-1)return pc(this,e,i)}return this.path.length===e.path.length?!0:this.path.length>e.path.length?ir(this.path,t):ir(e.path,t)}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),i=e.getParentPath();return ue(t,i)=="same"}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=w._createAt(this);break}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)&&this.stickiness=="toNext"?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,i=t.containsPosition(this)||t.start.isEqual(this);let s;return i?(s=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(s=s._getTransformedByDeletion(e.deletionPosition,1))):this.isEqual(e.deletionPosition)?s=w._createAt(e.deletionPosition):s=this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),s}_getTransformedByDeletion(e,t){const i=w._createAt(this);if(this.root!=e.root)return i;if(ue(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if(ue(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;if(e.offset<=this.path[s]){if(e.offset+t>this.path[s])return null;i.path[s]-=t}}return i}_getTransformedByInsertion(e,t){const i=w._createAt(this);if(this.root!=e.root)return i;if(ue(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(i.offset+=t);else if(ue(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;e.offset<=this.path[s]&&(i.path[s]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return w._createAt(this);const s=this._getTransformedByDeletion(e,i);return s===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(i).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):s._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,s=w._createAt(t);return s.stickiness=this.stickiness,s.offset=s.offset+this.path[i]-e.offset,s.path=[...s.path,...this.path.slice(i+1)],s}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof w)return new w(e.root,e.path,e.stickiness);{const s=e;if(t=="end")t=s.maxOffset;else{if(t=="before")return this._createBefore(s,i);if(t=="after")return this._createAfter(s,i);if(t!==0&&!t)throw new d("model-createpositionat-offset-required",[this,e])}if(!s.is("element")&&!s.is("documentFragment"))throw new d("model-position-parent-incorrect",[this,e]);const r=s.getPath();return r.push(t),new this(s.root,r,i)}}static _createAfter(e,t){if(!e.parent)throw new d("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new d("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const i=new w(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new d("model-position-fromjson-no-root",t,{rootName:e.root});return new w(t.getRoot(e.root),e.path,e.stickiness)}}w.prototype.is=function(n){return n==="position"||n==="model:position"};function Ii(n,e){const t=e.getChild(e.offsetToIndex(n.offset));return t&&t.is("$text")&&t.startOffset<n.offset?t:null}function mc(n,e,t){return t!==null?null:e.getChild(e.offsetToIndex(n.offset))}function gc(n,e,t){return t!==null?null:e.getChild(e.offsetToIndex(n.offset)-1)}function pc(n,e,t){return!(t+1===n.path.length||!ir(e.path,t+1)||!tv(n,t+1))}function ir(n,e){for(;e<n.length;){if(n[e]!==0)return!1;e++}return!0}function tv(n,e){let t=n.parent,i=n.path.length-1,s=0;for(;i>=e;){if(n.path[i]+s!==t.maxOffset)return!1;s=1,i--,t=t.parent}return!0}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class g extends ut{constructor(e,t){super(),this.start=w._createAt(e),this.end=t?w._createAt(t):w._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new ht({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return ue(e,t)=="same"}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}containsItem(e){const t=w._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new g(this.start,e.start)),this.containsPosition(e.end)&&t.push(new g(e.end,this.end))):t.push(new g(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new g(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(this.start.isBefore(e.start)?i=t?this.end.isTouching(e.start):this.end.isEqual(e.start):i=t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let s=this.start,r=this.end;return e.start.isBefore(s)&&(s=e.start),e.end.isAfter(r)&&(r=e.end),new g(s,r)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=w._createAt(this.start);let s=i.parent;for(;i.path.length>t+1;){const r=s.maxOffset-i.offset;r!==0&&e.push(new g(i,i.getShiftedBy(r))),i.path=i.path.slice(0,-1),i.offset++,s=s.parent}for(;i.path.length<=this.end.path.length;){const r=this.end.path[i.path.length-1],o=r-i.offset;o!==0&&e.push(new g(i,i.getShiftedBy(o))),i.offset=r,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new ht(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ht(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new ht(e);yield t.position;for(const i of t)yield i.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 g(this.start,this.end)]}getTransformedByOperations(e){const t=[new g(this.start,this.end)];for(const i of e)for(let s=0;s<t.length;s++){const r=t[s].getTransformedByOperation(i);t.splice(s,1,...r),s+=r.length-1}for(let i=0;i<t.length;i++){const s=t[i];for(let r=i+1;r<t.length;r++){const o=t[r];(s.containsRange(o)||o.containsRange(s)||s.isEqual(o))&&t.splice(r,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,s=e.howMany,r=e.targetPosition;return this._getTransformedByMove(i,r,s,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new g(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new g(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=w._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new g(t,i)):new g(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new g(this.start,e),new g(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const s=new g(this.start,this.end);return s.start=s.start._getTransformedByInsertion(e,t),s.end=s.end._getTransformedByInsertion(e,t),[s]}}_getTransformedByMove(e,t,i,s=!1){if(this.isCollapsed){const h=this.start._getTransformedByMove(e,t,i);return[new g(h)]}const r=g._createFromPositionAndShift(e,i),o=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!s&&(r.containsPosition(this.start)||r.containsPosition(this.end))){const h=this.start._getTransformedByMove(e,t,i),f=this.end._getTransformedByMove(e,t,i);return[new g(h,f)]}let a;const l=this.getDifference(r);let c=null;const u=this.getIntersection(r);if(l.length==1?c=new g(l[0].start._getTransformedByDeletion(e,i),l[0].end._getTransformedByDeletion(e,i)):l.length==2&&(c=new g(this.start,this.end._getTransformedByDeletion(e,i))),c?a=c._getTransformedByInsertion(o,i,u!==null||s):a=[],u){const h=new g(u.start._getCombined(r.start,o),u.end._getCombined(r.start,o));a.length==2?a.splice(1,0,h):a.push(h)}return a}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),s=this.end._getTransformedByDeletion(e,t);return i==null&&s==null?null:(i==null&&(i=e),s==null&&(s=e),new g(i,s))}static _createFromPositionAndShift(e,t){const i=e,s=e.getShiftedBy(t);return t>0?new this(i,s):new this(s,i)}static _createIn(e){return new this(w._createAt(e,0),w._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(w._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new d("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((r,o)=>r.start.isAfter(o.start)?1:-1);const i=e.indexOf(t),s=new this(t.start,t.end);if(i>0)for(let r=i-1;e[r].end.isEqual(s.start);r++)s.start=w._createAt(e[r].start);for(let r=i+1;r<e.length&&e[r].start.isEqual(s.end);r++)s.end=w._createAt(e[r].end);return s}static fromJSON(e,t){return new this(w.fromJSON(e.start,t),w.fromJSON(e.end,t))}}g.prototype.is=function(n){return n==="range"||n==="model:range"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class wc extends L(){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new d("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),s=this._viewToModelMapping.get(i),r=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=w._createAt(s,r)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const s of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(s);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const s=this._elementToMarkerNames.get(e)||new Set;s.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,s)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),i.size==0&&this._markerNameToElements.delete(t));const s=this._elementToMarkerNames.get(e);s&&(s.delete(t),s.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new g(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new S(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={}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const s of t)if(s.is("attributeElement"))for(const r of s.getElementsWithSameId())i.add(r);else i.add(s);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e){const r=this._toModelOffset(e.parent,e.index,i),o=this._toModelOffset(e,t,e);return r+o}if(e.is("$text"))return t;let s=0;for(let r=0;r<t;r++)s+=this.getModelLength(e.getChild(r));return s}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name))return this._viewToModelLengthCallbacks.get(e.name)(e);if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,s=0,r=0,o=0;if(e.is("$text"))return new v(e,t);for(;r<t;)i=e.getChild(o),s=this.getModelLength(i),r+=s,o++;return r==t?this._moveViewPositionToTextNode(new v(e,o)):this.findPositionIn(i,t-(r-s))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof j?new v(t,t.data.length):i instanceof j?new v(i,0):e}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class iv{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=vn(t),e instanceof Ve&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=vn(t),e instanceof Ve&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=vn(t),e instanceof Ve&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(i===void 0)return null;const s=i.get(t);return s===void 0?null:s}revert(e,t){t=vn(t),e instanceof Ve&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return i===!1?(this._consumable.get(e).set(t,!0),!0):i===!0?!1:null}verifyAllConsumed(e){const t=[];for(const[i,s]of this._consumable)for(const[r,o]of s){const a=r.split(":")[0];o&&e==a&&t.push({event:r,item:i.name||i.description})}if(t.length)throw new d("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const s=i.get(e.endOffset);s&&(t=s.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,i=e.endOffset,s=e.parent,r=Symbol("$textProxy:"+e.data);let o,a;return o=this._textProxyRegistry.get(t),o||(o=new Map,this._textProxyRegistry.set(t,o)),a=o.get(i),a||(a=new Map,o.set(i,a)),a.set(s,r),r}}function vn(n){const e=n.split(":");return e[0]=="insert"?e[0]:e[0]=="addMarker"||e[0]=="removeMarker"?n:e.length>1?e[0]+":"+e[1]:e[0]}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class bc extends L(){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,i){const s=this._createConversionApi(i,e.getRefreshedItems());for(const o of e.getMarkersToRemove())this._convertMarkerRemove(o.name,o.range,s);const r=this._reduceChanges(e.getChanges());for(const o of r)o.type==="insert"?this._convertInsert(g._createFromPositionAndShift(o.position,o.length),s):o.type==="reinsert"?this._convertReinsert(g._createFromPositionAndShift(o.position,o.length),s):o.type==="remove"?this._convertRemove(o.position,o.length,o.name,s):this._convertAttribute(o.range,o.attributeKey,o.attributeOldValue,o.attributeNewValue,s);for(const o of s.mapper.flushUnboundMarkerNames()){const a=t.get(o).getRange();this._convertMarkerRemove(o,a,s),this._convertMarkerAdd(o,a,s)}for(const o of e.getMarkersToAdd())this._convertMarkerAdd(o.name,o.range,s);s.mapper.flushDeferredBindings(),s.consumable.verifyAllConsumed("insert")}convert(e,t,i,s={}){const r=this._createConversionApi(i,void 0,s);this._convertInsert(e,r);for(const[o,a]of t)this._convertMarkerAdd(o,a,r);r.consumable.verifyAllConsumed("insert")}convertSelection(e,t,i){const s=Array.from(t.getMarkersAtPosition(e.getFirstPosition())),r=this._createConversionApi(i);if(this._addConsumablesForSelection(r.consumable,e,s),this.fire("selection",{selection:e},r),!!e.isCollapsed){for(const o of s){const a=o.getRange();if(!nv(e.getFirstPosition(),o,r.mapper))continue;const l={item:e,markerName:o.name,markerRange:a};r.consumable.test(e,"addMarker:"+o.name)&&this.fire(`addMarker:${o.name}`,l,r)}for(const o of e.getAttributeKeys()){const a={item:e,range:e.getFirstRange(),attributeKey:o,attributeOldValue:null,attributeNewValue:e.getAttribute(o)};r.consumable.test(e,"attribute:"+a.attributeKey)&&this.fire(`attribute:${a.attributeKey}:$text`,a,r)}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,Array.from(e));for(const s of Array.from(e.getWalker({shallow:!0})).map(_c))this._testAndFire("insert",s,t)}_convertRemove(e,t,i,s){this.fire(`remove:${i}`,{position:e,length:t},s)}_convertAttribute(e,t,i,s,r){this._addConsumablesForRange(r.consumable,e,`attribute:${t}`);for(const o of e){const a={item:o.item,range:g._createFromPositionAndShift(o.previousPosition,o.length),attributeKey:t,attributeOldValue:i,attributeNewValue:s};this._testAndFire(`attribute:${t}`,a,r)}}_convertReinsert(e,t){const i=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,i);for(const s of i.map(_c))this._testAndFire("insert",{...s,reconversion:!0},t)}_convertMarkerAdd(e,t,i){if(t.root.rootName=="$graveyard")return;const s=`addMarker:${e}`;if(i.consumable.add(t,s),this.fire(s,{markerName:e,markerRange:t},i),!!i.consumable.consume(t,s)){this._addConsumablesForRange(i.consumable,t,s);for(const r of t.getItems()){if(!i.consumable.test(r,s))continue;const o={item:r,range:g._createOn(r),markerName:e,markerRange:t};this.fire(s,o,i)}}}_convertMarkerRemove(e,t,i){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},i)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const i of t){const s=i.item;if(e.test(s,"insert")===null){e.add(s,"insert");for(const r of s.getAttributeKeys())e.add(s,"attribute:"+r)}}return e}_addConsumablesForRange(e,t,i){for(const s of t.getItems())e.add(s,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(const s of i)e.add(t,"addMarker:"+s.name);for(const s of t.getAttributeKeys())e.add(t,"attribute:"+s);return e}_testAndFire(e,t,i){const s=sv(e,t),r=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,o=this._firedEventsMap.get(i),a=o.get(r);if(!a)o.set(r,new Set([s]));else if(!a.has(s))a.add(s);else return;this.fire(s,t,i)}_testAndFireAddAttributes(e,t){const i={item:e,range:g._createOn(e)};for(const s of i.item.getAttributeKeys())i.attributeKey=s,i.attributeOldValue=null,i.attributeNewValue=i.item.getAttribute(s),this._testAndFire(`attribute:${s}`,i,t)}_createConversionApi(e,t=new Set,i={}){const s={...this._conversionApi,consumable:new iv,writer:e,options:i,convertItem:r=>this._convertInsert(g._createOn(r),s),convertChildren:r=>this._convertInsert(g._createIn(r),s,{doNotAddConsumables:!0}),convertAttributes:r=>this._testAndFireAddAttributes(r,s),canReuseView:r=>!t.has(s.mapper.toModelElement(r))};return this._firedEventsMap.set(s,new Map),s}}function nv(n,e,t){const i=e.getRange(),s=Array.from(n.getAncestors());return s.shift(),s.reverse(),!s.some(o=>{if(i.containsItem(o))return!!t.toViewElement(o).getCustomProperty("addHighlight")})}function sv(n,e){const t=e.item.is("element")?e.item.name:"$text";return`${n}:${t}`}function _c(n){const e=n.item,t=g._createFromPositionAndShift(n.previousPosition,n.length);return{item:e,range:t}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ve extends L(ut){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}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 this._ranges.length===1?this._ranges[0].isCollapsed:!1}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const s of e._ranges)if(t.isEqual(s)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new g(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 g(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 g(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){let[t,i,s]=e;if(typeof i=="object"&&(s=i,i=void 0),t===null)this._setRanges([]);else if(t instanceof ve)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof g)this._setRanges([t],!!s&&!!s.backward);else if(t instanceof w)this._setRanges([new g(t)]);else if(t instanceof Rt){const r=!!s&&!!s.backward;let o;if(i=="in")o=g._createIn(t);else if(i=="on")o=g._createOn(t);else if(i!==void 0)o=new g(w._createAt(t,i));else throw new d("model-selection-setto-required-second-parameter",[this,t]);this._setRanges([o],r)}else if(we(t))this._setRanges(t,s&&!!s.backward);else throw new d("model-selection-setto-not-selectable",[this,t])}_setRanges(e,t=!1){const i=Array.from(e),s=i.some(r=>{if(!(r instanceof g))throw new d("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(o=>!o.isEqual(r))});i.length===this._ranges.length&&!s||(this._replaceAllRanges(i),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new d("model-selection-setfocus-no-ranges",[this,e]);const i=w._createAt(e,t);if(i.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.length&&this._popRange(),i.compareWith(s)=="before"?(this._pushRange(new g(i,s)),this._lastRangeBackward=!0):(this._pushRange(new g(s,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=yc(t.start,e);ov(i,t)&&(yield i);for(const r of t.getWalker()){const o=r.item;r.type=="elementEnd"&&rv(o,e,t)&&(yield o)}const s=yc(t.end,e);av(s,t)&&(yield s)}}containsEntireContent(e=this.anchor.root){const t=w._createAt(e,0),i=w._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new g(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new d("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}ve.prototype.is=function(n){return n==="selection"||n==="model:selection"};function vc(n,e){return e.has(n)?!1:(e.add(n),n.root.document.model.schema.isBlock(n)&&!!n.parent)}function rv(n,e,t){return vc(n,e)&&nr(n,t)}function yc(n,e){const i=n.parent.root.document.model.schema,s=n.parent.getAncestors({parentFirst:!0,includeSelf:!0});let r=!1;const o=s.find(a=>r?!1:(r=i.isLimit(a),!r&&vc(a,e)));return s.forEach(a=>e.add(a)),o}function nr(n,e){const t=lv(n);return t?!e.containsRange(g._createOn(t),!0):!0}function ov(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.start.isTouching(w._createAt(n,n.maxOffset))?!1:nr(n,e):!1}function av(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.end.isTouching(w._createAt(n,0))?!1:nr(n,e):!1}function lv(n){const e=n.root.document.model.schema;let t=n.parent;for(;t;){if(e.isBlock(t))return t;t=t.parent}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class $e extends L(g){constructor(e,t){super(e,t),cv.call(this)}detach(){this.stopListening()}toRange(){return new g(this.start,this.end)}static fromRange(e){return new $e(e.start,e.end)}}$e.prototype.is=function(n){return n==="liveRange"||n==="model:liveRange"||n=="range"||n==="model:range"};function cv(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&uv.call(this,t)},{priority:"low"})}function uv(n){const e=this.getTransformedByOperation(n),t=g._createFromRanges(e),i=!t.isEqual(this),s=hv(this,n);let r=null;if(i){t.root.rootName=="$graveyard"&&(n.type=="remove"?r=n.sourcePosition:r=n.deletionPosition);const o=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",o,{deletionPosition:r})}else s&&this.fire("change:content",this.toRange(),{deletionPosition:r})}function hv(n,e){switch(e.type){case"insert":return n.containsPosition(e.position);case"move":case"remove":case"reinsert":case"merge":return n.containsPosition(e.sourcePosition)||n.start.isEqual(e.sourcePosition)||n.containsPosition(e.targetPosition);case"split":return n.containsPosition(e.splitPosition)||n.containsPosition(e.insertionPosition)}return!1}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Ri="selection:";class De extends L(ut){constructor(e){super(),this._selection=new dv(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_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 Ri+e}static _isStoreAttributeKey(e){return e.startsWith(Ri)}}De.prototype.is=function(n){return n==="selection"||n=="model:selection"||n=="documentSelection"||n=="model:documentSelection"};class dv extends ve{constructor(e){super(),this.markers=new Ie({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,i)=>{const s=i[0];!s.isDocumentOperation||s.type=="marker"||s.type=="rename"||s.type=="noop"||(this._ranges.length==0&&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",()=>{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,i,s,r)=>{this._updateMarker(i,r)}),this.listenTo(this._document,"change",(t,i)=>{fv(this._model,i)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const i=[e];this.fire("change:attribute",{attributeKeys:i,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=qe();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new d("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new d("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=$e.fromRange(e);return t.on("change:range",(i,s,r)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=r.deletionPosition;const o=this._ranges.indexOf(t);this._ranges.splice(o,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const s of this._model.markers){const r=s.name.split(":",1)[0];if(!this._observedMarkers.has(r))continue;const o=s.getRange();for(const a of this.getRanges())o.containsRange(a,!a.isCollapsed)&&e.push(s)}const i=Array.from(this.markers);for(const s of e)this.markers.has(s)||(this.markers.add(s),t=!0);for(const s of Array.from(this.markers))e.includes(s)||(this.markers.remove(s),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let s=!1;const r=Array.from(this.markers),o=this.markers.has(e);if(!t)o&&(this.markers.remove(e),s=!0);else{let a=!1;for(const l of this.getRanges())if(t.containsRange(l,!l.isCollapsed)){a=!0;break}a&&!o?(this.markers.add(e),s=!0):!a&&o&&(this.markers.remove(e),s=!0)}s&&this.fire("change:marker",{oldMarkers:r,directChange:!1})}_updateAttributes(e){const t=Xe(this._getSurroundingAttributes()),i=Xe(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[r,o]of this._attributePriority)o=="low"&&(this._attrs.delete(r),this._attributePriority.delete(r));this._setAttributesTo(t);const s=[];for(const[r,o]of this.getAttributes())(!i.has(r)||i.get(r)!==o)&&s.push(r);for(const[r]of i)this.hasAttribute(r)||s.push(r);s.length>0&&this.fire("change:attribute",{attributeKeys:s,directChange:!1})}_setAttribute(e,t,i=!0){const s=i?"normal":"low";return s=="low"&&this._attributePriority.get(e)=="normal"||super.getAttribute(e)===t?!1:(this._attrs.set(e,t),this._attributePriority.set(e,s),!0)}_removeAttribute(e,t=!0){const i=t?"normal":"low";return i=="low"&&this._attributePriority.get(e)=="normal"||(this._attributePriority.set(e,i),!super.hasAttribute(e))?!1:(this._attrs.delete(e),!0)}_setAttributesTo(e){const t=new Set;for(const[i,s]of this.getAttributes())e.get(i)!==s&&this._removeAttribute(i,!1);for(const[i,s]of e)this._setAttribute(i,s,!1)&&t.add(i);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(Ri)&&(yield[t.substr(Ri.length),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let i=null;if(this.isCollapsed){const s=e.textNode?e.textNode:e.nodeBefore,r=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=yn(s,t)),i||(i=yn(r,t)),!this.isGravityOverridden&&!i){let o=s;for(;o&&!i;)o=o.previousSibling,i=yn(o,t)}if(!i){let o=r;for(;o&&!i;)o=o.nextSibling,i=yn(o,t)}i||(i=this.getStoredAttributes())}else{const s=this.getFirstRange();for(const r of s){if(r.item.is("element")&&t.isObject(r.item))break;if(r.type=="text"){i=r.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function yn(n,e){if(!n)return null;if(n instanceof Ve||n instanceof q)return n.getAttributes();if(!e.isInline(n))return null;if(!e.isObject(n))return[];const t=[];for(const[i,s]of n.getAttributes())e.checkAttribute("$text",i)&&t.push([i,s]);return t}function fv(n,e){const t=n.document.differ;for(const i of t.getChanges()){if(i.type!="insert")continue;const s=i.position.parent;i.length===s.maxOffset&&n.enqueueChange(e,o=>{const a=Array.from(s.getAttributeKeys()).filter(l=>l.startsWith(Ri));for(const l of a)o.removeAttribute(l,s)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class kc{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class mv extends kc{elementToElement(e){return this.add(Ov(e))}elementToStructure(e){return this.add(Mv(e))}attributeToElement(e){return this.add(Vv(e))}attributeToAttribute(e){return this.add(Dv(e))}markerToElement(e){return this.add(Bv(e))}markerToHighlight(e){return this.add(Nv(e))}markerToData(e){return this.add(Fv(e))}}function Cc(){return(n,e,t)=>{if(!t.consumable.consume(e.item,n.name))return;const i=t.writer,s=t.mapper.toViewPosition(e.range.start),r=i.createText(e.item.data);i.insert(s,r)}}function Ec(){return(n,e,t)=>{t.convertAttributes(e.item),!e.reconversion&&e.item.is("element")&&!e.item.isEmpty&&t.convertChildren(e.item)}}function gv(){return(n,e,t)=>{const i=t.mapper.toViewPosition(e.position),s=e.position.getShiftedBy(e.length),r=t.mapper.toViewPosition(s,{isPhantom:!0}),o=t.writer.createRange(i,r),a=t.writer.remove(o.getTrimmed());for(const l of t.writer.createRangeIn(a).getItems())t.mapper.unbindViewElement(l,{defer:!0})}}function Ac(n,e){const t=n.createAttributeElement("span",e.attributes);return e.classes&&t._addClass(e.classes),typeof e.priority=="number"&&(t._priority=e.priority),t._id=e.id,t}function pv(){return(n,e,t)=>{const i=e.selection;if(i.isCollapsed||!t.consumable.consume(i,"selection"))return;const s=[];for(const r of i.getRanges())s.push(t.mapper.toViewRange(r));t.writer.setSelection(s,{backward:i.isBackward})}}function wv(){return(n,e,t)=>{const i=e.selection;if(!i.isCollapsed||!t.consumable.consume(i,"selection"))return;const s=t.writer,r=i.getFirstPosition(),o=t.mapper.toViewPosition(r),a=s.breakAttributes(o);s.setSelection(a)}}function bv(){return(n,e,t)=>{const i=t.writer,s=i.document.selection;for(const r of s.getRanges())r.isCollapsed&&r.end.parent.isAttached()&&t.writer.mergeAttributes(r.start);i.setSelection(null)}}function _v(n){return(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n(t.attributeOldValue,i,t),r=n(t.attributeNewValue,i,t);if(!s&&!r)return;i.consumable.consume(t.item,e.name);const o=i.writer,a=o.document.selection;if(t.item instanceof ve||t.item instanceof De)o.wrap(a.getFirstRange(),r);else{let l=i.mapper.toViewRange(t.range);t.attributeOldValue!==null&&s&&(l=o.unwrap(l,s)),t.attributeNewValue!==null&&r&&o.wrap(l,r)}}}function vv(n,e=jv){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const r=n(i.item,s,i);if(!r)return;e(i.item,s.consumable);const o=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,r),s.writer.insert(o,r),s.convertAttributes(i.item),Oc(r,i.item.getChildren(),s,{reconversion:i.reconversion})}}function yv(n,e){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const r=new Map;s.writer._registerSlotFactory(zv(i.item,r,s));const o=n(i.item,s,i);if(s.writer._clearSlotFactory(),!o)return;Hv(i.item,r,s),e(i.item,s.consumable);const a=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,o),s.writer.insert(a,o),s.convertAttributes(i.item),Wv(o,r,s,{reconversion:i.reconversion})}}function kv(n){return(e,t,i)=>{t.isOpening=!0;const s=n(t,i);t.isOpening=!1;const r=n(t,i);if(!s||!r)return;const o=t.markerRange;if(o.isCollapsed&&!i.consumable.consume(o,e.name))return;for(const c of o)if(!i.consumable.consume(c.item,e.name))return;const a=i.mapper,l=i.writer;l.insert(a.toViewPosition(o.start),s),i.mapper.bindElementToMarker(s,t.markerName),o.isCollapsed||(l.insert(a.toViewPosition(o.end),r),i.mapper.bindElementToMarker(r,t.markerName)),e.stop()}}function Cv(){return(n,e,t)=>{const i=t.mapper.markerNameToElements(e.markerName);if(i){for(const s of i)t.mapper.unbindElementFromMarkerName(s,e.markerName),t.writer.clear(t.writer.createRangeOn(s),s);t.writer.clearClonedElementsGroup(e.markerName),n.stop()}}}function Ev(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const r=t.markerRange;i.consumable.consume(r,e.name)&&(Tc(r,!1,i,t,s),Tc(r,!0,i,t,s),e.stop())}}function Tc(n,e,t,i,s){const r=e?n.start:n.end,o=r.nodeAfter&&r.nodeAfter.is("element")?r.nodeAfter:null,a=r.nodeBefore&&r.nodeBefore.is("element")?r.nodeBefore:null;if(o||a){let c,u;e&&o||!e&&!a?(c=o,u=!0):(c=a,u=!1);const h=t.mapper.toViewElement(c);if(h){Av(h,e,u,t,i,s);return}}const l=t.mapper.toViewPosition(r);Tv(l,e,t,i,s)}function Av(n,e,t,i,s,r){const o=`data-${r.group}-${e?"start":"end"}-${t?"before":"after"}`,a=n.hasAttribute(o)?n.getAttribute(o).split(","):[];a.unshift(r.name),i.writer.setAttribute(o,a.join(","),n),i.mapper.bindElementToMarker(n,s.markerName)}function Tv(n,e,t,i,s){const r=`${s.group}-${e?"start":"end"}`,o=s.name?{name:s.name}:null,a=t.writer.createUIElement(r,o);t.writer.insert(n,a),t.mapper.bindElementToMarker(a,i.markerName)}function Pv(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const r=i.mapper.markerNameToElements(t.markerName);if(!r)return;for(const a of r)i.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("containerElement")?(o(`data-${s.group}-start-before`,a),o(`data-${s.group}-start-after`,a),o(`data-${s.group}-end-before`,a),o(`data-${s.group}-end-after`,a)):i.writer.clear(i.writer.createRangeOn(a),a);i.writer.clearClonedElementsGroup(t.markerName),e.stop();function o(a,l){if(l.hasAttribute(a)){const c=new Set(l.getAttribute(a).split(","));c.delete(s.name),c.size==0?i.writer.removeAttribute(a,l):i.writer.setAttribute(a,Array.from(c).join(","),l)}}}}function Sv(n){return(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n(t.attributeOldValue,i,t),r=n(t.attributeNewValue,i,t);if(!s&&!r)return;i.consumable.consume(t.item,e.name);const o=i.mapper.toViewElement(t.item),a=i.writer;if(!o)throw new d("conversion-attribute-to-attribute-on-text",i.dispatcher,t);if(t.attributeOldValue!==null&&s)if(s.key=="class"){const l=X(s.value);for(const c of l)a.removeClass(c,o)}else if(s.key=="style"){const l=Object.keys(s.value);for(const c of l)a.removeStyle(c,o)}else a.removeAttribute(s.key,o);if(t.attributeNewValue!==null&&r)if(r.key=="class"){const l=X(r.value);for(const c of l)a.addClass(c,o)}else if(r.key=="style"){const l=Object.keys(r.value);for(const c of l)a.setStyle(c,r.value[c],o)}else a.setAttribute(r.key,r.value,o)}}function xv(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof ve||t.item instanceof De)&&!t.item.is("$textProxy"))return;const s=sr(n,t,i);if(!s||!i.consumable.consume(t.item,e.name))return;const r=i.writer,o=Ac(r,s),a=r.document.selection;if(t.item instanceof ve||t.item instanceof De)r.wrap(a.getFirstRange(),o);else{const l=i.mapper.toViewRange(t.range),c=r.wrap(l,o);for(const u of c.getItems())if(u.is("attributeElement")&&u.isSimilar(o)){i.mapper.bindElementToMarker(u,t.markerName);break}}}}function Iv(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof F))return;const s=sr(n,t,i);if(!s||!i.consumable.test(t.item,e.name))return;const r=i.mapper.toViewElement(t.item);if(r&&r.getCustomProperty("addHighlight")){i.consumable.consume(t.item,e.name);for(const a of g._createIn(t.item))i.consumable.consume(a.item,e.name);r.getCustomProperty("addHighlight")(r,s,i.writer),i.mapper.bindElementToMarker(r,t.markerName)}}}function Rv(n){return(e,t,i)=>{if(t.markerRange.isCollapsed)return;const s=sr(n,t,i);if(!s)return;const r=Ac(i.writer,s),o=i.mapper.markerNameToElements(t.markerName);if(o){for(const a of o)i.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("attributeElement")?i.writer.unwrap(i.writer.createRangeOn(a),r):a.getCustomProperty("removeHighlight")(a,s.id,i.writer);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}}function Ov(n){const e=Pc(n.model),t=Oi(n.view,"container");return e.attributes.length&&(e.children=!0),i=>{i.on(`insert:${e.name}`,vv(t,Rc(e)),{priority:n.converterPriority||"normal"}),(e.children||e.attributes.length)&&i.on("reduceChanges",Ic(e),{priority:"low"})}}function Mv(n){const e=Pc(n.model),t=Oi(n.view,"container");return e.children=!0,i=>{if(i._conversionApi.schema.checkChild(e.name,"$text"))throw new d("conversion-element-to-structure-disallowed-text",i,{elementName:e.name});i.on(`insert:${e.name}`,yv(t,Rc(e)),{priority:n.converterPriority||"normal"}),i.on("reduceChanges",Ic(e),{priority:"low"})}}function Vv(n){n=Ze(n);let e=n.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)n.view[s]=Oi(n.view[s],"attribute");else n.view=Oi(n.view,"attribute");const i=Sc(n);return s=>{s.on(t,_v(i),{priority:n.converterPriority||"normal"})}}function Dv(n){n=Ze(n);let e=n.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)n.view[s]=xc(n.view[s]);else n.view=xc(n.view);const i=Sc(n);return s=>{s.on(t,Sv(i),{priority:n.converterPriority||"normal"})}}function Bv(n){const e=Oi(n.view,"ui");return t=>{t.on(`addMarker:${n.model}`,kv(e),{priority:n.converterPriority||"normal"}),t.on(`removeMarker:${n.model}`,Cv(),{priority:n.converterPriority||"normal"})}}function Fv(n){n=Ze(n);const e=n.model;let t=n.view;return t||(t=i=>({group:e,name:i.substr(n.model.length+1)})),i=>{i.on(`addMarker:${e}`,Ev(t),{priority:n.converterPriority||"normal"}),i.on(`removeMarker:${e}`,Pv(t),{priority:n.converterPriority||"normal"})}}function Nv(n){return e=>{e.on(`addMarker:${n.model}`,xv(n.view),{priority:n.converterPriority||"normal"}),e.on(`addMarker:${n.model}`,Iv(n.view),{priority:n.converterPriority||"normal"}),e.on(`removeMarker:${n.model}`,Rv(n.view),{priority:n.converterPriority||"normal"})}}function Pc(n){return typeof n=="string"&&(n={name:n}),n.attributes?Array.isArray(n.attributes)||(n.attributes=[n.attributes]):n.attributes=[],n.children=!!n.children,n}function Oi(n,e){return typeof n=="function"?n:(t,i)=>Lv(n,i,e)}function Lv(n,e,t){typeof n=="string"&&(n={name:n});let i;const s=e.writer,r=Object.assign({},n.attributes);if(t=="container")i=s.createContainerElement(n.name,r);else if(t=="attribute"){const o={priority:n.priority||St.DEFAULT_PRIORITY};i=s.createAttributeElement(n.name,r,o)}else i=s.createUIElement(n.name,r);if(n.styles){const o=Object.keys(n.styles);for(const a of o)s.setStyle(a,n.styles[a],i)}if(n.classes){const o=n.classes;if(typeof o=="string")s.addClass(o,i);else for(const a of o)s.addClass(a,i)}return i}function Sc(n){return n.model.values?(e,t,i)=>{const s=n.view[e];return s?s(e,t,i):null}:n.view}function xc(n){return typeof n=="string"?e=>({key:n,value:e}):typeof n=="object"?n.value?()=>n:e=>({key:n.key,value:e}):n}function sr(n,e,t){const i=typeof n=="function"?n(e,t):n;return i?(i.priority||(i.priority=10),i.id||(i.id=e.markerName),i):null}function $v(n){return(e,t)=>{if(!e.is("element",n.name))return!1;if(t.type=="attribute"){if(n.attributes.includes(t.attributeKey))return!0}else{/* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */if(n.children)return!0}return!1}}function Ic(n){const e=$v(n);return(t,i)=>{const s=[];i.reconvertedElements||(i.reconvertedElements=new Set);for(const r of i.changes){const o=r.type=="attribute"?r.range.start.nodeAfter:r.position.parent;if(!o||!e(o,r)){s.push(r);continue}if(!i.reconvertedElements.has(o)){i.reconvertedElements.add(o);const a=w._createBefore(o);let l=s.length;for(let c=s.length-1;c>=0;c--){const u=s[c],f=(u.type=="attribute"?u.range.start:u.position).compareWith(a);if(f=="before"||u.type=="remove"&&f=="same")break;l=c}s.splice(l,0,{type:"remove",name:o.name,position:a,length:1},{type:"reinsert",name:o.name,position:a,length:1})}}i.changes=s}}function Rc(n){return(e,t,i={})=>{const s=["insert"];for(const r of n.attributes)e.hasAttribute(r)&&s.push(`attribute:${r}`);return s.every(r=>t.test(e,r))?(i.preflight||s.forEach(r=>t.consume(e,r)),!0):!1}}function zv(n,e,t){return(i,s)=>{const r=i.createContainerElement("$slot");let o=null;if(s==="children")o=Array.from(n.getChildren());else if(typeof s=="function")o=Array.from(n.getChildren()).filter(a=>s(a));else throw new d("conversion-slot-mode-unknown",t.dispatcher,{modeOrFilter:s});return e.set(r,o),r}}function Hv(n,e,t){const i=Array.from(e.values()).flat(),s=new Set(i);if(s.size!=i.length)throw new d("conversion-slot-filter-overlap",t.dispatcher,{element:n});if(s.size!=n.childCount)throw new d("conversion-slot-filter-incomplete",t.dispatcher,{element:n})}function Wv(n,e,t,i){t.mapper.on("modelToViewPosition",o,{priority:"highest"});let s=null,r=null;for([s,r]of e)Oc(n,r,t,i),t.writer.move(t.writer.createRangeIn(s),t.writer.createPositionBefore(s)),t.writer.remove(s);t.mapper.off("modelToViewPosition",o);function o(a,l){const c=l.modelPosition.nodeAfter,u=r.indexOf(c);u<0||(l.viewPosition=l.mapper.findPositionIn(s,u))}}function Oc(n,e,t,i){for(const s of e)Uv(n.root,s,t,i)||t.convertItem(s)}function Uv(n,e,t,i){const{writer:s,mapper:r}=t;if(!i.reconversion)return!1;const o=r.toViewElement(e);return!o||o.root==n||!t.canReuseView(o)?!1:(s.move(s.createRangeOn(o),r.toViewPosition(w._createBefore(e))),!0)}function jv(n,e,{preflight:t}={}){return t?e.test(n,"insert"):e.consume(n,"insert")}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Mc(n){const{schema:e,document:t}=n.model;for(const i of t.getRootNames()){const s=t.getRoot(i);if(s.isEmpty&&!e.checkChild(s,"$text")&&e.checkChild(s,"paragraph"))return n.insertElement("paragraph",s),!0}return!1}function Vc(n,e,t){const i=t.createContext(n);return!(!t.checkChild(i,"paragraph")||!t.checkChild(i.push("paragraph"),e))}function Dc(n,e){const t=e.createElement("paragraph");return e.insert(t,n),e.createPositionAt(t,0)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class qv extends kc{elementToElement(e){return this.add(Fc(e))}elementToAttribute(e){return this.add(Jv(e))}attributeToAttribute(e){return this.add(Zv(e))}elementToMarker(e){return this.add(Yv(e))}dataToMarker(e){return this.add(Xv(e))}}function Bc(){return(n,e,t)=>{if(!e.modelRange&&t.consumable.consume(e.viewItem,{name:!0})){const{modelRange:i,modelCursor:s}=t.convertChildren(e.viewItem,e.modelCursor);e.modelRange=i,e.modelCursor=s}}}function Gv(){return(n,e,{schema:t,consumable:i,writer:s})=>{let r=e.modelCursor;if(!i.test(e.viewItem))return;if(!t.checkChild(r,"$text")){if(!Vc(r,"$text",t)||e.viewItem.data.trim().length==0)return;const a=r.nodeBefore;r=Dc(r,s),a&&a.is("element","$marker")&&(s.move(s.createRangeOn(a),r),r=s.createPositionAfter(a))}i.consume(e.viewItem);const o=s.createText(e.viewItem.data);s.insert(o,r),e.modelRange=s.createRange(r,r.getShiftedBy(o.offsetSize)),e.modelCursor=e.modelRange.end}}function Kv(n,e){return(t,i)=>{const s=i.newSelection,r=[];for(const a of s.getRanges())r.push(e.toModelRange(a));const o=n.createSelection(r,{backward:s.isBackward});o.isEqual(n.document.selection)||n.change(a=>{a.setSelection(o)})}}function Fc(n){n=Ze(n);const e=or(n),t=rr(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"normal"})}}function Jv(n){n=Ze(n),Nc(n);const e=Lc(n,!1),t=rr(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"low"})}}function Zv(n){n=Ze(n);let e=null;(typeof n.view=="string"||n.view.key)&&(e=ty(n)),Nc(n,e);const t=Lc(n,!0);return i=>{i.on("element",t,{priority:n.converterPriority||"low"})}}function Yv(n){const e=sy(n.model);return Fc({...n,model:e})}function Xv(n){n=Ze(n),n.model||(n.model=s=>s?n.view+":"+s:n.view);const e={view:n.view,model:n.model},t=or($c(e,"start")),i=or($c(e,"end"));return s=>{s.on(`element:${n.view}-start`,t,{priority:n.converterPriority||"normal"}),s.on(`element:${n.view}-end`,i,{priority:n.converterPriority||"normal"});const r=pe.low,o=pe.highest,a=pe.get(n.converterPriority)/o;s.on("element",Qv(e),{priority:r+a})}}function Qv(n){return(e,t,i)=>{const s=`data-${n.view}`;if(!i.consumable.test(t.viewItem,{attributes:s+"-end-after"})&&!i.consumable.test(t.viewItem,{attributes:s+"-start-after"})&&!i.consumable.test(t.viewItem,{attributes:s+"-end-before"})&&!i.consumable.test(t.viewItem,{attributes:s+"-start-before"}))return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor)),i.consumable.consume(t.viewItem,{attributes:s+"-end-after"})&&r(t.modelRange.end,t.viewItem.getAttribute(s+"-end-after").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-start-after"})&&r(t.modelRange.end,t.viewItem.getAttribute(s+"-start-after").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-end-before"})&&r(t.modelRange.start,t.viewItem.getAttribute(s+"-end-before").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-start-before"})&&r(t.modelRange.start,t.viewItem.getAttribute(s+"-start-before").split(","));function r(o,a){for(const l of a){const c=n.model(l,i),u=i.writer.createElement("$marker",{"data-name":c});i.writer.insert(u,o),t.modelCursor.isEqual(o)?t.modelCursor=t.modelCursor.getShiftedBy(1):t.modelCursor=t.modelCursor._getTransformedByInsertion(o,1),t.modelRange=t.modelRange._getTransformedByInsertion(o,1)[0]}}}}function rr(n){return typeof n=="string"?n:typeof n=="object"&&typeof n.name=="string"?n.name:null}function or(n){const e=new Zt(n.view);return(t,i,s)=>{const r=e.match(i.viewItem);if(!r)return;const o=r.match;if(o.name=!0,!s.consumable.test(i.viewItem,o))return;const a=ey(n.model,i.viewItem,s);a&&s.safeInsert(a,i.modelCursor)&&(s.consumable.consume(i.viewItem,o),s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i))}}function ey(n,e,t){return n instanceof Function?n(e,t):t.writer.createElement(n)}function ty(n){typeof n.view=="string"&&(n.view={key:n.view});const e=n.view.key;let t;if(e=="class"||e=="style")t={[e=="class"?"classes":"styles"]:n.view.value};else{const i=typeof n.view.value>"u"?/[\s\S]*/:n.view.value;t={attributes:{[e]:i}}}return n.view.name&&(t.name=n.view.name),n.view=t,e}function Nc(n,e=null){const t=e===null?!0:r=>r.getAttribute(e),i=typeof n.model!="object"?n.model:n.model.key,s=typeof n.model!="object"||typeof n.model.value>"u"?t:n.model.value;n.model={key:i,value:s}}function Lc(n,e){const t=new Zt(n.view);return(i,s,r)=>{if(!s.modelRange&&e)return;const o=t.match(s.viewItem);if(!o||(iy(n.view,s.viewItem)?o.match.name=!0:delete o.match.name,!r.consumable.test(s.viewItem,o.match)))return;const a=n.model.key,l=typeof n.model.value=="function"?n.model.value(s.viewItem,r):n.model.value;if(l===null)return;s.modelRange||Object.assign(s,r.convertChildren(s.viewItem,s.modelCursor)),ny(s.modelRange,{key:a,value:l},e,r)&&(r.consumable.test(s.viewItem,{name:!0})&&(o.match.name=!0),r.consumable.consume(s.viewItem,o.match))}}function iy(n,e){const t=typeof n=="function"?n(e):n;return typeof t=="object"&&!rr(t)?!1:!t.classes&&!t.attributes&&!t.styles}function ny(n,e,t,i){let s=!1;for(const r of Array.from(n.getItems({shallow:t})))i.schema.checkAttribute(r,e.key)&&(s=!0,!r.hasAttribute(e.key)&&i.writer.setAttribute(e.key,e.value,r));return s}function sy(n){return(e,t)=>{const i=typeof n=="string"?n:n(e,t);return t.writer.createElement("$marker",{"data-name":i})}}function $c(n,e){const t=(i,s)=>{const r=i.getAttribute("name"),o=n.model(r,s);return s.writer.createElement("$marker",{"data-name":o})};return{view:`${n.view}-${e}`,model:t}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function ry(n){n.document.registerPostFixer(e=>oy(e,n))}function oy(n,e){const t=e.document.selection,i=e.schema,s=[];let r=!1;for(const o of t.getRanges()){const a=zc(o,i);a&&!a.isEqual(o)?(s.push(a),r=!0):s.push(o)}return r&&n.setSelection(uy(s),{backward:t.isBackward}),!1}function zc(n,e){return n.isCollapsed?ay(n,e):ly(n,e)}function ay(n,e){const t=n.start,i=e.getNearestSelectionRange(t);if(!i){const r=t.getAncestors().reverse().find(o=>e.isObject(o));return r?g._createOn(r):null}if(!i.isCollapsed)return i;const s=i.start;return t.isEqual(s)?null:new g(s)}function ly(n,e){const{start:t,end:i}=n,s=e.checkChild(t,"$text"),r=e.checkChild(i,"$text"),o=e.getLimitElement(t),a=e.getLimitElement(i);if(o===a){if(s&&r)return null;if(cy(t,i,e)){const h=t.nodeAfter&&e.isSelectable(t.nodeAfter)?null:e.getNearestSelectionRange(t,"forward"),m=i.nodeBefore&&e.isSelectable(i.nodeBefore)?null:e.getNearestSelectionRange(i,"backward"),p=h?h.start:t,b=m?m.end:i;return new g(p,b)}}const l=o&&!o.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const u=t.nodeAfter&&i.nodeBefore&&t.nodeAfter.parent===i.nodeBefore.parent,h=l&&(!u||!Wc(t.nodeAfter,e)),f=c&&(!u||!Wc(i.nodeBefore,e));let m=t,p=i;return h&&(m=w._createBefore(Hc(o,e))),f&&(p=w._createAfter(Hc(a,e))),new g(m,p)}return null}function Hc(n,e){let t=n,i=t;for(;e.isLimit(i)&&i.parent;)t=i,i=i.parent;return t}function cy(n,e,t){const i=n.nodeAfter&&!t.isLimit(n.nodeAfter)||t.checkChild(n,"$text"),s=e.nodeBefore&&!t.isLimit(e.nodeBefore)||t.checkChild(e,"$text");return i||s}function uy(n){const e=[...n],t=new Set;let i=1;for(;i<e.length;){const r=e[i],o=e.slice(0,i);for(const[a,l]of o.entries())if(!t.has(a)){if(r.isEqual(l))t.add(a);else if(r.isIntersecting(l)){t.add(a),t.add(i);const c=r.getJoined(l);e.push(c)}}i++}return e.filter((r,o)=>!t.has(o))}function Wc(n,e){return n&&e.isSelectable(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class hy extends H(){constructor(e,t){super(),this.model=e,this.view=new Q1(t),this.mapper=new wc,this.downcastDispatcher=new bc({mapper:this.mapper,schema:e.schema});const i=this.model.document,s=i.selection,r=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(o=>{this.downcastDispatcher.convertChanges(i.differ,r,o),this.downcastDispatcher.convertSelection(s,r,o)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",Kv(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",dy(this.mapper,this.model.schema,this.view),{priority:"high"}),this.downcastDispatcher.on("insert:$text",Cc(),{priority:"lowest"}),this.downcastDispatcher.on("insert",Ec(),{priority:"lowest"}),this.downcastDispatcher.on("remove",gv(),{priority:"low"}),this.downcastDispatcher.on("selection",bv(),{priority:"high"}),this.downcastDispatcher.on("selection",pv(),{priority:"low"}),this.downcastDispatcher.on("selection",wv(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(o=>{if(o.rootName=="$graveyard")return null;const a=new jl(this.view.document,o.name);return a.rootName=o.rootName,this.mapper.bindElements(o,a),a})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,i=this.model.markers.get(t);if(!i)throw new d("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(i)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}function dy(n,e,t){return(i,s)=>{if(!(t.document.isComposing&&!x.isAndroid))for(let r=0;r<s.targetRanges.length;r++){const o=s.targetRanges[r],a=n.toModelRange(o),l=zc(a,e);!l||l.isEqual(a)||(s.targetRanges[r]=n.toViewRange(l))}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Mi{constructor(){this._consumables=new Map}add(e,t){let i;if(e.is("$text")||e.is("documentFragment")){this._consumables.set(e,!0);return}this._consumables.has(e)?i=this._consumables.get(e):(i=new fy(e),this._consumables.set(e,i)),i.add(t)}test(e,t){const i=this._consumables.get(e);return i===void 0?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return this.test(e,t)?(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0):!1}revert(e,t){const i=this._consumables.get(e);i!==void 0&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const o of i)o=="style"||o=="class"||t.attributes.push(o);const s=e.getClassNames();for(const o of s)t.classes.push(o);const r=e.getStyleNames();for(const o of r)t.styles.push(o);return t}static createFrom(e,t){if(t||(t=new Mi),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,Mi.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=Mi.createFrom(i,t);return t}}const kn=["attributes","classes","styles"];class fy{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 of kn)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of kn)if(t in e){const i=this._test(t,e[t]);if(i!==!0)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of kn)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of kn)t in e&&this._revert(t,e[t])}_add(e,t){const i=he(t)?t:[t],s=this._consumables[e];for(const r of i){if(e==="attributes"&&(r==="class"||r==="style"))throw new d("viewconsumable-invalid-attribute",this);if(s.set(r,!0),e==="styles")for(const o of this.element.document.stylesProcessor.getRelatedStyles(r))s.set(o,!0)}}_test(e,t){const i=he(t)?t:[t],s=this._consumables[e];for(const r of i)if(e==="attributes"&&(r==="class"||r==="style")){const o=r=="class"?"classes":"styles",a=this._test(o,[...this._consumables[o].keys()]);if(a!==!0)return a}else{const o=s.get(r);if(o===void 0)return null;if(!o)return!1}return!0}_consume(e,t){const i=he(t)?t:[t],s=this._consumables[e];for(const r of i)if(e==="attributes"&&(r==="class"||r==="style")){const o=r=="class"?"classes":"styles";this._consume(o,[...this._consumables[o].keys()])}else if(s.set(r,!1),e=="styles")for(const o of this.element.document.stylesProcessor.getRelatedStyles(r))s.set(o,!1)}_revert(e,t){const i=he(t)?t:[t],s=this._consumables[e];for(const r of i)if(e==="attributes"&&(r==="class"||r==="style")){const o=r=="class"?"classes":"styles";this._revert(o,[...this._consumables[o].keys()])}else s.get(r)===!1&&s.set(r,!0)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class my extends H(){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new Mt(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Mt(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new d("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new d("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return typeof e=="string"?t=e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?t="$text":t=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):!1}isObject(e){const t=this.getDefinition(e);return t?!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent):!1}isInline(e){const t=this.getDefinition(e);return!!(t&&t.isInline)}isSelectable(e){const t=this.getDefinition(e);return t?!!(t.isSelectable||t.isObject):!1}isContent(e){const t=this.getDefinition(e);return t?!!(t.isContent||t.isObject):!1}checkChild(e,t){return t?this._checkContextMatch(t,e):!1}checkAttribute(e,t){const i=this.getDefinition(e.last);return i?i.allowAttributes.includes(t):!1}checkMerge(e,t){if(e instanceof w){const i=e.nodeBefore,s=e.nodeAfter;if(!(i instanceof F))throw new d("schema-check-merge-no-element-before",this);if(!(s instanceof F))throw new d("schema-check-merge-no-element-after",this);return this.checkMerge(i,s)}for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[i,s])=>{if(!s)return;const r=e(i,s);typeof r=="boolean"&&(t.stop(),t.return=r)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[i,s])=>{const r=e(i,s);typeof r=="boolean"&&(t.stop(),t.return=r)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(e instanceof w?t=e.parent:t=(e instanceof g?[e]:Array.from(e.getRanges())).reduce((s,r)=>{const o=r.getCommonAncestor();return s?s.getCommonAncestor(o,{includeSelf:!0}):o},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const s=[...e.getFirstPosition().getAncestors(),new q("",e.getAttributes())];return this.checkAttribute(s,t)}else{const i=e.getRanges();for(const s of i)for(const r of s)if(this.checkAttribute(r.item,t))return!0}return!1}*getValidRanges(e,t){e=Iy(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new g(e);let i,s;const r=e.getAncestors().reverse().find(o=>this.isLimit(o))||e.root;(t=="both"||t=="backward")&&(i=new ht({boundaries:g._createIn(r),startPosition:e,direction:"backward"})),(t=="both"||t=="forward")&&(s=new ht({boundaries:g._createIn(r),startPosition:e}));for(const o of xy(i,s)){const a=o.walker==i?"elementEnd":"elementStart",l=o.value;if(l.type==a&&this.isObject(l.item))return g._createOn(l.item);if(this.checkChild(l.nextPosition,"$text"))return new g(l.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}setAllowedAttributes(e,t,i){const s=i.model;for(const[r,o]of Object.entries(t))s.schema.checkAttribute(e,r)&&i.setAttribute(r,o,e)}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))Uc(this,i,t);else{const r=g._createIn(i).getPositions();for(const o of r){const a=o.nodeBefore||o.parent;Uc(this,a,t)}}}getAttributesWithProperty(e,t,i){const s={};for(const[r,o]of e.getAttributes()){const a=this.getAttributeProperties(r);a[t]!==void 0&&(i===void 0||i===a[t])&&(s[r]=o)}return s}createContext(e){return new Mt(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const s of i)e[s]=gy(t[s],s);for(const s of i)py(e,s);for(const s of i)wy(e,s);for(const s of i)by(e,s);for(const s of i)_y(e,s),vy(e,s);for(const s of i)yy(e,s),ky(e,s),Cy(e,s);this._compiledDefinitions=e}_checkContextMatch(e,t,i=t.length-1){const s=t.getItem(i);if(e.allowIn.includes(s.name)){if(i==0)return!0;{const r=this.getDefinition(s);return this._checkContextMatch(r,t,i-1)}}else return!1}*_getValidRangesForRange(e,t){let i=e.start,s=e.start;for(const r of e.getItems({shallow:!0}))r.is("element")&&(yield*this._getValidRangesForRange(g._createIn(r),t)),this.checkAttribute(r,t)||(i.isEqual(s)||(yield new g(i,s)),i=w._createAfter(r)),s=w._createAfter(r);i.isEqual(s)||(yield new g(i,s))}}class Mt{constructor(e){if(e instanceof Mt)return e;let t;typeof e=="string"?t=[e]:Array.isArray(e)?t=e:t=e.getAncestors({includeSelf:!0}),this._items=t.map(Sy)}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 Mt([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 gy(n,e){const t={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return Ey(n,t),Vt(n,t,"allowIn"),Vt(n,t,"allowContentOf"),Vt(n,t,"allowWhere"),Vt(n,t,"allowAttributes"),Vt(n,t,"allowAttributesOf"),Vt(n,t,"allowChildren"),Vt(n,t,"inheritTypesFrom"),Ay(n,t),t}function py(n,e){const t=n[e];for(const i of t.allowChildren){const s=n[i];s&&s.allowIn.push(e)}t.allowChildren.length=0}function wy(n,e){for(const t of n[e].allowContentOf)n[t]&&Ty(n,t).forEach(s=>{s.allowIn.push(e)});delete n[e].allowContentOf}function by(n,e){for(const t of n[e].allowWhere){const i=n[t];if(i){const s=i.allowIn;n[e].allowIn.push(...s)}}delete n[e].allowWhere}function _y(n,e){for(const t of n[e].allowAttributesOf){const i=n[t];if(i){const s=i.allowAttributes;n[e].allowAttributes.push(...s)}}delete n[e].allowAttributesOf}function vy(n,e){const t=n[e];for(const i of t.inheritTypesFrom){const s=n[i];if(s){const r=Object.keys(s).filter(o=>o.startsWith("is"));for(const o of r)o in t||(t[o]=s[o])}}delete t.inheritTypesFrom}function yy(n,e){const t=n[e],i=t.allowIn.filter(s=>n[s]);t.allowIn=Array.from(new Set(i))}function ky(n,e){const t=n[e];for(const i of t.allowIn)n[i].allowChildren.push(e)}function Cy(n,e){const t=n[e];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function Ey(n,e){for(const t of n){const i=Object.keys(t).filter(s=>s.startsWith("is"));for(const s of i)e[s]=!!t[s]}}function Vt(n,e,t){for(const i of n){const s=i[t];typeof s=="string"?e[t].push(s):Array.isArray(s)&&e[t].push(...s)}}function Ay(n,e){for(const t of n){const i=t.inheritAllFrom;i&&(e.allowContentOf.push(i),e.allowWhere.push(i),e.allowAttributesOf.push(i),e.inheritTypesFrom.push(i))}}function Ty(n,e){const t=n[e];return Py(n).filter(i=>i.allowIn.includes(t.name))}function Py(n){return Object.keys(n).map(e=>n[e])}function Sy(n){return typeof n=="string"||n.is("documentFragment")?{name:typeof n=="string"?n:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:n.is("element")?n.name:"$text",*getAttributeKeys(){yield*n.getAttributeKeys()},getAttribute(e){return n.getAttribute(e)}}}function*xy(n,e){let t=!1;for(;!t;){if(t=!0,n){const i=n.next();i.done||(t=!1,yield{walker:n,value:i.value})}if(e){const i=e.next();i.done||(t=!1,yield{walker:e,value:i.value})}}}function*Iy(n){for(const e of n)yield*e.getMinimalFlatRanges()}function Uc(n,e,t){for(const i of e.getAttributeKeys())n.checkAttribute(e,i)||t.removeAttribute(i,e)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ry extends L(){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(t,i)=>this._convertItem(t,i),convertChildren:(t,i)=>this._convertChildren(t,i),safeInsert:(t,i)=>this._safeInsert(t,i),updateConversionResult:(t,i)=>this._updateConversionResult(t,i),splitToAllowedParent:(t,i)=>this._splitToAllowedParent(t,i),getSplitParts:t=>this._getSplitParts(t),keepEmptyElement:t=>this._keepEmptyElement(t)}}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=My(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=Mi.createFrom(e),this.conversionApi.store={};const{modelRange:s}=this._convertItem(e,this._modelCursor),r=t.createDocumentFragment();if(s){this._removeEmptyElements();for(const o of Array.from(this._modelCursor.parent.getChildren()))t.append(o,r);r.markers=Oy(r,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,r}_convertItem(e,t){const i={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof g))throw new d("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:w._createAt(t,0);const s=new g(i);for(const r of Array.from(e.getChildren())){const o=this._convertItem(r,i);o.modelRange instanceof g&&(s.end=o.modelRange.end,i=o.modelCursor)}return{modelRange:s,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return i?(this.conversionApi.writer.insert(e,i.position),!0):!1}_updateConversionResult(e,t){const i=this._getSplitParts(e),s=this.conversionApi.writer;t.modelRange||(t.modelRange=s.createRange(s.createPositionBefore(e),s.createPositionAfter(i[i.length-1])));const r=this._cursorParents.get(e);r?t.modelCursor=s.createPositionAt(r,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:s}=this.conversionApi;let r=i.findAllowedParent(t,e);if(r){if(r===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(r)&&(r=null)}if(!r)return Vc(t,e,i)?{position:Dc(t,s)}:null;const o=this.conversionApi.writer.split(t,r),a=[];for(const c of o.range.getWalker())if(c.type=="elementEnd")a.push(c.item);else{const u=a.pop(),h=c.item;this._registerSplitPair(u,h)}const l=o.range.end.parent;return this._cursorParents.set(e,l),{position:o.position,cursorParent:l}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return this._splitParts.has(e)?t=this._splitParts.get(e):t=[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}function Oy(n,e){const t=new Set,i=new Map,s=g._createIn(n).getItems();for(const r of s)r.is("element","$marker")&&t.add(r);for(const r of t){const o=r.getAttribute("data-name"),a=e.createPositionBefore(r);i.has(o)?i.get(o).end=a.clone():i.set(o,new g(a.clone())),e.remove(r)}return i}function My(n,e){let t;for(const i of new Mt(n)){const s={};for(const o of i.getAttributeKeys())s[o]=i.getAttribute(o);const r=e.createElement(i.name,s);t&&e.insert(r,t),t=w._createAt(r,0)}return t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Vy{getHtml(e){const i=document.implementation.createHTMLDocument("").createElement("div");return i.appendChild(e),i.innerHTML}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Dy{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new ac(e,{renderingMode:"data"}),this.htmlWriter=new Vy}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e=="marked"?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),s=t.body.childNodes;for(;s.length>0;)i.appendChild(s[0]);return i}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class By extends L(){constructor(e,t){super(),this.model=e,this.mapper=new wc,this.downcastDispatcher=new bc({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",Cc(),{priority:"lowest"}),this.downcastDispatcher.on("insert",Ec(),{priority:"lowest"}),this.upcastDispatcher=new Ry({schema:e.schema}),this.viewDocument=new Gl(t),this.stylesProcessor=t,this.htmlProcessor=new Dy(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Jl(this.viewDocument),this.upcastDispatcher.on("text",Gv(),{priority:"lowest"}),this.upcastDispatcher.on("element",Bc(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",Bc(),{priority:"lowest"}),H().prototype.decorate.call(this,"init"),H().prototype.decorate.call(this,"set"),H().prototype.decorate.call(this,"get"),H().prototype.decorate.call(this,"toView"),H().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},Mc)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new d("datacontroller-get-non-existent-root",this);const s=this.model.document.getRoot(t);return s.isAttached()||G("datacontroller-get-detached-root",this),i==="empty"&&!this.model.hasContent(s,{ignoreWhitespaces:!0})?"":this.stringify(s,e)}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,s=this._viewWriter;this.mapper.clearBindings();const r=g._createIn(e),o=new xt(i);this.mapper.bindElements(e,o);const a=e.is("documentFragment")?e.markers:Fy(e);return this.downcastDispatcher.convert(r,a,s,t),o}init(e){if(this.model.document.version)throw new d("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new d("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},i=>{for(const s of Object.keys(t)){const r=this.model.document.getRoot(s);i.insert(this.parse(t[s],r),r,0)}}),Promise.resolve()}set(e,t={}){let i={};if(typeof e=="string"?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new d("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},s=>{s.setSelection(null),s.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const r of Object.keys(i)){const o=this.model.document.getRoot(r);s.remove(s.createRangeIn(o)),s.insert(this.parse(i[r],o),o,0)}})}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}function Fy(n){const e=[],t=n.root.document;if(!t)return new Map;const i=g._createIn(n);for(const s of t.model.markers){const r=s.getRange(),o=r.isCollapsed,a=r.start.isEqual(i.start)||r.end.isEqual(i.end);if(o&&a)e.push([s.name,r]);else{const l=i.getIntersection(r);l&&e.push([s.name,l])}}return e.sort(([s,r],[o,a])=>{if(r.end.compareWith(a.start)!=="after")return 1;if(r.start.compareWith(a.end)!=="before")return-1;switch(r.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(r.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return o.localeCompare(s)}}}),new Map(e)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ny{constructor(e,t){this._helpers=new Map,this._downcast=X(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=X(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new d("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new d("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of ar(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of ar(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of ar(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new d("conversion-group-exists",this);const s=i?new mv(t):new qv(t);this._helpers.set(e,s)}}function*ar(n){if(n.model.values)for(const e of n.model.values){const t={key:n.model.key,value:e},i=n.view[e],s=n.upcastAlso?n.upcastAlso[e]:void 0;yield*jc(t,i,s)}else yield*jc(n.model,n.view,n.upcastAlso)}function*jc(n,e,t){if(yield{model:n,view:e},t)for(const i of X(t))yield{model:n,view:i}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ye{constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,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,t){return new this(e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function lr(n,e){const t=Gc(e),i=t.reduce((o,a)=>o+a.offsetSize,0),s=n.parent;Bi(n);const r=n.index;return s._insertChild(r,t),Di(s,r+t.length),Di(s,r),new g(n,n.getShiftedBy(i))}function qc(n){if(!n.isFlat)throw new d("operation-utils-remove-range-not-flat",this);const e=n.start.parent;Bi(n.start),Bi(n.end);const t=e._removeChildren(n.start.index,n.end.index-n.start.index);return Di(e,n.start.index),t}function Vi(n,e){if(!n.isFlat)throw new d("operation-utils-move-range-not-flat",this);const t=qc(n);return e=e._getTransformedByDeletion(n.start,n.end.offset-n.start.offset),lr(e,t)}function Ly(n,e,t){Bi(n.start),Bi(n.end);for(const i of n.getItems({shallow:!0})){const s=i.is("$textProxy")?i.textNode:i;t!==null?s._setAttribute(e,t):s._removeAttribute(e),Di(s.parent,s.index)}Di(n.end.parent,n.end.index)}function Gc(n){const e=[];function t(i){if(typeof i=="string")e.push(new q(i));else if(i instanceof Ve)e.push(new q(i.data,i.getAttributes()));else if(i instanceof Rt)e.push(i);else if(we(i))for(const s of i)t(s)}t(n);for(let i=1;i<e.length;i++){const s=e[i],r=e[i-1];s instanceof q&&r instanceof q&&Kc(s,r)&&(e.splice(i-1,2,new q(r.data+s.data,r.getAttributes())),i--)}return e}function Di(n,e){const t=n.getChild(e-1),i=n.getChild(e);if(t&&i&&t.is("$text")&&i.is("$text")&&Kc(t,i)){const s=new q(t.data+i.data,t.getAttributes());n._removeChildren(e-1,2),n._insertChild(e-1,s)}}function Bi(n){const e=n.textNode,t=n.parent;if(e){const i=n.offset-e.startOffset,s=e.index;t._removeChildren(s,1);const r=new q(e.data.substr(0,i),e.getAttributes()),o=new q(e.data.substr(i),e.getAttributes());t._insertChild(s,[r,o])}}function Kc(n,e){const t=n.getAttributes(),i=e.getAttributes();for(const s of t){if(s[1]!==e.getAttribute(s[0]))return!1;i.next()}return i.next().done}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class V extends ye{constructor(e,t,i,s){super(s),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[g._createFromPositionAndShift(this.sourcePosition,this.howMany),g._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new V(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new V(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,s=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new d("move-operation-nodes-do-not-exist",this);if(e===t&&i<s&&s<i+this.howMany)throw new d("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&ue(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const r=this.sourcePosition.path.length-1;if(this.targetPosition.path[r]>=i&&this.targetPosition.path[r]<i+this.howMany)throw new d("move-operation-node-into-itself",this)}}_execute(){Vi(g._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=w.fromJSON(e.sourcePosition,t),s=w.fromJSON(e.targetPosition,t);return new this(i,e.howMany,s,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class se extends ye{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new xi(Gc(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new xi([...this.nodes].map(i=>i._clone(!0))),t=new se(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new w(e,[0]);return new V(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new d("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new xi([...e].map(t=>t._clone(!0))),lr(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const r of e.nodes)r.name?i.push(F.fromJSON(r)):i.push(q.fromJSON(r));const s=new se(w.fromJSON(e.position,t),i,e.baseVersion);return s.shouldReceiveAttributes=e.shouldReceiveAttributes,s}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class N extends ye{constructor(e,t,i,s,r){super(r),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=s?s.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 w(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new g(this.splitPosition,e)}get affectedSelectable(){const e=[g._createFromPositionAndShift(this.splitPosition,0),g._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(g._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new N(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new w(e,[0]);return new ee(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new d("split-operation-position-invalid",this);if(e.parent){if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new d("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new d("split-operation-graveyard-position-invalid",this)}else throw new d("split-operation-split-in-root",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Vi(g._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const i=e._clone();lr(this.insertionPosition,i)}const t=new g(w._createAt(e,this.splitPosition.offset),w._createAt(e,e.maxOffset));Vi(t,this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new w(e.root,t,"toPrevious")}static fromJSON(e,t){const i=w.fromJSON(e.splitPosition,t),s=w.fromJSON(e.insertionPosition,t),r=e.graveyardPosition?w.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,s,r,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ee extends ye{constructor(e,t,i,s,r){super(r),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=s.clone()}get type(){return"merge"}get deletionPosition(){return new w(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new g(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[g._createOn(e),g._createFromPositionAndShift(this.targetPosition,0),g._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new ee(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new w(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new N(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(e.parent)if(t.parent){if(this.howMany!=e.maxOffset)throw new d("merge-operation-how-many-invalid",this)}else throw new d("merge-operation-target-position-invalid",this);else throw new d("merge-operation-source-position-invalid",this)}_execute(){const e=this.sourcePosition.parent,t=g._createIn(e);Vi(t,this.targetPosition),Vi(g._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=w.fromJSON(e.sourcePosition,t),s=w.fromJSON(e.targetPosition,t),r=w.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,s,r,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class me extends ye{constructor(e,t,i,s,r,o){super(o),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=r,this._markers=s}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new me(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new me(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}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 me(e.name,e.oldRange?g.fromJSON(e.oldRange,t):null,e.newRange?g.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class te extends ye{constructor(e,t,i,s,r){super(r),this.range=e.clone(),this.key=t,this.oldValue=i===void 0?null:i,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new te(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new te(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new d("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!rn(e.getAttribute(this.key),this.oldValue))throw new d("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new d("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){rn(this.oldValue,this.newValue)||Ly(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new te(g.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ne extends ye{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new ne(this.baseVersion)}getReversed(){return new ne(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ge extends ye{constructor(e,t,i,s){super(s),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new ge(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new ge(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(e instanceof F){if(e.name!==this.oldName)throw new d("rename-operation-wrong-name",this)}else throw new d("rename-operation-wrong-position",this)}_execute(){const e=this.position.nodeAfter;e.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 ge(w.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Qe extends ye{constructor(e,t,i,s,r){super(r),this.root=e,this.key=t,this.oldValue=i===void 0?null:i,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new Qe(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Qe(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new d("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new d("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new d("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?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 d("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Qe(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ze extends ye{constructor(e,t,i,s,r){if(super(r),this.rootName=e,this.elementName=t,this.isAdd=i,this._document=s,!this._document.getRoot(this.rootName)){const o=this._document.createRoot(this.elementName,this.rootName);o._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new ze(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new ze(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_validate(){const e=this._document.getRoot(this.rootName);if(e.isAttached()&&this.isAdd)throw new d("root-operation-root-attached",this);if(!e.isAttached()&&!this.isAdd)throw new d("root-operation-root-detached",this)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new ze(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Ae={};Ae[te.className]=te,Ae[se.className]=se,Ae[me.className]=me,Ae[V.className]=V,Ae[ne.className]=ne,Ae[ye.className]=ye,Ae[ge.className]=ge,Ae[Qe.className]=Qe,Ae[ze.className]=ze,Ae[N.className]=N,Ae[ee.className]=ee;class $y{static fromJSON(e,t){return Ae[e.__className].fromJSON(e,t)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const cr=new Map;function M(n,e,t){let i=cr.get(n);i||(i=new Map,cr.set(n,i)),i.set(e,t)}function zy(n,e){const t=cr.get(n);return t&&t.has(e)?t.get(e):Hy}function Hy(n){return[n]}function Jc(n,e,t={}){const i=zy(n.constructor,e.constructor);try{return n=n.clone(),i(n,e,t)}catch(s){throw s}}function Wy(n,e,t){n=n.slice(),e=e.slice();const i=new Uy(t.document,t.useRelations,t.forceWeakRemove);i.setOriginalOperations(n),i.setOriginalOperations(e);const s=i.originalOperations;if(n.length==0||e.length==0)return{operationsA:n,operationsB:e,originalOperations:s};const r=new WeakMap;for(const l of n)r.set(l,0);const o={nextBaseVersionA:n[n.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:n.length,originalOperationsBCount:e.length};let a=0;for(;a<n.length;){const l=n[a],c=r.get(l);if(c==e.length){a++;continue}const u=e[c],h=Jc(l,u,i.getContext(l,u,!0)),f=Jc(u,l,i.getContext(u,l,!1));i.updateRelation(l,u),i.setOriginalOperations(h,l),i.setOriginalOperations(f,u);for(const m of h)r.set(m,c+f.length);n.splice(a,1,...h),e.splice(c,1,...f)}if(t.padWithNoOps){const l=n.length-o.originalOperationsACount,c=e.length-o.originalOperationsBCount;Yc(n,c-l),Yc(e,l-c)}return Zc(n,o.nextBaseVersionB),Zc(e,o.nextBaseVersionA),{operationsA:n,operationsB:e,originalOperations:s}}class Uy{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const s of e)this.originalOperations.set(s,i||s)}updateRelation(e,t){if(e instanceof V)t instanceof ee?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof V&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof N){if(t instanceof ee)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof V)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const i=g._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const s=i.end.offset-e.splitPosition.offset,r=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:s,offset:r})}}}else if(e instanceof ee)t instanceof ee?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof N&&e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource");else if(e instanceof me){const i=e.newRange;if(!i)return;if(t instanceof V){const s=g._createFromPositionAndShift(t.sourcePosition,t.howMany),r=s.containsPosition(i.start)||s.start.isEqual(i.start),o=s.containsPosition(i.end)||s.end.isEqual(i.end);(r||o)&&!s.containsRange(i)&&this._setRelation(e,t,{side:r?"left":"right",path:r?i.start.path.slice():i.end.path.slice()})}else if(t instanceof ee){const s=i.start.isEqual(t.targetPosition),r=i.start.isEqual(t.deletionPosition),o=i.end.isEqual(t.deletionPosition),a=i.end.isEqual(t.sourcePosition);(s||r||o||a)&&this._setRelation(e,t,{wasInLeftElement:s,wasStartBeforeMergedElement:r,wasEndBeforeMergedElement:o,wasInRightElement:a})}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),s=this._history.getUndoneOperation(i);if(!s)return null;const r=this.originalOperations.get(e),o=this._relations.get(r);return o&&o.get(s)||null}_setRelation(e,t,i){const s=this.originalOperations.get(e),r=this.originalOperations.get(t);let o=this._relations.get(s);o||(o=new Map,this._relations.set(s,o)),o.set(r,i)}}function Zc(n,e){for(const t of n)t.baseVersion=e++}function Yc(n,e){for(let t=0;t<e;t++)n.push(new ne(0))}M(te,te,(n,e,t)=>{if(n.key===e.key&&n.range.start.hasSameParentAs(e.range.start)){const i=n.range.getDifference(e.range).map(r=>new te(r,n.key,n.oldValue,n.newValue,0)),s=n.range.getIntersection(e.range);return s&&t.aIsStrong&&i.push(new te(s,e.key,e.newValue,n.newValue,0)),i.length==0?[new ne(0)]:i}else return[n]}),M(te,se,(n,e)=>{if(n.range.start.hasSameParentAs(e.position)&&n.range.containsPosition(e.position)){const i=n.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(s=>new te(s,n.key,n.oldValue,n.newValue,n.baseVersion));if(e.shouldReceiveAttributes){const s=Xc(e,n.key,n.oldValue);s&&i.unshift(s)}return i}return n.range=n.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[n]});function Xc(n,e,t){const s=n.nodes.getNode(0).getAttribute(e);if(s==t)return null;const r=new g(n.position,n.position.getShiftedBy(n.howMany));return new te(r,e,s,t,0)}M(te,ee,(n,e)=>{const t=[];n.range.start.hasSameParentAs(e.deletionPosition)&&(n.range.containsPosition(e.deletionPosition)||n.range.start.isEqual(e.deletionPosition))&&t.push(g._createFromPositionAndShift(e.graveyardPosition,1));const i=n.range._getTransformedByMergeOperation(e);return i.isCollapsed||t.push(i),t.map(s=>new te(s,n.key,n.oldValue,n.newValue,n.baseVersion))}),M(te,V,(n,e)=>jy(n.range,e).map(i=>new te(i,n.key,n.oldValue,n.newValue,n.baseVersion)));function jy(n,e){const t=g._createFromPositionAndShift(e.sourcePosition,e.howMany);let i=null,s=[];t.containsRange(n,!0)?i=n:n.start.hasSameParentAs(t.start)?(s=n.getDifference(t),i=n.getIntersection(t)):s=[n];const r=[];for(let o of s){o=o._getTransformedByDeletion(e.sourcePosition,e.howMany);const a=e.getMovedRangeStart(),l=o.start.hasSameParentAs(a),c=o._getTransformedByInsertion(a,e.howMany,l);r.push(...c)}return i&&r.push(i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany,!1)[0]),r}M(te,N,(n,e)=>{if(n.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||n.range.end.offset++,[n];if(n.range.start.hasSameParentAs(e.splitPosition)&&n.range.containsPosition(e.splitPosition)){const t=n.clone();return t.range=new g(e.moveTargetPosition.clone(),n.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),n.range.end=e.splitPosition.clone(),n.range.end.stickiness="toPrevious",[n,t]}return n.range=n.range._getTransformedBySplitOperation(e),[n]}),M(se,te,(n,e)=>{const t=[n];if(n.shouldReceiveAttributes&&n.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(n.position)){const i=Xc(n,e.key,e.newValue);i&&t.push(i)}return t}),M(se,se,(n,e,t)=>n.position.isEqual(e.position)&&t.aIsStrong?[n]:(n.position=n.position._getTransformedByInsertOperation(e),[n])),M(se,V,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n])),M(se,N,(n,e)=>(n.position=n.position._getTransformedBySplitOperation(e),[n])),M(se,ee,(n,e)=>(n.position=n.position._getTransformedByMergeOperation(e),[n])),M(me,se,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByInsertOperation(e)[0]),n.newRange&&(n.newRange=n.newRange._getTransformedByInsertOperation(e)[0]),[n])),M(me,me,(n,e,t)=>{if(n.name==e.name)if(t.aIsStrong)n.oldRange=e.newRange?e.newRange.clone():null;else return[new ne(0)];return[n]}),M(me,ee,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByMergeOperation(e)),n.newRange&&(n.newRange=n.newRange._getTransformedByMergeOperation(e)),[n])),M(me,V,(n,e,t)=>{if(n.oldRange&&(n.oldRange=g._createFromRanges(n.oldRange._getTransformedByMoveOperation(e))),n.newRange){if(t.abRelation){const i=g._createFromRanges(n.newRange._getTransformedByMoveOperation(e));if(t.abRelation.side=="left"&&e.targetPosition.isEqual(n.newRange.start))return n.newRange.end=i.end,n.newRange.start.path=t.abRelation.path,[n];if(t.abRelation.side=="right"&&e.targetPosition.isEqual(n.newRange.end))return n.newRange.start=i.start,n.newRange.end.path=t.abRelation.path,[n]}n.newRange=g._createFromRanges(n.newRange._getTransformedByMoveOperation(e))}return[n]}),M(me,N,(n,e,t)=>{if(n.oldRange&&(n.oldRange=n.oldRange._getTransformedBySplitOperation(e)),n.newRange){if(t.abRelation){const i=n.newRange._getTransformedBySplitOperation(e);return n.newRange.start.isEqual(e.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?n.newRange.start=w._createAt(e.insertionPosition):n.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(n.newRange.start=w._createAt(e.moveTargetPosition)),n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?n.newRange.end=w._createAt(e.moveTargetPosition):n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?n.newRange.end=w._createAt(e.insertionPosition):n.newRange.end=i.end,[n]}n.newRange=n.newRange._getTransformedBySplitOperation(e)}return[n]}),M(ee,se,(n,e)=>(n.sourcePosition.hasSameParentAs(e.position)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByInsertOperation(e),n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e),[n])),M(ee,ee,(n,e,t)=>{if(n.sourcePosition.isEqual(e.sourcePosition)&&n.targetPosition.isEqual(e.targetPosition))if(t.bWasUndone){const i=e.graveyardPosition.path.slice();return i.push(0),n.sourcePosition=new w(e.graveyardPosition.root,i),n.howMany=0,[n]}else return[new ne(0)];if(n.sourcePosition.isEqual(e.sourcePosition)&&!n.targetPosition.isEqual(e.targetPosition)&&!t.bWasUndone&&t.abRelation!="splitAtSource"){const i=n.targetPosition.root.rootName=="$graveyard",s=e.targetPosition.root.rootName=="$graveyard";if(s&&!i||!(i&&!s)&&t.aIsStrong){const l=e.targetPosition._getTransformedByMergeOperation(e),c=n.targetPosition._getTransformedByMergeOperation(e);return[new V(l,n.howMany,c,0)]}else return[new ne(0)]}return n.sourcePosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByMergeOperation(e),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),(!n.graveyardPosition.isEqual(e.graveyardPosition)||!t.aIsStrong)&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(e)),[n]}),M(ee,V,(n,e,t)=>{const i=g._createFromPositionAndShift(e.sourcePosition,e.howMany);return e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&n.deletionPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(n.sourcePosition)?[new ne(0)]:(n.sourcePosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.sourcePosition.hasSameParentAs(e.sourcePosition)&&(n.howMany-=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByMoveOperation(e),n.targetPosition=n.targetPosition._getTransformedByMoveOperation(e),n.graveyardPosition.isEqual(e.targetPosition)||(n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(e)),[n])}),M(ee,N,(n,e,t)=>{if(e.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),n.deletionPosition.isEqual(e.graveyardPosition)&&(n.howMany=e.howMany)),n.targetPosition.isEqual(e.splitPosition)){const i=e.howMany!=0,s=e.graveyardPosition&&n.deletionPosition.isEqual(e.graveyardPosition);if(i||s||t.abRelation=="mergeTargetNotMoved")return n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(e),[n]}if(n.sourcePosition.isEqual(e.splitPosition)){if(t.abRelation=="mergeSourceNotMoved")return n.howMany=0,n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n];if(t.abRelation=="mergeSameElement"||n.sourcePosition.offset>0)return n.sourcePosition=e.moveTargetPosition.clone(),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n]}return n.sourcePosition.hasSameParentAs(e.splitPosition)&&(n.howMany=e.splitPosition.offset),n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(e),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n]}),M(V,se,(n,e)=>{const i=g._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByInsertOperation(e,!1)[0];return n.sourcePosition=i.start,n.howMany=i.end.offset-i.start.offset,n.targetPosition.isEqual(e.position)||(n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e)),[n]}),M(V,V,(n,e,t)=>{const i=g._createFromPositionAndShift(n.sourcePosition,n.howMany),s=g._createFromPositionAndShift(e.sourcePosition,e.howMany);let r=t.aIsStrong,o=!t.aIsStrong;t.abRelation=="insertBefore"||t.baRelation=="insertAfter"?o=!0:(t.abRelation=="insertAfter"||t.baRelation=="insertBefore")&&(o=!1);let a;if(n.targetPosition.isEqual(e.targetPosition)&&o?a=n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):a=n.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Qc(n,e)&&Qc(e,n))return[e.getReversed()];if(i.containsPosition(e.targetPosition)&&i.containsRange(s,!0))return i.start=i.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),i.end=i.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),ei([i],a);if(s.containsPosition(n.targetPosition)&&s.containsRange(i,!0))return i.start=i.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),i.end=i.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),ei([i],a);const u=ue(n.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if(u=="prefix"||u=="extension")return i.start=i.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),i.end=i.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),ei([i],a);n.type=="remove"&&e.type!="remove"&&!t.aWasUndone&&!t.forceWeakRemove?r=!0:n.type!="remove"&&e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&(r=!1);const h=[],f=i.getDifference(s);for(const p of f){p.start=p.start._getTransformedByDeletion(e.sourcePosition,e.howMany),p.end=p.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const b=ue(p.start.getParentPath(),e.getMovedRangeStart().getParentPath())=="same",E=p._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,b);h.push(...E)}const m=i.getIntersection(s);return m!==null&&r&&(m.start=m.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),m.end=m.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),h.length===0?h.push(m):h.length==1?s.start.isBefore(i.start)||s.start.isEqual(i.start)?h.unshift(m):h.push(m):h.splice(1,0,m)),h.length===0?[new ne(n.baseVersion)]:ei(h,a)}),M(V,N,(n,e,t)=>{let i=n.targetPosition.clone();(!n.targetPosition.isEqual(e.insertionPosition)||!e.graveyardPosition||t.abRelation=="moveTargetAfter")&&(i=n.targetPosition._getTransformedBySplitOperation(e));const s=g._createFromPositionAndShift(n.sourcePosition,n.howMany);if(s.end.isEqual(e.insertionPosition))return e.graveyardPosition||n.howMany++,n.targetPosition=i,[n];if(s.start.hasSameParentAs(e.splitPosition)&&s.containsPosition(e.splitPosition)){let a=new g(e.splitPosition,s.end);a=a._getTransformedBySplitOperation(e);const l=[new g(s.start,e.splitPosition),a];return ei(l,i)}n.targetPosition.isEqual(e.splitPosition)&&t.abRelation=="insertAtSource"&&(i=e.moveTargetPosition),n.targetPosition.isEqual(e.insertionPosition)&&t.abRelation=="insertBetween"&&(i=n.targetPosition);const o=[s._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const a=s.start.isEqual(e.graveyardPosition)||s.containsPosition(e.graveyardPosition);n.howMany>1&&a&&!t.aWasUndone&&o.push(g._createFromPositionAndShift(e.insertionPosition,1))}return ei(o,i)}),M(V,ee,(n,e,t)=>{const i=g._createFromPositionAndShift(n.sourcePosition,n.howMany);if(e.deletionPosition.hasSameParentAs(n.sourcePosition)&&i.containsPosition(e.sourcePosition)){if(n.type=="remove"&&!t.forceWeakRemove){if(!t.aWasUndone){const o=[];let a=e.graveyardPosition.clone(),l=e.targetPosition._getTransformedByMergeOperation(e);n.howMany>1&&(o.push(new V(n.sourcePosition,n.howMany-1,n.targetPosition,0)),a=a._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany-1),l=l._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany-1));const c=e.deletionPosition._getCombined(n.sourcePosition,n.targetPosition),u=new V(a,1,c,0),h=u.getMovedRangeStart().path.slice();h.push(0);const f=new w(u.targetPosition.root,h);l=l._getTransformedByMove(a,c,1);const m=new V(l,e.howMany,f,0);return o.push(u),o.push(m),o}}else if(n.howMany==1)return t.bWasUndone?(n.sourcePosition=e.graveyardPosition.clone(),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),[n]):[new ne(0)]}const r=g._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByMergeOperation(e);return n.sourcePosition=r.start,n.howMany=r.end.offset-r.start.offset,n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),[n]}),M(ge,se,(n,e)=>(n.position=n.position._getTransformedByInsertOperation(e),[n])),M(ge,ee,(n,e)=>n.position.isEqual(e.deletionPosition)?(n.position=e.graveyardPosition.clone(),n.position.stickiness="toNext",[n]):(n.position=n.position._getTransformedByMergeOperation(e),[n])),M(ge,V,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n])),M(ge,ge,(n,e,t)=>{if(n.position.isEqual(e.position))if(t.aIsStrong)n.oldName=e.newName;else return[new ne(0)];return[n]}),M(ge,N,(n,e)=>{const t=n.position.path,i=e.splitPosition.getParentPath();if(ue(t,i)=="same"&&!e.graveyardPosition){const s=new ge(n.position.getShiftedBy(1),n.oldName,n.newName,0);return[n,s]}return n.position=n.position._getTransformedBySplitOperation(e),[n]}),M(Qe,Qe,(n,e,t)=>{if(n.root===e.root&&n.key===e.key){if(!t.aIsStrong||n.newValue===e.newValue)return[new ne(0)];n.oldValue=e.newValue}return[n]}),M(ze,ze,(n,e,t)=>n.rootName===e.rootName&&n.isAdd===e.isAdd&&!t.bWasUndone?[new ne(0)]:[n]),M(N,se,(n,e)=>(n.splitPosition.hasSameParentAs(e.position)&&n.splitPosition.offset<e.position.offset&&(n.howMany+=e.howMany),n.splitPosition=n.splitPosition._getTransformedByInsertOperation(e),n.insertionPosition=n.insertionPosition._getTransformedByInsertOperation(e),[n])),M(N,ee,(n,e,t)=>{if(!n.graveyardPosition&&!t.bWasUndone&&n.splitPosition.hasSameParentAs(e.sourcePosition)){const i=e.graveyardPosition.path.slice();i.push(0);const s=new w(e.graveyardPosition.root,i),r=N.getInsertionPosition(new w(e.graveyardPosition.root,i)),o=new N(s,0,r,null,0);return n.splitPosition=n.splitPosition._getTransformedByMergeOperation(e),n.insertionPosition=N.getInsertionPosition(n.splitPosition),n.graveyardPosition=o.insertionPosition.clone(),n.graveyardPosition.stickiness="toNext",[o,n]}return n.splitPosition.hasSameParentAs(e.deletionPosition)&&!n.splitPosition.isAfter(e.deletionPosition)&&n.howMany--,n.splitPosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.splitPosition=n.splitPosition._getTransformedByMergeOperation(e),n.insertionPosition=N.getInsertionPosition(n.splitPosition),n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(e)),[n]}),M(N,V,(n,e,t)=>{const i=g._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.graveyardPosition){const r=i.start.isEqual(n.graveyardPosition)||i.containsPosition(n.graveyardPosition);if(!t.bWasUndone&&r){const o=n.splitPosition._getTransformedByMoveOperation(e),a=n.graveyardPosition._getTransformedByMoveOperation(e),l=a.path.slice();l.push(0);const c=new w(a.root,l);return[new V(o,n.howMany,c,0)]}n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(e)}const s=n.splitPosition.isEqual(e.targetPosition);if(s&&(t.baRelation=="insertAtSource"||t.abRelation=="splitBefore"))return n.howMany+=e.howMany,n.splitPosition=n.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),n.insertionPosition=N.getInsertionPosition(n.splitPosition),[n];if(s&&t.abRelation&&t.abRelation.howMany){const{howMany:r,offset:o}=t.abRelation;return n.howMany+=r,n.splitPosition=n.splitPosition.getShiftedBy(o),[n]}if(n.splitPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(n.splitPosition)){const r=e.howMany-(n.splitPosition.offset-e.sourcePosition.offset);return n.howMany-=r,n.splitPosition.hasSameParentAs(e.targetPosition)&&n.splitPosition.offset<e.targetPosition.offset&&(n.howMany+=e.howMany),n.splitPosition=e.sourcePosition.clone(),n.insertionPosition=N.getInsertionPosition(n.splitPosition),[n]}return e.sourcePosition.isEqual(e.targetPosition)||(n.splitPosition.hasSameParentAs(e.sourcePosition)&&n.splitPosition.offset<=e.sourcePosition.offset&&(n.howMany-=e.howMany),n.splitPosition.hasSameParentAs(e.targetPosition)&&n.splitPosition.offset<e.targetPosition.offset&&(n.howMany+=e.howMany)),n.splitPosition.stickiness="toNone",n.splitPosition=n.splitPosition._getTransformedByMoveOperation(e),n.splitPosition.stickiness="toNext",n.graveyardPosition?n.insertionPosition=n.insertionPosition._getTransformedByMoveOperation(e):n.insertionPosition=N.getInsertionPosition(n.splitPosition),[n]}),M(N,N,(n,e,t)=>{if(n.splitPosition.isEqual(e.splitPosition)){if(!n.graveyardPosition&&!e.graveyardPosition)return[new ne(0)];if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition))return[new ne(0)];if(t.abRelation=="splitBefore")return n.howMany=0,n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(e),[n]}if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition)){const i=n.splitPosition.root.rootName=="$graveyard",s=e.splitPosition.root.rootName=="$graveyard";if(s&&!i||!(i&&!s)&&t.aIsStrong){const l=[];return e.howMany&&l.push(new V(e.moveTargetPosition,e.howMany,e.splitPosition,0)),n.howMany&&l.push(new V(n.splitPosition,n.howMany,n.moveTargetPosition,0)),l}else return[new ne(0)]}if(n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(e)),n.splitPosition.isEqual(e.insertionPosition)&&t.abRelation=="splitBefore")return n.howMany++,[n];if(e.splitPosition.isEqual(n.insertionPosition)&&t.baRelation=="splitBefore"){const i=e.insertionPosition.path.slice();i.push(0);const s=new w(e.insertionPosition.root,i),r=new V(n.insertionPosition,1,s,0);return[n,r]}return n.splitPosition.hasSameParentAs(e.splitPosition)&&n.splitPosition.offset<e.splitPosition.offset&&(n.howMany-=e.howMany),n.splitPosition=n.splitPosition._getTransformedBySplitOperation(e),n.insertionPosition=N.getInsertionPosition(n.splitPosition),[n]});function Qc(n,e){return n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function ei(n,e){const t=[];for(let i=0;i<n.length;i++){const s=n[i],r=new V(s.start,s.end.offset-s.start.offset,e,0);t.push(r);for(let o=i+1;o<n.length;o++)n[o]=n[o]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];e=e._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class oe extends L(w){constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new d("model-liveposition-root-not-rootelement",e);qy.call(this)}detach(){this.stopListening()}toPosition(){return new w(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}oe.prototype.is=function(n){return n==="livePosition"||n==="model:livePosition"||n=="position"||n==="model:position"};function qy(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&Gy.call(this,t)},{priority:"low"})}function Gy(n){const e=this.getTransformedByOperation(n);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ti{constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},G("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:i=!0,isUndo:s=!1,isTyping:r=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=s,this.isTyping=r}get type(){return G("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ky{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){const t=e;switch(t.type){case"insert":{if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break}case"addAttribute":case"removeAttribute":case"changeAttribute":{for(const i of t.range.getItems({shallow:!0}))this._isInInsertedElement(i.parent)||this._markAttribute(i);break}case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const i=this._isInInsertedElement(t.sourcePosition.parent),s=this._isInInsertedElement(t.targetPosition.parent);i||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),s||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const i=g._createFromPositionAndShift(t.position,1);for(const s of this._markerCollection.getMarkersIntersectingRange(i)){const r=s.getData();this.bufferMarkerChange(s.name,r,r)}break}case"split":{const i=t.splitPosition.parent;this._isInInsertedElement(i)||this._markRemove(i,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const i=t.sourcePosition.parent;this._isInInsertedElement(i.parent)||this._markRemove(i.parent,i.startOffset,1);const s=t.graveyardPosition.parent;this._markInsert(s,t.graveyardPosition.offset,1);const r=t.targetPosition.parent;this._isInInsertedElement(r)||this._markInsert(r,t.targetPosition.offset,i.maxOffset);break}case"detachRoot":case"addRoot":{this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{const i=t.root.rootName;this._bufferRootAttributeChange(i,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i){const s=this._changedMarkers.get(e);s?(s.newMarkerData=i,s.oldMarkerData.range==null&&i.range==null&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{newMarkerData:i,oldMarkerData:t})}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)i.oldMarkerData.range!=null&&e.push({name:t,range:i.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)i.newMarkerData.range!=null&&e.push({name:t,range:i.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this._changesInElement.size>0||this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const i=e.range&&!t.range,s=!e.range&&t.range,r=e.range&&t.range&&!e.range.isEqual(t.range);if(i||s||r)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const i of this._changesInElement.keys()){const s=this._changesInElement.get(i).sort((u,h)=>u.offset===h.offset?u.type!=h.type?u.type=="remove"?-1:1:0:u.offset<h.offset?-1:1),r=this._elementSnapshots.get(i),o=eu(i.getChildren()),a=Jy(r.length,s);let l=0,c=0;for(const u of a)if(u==="i")t.push(this._getInsertDiff(i,l,o[l])),l++;else if(u==="r")t.push(this._getRemoveDiff(i,l,r[c])),c++;else if(u==="a"){const h=o[l].attributes,f=r[c].attributes;let m;if(o[l].name=="$text")m=new g(w._createAt(i,l),w._createAt(i,l+1));else{const p=i.offsetToIndex(l);m=new g(w._createAt(i,l),w._createAt(i.getChild(p),0))}t.push(...this._getAttributesDiff(m,f,h)),l++,c++}else l++,c++}t.sort((i,s)=>i.position.root!=s.position.root?i.position.root.rootName<s.position.root.rootName?-1:1:i.position.isEqual(s.position)?i.changeCount-s.changeCount:i.position.isBefore(s.position)?-1:1);for(let i=1,s=0;i<t.length;i++){const r=t[s],o=t[i],a=r.type=="remove"&&o.type=="remove"&&r.name=="$text"&&o.name=="$text"&&r.position.isEqual(o.position),l=r.type=="insert"&&o.type=="insert"&&r.name=="$text"&&o.name=="$text"&&r.position.parent==o.position.parent&&r.position.offset+r.length==o.position.offset,c=r.type=="attribute"&&o.type=="attribute"&&r.position.parent==o.position.parent&&r.range.isFlat&&o.range.isFlat&&r.position.offset+r.length==o.position.offset&&r.attributeKey==o.attributeKey&&r.attributeOldValue==o.attributeOldValue&&r.attributeNewValue==o.attributeNewValue;a||l||c?(r.length++,c&&(r.range.end=r.range.end.getShiftedBy(1)),t[i]=null):s=i}t=t.filter(i=>i);for(const i of t)delete i.changeCount,i.type=="attribute"&&(delete i.position,delete i.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(Zy),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t={...e};return t.state!==void 0&&delete t.attributes,t})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e)){this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});return}const i=this._changedRoots.get(e);i.state!==void 0?(delete i.state,i.attributes===void 0&&this._changedRoots.delete(e)):i.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,i,s){const r=this._changedRoots.get(e)||{name:e},o=r.attributes||{};if(o[t]){const a=o[t];s===a.oldValue?delete o[t]:a.newValue=s}else o[t]={oldValue:i,newValue:s};Object.entries(o).length===0?(delete r.attributes,r.state===void 0&&this._changedRoots.delete(e)):(r.attributes=o,this._changedRoots.set(e,r))}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e);const t=g._createOn(e);for(const i of this._markerCollection.getMarkersIntersectingRange(t)){const s=i.getData();this.bufferMarkerChange(i.name,s,s)}this._cachedChanges=null}_markInsert(e,t,i){const s={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,s)}_markRemove(e,t,i){const s={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,s),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let s=0;s<i.length;s++)i[s].howMany<1&&(i.splice(s,1),s--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,eu(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const s=e.offset+e.howMany,r=i.offset+i.howMany;if(e.type=="insert"&&(i.type=="insert"&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<r&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),i.type=="remove"&&e.offset<i.offset&&(i.offset+=e.howMany),i.type=="attribute")){if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<r){const o=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:s,howMany:o-i.howMany,count:this._changeCount++})}}if(e.type=="remove"){if(i.type=="insert"){if(s<=i.offset)i.offset-=e.howMany;else if(s<=r)if(e.offset<i.offset){const o=s-i.offset;i.offset=e.offset,i.howMany-=o,e.nodesToHandle-=o}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<r){const o=r-e.offset;i.howMany-=o,e.nodesToHandle-=o}}if(i.type=="remove"&&(s<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),i.type=="attribute"){if(s<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const o=s-i.offset;i.offset=e.offset,i.howMany-=o}else if(e.offset<r)if(s<=r){const o=i.howMany;i.howMany=e.offset-i.offset;const a=o-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:a,count:this._changeCount++})}else i.howMany-=r-e.offset}}if(e.type=="attribute"){if(i.type=="insert")if(e.offset<i.offset&&s>i.offset){if(s>r){const o={type:"attribute",offset:r,howMany:s-r,count:this._changeCount++};this._handleChange(o,t),t.push(o)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<r&&(s>r?(e.nodesToHandle=s-r,e.offset=r):e.nodesToHandle=0);if(i.type=="remove"&&e.offset<i.offset&&s>i.offset){const o={type:"attribute",offset:i.offset,howMany:s-i.offset,count:this._changeCount++};this._handleChange(o,t),t.push(o),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}i.type=="attribute"&&(e.offset>=i.offset&&s<=r?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&s>=r&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i){return{type:"insert",position:w._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,i){return{type:"remove",position:w._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const s=[];i=new Map(i);for(const[r,o]of t){const a=i.has(r)?i.get(r):null;a!==o&&s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:o,attributeNewValue:a,changeCount:this._changeCount++}),i.delete(r)}for(const[r,o]of i)s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return s}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),s=e.startOffset;if(i){for(const r of i)if(r.type=="insert"&&s>=r.offset&&s<r.offset+r.howMany)return!0}return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const s=new g(w._createAt(e,t),w._createAt(e,t+i));for(const r of s.getItems({shallow:!0}))r.is("element")&&(this._elementSnapshots.delete(r),this._changesInElement.delete(r),this._removeAllNestedChanges(r,0,r.maxOffset))}}function eu(n){const e=[];for(const t of n)if(t.is("$text"))for(let i=0;i<t.data.length;i++)e.push({name:"$text",attributes:new Map(t.getAttributes())});else e.push({name:t.name,attributes:new Map(t.getAttributes())});return e}function Jy(n,e){const t=[];let i=0,s=0;for(const r of e){if(r.offset>i){for(let o=0;o<r.offset-i;o++)t.push("e");s+=r.offset-i}if(r.type=="insert"){for(let o=0;o<r.howMany;o++)t.push("i");i=r.offset+r.howMany}else if(r.type=="remove"){for(let o=0;o<r.howMany;o++)t.push("r");i=r.offset,s+=r.howMany}else t.push(..."a".repeat(r.howMany).split("")),i=r.offset+r.howMany,s+=r.howMany}if(s<n)for(let r=0;r<n-s-i;r++)t.push("e");return t}function Zy(n){const e="position"in n&&n.position.root.rootName=="$graveyard",t="range"in n&&n.range.root.rootName=="$graveyard";return!e&&!t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Yy{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new d("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const i=this._operations[0];e===void 0&&(e=i.baseVersion);let s=t-1;for(const[a,l]of this._gaps)e>a&&e<l&&(e=l),s>a&&s<l&&(s=a-1);if(s<i.baseVersion||e>this.lastOperation.baseVersion)return[];let r=this._baseVersionToOperationIndex.get(e);r===void 0&&(r=0);let o=this._baseVersionToOperationIndex.get(s);return o===void 0&&(o=this._operations.length-1),this._operations.slice(r,o+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Cn extends F{constructor(e,t,i="main"){super(t),this._isAttached=!0,this._document=e,this.rootName=i}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Cn.prototype.is=function(n,e){return e?e===this.name&&(n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"):n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"||n==="node"||n==="model:node"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const ur="$graveyard";class Xy extends L(){constructor(e){super(),this.model=e,this.history=new Yy,this.selection=new De(this),this.roots=new Ie({idProperty:"rootName"}),this.differ=new Ky(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",ur),this.listenTo(e,"applyOperation",(t,i)=>{const s=i[0];s.isDocumentOperation&&this.differ.bufferOperation(s)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,i)=>{const s=i[0];s.isDocumentOperation&&this.history.addOperation(s)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,i,s,r,o)=>{const a={...i.getData(),range:r};this.differ.bufferMarkerChange(i.name,o,a),s===null&&i.on("change",(l,c)=>{const u=i.getData();this.differ.bufferMarkerChange(i.name,{...u,range:c},u)})}),this.registerPostFixer(t=>{let i=!1;for(const s of this.roots)!s.isAttached()&&!s.isEmpty&&(t.remove(t.createRangeIn(s)),i=!0);for(const s of this.model.markers)s.getRange().root.isAttached()||(t.removeMarker(s),i=!0);return i})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(ur)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new d("model-document-createroot-name-exists",this,{name:t});const i=new Cn(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return Array.from(this.roots).filter(t=>t.rootName!=ur&&(e||t.isAttached())).map(t=>t.rootName)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=Xa(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,s=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(s)||t.createRange(s)}_validateSelectionRange(e){return tu(e.start)&&tu(e.end)}_callPostFixers(e){let t=!1;do for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break;while(t)}}function tu(n){const e=n.textNode;if(e){const t=e.data,i=n.offset-e.startOffset;return!Ls(t,i)&&!$s(t,i)}return!0}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Qy extends L(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof ii?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,s=!1){const r=e instanceof ii?e.name:e;if(r.includes(","))throw new d("markercollection-incorrect-marker-name",this);const o=this._markers.get(r);if(o){const c=o.getData(),u=o.getRange();let h=!1;return u.isEqual(t)||(o._attachLiveRange($e.fromRange(t)),h=!0),i!=o.managedUsingOperations&&(o._managedUsingOperations=i,h=!0),typeof s=="boolean"&&s!=o.affectsData&&(o._affectsData=s,h=!0),h&&this.fire(`update:${r}`,o,u,t,c),o}const a=$e.fromRange(t),l=new ii(r,a,i,s);return this._markers.set(r,l),this.fire(`update:${r}`,l,null,t,{...l.getData(),range:null}),l}_remove(e){const t=e instanceof ii?e.name:e,i=this._markers.get(t);return i?(this._markers.delete(t),this.fire(`update:${t}`,i,i.getRange(),null,i.getData()),this._destroyMarker(i),!0):!1}_refresh(e){const t=e instanceof ii?e.name:e,i=this._markers.get(t);if(!i)throw new d("markercollection-refresh-marker-not-exists",this);const s=i.getRange();this.fire(`update:${t}`,i,s,s,i.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)t.getRange().getIntersection(e)!==null&&(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()}}class ii extends L(ut){constructor(e,t,i,s){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=s}get managedUsingOperations(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new d("marker-destroyed",this);return this._liveRange.toRange()}_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}}ii.prototype.is=function(n){return n==="marker"||n==="model:marker"};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ek extends ye{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new d("detach-operation-on-document-node",this)}_execute(){qc(g._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class et extends ut{constructor(e){super(),this.markers=new Map,this._children=new xi,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 this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(F.fromJSON(i)):t.push(q.fromJSON(i));return new et(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=tk(t);for(const s of i)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const s of i)s.parent=null;return i}}et.prototype.is=function(n){return n==="documentFragment"||n==="model:documentFragment"};function tk(n){return typeof n=="string"?[new q(n)]:(we(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new q(e):e instanceof Ve?new q(e.data,e.getAttributes()):e))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ik{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new q(e,t)}createElement(e,t){return new F(e,t)}createDocumentFragment(){return new et}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof q&&e.data=="")return;const s=w._createAt(t,i);if(e.parent)if(su(e.root,s.root)){this.move(g._createOn(e),s);return}else{if(e.root.document)throw new d("model-writer-insert-forbidden-move",this);this.remove(e)}const r=s.root.document?s.root.document.version:null,o=new se(s,e,r);if(e instanceof q&&(o.shouldReceiveAttributes=!0),this.batch.addOperation(o),this.model.applyOperation(o),e instanceof et)for(const[a,l]of e.markers){const c=w._createAt(l.root,0),h={range:new g(l.start._getCombined(c,s),l.end._getCombined(c,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(a)?this.updateMarker(a,h):this.addMarker(a,h)}}insertText(e,t,i,s){t instanceof et||t instanceof F||t instanceof w?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,s)}insertElement(e,t,i,s){t instanceof et||t instanceof F||t instanceof w?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,s)}append(e,t){this.insert(e,t,"end")}appendText(e,t,i){t instanceof et||t instanceof F?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof et||t instanceof F?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof g){const s=i.getMinimalFlatRanges();for(const r of s)iu(this,e,t,r)}else nu(this,e,t,i)}setAttributes(e,t){for(const[i,s]of Xe(e))this.setAttribute(i,s,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof g){const i=t.getMinimalFlatRanges();for(const s of i)iu(this,e,null,s)}else nu(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=i=>{for(const s of i.getAttributeKeys())this.removeAttribute(s,i)};if(!(e instanceof g))t(e);else for(const i of e.getItems())t(i)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof g))throw new d("writer-move-invalid-range",this);if(!e.isFlat)throw new d("writer-move-range-not-flat",this);const s=w._createAt(t,i);if(s.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!su(e.root,s.root))throw new d("writer-move-different-document",this);const r=e.root.document?e.root.document.version:null,o=new V(e.start,e.end.offset-e.start.offset,s,r);this.batch.addOperation(o),this.model.applyOperation(o)}remove(e){this._assertWriterUsedCorrectly();const i=(e instanceof g?e:g._createOn(e)).getMinimalFlatRanges().reverse();for(const s of i)this._addOperationForAffectedMarkers("move",s),nk(s.start,s.end.offset-s.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof F))throw new d("writer-merge-no-element-before",this);if(!(i instanceof F))throw new d("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(g._createIn(i),w._createAt(t,"end")),this.remove(i)}_merge(e){const t=w._createAt(e.nodeBefore,"end"),i=w._createAt(e.nodeAfter,0),s=e.root.document.graveyard,r=new w(s,[0]),o=e.root.document.version,a=new ee(i,e.nodeAfter.maxOffset,t,r,o);this.batch.addOperation(a),this.model.applyOperation(a)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof F))throw new d("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,s=new ge(w._createBefore(e),e.name,t,i);this.batch.addOperation(s),this.model.applyOperation(s)}split(e,t){this._assertWriterUsedCorrectly();let i=e.parent;if(!i.parent)throw new d("writer-split-element-no-parent",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new d("writer-split-invalid-limit-element",this);let s,r;do{const o=i.root.document?i.root.document.version:null,a=i.maxOffset-e.offset,l=N.getInsertionPosition(e),c=new N(e,a,l,null,o);this.batch.addOperation(c),this.model.applyOperation(c),!s&&!r&&(s=i,r=e.parent.nextSibling),e=this.createPositionAfter(e.parent),i=e.parent}while(i!==t);return{position:e,range:new g(w._createAt(s,"end"),w._createAt(r,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new d("writer-wrap-range-not-flat",this);const i=t instanceof F?t:new F(t);if(i.childCount>0)throw new d("writer-wrap-element-not-empty",this);if(i.parent!==null)throw new d("writer-wrap-element-attached",this);this.insert(i,e.start);const s=new g(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(s,w._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new d("writer-unwrap-element-no-parent",this);this.move(g._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!="boolean")throw new d("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,s=t.range,r=t.affectsData===void 0?!1:t.affectsData;if(this.model.markers.has(e))throw new d("writer-addmarker-marker-exists",this);if(!s)throw new d("writer-addmarker-no-range",this);return i?(Fi(this,e,null,s,r),this.model.markers.get(e)):this.model.markers._set(e,s,i,r)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i=typeof e=="string"?e:e.name,s=this.model.markers.get(i);if(!s)throw new d("writer-updatemarker-marker-not-exists",this);if(!t){G("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),this.model.markers._refresh(s);return}const r=typeof t.usingOperation=="boolean",o=typeof t.affectsData=="boolean",a=o?t.affectsData:s.affectsData;if(!r&&!t.range&&!o)throw new d("writer-updatemarker-wrong-options",this);const l=s.getRange(),c=t.range?t.range:l;if(r&&t.usingOperation!==s.managedUsingOperations){t.usingOperation?Fi(this,i,null,c,a):(Fi(this,i,l,null,a),this.model.markers._set(i,c,void 0,a));return}s.managedUsingOperations?Fi(this,i,l,c,a):this.model.markers._set(i,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new d("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations){this.model.markers._remove(t);return}const s=i.getRange();Fi(this,t,s,null,i.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new d("writer-addroot-root-exists",this);const s=this.model.document,r=new ze(e,t,!0,s,s.version);return this.batch.addOperation(r),this.model.applyOperation(r),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new d("writer-detachroot-no-root",this);for(const r of this.model.markers)r.getRange().root===t&&this.removeMarker(r);for(const r of t.getAttributeKeys())this.removeAttribute(r,t);this.remove(this.createRangeIn(t));const i=this.model.document,s=new ze(t.rootName,t.name,!1,i,i.version);this.batch.addOperation(s),this.model.applyOperation(s)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._setSelectionAttribute(e,t);else for(const[i,s]of Xe(e))this._setSelectionAttribute(i,s)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const s=De._getStoreAttributeKey(e);this.setAttribute(s,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=De._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new d("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const s=i.getRange();let r=!1;if(e==="move"){const o=t;r=o.containsPosition(s.start)||o.start.isEqual(s.start)||o.containsPosition(s.end)||o.end.isEqual(s.end)}else{const o=t,a=o.nodeBefore,l=o.nodeAfter,c=s.start.parent==a&&s.start.isAtEnd,u=s.end.parent==l&&s.end.offset==0,h=s.end.nodeAfter==l,f=s.start.nodeAfter==l;r=c||u||h||f}r&&this.updateMarker(i.name,{range:s})}}}function iu(n,e,t,i){const s=n.model,r=s.document;let o=i.start,a,l,c;for(const h of i.getWalker({shallow:!0}))c=h.item.getAttribute(e),a&&l!=c&&(l!=t&&u(),o=a),a=h.nextPosition,l=c;a instanceof w&&a!=o&&l!=t&&u();function u(){const h=new g(o,a),f=h.root.document?r.version:null,m=new te(h,e,l,t,f);n.batch.addOperation(m),s.applyOperation(m)}}function nu(n,e,t,i){const s=n.model,r=s.document,o=i.getAttribute(e);let a,l;if(o!=t){if(i.root===i){const u=i.document?r.version:null;l=new Qe(i,e,o,t,u)}else{a=new g(w._createBefore(i),n.createPositionAfter(i));const u=a.root.document?r.version:null;l=new te(a,e,o,t,u)}n.batch.addOperation(l),s.applyOperation(l)}}function Fi(n,e,t,i,s){const r=n.model,o=r.document,a=new me(e,t,i,r.markers,!!s,o.version);n.batch.addOperation(a),r.applyOperation(a)}function nk(n,e,t,i){let s;if(n.root.document){const r=i.document,o=new w(r.graveyard,[0]);s=new V(n,e,o,r.version)}else s=new ek(n,e);t.addOperation(s),i.applyOperation(s)}function su(n,e){return n===e||n instanceof Cn&&e instanceof Cn}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function sk(n,e,t={}){if(e.isCollapsed)return;const i=e.getFirstRange();if(i.root.rootName=="$graveyard")return;const s=n.schema;n.change(r=>{if(!t.doNotResetEntireContent&&fk(s,e)){dk(r,e);return}const o={};if(!t.doNotAutoparagraph){const c=e.getSelectedElement();c&&Object.assign(o,s.getAttributesWithProperty(c,"copyOnReplace",!0))}const[a,l]=rk(i);a.isTouching(l)||r.remove(r.createRange(a,l)),t.leaveUnmerged||(ak(r,a,l),s.removeDisallowedAttributes(a.parent.getChildren(),r)),lu(r,e,a),!t.doNotAutoparagraph&&uk(s,a)&&au(r,a,e,o),a.detach(),l.detach()})}function rk(n){const e=n.root.document.model,t=n.start;let i=n.end;if(e.hasContent(n,{ignoreMarkers:!0})){const s=ok(i);if(s&&i.isTouching(e.createPositionAt(s,0))){const r=e.createSelection(n);e.modifySelection(r,{direction:"backward"});const o=r.getLastPosition(),a=e.createRange(o,i);e.hasContent(a,{ignoreMarkers:!0})||(i=o)}}return[oe.fromPosition(t,"toPrevious"),oe.fromPosition(i,"toNext")]}function ok(n){const e=n.parent,t=e.root.document.model.schema,i=e.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of i){if(t.isLimit(s))return null;if(t.isBlock(s))return s}}function ak(n,e,t){const i=n.model;if(!hr(n.model.schema,e,t))return;const[s,r]=ck(e,t);!s||!r||(!i.hasContent(s,{ignoreMarkers:!0})&&i.hasContent(r,{ignoreMarkers:!0})?ou(n,e,t,s.parent):ru(n,e,t,s.parent))}function ru(n,e,t,i){const s=e.parent,r=t.parent;if(!(s==i||r==i)){for(e=n.createPositionAfter(s),t=n.createPositionBefore(r),t.isEqual(e)||n.insert(r,e),n.merge(e);t.parent.isEmpty;){const o=t.parent;t=n.createPositionBefore(o),n.remove(o)}hr(n.model.schema,e,t)&&ru(n,e,t,i)}}function ou(n,e,t,i){const s=e.parent,r=t.parent;if(!(s==i||r==i)){for(e=n.createPositionAfter(s),t=n.createPositionBefore(r),t.isEqual(e)||n.insert(s,t);e.parent.isEmpty;){const o=e.parent;e=n.createPositionBefore(o),n.remove(o)}t=n.createPositionBefore(r),lk(n,t),hr(n.model.schema,e,t)&&ou(n,e,t,i)}}function lk(n,e){const t=e.nodeBefore,i=e.nodeAfter;t.name!=i.name&&n.rename(t,i.name),n.clearAttributes(t),n.setAttributes(Object.fromEntries(i.getAttributes()),t),n.merge(e)}function hr(n,e,t){const i=e.parent,s=t.parent;return i==s||n.isLimit(i)||n.isLimit(s)?!1:hk(e,t,n)}function ck(n,e){const t=n.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]&&t[s]==i[s];)s++;return[t[s],i[s]]}function uk(n,e){const t=n.checkChild(e,"$text"),i=n.checkChild(e,"paragraph");return!t&&i}function hk(n,e,t){const i=new g(n,e);for(const s of i.getWalker())if(t.isLimit(s.item))return!1;return!0}function au(n,e,t,i={}){const s=n.createElement("paragraph");n.model.schema.setAllowedAttributes(s,i,n),n.insert(s,e),lu(n,t,n.createPositionAt(s,0))}function dk(n,e){const t=n.model.schema.getLimitElement(e);n.remove(n.createRangeIn(t)),au(n,n.createPositionAt(t,0),e)}function fk(n,e){const t=n.getLimitElement(e);if(!e.containsEntireContent(t))return!1;const i=e.getFirstRange();return i.start.parent==i.end.parent?!1:n.checkChild(t,"paragraph")}function lu(n,e,t){e instanceof De?n.setSelection(t):e.setTo(t)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function mk(n,e){return n.change(t=>{const i=t.createDocumentFragment(),s=e.getFirstRange();if(!s||s.isCollapsed)return i;const r=s.start.root,o=s.start.getCommonPath(s.end),a=r.getNodeByPath(o);let l;s.start.parent==s.end.parent?l=s:l=t.createRange(t.createPositionAt(a,s.start.path[o.length]),t.createPositionAt(a,s.end.path[o.length]+1));const c=l.end.offset-l.start.offset;for(const u of l.getItems({shallow:!0}))u.is("$textProxy")?t.appendText(u.data,u.getAttributes(),i):t.append(t.cloneElement(u,!0),i);if(l!=s){const u=s._getTransformedByMove(l.start,t.createPositionAt(i,0),c)[0],h=t.createRange(t.createPositionAt(i,0),u.start),f=t.createRange(u.end,t.createPositionAt(i,"end"));cu(f,t),cu(h,t)}return i})}function cu(n,e){const t=[];Array.from(n.getItems({direction:"backward"})).map(i=>e.createRangeOn(i)).filter(i=>(i.start.isAfter(n.start)||i.start.isEqual(n.start))&&(i.end.isBefore(n.end)||i.end.isEqual(n.end))).forEach(i=>{t.push(i.start.parent),e.remove(i)}),t.forEach(i=>{let s=i;for(;s.parent&&s.isEmpty;){const r=e.createRangeOn(s);s=s.parent,e.remove(r)}})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function gk(n,e,t){return n.change(i=>{const s=t||n.document.selection;s.isCollapsed||n.deleteContent(s,{doNotAutoparagraph:!0});const r=new pk(n,i,s.anchor),o=[];let a;if(e.is("documentFragment")){if(e.markers.size){const u=[];for(const[h,f]of e.markers){const{start:m,end:p}=f,b=m.isEqual(p);u.push({position:m,name:h,isCollapsed:b},{position:p,name:h,isCollapsed:b})}u.sort(({position:h},{position:f})=>h.isBefore(f)?1:-1);for(const{position:h,name:f,isCollapsed:m}of u){let p=null,b=null;const E=h.parent===e&&h.isAtStart,T=h.parent===e&&h.isAtEnd;!E&&!T?(p=i.createElement("$marker"),i.insert(p,h)):m&&(b=E?"start":"end"),o.push({name:f,element:p,collapsed:b})}}a=e.getChildren()}else a=[e];r.handleNodes(a);let l=r.getSelectionRange();if(e.is("documentFragment")&&o.length){const u=l?$e.fromRange(l):null,h={};for(let f=o.length-1;f>=0;f--){const{name:m,element:p,collapsed:b}=o[f],E=!h[m];if(E&&(h[m]=[]),p){const T=i.createPositionAt(p,"before");h[m].push(T),i.remove(p)}else{const T=r.getAffectedRange();if(!T){b&&h[m].push(r.position);continue}b?h[m].push(T[b]):h[m].push(E?T.start:T.end)}}for(const[f,[m,p]]of Object.entries(h))m&&p&&m.root===p.root&&i.addMarker(f,{usingOperation:!0,affectsData:!0,range:new g(m,p)});u&&(l=u.toRange(),u.detach())}/* istanbul ignore else -- @preserve */l&&(s instanceof De?i.setSelection(l):s.setTo(l));const c=r.getAffectedRange()||n.createRange(s.anchor);return r.destroy(),c})}class pk{constructor(e,t,i){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){this._lastNode=e;/* istanbul ignore if -- @preserve */if(this.position.parent!=e||!this.position.isAtEnd)throw new d("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?g._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new g(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(this.schema.isObject(e)){this._handleObject(e);return}let t=this._checkAndAutoParagraphToAllowedPosition(e);if(!t&&(t=this._checkAndSplitToAllowedPosition(e),!t)){this._handleDisallowedNode(e);return}this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=oe.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){/* istanbul ignore if -- @preserve */if(!this.schema.checkChild(this.position,e))throw new d("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=oe.fromPosition(e,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=oe.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof F)||!this._canMergeLeft(e))return;const t=oe._createBefore(e);t.stickiness="toNext";const i=oe.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=oe._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=oe._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof F)||!this._canMergeRight(e))return;const t=oe._createAfter(e);t.stickiness="toNext";/* istanbul ignore if -- @preserve */if(!this.position.isEqual(t))throw new d("insertcontent-invalid-insertion-position",this);this.position=w._createAt(t.nodeBefore,"end");const i=oe.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=oe._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=oe._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof F&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof F&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!0}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const i=this.position.parent;this.position=this.writer.createPositionBefore(i),i.isEmpty&&i.parent===t&&this.writer.remove(i)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const i=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=i,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function uu(n,e,t="auto"){const i=n.getSelectedElement();if(i&&e.schema.isObject(i)&&!e.schema.isInline(i))return t=="before"||t=="after"?e.createRange(e.createPositionAt(i,t)):e.createRangeOn(i);const s=Ee(n.getSelectedBlocks());if(!s)return e.createRange(n.focus);if(s.isEmpty)return e.createRange(e.createPositionAt(s,0));const r=e.createPositionAfter(s);return n.focus.isTouching(r)?e.createRange(r):e.createRange(e.createPositionBefore(s))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function wk(n,e,t,i={}){if(!n.schema.isObject(e))throw new d("insertobject-element-not-an-object",n,{object:e});const s=t||n.document.selection;let r=s;i.findOptimalPosition&&n.schema.isBlock(e)&&(r=n.createSelection(uu(s,n,i.findOptimalPosition)));const o=Ee(s.getSelectedBlocks()),a={};return o&&Object.assign(a,n.schema.getAttributesWithProperty(o,"copyOnReplace",!0)),n.change(l=>{r.isCollapsed||n.deleteContent(r,{doNotAutoparagraph:!0});let c=e;const u=r.anchor.parent;!n.schema.checkChild(u,e)&&n.schema.checkChild(u,"paragraph")&&n.schema.checkChild("paragraph",e)&&(c=l.createElement("paragraph"),l.insert(e,c)),n.schema.setAllowedAttributes(c,a,l);const h=n.insertContent(c,r);return h.isCollapsed||i.setSelection&&bk(l,e,i.setSelection,a),h})}function bk(n,e,t,i){const s=n.model;if(t=="on"){n.setSelection(e,"on");return}if(t!="after")throw new d("insertobject-invalid-place-parameter-value",s);let r=e.nextSibling;if(s.schema.isInline(e)){n.setSelection(e,"after");return}!(r&&s.schema.checkChild(r,"$text"))&&s.schema.checkChild(e.parent,"paragraph")&&(r=n.createElement("paragraph"),s.schema.setAllowedAttributes(r,i,n),s.insertContent(r,n.createPositionAfter(e))),r&&n.setSelection(r,0)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const _k=' ,.?!:;"-()';function vk(n,e,t={}){const i=n.schema,s=t.direction!="backward",r=t.unit?t.unit:"character",o=!!t.treatEmojiAsSingleUnit,a=e.focus,l=new ht({boundaries:Ek(a,s),singleCharacters:!0,direction:s?"forward":"backward"}),c={walker:l,schema:i,isForward:s,unit:r,treatEmojiAsSingleUnit:o};let u;for(;u=l.next();){if(u.done)return;const h=yk(c,u.value);if(h){e instanceof De?n.change(f=>{f.setSelectionFocus(h)}):e.setFocus(h);return}}}function yk(n,e){const{isForward:t,walker:i,unit:s,schema:r,treatEmojiAsSingleUnit:o}=n,{type:a,item:l,nextPosition:c}=e;if(a=="text")return n.unit==="word"?Ck(i,t):kk(i,s,o);if(a==(t?"elementStart":"elementEnd")){if(r.isSelectable(l))return w._createAt(l,t?"after":"before");if(r.checkChild(c,"$text"))return c}else{if(r.isLimit(l)){i.skip(()=>!0);return}if(r.checkChild(c,"$text"))return c}}function kk(n,e,t){const i=n.position.textNode;if(i){const s=i.data;let r=n.position.offset-i.startOffset;for(;Ls(s,r)||e=="character"&&$s(s,r)||t&&Bl(s,r);)n.next(),r=n.position.offset-i.startOffset}return n.position}function Ck(n,e){let t=n.position.textNode;for(t||(t=e?n.position.nodeAfter:n.position.nodeBefore);t&&t.is("$text");){const i=n.position.offset-t.startOffset;if(Tk(t,i,e))t=e?n.position.nodeAfter:n.position.nodeBefore;else{if(Ak(t.data,i,e))break;n.next()}}return n.position}function Ek(n,e){const t=n.root,i=w._createAt(t,e?"end":0);return e?new g(n,i):new g(i,n)}function Ak(n,e,t){const i=e+(t?0:-1);return _k.includes(n.charAt(i))}function Tk(n,e,t){return e===(t?n.offsetSize:0)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */let Pk=class extends H(){constructor(){super(),this.markers=new Qy,this.document=new Xy(this),this.schema=new my,this._pendingChanges=[],this._currentWriter=null,["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("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if(t.name==="$marker")return!0}),ry(this),this.document.registerPostFixer(Mc),this.on("insertContent",(e,[t,i])=>{e.return=gk(this,t,i)}),this.on("insertObject",(e,[t,i,s])=>{e.return=wk(this,t,i,s)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new ti,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new ti):e instanceof ti||(e=new ti(e)):e=new ti,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(i){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(i,this)}}applyOperation(e){e._execute()}insertContent(e,t,i,...s){const r=dr(t,i);return this.fire("insertContent",[e,r,i,...s])}insertObject(e,t,i,s,...r){const o=dr(t,i);return this.fire("insertObject",[e,o,s,s,...r])}deleteContent(e,t){sk(this,e,t)}modifySelection(e,t){vk(this,e,t)}getSelectedContent(e){return mk(this,e)}hasContent(e,t={}){const i=e instanceof g?e:g._createIn(e);if(i.isCollapsed)return!1;const{ignoreWhitespaces:s=!1,ignoreMarkers:r=!1}=t;if(!r){for(const o of this.markers.getMarkersIntersectingRange(i))if(o.affectsData)return!0}for(const o of i.getItems())if(this.schema.isContent(o))if(o.is("$textProxy"))if(s){if(o.data.search(/\S/)!==-1)return!0}else return!0;else return!0;return!1}canEditAt(e){const t=dr(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new w(e,t,i)}createPositionAt(e,t){return w._createAt(e,t)}createPositionAfter(e){return w._createAfter(e)}createPositionBefore(e){return w._createBefore(e)}createRange(e,t){return new g(e,t)}createRangeIn(e){return g._createIn(e)}createRangeOn(e){return g._createOn(e)}createSelection(...e){return new ve(...e)}createBatch(e){return new ti(e)}createOperationFromJSON(e){return $y.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new ik(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}};function dr(n,e){if(n)return n instanceof ve||n instanceof De?n:n instanceof Rt?e||e===0?new ve(n,e):n.is("rootElement")?new ve(n,"in"):new ve(n,"on"):new ve(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Sk extends It{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class En extends It{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class fr{constructor(e){this.document=e}createDocumentFragment(e){return new xt(this.document,e)}createElement(e,t,i){return new Oe(this.document,e,t,i)}createText(e){return new j(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const s=i.getChildIndex(e);return this.removeChildren(s,1,i),this.insertChild(s,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new Oe(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){fe(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return v._createAt(e,t)}createPositionAfter(e){return v._createAfter(e)}createPositionBefore(e){return v._createBefore(e)}createRange(e,t){return new S(e,t)}createRangeOn(e){return S._createOn(e)}createRangeIn(e){return S._createIn(e)}createSelection(...e){return new ct(...e)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class xk{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new d("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Ik extends Re{constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){const s=t;t=(r,o)=>{this.editor.execute(s),o()}}super.set(e,t,i)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Rk extends H(){constructor(e={}){super();const t=this.constructor,i=e.language||t.defaultConfig&&t.defaultConfig.language;this._context=e.context||new $l({language:i}),this._context._addEditor(this,!e.context);const s=Array.from(t.builtinPlugins||[]);this.config=new hl(e,t.defaultConfig),this.config.define("plugins",s),this.config.define(this._context._getEditorConfig()),this.plugins=new Ll(this,s,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new xk,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new Pk,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const r=new m1;this.data=new By(this.model,r),this.editing=new hy(this.model,r),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Ny([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 Ik(this),this.keystrokes.listenTo(this.editing.view.document)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new d("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new d("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new d("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],r=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(s),i,r)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),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,...t){try{return this.commands.execute(e,...t)}catch(i){/* istanbul ignore next -- @preserve */d.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Ok(n){if(!_t(n.updateSourceElement))throw new d("attachtoform-missing-elementapi-interface",n);const e=n.sourceElement;if(Mk(e)&&e.form){let t;const i=e.form,s=()=>n.updateSourceElement();_t(i.submit)&&(t=i.submit,i.submit=()=>{s(),t.apply(i)}),i.addEventListener("submit",s),n.on("destroy",()=>{i.removeEventListener("submit",s),t&&(i.submit=t)})}}function Mk(n){return!!n&&n.tagName.toLowerCase()==="textarea"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function An(n){class e extends n{setData(i){this.data.set(i)}getData(i){return this.data.get(i)}}return e}{const n=An(Object);An.setData=n.prototype.setData,An.getData=n.prototype.getData}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function mr(n){class e extends n{updateSourceElement(i=this.data.get()){if(!this.sourceElement)throw new d("editor-missing-sourceelement",this);const s=this.config.get("updateSourceElementOnDestroy"),r=this.sourceElement instanceof HTMLTextAreaElement;if(!s&&!r){yl(this.sourceElement,"");return}yl(this.sourceElement,i)}}return e}mr.updateSourceElement=mr(Object).prototype.updateSourceElement;/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Vk(n,e){if(e.ckeditorInstance)throw new d("editor-source-element-already-used",n);e.ckeditorInstance=n,n.once("destroy",()=>{delete e.ckeditorInstance})}const Dk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',Bk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',Fk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',Nk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',Lk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',$k='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',zk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.91 10.54c.26-.23.64-.21.88.03l3.36 3.14 2.23-2.06a.64.64 0 0 1 .87 0l2.52 2.97V4.5H3.2v10.12l3.71-4.08zm10.27-7.51c.6 0 1.09.47 1.09 1.05v11.84c0 .59-.49 1.06-1.09 1.06H2.79c-.6 0-1.09-.47-1.09-1.06V4.08c0-.58.49-1.05 1.1-1.05h14.38zm-5.22 5.56a1.96 1.96 0 1 1 3.4-1.96 1.96 1.96 0 0 1-3.4 1.96z"/></svg>',Hk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',Wk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',Uk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',jk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',qk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',Gk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',Kk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',Jk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',Zk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',Yk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',Xk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',Qk='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',e2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',t2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',i2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',n2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M13 6H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5h11z"/></svg>',s2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M7 10H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5h5z"/></svg>',r2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M10 8H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6a.5.5 0 0 1 .5-.5h8z"/></svg>',o2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',a2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',l2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',c2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',u2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',h2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',d2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',f2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',m2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const B={bold:u2,cancel:Dk,caption:Bk,check:Fk,cog:Nk,eraser:Lk,image:zk,lowVision:$k,importExport:m2,paragraph:h2,plus:d2,text:f2,alignBottom:Hk,alignMiddle:Wk,alignTop:Uk,alignLeft:jk,alignCenter:qk,alignRight:Gk,alignJustify:Kk,objectLeft:e2,objectCenter:Zk,objectRight:t2,objectFullWidth:Xk,objectInline:Qk,objectBlockLeft:Jk,objectBlockRight:Yk,objectSizeFull:i2,objectSizeLarge:n2,objectSizeSmall:s2,objectSizeMedium:r2,pencil:o2,pilcrow:a2,quote:l2,threeVerticalDots:c2};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class hu{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const i="error"in t?t.error:t.reason;i instanceof Error&&this._handleError(i,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(i=>i!==t)}_fire(e,...t){const i=this._listeners[e]||[];for(const s of i)s.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const i=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:i}),i?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&e.context!==void 0&&e.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(e)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;const e=this.crashes[this.crashes.length-1].date,t=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(e-t)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function gr(n,e=new Set){const t=[n],i=new Set;let s=0;for(;t.length>s;){const r=t[s++];if(!(i.has(r)||!g2(r)||e.has(r)))if(i.add(r),Symbol.iterator in r)try{for(const o of r)t.push(o)}catch{}else for(const o in r)o!=="defaultValue"&&t.push(r[o])}return i}function g2(n){const e=Object.prototype.toString.call(n),t=typeof n;return!(t==="number"||t==="boolean"||t==="string"||t==="symbol"||t==="function"||e==="[object Date]"||e==="[object RegExp]"||e==="[object Module]"||n===void 0||n===null||n._watchdogExcluded||n instanceof EventTarget||n instanceof Event)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function du(n,e,t=new Set){if(n===e&&p2(n))return!0;const i=gr(n,t),s=gr(e,t);for(const r of i)if(s.has(r))return!0;return!1}function p2(n){return typeof n=="object"&&n!==null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class fu extends hu{constructor(e,t={}){super(t),this._editor=null,this._throttledSave=on(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(i,s)=>e.create(i,s)),this._destructor=i=>i.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{if(typeof this._elementOrData=="string")return this.create(this._data,this._config,this._config.context);{const e=Object.assign({},this._config,{initialData:this._data});return this.create(this._elementOrData,e,e.context)}}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,i){return Promise.resolve().then(()=>(super._startErrorHandling(),this._elementOrData=e,this._config=this._cloneEditorConfiguration(t)||{},this._config.context=i,this._creator(e,this._config))).then(s=>{this._editor=s,s.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=s.model.document.version,this._data=this._getData(),this.state="ready",this._fire("stateChange")})}destroy(){return Promise.resolve().then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.flush();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._lastDocumentVersion=e}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e={};for(const t of this._editor.model.document.getRootNames())e[t]=this._editor.data.get({rootName:t});return e}_isErrorComingFromThisItem(e){return du(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Es(e,(t,i)=>{if(qt(t)||i==="context")return t})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Ni=Symbol("MainQueueId");class w2 extends hu{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new b2,this._watchdogConfig=t,this._creator=i=>e.create(i),this._destructor=i=>i.destroy(),this._actionQueues.onEmpty(()=>{this.state==="initializing"&&(this.state="ready",this._fire("stateChange"))})}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}get context(){return this._context}create(e={}){return this._actionQueues.enqueue(Ni,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=mu(e);return Promise.all(t.map(i=>this._actionQueues.enqueue(i.id,()=>{if(this.state==="destroyed")throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let s;if(this._watchdogs.has(i.id))throw new Error(`Item with the given id is already added: '${i.id}'.`);if(i.type==="editor")return s=new fu(null,this._watchdogConfig),s.setCreator(i.creator),s._setExcludedProperties(this._contextProps),i.destructor&&s.setDestructor(i.destructor),this._watchdogs.set(i.id,s),s.on("error",(r,{error:o,causesRestart:a})=>{this._fire("itemError",{itemId:i.id,error:o}),a&&this._actionQueues.enqueue(i.id,()=>new Promise(l=>{const c=()=>{s.off("restart",c),this._fire("itemRestart",{itemId:i.id}),l()};s.on("restart",c)}))}),s.create(i.sourceElementOrData,i.config,this._context);throw new Error(`Not supported item type: '${i.type}'.`)})))}remove(e){const t=mu(e);return Promise.all(t.map(i=>this._actionQueues.enqueue(i,()=>{const s=this._getWatchdog(i);return this._watchdogs.delete(i),s.destroy()})))}destroy(){return this._actionQueues.enqueue(Ni,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Ni,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(e=>{console.error("An error happened during destroying the context or items.",e)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(e=>(this._context=e,this._contextProps=gr(this._context),Promise.all(Array.from(this._watchdogs.values()).map(t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(t=>t.destroy())).then(()=>this._destructor(e))})}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return du(this._context,e.context)}}class b2{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const i=e===Ni;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const r=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(Ni),this._queues.get(e)])).then(t),o=r.catch(()=>{});return this._queues.set(e,o),r.finally(()=>{this._activeActions--,this._queues.get(e)===o&&this._activeActions===0&&this._onEmptyCallbacks.forEach(a=>a())})}}function mu(n){return Array.isArray(n)?n:[n]}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function pr({emitter:n,activator:e,callback:t,contextElements:i}){n.listenTo(document,"mousedown",(s,r)=>{if(!e())return;const o=typeof r.composedPath=="function"?r.composedPath():[],a=typeof i=="function"?i():i;for(const l of a)if(l.contains(r.target)||o.includes(l))return;t()})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function wr(n){class e extends n{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...i){super(...i),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function br({view:n}){n.listenTo(n.element,"submit",(e,t)=>{t.preventDefault(),n.fire("submit")},{useCapture:!0})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function _2({keystrokeHandler:n,focusTracker:e,gridItems:t,numberOfColumns:i,uiLanguageDirection:s}){const r=typeof i=="number"?()=>i:i;n.set("arrowright",o((c,u)=>s==="rtl"?l(c,u.length):a(c,u.length))),n.set("arrowleft",o((c,u)=>s==="rtl"?a(c,u.length):l(c,u.length))),n.set("arrowup",o((c,u)=>{let h=c-r();return h<0&&(h=c+r()*Math.floor(u.length/r()),h>u.length-1&&(h-=r())),h})),n.set("arrowdown",o((c,u)=>{let h=c+r();return h>u.length-1&&(h=c%r()),h}));function o(c){return u=>{const h=t.find(p=>p.element===e.focusedElement),f=t.getIndex(h),m=c(f,t);t.get(m).focus(),u.stopPropagation(),u.preventDefault()}}function a(c,u){return c===u-1?0:c+1}function l(c,u){return c===0?u-1:c-1}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class tt extends Ie{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(t,i,s)=>{this._renderViewIntoCollectionParent(i,s)}),this.on("remove",(t,i)=>{i.element&&this._parentElement&&i.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!v2(e))throw new d("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const s of e)i.delegate(s).to(t);this.on("add",(i,s)=>{for(const r of e)s.delegate(r).to(t)}),this.on("remove",(i,s)=>{for(const r of e)s.stopDelegating(r,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}function v2(n){return n.every(e=>typeof e=="string")}const F5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class P extends Ye(H()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Ie,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,i)=>{i.locale=e,i.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Te.bind(this,this)}createCollection(e){const t=new tt(e);return this._viewCollections.add(t),t}registerChild(e){we(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){we(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Te(e)}extendTemplate(e){Te.extend(this.template,e)}render(){if(this.isRendered)throw new d("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const y2="http://www.w3.org/1999/xhtml";class Te extends L(){constructor(e){super(),Object.assign(this,bu(wu(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=Eu(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new d("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(const i of t.children)Pn(i)?yield i:_r(i)&&(yield*e(i))}yield*e(this)}static bind(e,t){return{to(i,s){return new k2({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:s})},if(i,s,r){return new gu({observable:e,emitter:t,attribute:i,valueIfTrue:s,callback:r})}}}static extend(e,t){if(e._isRendered)throw new d("template-extend-render",[this,e]);ku(e,bu(wu(t)))}_renderNode(e){let t;if(e.node?t=this.tag&&this.text:t=this.tag?this.text:!this.text,t)throw new d("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||y2,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(""),Tn(this.text)?this._bindToObservable({schema:this.text,updater:E2(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,i=e.revertData;for(const s in this.attributes){const r=t.getAttribute(s),o=this.attributes[s];i&&(i.attributes[s]=r);const a=Cu(o)?o[0].ns:null;if(Tn(o)){const l=Cu(o)?o[0].value:o;i&&Au(s)&&l.unshift(r),this._bindToObservable({schema:l,updater:A2(t,s,a),data:e})}else if(s=="style"&&typeof o[0]!="string")this._renderStyleAttribute(o[0],e);else{i&&r&&Au(s)&&o.unshift(r);const l=o.map(c=>c&&(c.value||c)).reduce((c,u)=>c.concat(u),[]).reduce(vu,"");ni(l)||t.setAttributeNS(a,s,l)}}}_renderStyleAttribute(e,t){const i=t.node;for(const s in e){const r=e[s];Tn(r)?this._bindToObservable({schema:[r],updater:T2(i,s),data:t}):i.style[s]=r}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,s=e.isApplying;let r=0;for(const o of this.children)if(vr(o)){if(!s){o.setParent(t);for(const a of o)i.appendChild(a.element)}}else if(Pn(o))s||(o.isRendered||o.render(),i.appendChild(o.element));else if(lt(o))i.appendChild(o);else if(s){const a=e.revertData,l=Eu();a.children.push(l),o._renderNode({intoFragment:!1,node:i.childNodes[r++],isApplying:!0,revertData:l})}else i.appendChild(o.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(s=>{const[r,o]=t.split("@");return s.activateDomEventListener(r,o,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const s=i.revertData;pu(e,t,i);const r=e.filter(o=>!ni(o)).filter(o=>o.observable).map(o=>o.activateAttributeListener(e,t,i));s&&s.bindings.push(r)}_revertTemplateFromNode(e,t){for(const s of t.bindings)for(const r of s)r();if(t.text){e.textContent=t.text;return}const i=e;for(const s in t.attributes){const r=t.attributes[s];r===null?i.removeAttribute(s):i.setAttribute(s,r)}for(let s=0;s<t.children.length;++s)this._revertTemplateFromNode(i.childNodes[s],t.children[s])}}class Li{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const s=()=>pu(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class k2 extends Li{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,i){const s=(r,o)=>{(!t||o.target.matches(t))&&(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(o):this.observable.fire(this.eventNameOrFunction,o))};return this.emitter.listenTo(i.node,e,s),()=>{this.emitter.stopListening(i.node,e,s)}}}class gu extends Li{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return ni(t)?!1:this.valueIfTrue||!0}}function Tn(n){return n?(n.value&&(n=n.value),Array.isArray(n)?n.some(Tn):n instanceof Li):!1}function C2(n,e){return n.map(t=>t instanceof Li?t.getValue(e):t)}function pu(n,e,{node:t}){const i=C2(n,t);let s;n.length==1&&n[0]instanceof gu?s=i[0]:s=i.reduce(vu,""),ni(s)?e.remove():e.set(s)}function E2(n){return{set(e){n.textContent=e},remove(){n.textContent=""}}}function A2(n,e,t){return{set(i){n.setAttributeNS(t,e,i)},remove(){n.removeAttributeNS(t,e)}}}function T2(n,e){return{set(t){n.style[e]=t},remove(){n.style[e]=null}}}function wu(n){return Es(n,t=>{if(t&&(t instanceof Li||_r(t)||Pn(t)||vr(t)))return t})}function bu(n){if(typeof n=="string"?n=x2(n):n.text&&I2(n),n.on&&(n.eventListeners=S2(n.on),delete n.on),!n.text){n.attributes&&P2(n.attributes);const e=[];if(n.children)if(vr(n.children))e.push(n.children);else for(const t of n.children)_r(t)||Pn(t)||lt(t)?e.push(t):e.push(new Te(t));n.children=e}return n}function P2(n){for(const e in n)n[e].value&&(n[e].value=X(n[e].value)),_u(n,e)}function S2(n){for(const e in n)_u(n,e);return n}function x2(n){return{text:[n]}}function I2(n){n.text=X(n.text)}function _u(n,e){n[e]=X(n[e])}function vu(n,e){return ni(e)?n:ni(n)?e:`${n} ${e}`}function yu(n,e){for(const t in e)n[t]?n[t].push(...e[t]):n[t]=e[t]}function ku(n,e){if(e.attributes&&(n.attributes||(n.attributes={}),yu(n.attributes,e.attributes)),e.eventListeners&&(n.eventListeners||(n.eventListeners={}),yu(n.eventListeners,e.eventListeners)),e.text&&n.text.push(...e.text),e.children&&e.children.length){if(n.children.length!=e.children.length)throw new d("ui-template-extend-children-mismatch",n);let t=0;for(const i of e.children)ku(n.children[t++],i)}}function ni(n){return!n&&n!==0}function Pn(n){return n instanceof P}function _r(n){return n instanceof Te}function vr(n){return n instanceof tt}function Cu(n){return K(n[0])&&n[0].ns}function Eu(){return{children:[],bindings:[],attributes:{}}}function Au(n){return n=="class"||n=="style"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class R2 extends tt{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new Te({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=w_(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&&e.childElementCount==0&&e.remove()}}const N5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class dt extends P{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon","ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],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 t=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),i=t.getAttribute("viewBox");i&&(this.viewBox=i);for(const{name:s,value:r}of Array.from(t.attributes))dt.presentationalAttributeNames.includes(s)&&this.element.setAttribute(s,r);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}dt.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];const L5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class $ extends P{constructor(e){super(e),this._focusDelayed=null;const t=this.bindTemplate,i=qe();this.set("ariaChecked",void 0),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${i}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._createLabelView(),this.iconView=new dt,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));const s={tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",r=>!r),t.if("isVisible","ck-hidden",r=>!r),t.to("isOn",r=>r?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],role:t.to("role"),type:t.to("type",r=>r||"button"),tabindex:t.to("tabindex"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy"),"aria-disabled":t.if("isEnabled",!0,r=>!r),"aria-checked":t.to("isOn"),"aria-pressed":t.to("isOn",r=>this.isToggleable?String(!!r):!1),"data-cke-tooltip-text":t.to("_tooltipString"),"data-cke-tooltip-position":t.to("tooltipPosition")},children:this.children,on:{click:t.to(r=>{this.isEnabled?this.fire("execute"):r.preventDefault()})}};x.isSafari&&(this._focusDelayed||(this._focusDelayed=Ns(()=>this.focus(),0)),s.on.mousedown=t.to(()=>{this._focusDelayed()}),s.on.mouseup=t.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(s)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_createLabelView(){const e=new P,t=this.bindTemplate;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:t.to("labelStyle"),id:this.ariaLabelledBy},children:[{text:t.to("label")}]}),e}_createKeystrokeView(){const e=new P;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>Ml(t))}]}),e}_getTooltipString(e,t,i){return e?typeof e=="string"?e:(i&&(i=Ml(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}const $5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class yr extends ${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 P;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function O2(n,e){const t=n.t,i={Black:t("Black"),"Dim grey":t("Dim grey"),Grey:t("Grey"),"Light grey":t("Light grey"),White:t("White"),Red:t("Red"),Orange:t("Orange"),Yellow:t("Yellow"),"Light green":t("Light green"),Green:t("Green"),Aquamarine:t("Aquamarine"),Turquoise:t("Turquoise"),"Light blue":t("Light blue"),Blue:t("Blue"),Purple:t("Purple")};return e.map(s=>{const r=i[s.label];return r&&r!=s.label&&(s.label=r),s})}function M2(n){return n.map(V2).filter(e=>!!e)}function V2(n){return typeof n=="string"?{model:n,label:n,hasBorder:!1,view:{name:"span",styles:{color:n}}}:{model:n.color,label:n.label||n.color,hasBorder:n.hasBorder===void 0?!1:n.hasBorder,view:{name:"span",styles:{color:`${n.color}`}}}}const D2='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Tu extends ${constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=D2,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%)"}}const z5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Pu extends P{constructor(e,t){super(e);const i=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const s={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new be,this.keystrokes=new Re,this.items.on("add",(r,o)=>{o.isOn=o.color===this.selectedColor}),i.forEach(r=>{const o=new Tu;o.set({color:r.color,label:r.label,tooltip:!0,hasBorder:r.options.hasBorder}),o.on("execute",()=>{this.fire("execute",{value:r.color,hasBorder:r.options.hasBorder,label:r.label})}),this.items.add(o)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:s}}),this.on("change:selectedColor",(r,o,a)=>{for(const l of this.items)l.isOn=l.color===a})}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),_2({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}function Su(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xu={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Iu=Su(xu);var Ru={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Ou(n){var e,t=[],i=1,s;if(typeof n=="string")if(Iu[n])t=Iu[n].slice(),s="rgb";else if(n==="transparent")i=0,s="rgb",t=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(n)){var r=n.slice(1),o=r.length,a=o<=4;i=1,a?(t=[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16)],o===4&&(i=parseInt(r[3]+r[3],16)/255)):(t=[parseInt(r[0]+r[1],16),parseInt(r[2]+r[3],16),parseInt(r[4]+r[5],16)],o===8&&(i=parseInt(r[6]+r[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(n)){var l=e[1],c=l==="rgb",r=l.replace(/a$/,"");s=r;var o=r==="cmyk"?4:r==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(f,m){if(/%$/.test(f))return m===o?parseFloat(f)/100:r==="rgb"?parseFloat(f)*255/100:parseFloat(f);if(r[m]==="h"){if(/deg$/.test(f))return parseFloat(f);if(Ru[f]!==void 0)return Ru[f]}return parseFloat(f)}),l===r&&t.push(1),i=c||t[o]===void 0?1:t[o],t=t.slice(0,o)}else n.length>10&&/[0-9](?:\s|\/)/.test(n)&&(t=n.match(/([0-9]+)/g).map(function(u){return parseFloat(u)}),s=n.match(/([a-z])/ig).join("").toLowerCase());else isNaN(n)?Array.isArray(n)||n.length?(t=[n[0],n[1],n[2]],s="rgb",i=n.length===4?n[3]:1):n instanceof Object&&(n.r!=null||n.red!=null||n.R!=null?(s="rgb",t=[n.r||n.red||n.R||0,n.g||n.green||n.G||0,n.b||n.blue||n.B||0]):(s="hsl",t=[n.h||n.hue||n.H||0,n.s||n.saturation||n.S||0,n.l||n.lightness||n.L||n.b||n.brightness]),i=n.a||n.alpha||n.opacity||1,n.opacity!=null&&(i/=100)):(s="rgb",t=[n>>>16,(n&65280)>>>8,n&255]);return{space:s,values:t,alpha:i}}const $i=xu,Mu={};for(const n of Object.keys($i))Mu[$i[n]]=n;const y={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Vu=y;for(const n of Object.keys(y)){if(!("channels"in y[n]))throw new Error("missing channels property: "+n);if(!("labels"in y[n]))throw new Error("missing channel labels property: "+n);if(y[n].labels.length!==y[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:e,labels:t}=y[n];delete y[n].channels,delete y[n].labels,Object.defineProperty(y[n],"channels",{value:e}),Object.defineProperty(y[n],"labels",{value:t})}y.rgb.hsl=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),r=Math.max(e,t,i),o=r-s;let a,l;r===s?a=0:e===r?a=(t-i)/o:t===r?a=2+(i-e)/o:i===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+r)/2;return r===s?l=0:c<=.5?l=o/(r+s):l=o/(2-r-s),[a,l*100,c*100]},y.rgb.hsv=function(n){let e,t,i,s,r;const o=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),h=function(f){return(c-f)/6/u+1/2};return u===0?(s=0,r=0):(r=u/c,e=h(o),t=h(a),i=h(l),o===c?s=i-t:a===c?s=1/3+e-i:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,r*100,c*100]},y.rgb.hwb=function(n){const e=n[0],t=n[1];let i=n[2];const s=y.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,r*100,i*100]},y.rgb.cmyk=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),r=(1-e-s)/(1-s)||0,o=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function B2(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}y.rgb.keyword=function(n){const e=Mu[n];if(e)return e;let t=1/0,i;for(const s of Object.keys($i)){const r=$i[s],o=B2(n,r);o<t&&(t=o,i=s)}return i},y.keyword.rgb=function(n){return $i[n]},y.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805,r=e*.2126+t*.7152+i*.0722,o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]},y.rgb.lab=function(n){const e=y.rgb.xyz(n);let t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const r=116*i-16,o=500*(t-i),a=200*(i-s);return[r,o,a]},y.hsl.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;let s,r,o;if(t===0)return o=i*255,[o,o,o];i<.5?s=i*(1+t):s=i+t-i*t;const a=2*i-s,l=[0,0,0];for(let c=0;c<3;c++)r=e+1/3*-(c-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(s-a)*6*r:2*r<1?o=s:3*r<2?o=a+(s-a)*(2/3-r)*6:o=a,l[c]=o*255;return l},y.hsl.hsv=function(n){const e=n[0];let t=n[1]/100,i=n[2]/100,s=t;const r=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=r<=1?r:2-r;const o=(i+t)/2,a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]},y.hsv.rgb=function(n){const e=n[0]/60,t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-t),a=255*i*(1-t*r),l=255*i*(1-t*(1-r));switch(i*=255,s){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}},y.hsv.hsl=function(n){const e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01);let r,o;o=(2-t)*i;const a=(2-t)*s;return r=t*s,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]},y.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100,i=n[2]/100;const s=t+i;let r;s>1&&(t/=s,i/=s);const o=Math.floor(6*e),a=1-i;r=6*e-o,o&1&&(r=1-r);const l=t+r*(a-t);let c,u,h;switch(o){default:case 6:case 0:c=a,u=l,h=t;break;case 1:c=l,u=a,h=t;break;case 2:c=t,u=a,h=l;break;case 3:c=t,u=l,h=a;break;case 4:c=l,u=t,h=a;break;case 5:c=a,u=t,h=l;break}return[c*255,u*255,h*255]},y.cmyk.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,r=1-Math.min(1,e*(1-s)+s),o=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]},y.xyz.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100;let s,r,o;return s=e*3.2406+t*-1.5372+i*-.4986,r=e*-.9689+t*1.8758+i*.0415,o=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[s*255,r*255,o*255]},y.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16,r=500*(e-t),o=200*(t-i);return[s,r,o]},y.lab.xyz=function(n){const e=n[0],t=n[1],i=n[2];let s,r,o;r=(e+16)/116,s=t/500+r,o=r-i/200;const a=r**3,l=s**3,c=o**3;return r=a>.008856?a:(r-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]},y.lab.lch=function(n){const e=n[0],t=n[1],i=n[2];let s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(t*t+i*i);return[e,o,s]},y.lch.lab=function(n){const e=n[0],t=n[1],s=n[2]/360*2*Math.PI,r=t*Math.cos(s),o=t*Math.sin(s);return[e,r,o]},y.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let r=e===null?y.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return r===2&&(o+=60),o},y.hsv.ansi16=function(n){return y.rgb.ansi16(y.hsv.rgb(n),n[2])},y.rgb.ansi256=function(n){const e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)},y.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(~~(n>50)+1)*.5,i=(e&1)*t*255,s=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[i,s,r]},y.ansi256.rgb=function(n){if(n>=232){const r=(n-232)*10+8;return[r,r,r]}n-=16;let e;const t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]},y.rgb.hex=function(n){const t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t},y.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));const i=parseInt(t,16),s=i>>16&255,r=i>>8&255,o=i&255;return[s,r,o]},y.rgb.hcg=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),r=Math.min(Math.min(e,t),i),o=s-r;let a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:s===e?l=(t-i)/o%6:s===t?l=2+(i-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]},y.hsl.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t);let s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]},y.hsv.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=e*t;let s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]},y.hcg.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];const s=[0,0,0],r=e%1*6,o=r%1,a=1-o;let l=0;switch(Math.floor(r)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*i,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]},y.hcg.hsv=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);let s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]},y.hcg.hsl=function(n){const e=n[1]/100,i=n[2]/100*(1-e)+.5*e;let s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]},y.hcg.hwb=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]},y.hwb.hcg=function(n){const e=n[1]/100,i=1-n[2]/100,s=i-e;let r=0;return s<1&&(r=(i-s)/(1-s)),[n[0],s*100,r*100]},y.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]},y.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]},y.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]},y.gray.hsl=function(n){return[0,0,n[0]]},y.gray.hsv=y.gray.hsl,y.gray.hwb=function(n){return[0,100,n[0]]},y.gray.cmyk=function(n){return[0,0,0,n[0]]},y.gray.lab=function(n){return[n[0],0,0]},y.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},y.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};const Sn=Vu;function F2(){const n={},e=Object.keys(Sn);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function N2(n){const e=F2(),t=[n];for(e[n].distance=0;t.length;){const i=t.pop(),s=Object.keys(Sn[i]);for(let r=s.length,o=0;o<r;o++){const a=s[o],l=e[a];l.distance===-1&&(l.distance=e[i].distance+1,l.parent=i,t.unshift(a))}}return e}function L2(n,e){return function(t){return e(n(t))}}function $2(n,e){const t=[e[n].parent,n];let i=Sn[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=L2(Sn[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}var z2=function(n){const e=N2(n),t={},i=Object.keys(e);for(let s=i.length,r=0;r<s;r++){const o=i[r];e[o].parent!==null&&(t[o]=$2(o,e))}return t};const kr=Vu,H2=z2,si={},W2=Object.keys(kr);function U2(n){const e=function(...t){const i=t[0];return i==null?i:(i.length>1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function j2(n){const e=function(...t){const i=t[0];if(i==null)return i;i.length>1&&(t=i);const s=n(t);if(typeof s=="object")for(let r=s.length,o=0;o<r;o++)s[o]=Math.round(s[o]);return s};return"conversion"in n&&(e.conversion=n.conversion),e}W2.forEach(n=>{si[n]={},Object.defineProperty(si[n],"channels",{value:kr[n].channels}),Object.defineProperty(si[n],"labels",{value:kr[n].labels});const e=H2(n);Object.keys(e).forEach(i=>{const s=e[i];si[n][i]=j2(s),si[n][i].raw=U2(s)})});var Du=si;const Bu=pi({__proto__:null,default:Su(Du)},[Du]);/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Fu(n,e){if(!n)return"";const t=Nu(n);if(!t)return"";if(t.space===e)return n;if(!K2(t))return"";const s=Bu[t.space][e];if(!s)return"";const r=s(t.space==="hex"?t.hexValue:t.values);return G2(r,e)}function q2(n){if(!n)return"";const e=Nu(n);return e?e.space==="hex"?e.hexValue:Fu(n,"hex"):"#000"}function G2(n,e){switch(e){case"hex":return`#${n}`;case"rgb":return`rgb( ${n[0]}, ${n[1]}, ${n[2]} )`;case"hsl":return`hsl( ${n[0]}, ${n[1]}%, ${n[2]}% )`;case"hwb":return`hwb( ${n[0]}, ${n[1]}, ${n[2]} )`;case"lab":return`lab( ${n[0]}% ${n[1]} ${n[2]} )`;case"lch":return`lch( ${n[0]}% ${n[1]} ${n[2]} )`;default:return""}}function Nu(n){if(n.startsWith("#")){const t=Ou(n);return{space:"hex",values:t.values,hexValue:n,alpha:t.alpha}}const e=Ou(n);return e.space?e:null}function K2(n){return Object.keys(Bu).includes(n.space)}const W5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Lu extends P{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${qe()}`;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")}]})}}const U5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class xn extends P{constructor(e,t){super(e);const i=`ck-labeled-field-view-${qe()}`,s=`ck-labeled-field-view-status-${qe()}`;this.fieldView=t(this,i,s),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(s),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(o,a)=>o||a);const r=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",r.to("class"),r.if("isEnabled","ck-disabled",o=>!o),r.if("isEmpty","ck-labeled-field-view_empty"),r.if("isFocused","ck-labeled-field-view_focused"),r.if("placeholder","ck-labeled-field-view_placeholder"),r.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new Lu(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new P(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",s=>!s)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}const j5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class J2 extends P{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.focusTracker=new be,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0),this.set("inputMode","text");const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),inputmode:t.to("inputMode"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to((...i)=>{this.fire("input",...i),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=Z2(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?"":e}}function Z2(n){return!n.value}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Y2 extends J2{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class X2 extends P{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",i=>`ck-dropdown__panel_${i}`),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(i=>{i.target.tagName.toLocaleLowerCase()!=="input"&&i.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():G("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}const q5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ri extends P{constructor(e,t,i){super(e);const s=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.keystrokes=new Re,this.focusTracker=new be,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",s.to("class"),s.if("isEnabled","ck-disabled",r=>!r)],id:s.to("id"),"aria-describedby":s.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":s.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",(t,i,s)=>{s&&(this.panelPosition==="auto"?this.panelView.position=ri._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=(t,i)=>{this.isOpen&&(this.isOpen=!1,i())};this.keystrokes.set("arrowdown",(t,i)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,i())}),this.keystrokes.set("arrowright",(t,i)=>{this.isOpen&&i()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:s,northEast:r,northWest:o,southMiddleEast:a,southMiddleWest:l,northMiddleEast:c,northMiddleWest:u}=ri.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[i,s,a,l,e,r,o,c,u,t]:[s,i,l,a,e,o,r,u,c,t]}}ri.defaultPanelPositions={south:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)/2,name:"s"}),southEast:n=>({top:n.bottom,left:n.left,name:"se"}),southWest:(n,e)=>({top:n.bottom,left:n.left-e.width+n.width,name:"sw"}),southMiddleEast:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)/4,name:"sme"}),southMiddleWest:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)*3/4,name:"smw"}),north:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)/2,name:"n"}),northEast:(n,e)=>({top:n.top-e.height,left:n.left,name:"ne"}),northWest:(n,e)=>({top:n.top-e.height,left:n.left-e.width+n.width,name:"nw"}),northMiddleEast:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)/4,name:"nme"}),northMiddleWest:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)*3/4,name:"nmw"})},ri._getOptimalPosition=El;const $u='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Cr extends ${constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",t=>String(t))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new dt;return e.content=$u,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Dt{constructor(e){if(this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];typeof i=="string"&&(i=[i]);for(const s of i)e.keystrokeHandler.set(s,(r,o)=>{this[t](),o()})}}get first(){return this.focusables.find(Er)||null}get last(){return this.focusables.filter(Er).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return this.focusTracker.focusedElement===null?null:(this.focusables.find((t,i)=>{const s=t.element===this.focusTracker.focusedElement;return s&&(e=i),s}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,i=this.focusables.length;if(!i)return null;if(t===null)return this[e===1?"first":"last"];let s=(t+i+e)%i;do{const r=this.focusables.get(s);if(Er(r))return r;s=(s+i+e)%i}while(s!==t);return null}}function Er(n){return!!(n.focus&&Et(n.element))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class zu extends P{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Q2 extends P{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function eC(n){return n.bindTemplate.to(e=>{e.target===n.element&&e.preventDefault()})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Hu(n){return Array.isArray(n)?{items:n,removeItems:[]}:n?Object.assign({items:[],removeItems:[]},n):{items:[],removeItems:[]}}const G5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const{threeVerticalDots:Wu}=B,tC={alignLeft:B.alignLeft,bold:B.bold,importExport:B.importExport,paragraph:B.paragraph,plus:B.plus,text:B.text,threeVerticalDots:B.threeVerticalDots};class Ar extends P{constructor(e,t){super(e);const i=this.bindTemplate,s=this.t;this.options=t||{},this.set("ariaLabel",s("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new be,this.keystrokes=new Re,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new iC(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const r=e.uiLanguageDirection==="rtl";this._focusCycler=new Dt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[r?"arrowright":"arrowleft","arrowup"],focusNext:[r?"arrowleft":"arrowright","arrowdown"]}});const o=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];this.options.shouldGroupWhenFull&&this.options.isFloating&&o.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:o,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:eC(this)}}),this._behavior=this.options.shouldGroupWhenFull?new sC(this):new nC(this)}render(){super.render(),this.focusTracker.add(this.element);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(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,i){this.items.addMany(this._buildItemsFromConfig(e,t,i))}_buildItemsFromConfig(e,t,i){const s=Hu(e),r=i||s.removeItems;return this._cleanItemsConfiguration(s.items,t,r).map(a=>K(a)?this._createNestedToolbarDropdown(a,t,r):a==="|"?new zu:a==="-"?new Q2:t.create(a)).filter(a=>!!a)}_cleanItemsConfiguration(e,t,i){const s=e.filter((r,o,a)=>r==="|"?!0:i.indexOf(r)!==-1?!1:r==="-"?this.options.shouldGroupWhenFull?(G("toolbarview-line-break-ignored-when-grouping-items",a),!1):!0:!K(r)&&!t.has(r)?(G("toolbarview-item-unavailable",{item:r}),!1):!0);return this._cleanSeparatorsAndLineBreaks(s)}_cleanSeparatorsAndLineBreaks(e){const t=o=>o!=="-"&&o!=="|",i=e.length,s=e.findIndex(t);if(s===-1)return[];const r=i-e.slice().reverse().findIndex(t);return e.slice(s,r).filter((o,a,l)=>t(o)?!0:!(a>0&&l[a-1]===o))}_createNestedToolbarDropdown(e,t,i){let{label:s,icon:r,items:o,tooltip:a=!0,withText:l=!1}=e;if(o=this._cleanItemsConfiguration(o,t,i),!o.length)return null;const c=this.locale,u=it(c);return s||G("toolbarview-nested-toolbar-dropdown-missing-label",e),u.class="ck-toolbar__nested-toolbar-dropdown",u.buttonView.set({label:s,tooltip:a,withText:!!l}),r!==!1?u.buttonView.icon=tC[r]||r||Wu:u.buttonView.withText=!0,In(u,()=>u.toolbarView._buildItemsFromConfig(o,t,i)),u}}class iC extends P{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class nC{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(i=>i),e.focusables.bindTo(e.items).using(i=>i),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class sC{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,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(),e.itemsView.children.bindTo(this.ungroupedItems).using(t=>t),this.ungroupedItems.on("change",this._updateFocusCycleableItems.bind(this)),e.children.on("change",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(t,i)=>{const s=i.index,r=Array.from(i.added);for(const o of i.removed)s>=this.ungroupedItems.length?this.groupedItems.remove(o):this.ungroupedItems.remove(o);for(let o=s;o<s+r.length;o++){const a=r[o-s];o>this.ungroupedItems.length?this.groupedItems.add(a,o-this.ungroupedItems.length):this.ungroupedItems.add(a,o)}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(!Et(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new D(e.lastChild),s=new D(e);if(!this.cachedPadding){const r=R.window.getComputedStyle(e),o=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(r[o])}return t==="ltr"?i.right>s.right-this.cachedPadding:i.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new W(this.viewElement,t=>{(!e||e!==t.contentRect.width||this.shouldUpdateGroupingOnNextResize)&&(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new zu),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=it(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",In(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:Wu}),i}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}const K5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class rC extends P{constructor(e){super(e);const t=this.bindTemplate;this.items=this.createCollection(),this.focusTracker=new be,this.keystrokes=new Re,this._focusCycler=new Dt({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel")},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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Uu extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",i=>!i)],role:"presentation"},children:this.children})}focus(){this.children.first.focus()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class oC extends P{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}const J5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ju extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),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 Re,this.focusTracker=new be,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.to("class"),t.if("isVisible","ck-hidden",i=>!i),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())})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(){const e=new $;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 $,t=e.bindTemplate;return e.icon=$u,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",i=>String(i))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}const Z5="",Y5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function it(n,e=Cr){const t=new e(n),i=new X2(n),s=new ri(n,t,i);return t.bind("isEnabled").to(s),t instanceof ju?t.arrowView.bind("isOn").to(s,"isOpen"):t.bind("isOn").to(s,"isOpen"),aC(s),s}function In(n,e,t={}){n.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),n.isOpen?qu(n,e,t):n.once("change:isOpen",()=>qu(n,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&Pr(n,()=>n.toolbarView.items.find(i=>i.isOn))}function qu(n,e,t){const i=n.locale,s=i.t,r=n.toolbarView=new Ar(i),o=typeof e=="function"?e():e;r.ariaLabel=t.ariaLabel||s("Dropdown toolbar"),t.maxWidth&&(r.maxWidth=t.maxWidth),t.class&&(r.class=t.class),t.isCompact&&(r.isCompact=t.isCompact),t.isVertical&&(r.isVertical=!0),o instanceof tt?r.items.bindTo(o).using(a=>a):r.items.addMany(o),n.panelView.children.add(r),r.items.delegate("execute").to(n)}function Tr(n,e,t={}){n.isOpen?Gu(n,e,t):n.once("change:isOpen",()=>Gu(n,e,t),{priority:"highest"}),Pr(n,()=>n.listView.items.find(i=>i instanceof Uu?i.children.first.isOn:!1))}function Gu(n,e,t){const i=n.locale,s=n.listView=new rC(i),r=typeof e=="function"?e():e;s.ariaLabel=t.ariaLabel,s.role=t.role,s.items.bindTo(r).using(o=>{if(o.type==="separator")return new oC(i);if(o.type==="button"||o.type==="switchbutton"){const a=new Uu(i);let l;return o.type==="button"?l=new $(i):l=new yr(i),l.bind(...Object.keys(o.model)).to(o.model),l.delegate("execute").to(a),a.children.add(l),a}return null}),n.panelView.children.add(s),s.items.delegate("execute").to(n)}function Pr(n,e){n.on("change:isOpen",()=>{if(!n.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():G("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:pe.low-10})}function aC(n){lC(n),cC(n),uC(n),hC(n),dC(n),fC(n)}function lC(n){n.on("render",()=>{pr({emitter:n,activator:()=>n.isOpen,callback:()=>{n.isOpen=!1},contextElements:[n.element]})})}function cC(n){n.on("execute",e=>{e.source instanceof yr||(n.isOpen=!1)})}function uC(n){n.focusTracker.on("change:isFocused",(e,t,i)=>{n.isOpen&&!i&&(n.isOpen=!1)})}function hC(n){n.keystrokes.set("arrowdown",(e,t)=>{n.isOpen&&(n.panelView.focus(),t())}),n.keystrokes.set("arrowup",(e,t)=>{n.isOpen&&(n.panelView.focusLast(),t())})}function dC(n){n.on("change:isOpen",(e,t,i)=>{if(i)return;const s=n.panelView.element;s&&s.contains(R.document.activeElement)&&n.buttonView.focus()})}function fC(n){n.on("change:isOpen",(e,t,i)=>{i&&n.panelView.focus()},{priority:"low"})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Rn(n,e,t){const i=new Y2(n.locale);return i.set({id:e,ariaDescribedById:t}),i.bind("isReadOnly").to(n,"isEnabled",s=>!s),i.bind("hasError").to(n,"errorText",s=>!!s),i.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(i),i}const zi=(n,e=0,t=1)=>n>t?t:n<e?e:n,ae=(n,e=0,t=Math.pow(10,e))=>Math.round(t*n)/t,mC=n=>_C(Sr(n)),Sr=n=>(n[0]==="#"&&(n=n.substring(1)),n.length<6?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?ae(parseInt(n[3]+n[3],16)/255,2):1}:{r:parseInt(n.substring(0,2),16),g:parseInt(n.substring(2,4),16),b:parseInt(n.substring(4,6),16),a:n.length===8?ae(parseInt(n.substring(6,8),16)/255,2):1}),gC=n=>bC(wC(n)),pC=({h:n,s:e,v:t,a:i})=>{const s=(200-e)*t/100;return{h:ae(n),s:ae(s>0&&s<200?e*t/100/(s<=100?s:200-s)*100:0),l:ae(s/2),a:ae(i,2)}},xr=n=>{const{h:e,s:t,l:i}=pC(n);return`hsl(${e}, ${t}%, ${i}%)`},wC=({h:n,s:e,v:t,a:i})=>{n=n/360*6,e=e/100,t=t/100;const s=Math.floor(n),r=t*(1-e),o=t*(1-(n-s)*e),a=t*(1-(1-n+s)*e),l=s%6;return{r:ae([t,o,r,r,a,t][l]*255),g:ae([a,t,t,o,r,r][l]*255),b:ae([r,r,a,t,t,o][l]*255),a:ae(i,2)}},On=n=>{const e=n.toString(16);return e.length<2?"0"+e:e},bC=({r:n,g:e,b:t,a:i})=>{const s=i<1?On(ae(i*255)):"";return"#"+On(n)+On(e)+On(t)+s},_C=({r:n,g:e,b:t,a:i})=>{const s=Math.max(n,e,t),r=s-Math.min(n,e,t),o=r?s===n?(e-t)/r:s===e?2+(t-n)/r:4+(n-e)/r:0;return{h:ae(60*(o<0?o+6:o)),s:ae(s?r/s*100:0),v:ae(s/255*100),a:i}},Ku=(n,e)=>{if(n===e)return!0;for(const t in n)if(n[t]!==e[t])return!1;return!0},vC=(n,e)=>n.toLowerCase()===e.toLowerCase()?!0:Ku(Sr(n),Sr(e)),Ju={},Zu=n=>{let e=Ju[n];return e||(e=document.createElement("template"),e.innerHTML=n,Ju[n]=e),e},Ir=(n,e,t)=>{n.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))};let oi=!1;const Rr=n=>"touches"in n,yC=n=>oi&&!Rr(n)?!1:(oi||(oi=Rr(n)),!0),Yu=(n,e)=>{const t=Rr(e)?e.touches[0]:e,i=n.el.getBoundingClientRect();Ir(n.el,"move",n.getMove({x:zi((t.pageX-(i.left+window.pageXOffset))/i.width),y:zi((t.pageY-(i.top+window.pageYOffset))/i.height)}))},kC=(n,e)=>{const t=e.keyCode;t>40||n.xy&&t<37||t<33||(e.preventDefault(),Ir(n.el,"move",n.getMove({x:t===39?.01:t===37?-.01:t===34?.05:t===33?-.05:t===35?1:t===36?-1:0,y:t===40?.01:t===38?-.01:0},!0)))};class Xu{constructor(e,t,i,s){const r=Zu(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(r.content.cloneNode(!0));const o=e.querySelector(`[part=${t}]`);o.addEventListener("mousedown",this),o.addEventListener("touchstart",this),o.addEventListener("keydown",this),this.el=o,this.xy=s,this.nodes=[o.firstChild,o]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(oi?"touchmove":"mousemove",this),t(oi?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!yC(e)||!oi&&e.button!=0)return;this.el.focus(),Yu(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Yu(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":kC(this,e);break}}style(e){e.forEach((t,i)=>{for(const s in t)this.nodes[i].style.setProperty(s,t[s])})}}class CC extends Xu{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:`${e/360*100}%`,color:xr({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${ae(e)}`)}getMove(e,t){return{h:t?zi(this.h+e.x*360,0,360):360*e.x}}}class EC extends Xu{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:xr(e)},{"background-color":xr({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${ae(e.s)}%, Brightness ${ae(e.v)}%`)}getMove(e,t){return{s:t?zi(this.hsva.s+e.x*100,0,100):e.x*100,v:t?zi(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}}const AC=':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',TC="[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}",PC="[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}",Mn=Symbol("same"),Or=Symbol("color"),Qu=Symbol("hsva"),Mr=Symbol("update"),eh=Symbol("parts"),th=Symbol("css"),ih=Symbol("sliders");class SC extends HTMLElement{static get observedAttributes(){return["color"]}get[th](){return[AC,TC,PC]}get[ih](){return[EC,CC]}get color(){return this[Or]}set color(e){if(!this[Mn](e)){const t=this.colorModel.toHsva(e);this[Mr](t),this[Or]=e}}constructor(){super();const e=Zu(`<style>${this[th].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[eh]=this[ih].map(i=>new i(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const s=this.colorModel.fromAttr(i);this[Mn](s)||(this.color=s)}handleEvent(e){const t=this[Qu],i={...t,...e.detail};this[Mr](i);let s;!Ku(i,t)&&!this[Mn](s=this.colorModel.fromHsva(i))&&(this[Or]=s,Ir(this,"color-changed",{value:s}))}[Mn](e){return this.color&&this.colorModel.equal(e,this.color)}[Mr](e){this[Qu]=e,this[eh].forEach(t=>t.update(e))}}const xC={defaultColor:"#000",toHsva:mC,fromHsva:({h:n,s:e,v:t})=>gC({h:n,s:e,v:t,a:1}),equal:vC,fromAttr:n=>n};class IC extends SC{get colorModel(){return xC}}class RC extends IC{}customElements.define("hex-color-picker",RC);const X5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const OC=150;class MC extends P{constructor(e,t){super(e),this.set("color",""),this.set("_hexColor",""),this._format=t.format||"hsl",this.hexInputRow=this._createInputRow();const i=this.createCollection();i.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:i}),this._debounceColorPickerEvent=jt(s=>{this.set("color",s)},OC,{leading:!0}),this.on("set:color",(s,r,o)=>{s.return=Fu(o,this._format)}),this.on("change:color",()=>{this._hexColor=Vr(this.color)}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Vr(this.color)!=Vr(this._hexColor)&&(this.color=this._hexColor)})}render(){if(super.render(),this.picker=R.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.element.insertBefore(this.picker,this.hexInputRow.element);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",e=>{const i=e.detail.value;this._debounceColorPickerEvent(i)})}focus(){/* istanbul ignore next -- @preserve */(x.isGecko||x.isiOS||x.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const i=[...this.picker.shadowRoot.children].filter(s=>s.getAttribute("role")==="slider").map(s=>new VC(s));this.slidersView=this.createCollection(),i.forEach(s=>{this.slidersView.add(s)})}_createInputRow(){const e=new DC,t=this._createColorInput();return new BC(this.locale,[e,t])}_createColorInput(){const e=new xn(this.locale,Rn),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",i=>e.isFocused?e.fieldView.value:i.startsWith("#")?i.substring(1):i),e.fieldView.on("input",()=>{const i=e.fieldView.element.value;if(i){const s=i.trim(),r=s.startsWith("#")?s.substring(1):s;[3,4,6,8].includes(r.length)&&/(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})/.test(r)&&this._debounceColorPickerEvent("#"+r)}}),e}}function Vr(n){let e=q2(n);return e||(e="#000"),e.length===4&&(e="#"+[e[1],e[1],e[2],e[2],e[3],e[3]].join("")),e.toLowerCase()}class VC extends P{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class DC extends P{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class BC extends P{constructor(e,t){super(e),this.children=this.createCollection(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class FC{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(Dr(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new d("componentfactory-item-missing",this,{name:e});return this._components.get(Dr(e)).callback(this.editor.locale)}has(e){return this._components.has(Dr(e))}}function Dr(n){return String(n).toLowerCase()}const Q5="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const nh=Vs("px"),sh=R.document.body;class le extends P{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",void 0),this._pinWhenIsVisibleCallback=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",i=>`ck-balloon-panel_${i}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",nh),left:t.to("left",nh)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=le.defaultPositions,i=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast,t.viewportStickyNorth],limiter:sh,fitInViewport:!0},e),s=le._getOptimalPosition(i),r=parseInt(s.left),o=parseInt(s.top),a=s.name,l=s.config||{},{withArrow:c=!0}=l;this.top=o,this.left=r,this.position=a,this.withArrow=c}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=Br(e.target),i=e.limiter?Br(e.limiter):sh;this.listenTo(R.document,"scroll",(s,r)=>{const o=r.target,a=t&&o.contains(t),l=i&&o.contains(i);(a||l||!t||!i)&&this.attachTo(e)},{useCapture:!0}),this.listenTo(R.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(R.document,"scroll"),this.stopListening(R.window,"resize")}}le.arrowSideOffset=25,le.arrowHeightOffset=10,le.stickyVerticalOffset=20,le._getOptimalPosition=El,le.defaultPositions=rh();function Br(n){return qt(n)?n:hn(n)?n.commonAncestorContainer:typeof n=="function"?Br(n()):null}function rh(n={}){const{sideOffset:e=le.arrowSideOffset,heightOffset:t=le.arrowHeightOffset,stickyVerticalOffset:i=le.stickyVerticalOffset,config:s}=n;return{northWestArrowSouthWest:(a,l)=>({top:r(a,l),left:a.left-e,name:"arrow_sw",...s&&{config:s}}),northWestArrowSouthMiddleWest:(a,l)=>({top:r(a,l),left:a.left-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northWestArrowSouth:(a,l)=>({top:r(a,l),left:a.left-l.width/2,name:"arrow_s",...s&&{config:s}}),northWestArrowSouthMiddleEast:(a,l)=>({top:r(a,l),left:a.left-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northWestArrowSouthEast:(a,l)=>({top:r(a,l),left:a.left-l.width+e,name:"arrow_se",...s&&{config:s}}),northArrowSouthWest:(a,l)=>({top:r(a,l),left:a.left+a.width/2-e,name:"arrow_sw",...s&&{config:s}}),northArrowSouthMiddleWest:(a,l)=>({top:r(a,l),left:a.left+a.width/2-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northArrowSouth:(a,l)=>({top:r(a,l),left:a.left+a.width/2-l.width/2,name:"arrow_s",...s&&{config:s}}),northArrowSouthMiddleEast:(a,l)=>({top:r(a,l),left:a.left+a.width/2-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northArrowSouthEast:(a,l)=>({top:r(a,l),left:a.left+a.width/2-l.width+e,name:"arrow_se",...s&&{config:s}}),northEastArrowSouthWest:(a,l)=>({top:r(a,l),left:a.right-e,name:"arrow_sw",...s&&{config:s}}),northEastArrowSouthMiddleWest:(a,l)=>({top:r(a,l),left:a.right-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northEastArrowSouth:(a,l)=>({top:r(a,l),left:a.right-l.width/2,name:"arrow_s",...s&&{config:s}}),northEastArrowSouthMiddleEast:(a,l)=>({top:r(a,l),left:a.right-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northEastArrowSouthEast:(a,l)=>({top:r(a,l),left:a.right-l.width+e,name:"arrow_se",...s&&{config:s}}),southWestArrowNorthWest:a=>({top:o(a),left:a.left-e,name:"arrow_nw",...s&&{config:s}}),southWestArrowNorthMiddleWest:(a,l)=>({top:o(a),left:a.left-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southWestArrowNorth:(a,l)=>({top:o(a),left:a.left-l.width/2,name:"arrow_n",...s&&{config:s}}),southWestArrowNorthMiddleEast:(a,l)=>({top:o(a),left:a.left-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southWestArrowNorthEast:(a,l)=>({top:o(a),left:a.left-l.width+e,name:"arrow_ne",...s&&{config:s}}),southArrowNorthWest:a=>({top:o(a),left:a.left+a.width/2-e,name:"arrow_nw",...s&&{config:s}}),southArrowNorthMiddleWest:(a,l)=>({top:o(a),left:a.left+a.width/2-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southArrowNorth:(a,l)=>({top:o(a),left:a.left+a.width/2-l.width/2,name:"arrow_n",...s&&{config:s}}),southArrowNorthMiddleEast:(a,l)=>({top:o(a),left:a.left+a.width/2-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southArrowNorthEast:(a,l)=>({top:o(a),left:a.left+a.width/2-l.width+e,name:"arrow_ne",...s&&{config:s}}),southEastArrowNorthWest:a=>({top:o(a),left:a.right-e,name:"arrow_nw",...s&&{config:s}}),southEastArrowNorthMiddleWest:(a,l)=>({top:o(a),left:a.right-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southEastArrowNorth:(a,l)=>({top:o(a),left:a.right-l.width/2,name:"arrow_n",...s&&{config:s}}),southEastArrowNorthMiddleEast:(a,l)=>({top:o(a),left:a.right-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southEastArrowNorthEast:(a,l)=>({top:o(a),left:a.right-l.width+e,name:"arrow_ne",...s&&{config:s}}),westArrowEast:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.left-l.width-t,name:"arrow_e",...s&&{config:s}}),eastArrowWest:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.right+t,name:"arrow_w",...s&&{config:s}}),viewportStickyNorth:(a,l,c)=>a.getIntersection(c)?{top:c.top+i,left:a.left+a.width/2-l.width/2,name:"arrowless",config:{withArrow:!1,...s}}:null};function r(a,l){return a.top-l.height-t}function o(a){return a.bottom+t}}const eS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const oh="ck-tooltip";class re extends Ye(){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,re._editors.add(e),re._instance)return re._instance;re._instance=this,this.tooltipTextView=new P(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new le(e.locale),this.balloonPanelView.class=oh,this.balloonPanelView.content.add(this.tooltipTextView),this._pinTooltipDebounced=jt(this._pinTooltip,600),this.listenTo(R.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(R.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(R.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(R.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(R.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;re._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),re._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),re._instance=null)}static getPositioningFunctions(e){const t=re.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onEnterOrFocus(e,{target:t}){const i=Fr(t);i&&i!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(i,NC(i)))}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if(e.name==="mouseleave"){if(!qt(t)||this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const s=Fr(t),r=Fr(i);s&&s!==r&&this._unpinTooltip()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltip()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:i,cssClass:s}){const r=Ee(re._editors.values()).ui.view.body;r.has(this.balloonPanelView)||r.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.pin({target:e,positions:re.getPositioningFunctions(i)}),this._resizeObserver=new W(e,()=>{Et(e)||this._unpinTooltip()}),this.balloonPanelView.class=[oh,s].filter(o=>o).join(" ");for(const o of re._editors)this.listenTo(o.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i}_unpinTooltip(){this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of re._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver&&this._resizeObserver.destroy()}_updateTooltipPosition(){if(!Et(this._currentElementWithTooltip)){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:re.getPositioningFunctions(this._currentTooltipPosition)})}}re.defaultBalloonPositions=rh({heightOffset:5,sideOffset:13}),re._editors=new Set,re._instance=null;function Fr(n){return qt(n)?n.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function NC(n){return{text:n.dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}}const LC=`<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></svg>
`;/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const $C=53,zC=10,HC=50,WC=350,UC="Powered by",Vn={top:-99999,left:-99999,name:"invalid",config:{withArrow:!1}};class jC extends Ye(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=on(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor,t=!!e.config.get("ui.poweredBy.forceVisible");/* istanbul ignore next -- @preserve */!t&&J_(e.config.get("licenseKey"))==="VALID"||e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(i,s,r)=>{this._updateLastFocusedEditableElement(),r?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(i,s,r)=>{this._updateLastFocusedEditableElement(),r&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new le,i=lh(e),s=new qC(e.locale,i.label);t.content.add(s),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=GC(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i){this._lastFocusedEditableElement=null;return}const s=Array.from(e.ui.getEditableElementsNames()).map(r=>e.ui.getEditableElement(r));s.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=s[0]}}class qC extends P{constructor(e,t){super(e);const i=new dt,s=this.bindTemplate;i.set({content:LC,isColorInherited:!1}),i.extendTemplate({attributes:{style:{width:$C+"px",height:zC+"px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],i],on:{dragstart:s.to(r=>r.preventDefault())}}]})}}function GC(n,e){const t=lh(n),i=t.side==="right"?KC(e,t):JC(e,t);return{target:e,positions:[i]}}function KC(n,e){return ah(n,e,(t,i)=>t.left+t.width-i.width-e.horizontalOffset)}function JC(n,e){return ah(n,e,t=>t.left+e.horizontalOffset)}function ah(n,e,t){return(i,s)=>{const r=i.getVisible();if(!r||i.width<WC||i.height<HC)return Vn;let o;e.position==="inside"?o=i.bottom-s.height:o=i.bottom-s.height/2,o-=e.verticalOffset;const a=t(i,s);if(e.position==="inside"){const l=s.clone().moveTo(a,o);if(l.getIntersectionArea(r)<l.getArea())return Vn}else{const l=y_(n);if(l){const c=new D(l);if(r.bottom+s.height/2>c.bottom)return Vn}}return{top:o,left:a,name:`position_${e.position}-side_${e.side}`,config:{withArrow:!1}}}}function lh(n){const e=n.config.get("ui.poweredBy"),t=e&&e.position||"border";return{position:t,label:UC,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:n.locale.contentLanguageDirection==="ltr"?"right":"left",...e}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ZC extends H(){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[];const t=e.editing.view;this.editor=e,this.componentFactory=new FC(e),this.focusTracker=new be,this.tooltipManager=new re(e),this.poweredBy=new jC(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",()=>{this.isReady=!0}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?i():this.once("ready",i)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:i}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let i,s;e.keystrokes.set("Alt+F10",(r,o)=>{const a=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(a)&&!Array.from(t.domRoots.values()).includes(a)&&(i=a);const l=this._getCurrentFocusedToolbarDefinition();(!l||!s)&&(s=this._getFocusableCandidateToolbarDefinitions());for(let c=0;c<s.length;c++){const u=s.shift();if(s.push(u),u!==l&&this._focusFocusableCandidateToolbar(u)){l&&l.options.afterBlur&&l.options.afterBlur();break}}o()}),e.keystrokes.set("Esc",(r,o)=>{const a=this._getCurrentFocusedToolbarDefinition();a&&(i?(i.focus(),i=null):e.editing.view.focus(),a.options.afterBlur&&a.options.afterBlur(),o())})}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:i,options:s}=t;(Et(i.element)||s.beforeFocus)&&e.push(t)}return e.sort((t,i)=>ch(t)-ch(i)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:i}}=e;return i&&i(),Et(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){const i={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=i.top,t.viewportOffset.bottom+=i.bottom,t.viewportOffset.left+=i.left,t.viewportOffset.right+=i.right}}function ch(n){const{toolbarView:e,options:t}=n;let i=10;return Et(e.element)&&i--,t.isContextual&&i--,i}const tS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class YC extends P{constructor(e){super(e),this.body=new R2(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class XC extends P{constructor(e,t,i){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;e.isRenderingInProgress?i(this):t(this);function t(s){e.change(r=>{const o=e.document.getRoot(s.name);r.addClass(s.isFocused?"ck-focused":"ck-blurred",o),r.removeClass(s.isFocused?"ck-blurred":"ck-focused",o)})}function i(s){e.once("change:isRenderingInProgress",(r,o,a)=>{a?i(s):t(s)})}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class QC extends XC{constructor(e,t,i,s={}){super(e,t,i);const r=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=s.label||(()=>r("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change(t=>{const i=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),i)})}}const iS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Nr extends H(){constructor(e,t){super(),t&&Qo(this,t),e&&this.set(e)}}const eE='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',tE='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',nS="",sS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Dn=Vs("px");class Bn extends _{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,s=t.document.selection.editableElement;return s?t.domConverter.mapViewToDom(s.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new d("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t)){this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,(!this._visibleStack||e.singleViewMode)&&this.showStack(t);return}const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new d("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(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 d("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new le(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(i=>i[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 iE(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(i,s)=>!s&&i>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(i,s)=>{if(s<2)return"";const r=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[r,s])}),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 nE(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,i)=>!i&&t>=2?Math.min(t-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:s=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),s&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class iE extends P{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new be,this.buttonPrevView=this._createButtonView(t("Previous"),eE),this.buttonNextView=this._createButtonView(t("Next"),tE),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",s=>s?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new $(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class nE extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",s=>s?"":"ck-hidden")],style:{top:i.to("top",Dn),left:i.to("left",Dn),width:i.to("width",Dn),height:i.to("height",Dn)}},children:this.content}),this.on("change:numberOfPanels",(s,r,o,a)=>{o>a?this._addPanels(o-a):this._removePanels(a-o),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new P;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:s}=new D(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:s})}}}const rS="",oS="",sE='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const rE={colorPaletteIcon:sE};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class oE extends ZC{constructor(e,t){super(e),this.view=t,this._toolbarConfig=Hu(e.config.get("toolbar"))}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,i=e.editing.view,s=t.editable,r=i.document.getRoot();s.name=r.rootName,t.render();const o=s.element;this.setEditableElement(s.name,o),s.bind("isFocused").to(this.focusTracker),i.attachDomRoot(o),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.editor,t=this.view,i=t.editable.element,s=t.toolbar;t.panel.bind("isVisible").to(this.focusTracker,"isFocused"),t.bind("viewportTopOffset").to(this,"viewportOffset",({top:r})=>r||0),t.listenTo(e.ui,"update",()=>{t.panel.isVisible&&t.panel.pin({target:i,positions:t.panelPositions})}),s.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(s)}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot();e.sourceElement;const s=e.config.get("placeholder");if(s){const r=typeof s=="string"?s:s[i.rootName];r&&t1({view:t,element:i,text:r,isDirectHost:!1,keepOnFocus:!0})}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const aE=Vs("px");class lE extends YC{constructor(e,t,i,s={}){super(e);const r=e.t;this.toolbar=new Ar(e,{shouldGroupWhenFull:s.shouldToolbarGroupWhenFull,isFloating:!0}),this.set("viewportTopOffset",0),this.panel=new le(e),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new QC(e,t,i,{label:o=>r("Rich Text Editor. Editing area: %0",o.name)}),this._resizeObserver=null}render(){if(super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.panel.content.add(this.toolbar),this.toolbar.options.shouldGroupWhenFull){const t=this.editable.element;this._resizeObserver=new W(t,()=>{this.toolbar.maxWidth=aE(new D(t).width)})}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(e,t){let i;return e.top>t.height+this.viewportTopOffset?i=e.top-t.height:e.bottom>t.height+this.viewportTopOffset+50?i=this.viewportTopOffset:i=e.bottom,i}_getPanelPositions(){const e=[(t,i)=>({top:this._getPanelPositionTop(t,i),left:t.left,name:"toolbar_west",config:{withArrow:!1}}),(t,i)=>({top:this._getPanelPositionTop(t,i),left:t.left+t.width-i.width,name:"toolbar_east",config:{withArrow:!1}})];return this.locale.uiLanguageDirection==="ltr"?e:e.reverse()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Fn extends An(mr(Rk)){constructor(e,t={}){if(!Nn(e)&&t.initialData!==void 0)throw new d("editor-create-initial-data",null);super(t),this.config.get("initialData")===void 0&&this.config.set("initialData",cE(e)),this.model.document.createRoot(),Nn(e)&&(this.sourceElement=e,Vk(this,e));const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),s=new lE(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:i});this.ui=new oE(this,s),Ok(this)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,t={}){return new Promise(i=>{if(Nn(e)&&e.tagName==="TEXTAREA")throw new d("editor-wrong-element",null);const s=new this(e,t);i(s.initPlugins().then(()=>s.ui.init()).then(()=>s.data.init(s.config.get("initialData"))).then(()=>s.fire("ready")).then(()=>s))})}}Fn.Context=$l,Fn.EditorWatchdog=fu,Fn.ContextWatchdog=w2;function cE(n){return Nn(n)?k_(n):n}function Nn(n){return qt(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Lr extends It{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"});function i(s){return(r,o)=>{o.preventDefault();const a=o.dropRange?[o.dropRange]:null,l=new je(t,s);t.fire(l,{dataTransfer:o.dataTransfer,method:r.name,targetRanges:a,target:o.target,domEvent:o.domEvent}),l.stop.called&&o.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,i=e.type=="drop"||e.type=="paste",s={dataTransfer:new dc(t,{cacheFiles:i})};(e.type=="drop"||e.type=="dragover")&&(s.dropRange=uE(this.view,e)),this.fire(e.type,e,s)}}function uE(n,e){const t=e.target.ownerDocument,i=e.clientX,s=e.clientY;let r;return t.caretRangeFromPoint&&t.caretRangeFromPoint(i,s)?r=t.caretRangeFromPoint(i,s):e.rangeParent&&(r=t.createRange(),r.setStart(e.rangeParent,e.rangeOffset),r.collapse(!0)),r?n.domConverter.domRangeToView(r):null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function hE(n){return n=n.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;"),(n.includes("</p><p>")||n.includes("<br>"))&&(n=`<p>${n}</p>`),n}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function dE(n){return n.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const uh=["figcaption","li"];function hh(n){let e="";if(n.is("$text")||n.is("$textProxy"))e=n.data;else if(n.is("element","img")&&n.hasAttribute("alt"))e=n.getAttribute("alt");else if(n.is("element","br"))e=`
`;else{let t=null;for(const i of n.getChildren()){const s=hh(i);t&&(t.is("containerElement")||i.is("containerElement"))&&(uh.includes(t.name)||uh.includes(i.name)?e+=`
`:e+=`

`),e+=s,t=i}}return e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ft extends _{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Lr),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document;this.listenTo(s,"clipboardInput",(r,o)=>{o.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&r.stop()},{priority:"highest"}),this.listenTo(s,"clipboardInput",(r,o)=>{const a=o.dataTransfer;let l;if(o.content)l=o.content;else{let u="";a.getData("text/html")?u=dE(a.getData("text/html")):a.getData("text/plain")&&(u=hE(a.getData("text/plain"))),l=this.editor.data.htmlProcessor.toView(u)}const c=new je(this,"inputTransformation");this.fire(c,{content:l,dataTransfer:a,targetRanges:o.targetRanges,method:o.method}),c.stop.called&&r.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(r,o)=>{if(o.content.isEmpty)return;const l=this.editor.data.toModel(o.content,"$clipboardHolder");l.childCount!=0&&(r.stop(),t.change(()=>{this.fire("contentInsertion",{content:l,method:o.method,dataTransfer:o.dataTransfer,targetRanges:o.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(r,o)=>{o.resultRange=t.insertContent(o.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,s=e.editing.view.document,r=(o,a)=>{const l=a.dataTransfer;a.preventDefault();const c=e.data.toView(e.model.getSelectedContent(t.selection));s.fire("clipboardOutput",{dataTransfer:l,content:c,method:o.name})};this.listenTo(s,"copy",r,{priority:"low"}),this.listenTo(s,"cut",(o,a)=>{e.model.canEditAt(e.model.document.selection)?r(o,a):a.preventDefault()},{priority:"low"}),this.listenTo(s,"clipboardOutput",(o,a)=>{a.content.isEmpty||(a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content)),a.dataTransfer.setData("text/plain",hh(a.content))),a.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class dh{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(i,s)=>{s.isLocal&&s.isUndoable&&s!==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({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}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=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class fE extends Q{constructor(e,t){super(e),this._buffer=new dh(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,s=e.text||"",r=s.length;let o=i.selection;if(e.selection?o=e.selection:e.range&&(o=t.createSelection(e.range)),!t.canEditAt(o))return;const a=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock(),t.deleteContent(o),s&&t.insertContent(l.createText(s,i.selection.getAttributes()),o),a?l.setSelection(a):o.is("documentSelection")||l.setSelection(o),this._buffer.unlock(),this._buffer.input(r)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const fh=["insertText","insertReplacementText"];class mE extends Me{constructor(e){super(e),x.isAndroid&&fh.push("insertCompositionText");const t=e.document;t.on("beforeinput",(i,s)=>{if(!this.isEnabled)return;const{data:r,targetRanges:o,inputType:a,domEvent:l}=s;if(!fh.includes(a))return;const c=new je(t,"insertText");t.fire(c,new Qt(e,l,{text:r,selection:e.createSelection(o)})),c.stop.called&&i.stop()}),t.on("compositionend",(i,{data:s,domEvent:r})=>{!this.isEnabled||x.isAndroid||s&&t.fire("insertText",new Qt(e,r,{text:s,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class mh extends _{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,s=t.document.selection;i.addObserver(mE);const r=new fE(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",r),e.commands.add("input",r),this.listenTo(i.document,"insertText",(o,a)=>{i.document.isComposing||a.preventDefault();const{text:l,selection:c,resultRange:u}=a,h=Array.from(c.getRanges()).map(p=>e.editing.mapper.toModelRange(p));let f=l;if(x.isAndroid){const p=Array.from(h[0].getItems()).reduce((b,E)=>b+(E.is("$textProxy")?E.data:""),"");p&&(p.length<=f.length?f.startsWith(p)&&(f=f.substring(p.length),h[0].start=h[0].start.getShiftedBy(p.length)):p.startsWith(f)&&(h[0].start=h[0].start.getShiftedBy(f.length),f=""))}const m={text:f,selection:t.createSelection(h)};u&&(m.resultRange=e.editing.mapper.toModelRange(u)),e.execute("insertText",m)}),x.isAndroid?this.listenTo(i.document,"keydown",(o,a)=>{s.isCollapsed||a.keyCode!=229||!i.document.isComposing||gh(t,r)}):this.listenTo(i.document,"compositionstart",()=>{s.isCollapsed||gh(t,r)})}}function gh(n,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),n.enqueueChange(t.batch,()=>{n.deleteContent(n.document.selection)}),t.unlock()}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ph extends Q{constructor(e,t){super(e),this.direction=t,this._buffer=new dh(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const r=s.createSelection(e.selection||i.selection);if(!t.canEditAt(r))return;const o=e.sequence||1,a=r.isCollapsed;if(r.isCollapsed&&t.modifySelection(r,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(o)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(r,o)){this.editor.execute("paragraph",{selection:r});return}if(r.isCollapsed)return;let l=0;r.getFirstRange().getMinimalFlatRanges().forEach(c=>{l+=Os(c.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(r,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),s.setSelection(r),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,r=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(r))||!t.schema.checkChild(r,"paragraph"))return!1;const a=r.getChild(0);return!(a&&a.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,r=t.schema.getLimitElement(s),o=e.createElement("paragraph");e.remove(e.createRangeIn(r)),e.insert(o,r),e.setSelection(o,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),r=i.schema.getLimitElement(s),o=r.getChild(0);return!(s.parent!=o||!e.containsEntireContent(o)||!i.schema.checkChild(r,"paragraph")||o.name=="paragraph")}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const gE="character",wh="word",pE="codePoint",mt="selection",ai="backward",Hi="forward",bh={deleteContent:{unit:mt,direction:ai},deleteContentBackward:{unit:pE,direction:ai},deleteWordBackward:{unit:wh,direction:ai},deleteHardLineBackward:{unit:mt,direction:ai},deleteSoftLineBackward:{unit:mt,direction:ai},deleteContentForward:{unit:gE,direction:Hi},deleteWordForward:{unit:wh,direction:Hi},deleteHardLineForward:{unit:mt,direction:Hi},deleteSoftLineForward:{unit:mt,direction:Hi}};class wE extends Me{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",()=>{i++}),t.on("keyup",()=>{i=0}),t.on("beforeinput",(s,r)=>{if(!this.isEnabled)return;const{targetRanges:o,domEvent:a,inputType:l}=r,c=bh[l];if(!c)return;const u={direction:c.direction,unit:c.unit,sequence:i};u.unit==mt&&(u.selectionToRemove=e.createSelection(o[0])),l==="deleteContentBackward"&&(x.isAndroid&&(u.sequence=1),_E(o)&&(u.unit=mt,u.selectionToRemove=e.createSelection(o)));const h=new Yt(t,"delete",o[0]);t.fire(h,new Qt(e,a,u)),h.stop.called&&s.stop()}),x.isBlink&&bE(this)}observe(){}stopObserving(){}}function bE(n){const e=n.view,t=e.document;let i=null,s=!1;t.on("keydown",(a,{keyCode:l})=>{i=l,s=!1}),t.on("keyup",(a,{keyCode:l,domEvent:c})=>{const u=t.selection,h=n.isEnabled&&l==i&&r(l)&&!u.isCollapsed&&!s;if(i=null,h){const f=u.getFirstRange(),m=new Yt(t,"delete",f),p={unit:mt,direction:o(l),selectionToRemove:u};t.fire(m,new Qt(e,c,p))}}),t.on("beforeinput",(a,{inputType:l})=>{const c=bh[l];r(i)&&c&&c.direction==o(i)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(a,{inputType:l,data:c})=>{i==O.delete&&l=="insertText"&&c==""&&a.stop()},{priority:"high"});function r(a){return a==O.backspace||a==O.delete}function o(a){return a==O.backspace?ai:Hi}}function _E(n){if(n.length!=1||n[0].isCollapsed)return!1;const e=n[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:i}of e){if(!i.parent.is("$text"))t++;else{const s=i.parent.data,r=i.offset;if(Ls(s,r)||$s(s,r)||Bl(s,r))continue;t++}if(t>1)return!0}return!1}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class li extends _{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,s=e.model.document;t.addObserver(wE),this._undoOnBackspace=!1;const r=new ph(e,"forward");e.commands.add("deleteForward",r),e.commands.add("forwardDelete",r),e.commands.add("delete",new ph(e,"backward")),this.listenTo(i,"delete",(o,a)=>{i.isComposing||a.preventDefault();const{direction:l,sequence:c,selectionToRemove:u,unit:h}=a,f=l==="forward"?"deleteForward":"delete",m={sequence:c};if(h=="selection"){const p=Array.from(u.getRanges()).map(b=>e.editing.mapper.toModelRange(b));m.selection=e.model.createSelection(p)}else m.unit=h;e.execute(f,m),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(o,a)=>{this._undoOnBackspace&&a.direction=="backward"&&a.sequence==1&&a.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),a.preventDefault(),o.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class vE extends _{static get requires(){return[mh,li]}static get pluginName(){return"Typing"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function _h(n,e){let t=n.start;return{text:Array.from(n.getWalker({ignoreElementEnd:!1})).reduce((s,{item:r})=>r.is("$text")||r.is("$textProxy")?s+r.data:(t=e.createPositionAfter(r),""),""),range:e.createRange(t,n.end)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class yE extends H(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",(i,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(i,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,r=i.document.selection,o=i.createRange(i.createPositionAt(r.focus.parent,0),r.focus),{text:a,range:l}=_h(o,i),c=this.testCallback(a);if(!c&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!c,c){const u=Object.assign(t,{text:a,range:l});typeof c=="object"&&Object.assign(u,c),this.fire(`matched:${e}`,u)}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class vh extends _{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,s=e.locale,r=t.document.selection;this.listenTo(i.document,"arrowKey",(o,a)=>{if(!r.isCollapsed||a.shiftKey||a.altKey||a.ctrlKey)return;const l=a.keyCode==O.arrowright,c=a.keyCode==O.arrowleft;if(!l&&!c)return;const u=s.contentLanguageDirection;let h=!1;u==="ltr"&&l||u==="rtl"&&c?h=this._handleForwardMovement(a):h=this._handleBackwardMovement(a),h===!0&&o.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(r,"change:range",(o,a)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!a.directChange&&$n(r.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,s=this.editor.model.document.selection,r=s.getFirstPosition();return this._isGravityOverridden||r.isAtStart&&$r(s,t)?!1:$n(r,t)?(Ln(e),this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,s=i.document.selection,r=s.getFirstPosition();return this._isGravityOverridden?(Ln(e),this._restoreGravity(),zr(i,t,r),!0):r.isAtStart?$r(s,t)?(Ln(e),zr(i,t,r),!0):!1:kE(r,t)?r.isAtEnd&&!$r(s,t)&&$n(r,t)?(Ln(e),zr(i,t,r),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}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 $r(n,e){for(const t of e)if(n.hasAttribute(t))return!0;return!1}function zr(n,e,t){const i=t.nodeBefore;n.change(s=>{i?s.setSelectionAttribute(i.getAttributes()):s.removeSelectionAttribute(e)})}function Ln(n){n.preventDefault()}function kE(n,e){const t=n.getShiftedBy(-1);return $n(t,e)}function $n(n,e){const{nodeBefore:t,nodeAfter:i}=n;for(const s of e){const r=t?t.getAttribute(s):void 0;if((i?i.getAttribute(s):void 0)!==r)return!0}return!1}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function ci(n,e,t,i){return i.createRange(yh(n,e,t,!0,i),yh(n,e,t,!1,i))}function yh(n,e,t,i,s){let r=n.textNode||(i?n.nodeBefore:n.nodeAfter),o=null;for(;r&&r.getAttribute(e)==t;)o=r,r=i?r.previousSibling:r.nextSibling;return o?s.createPositionAt(o,i?"before":"after"):n}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function CE(n,e,t,i){const s=n.editing.view,r=new Set;s.document.registerPostFixer(o=>{const a=n.model.document.selection;let l=!1;if(a.hasAttribute(e)){const c=ci(a.getFirstPosition(),e,a.getAttribute(e),n.model),u=n.editing.mapper.toViewRange(c);for(const h of u.getItems())h.is("element",t)&&!h.hasClass(i)&&(o.addClass(i,h),r.add(h),l=!0)}return l}),n.conversion.for("editingDowncast").add(o=>{o.on("insert",a,{priority:"highest"}),o.on("remove",a,{priority:"highest"}),o.on("attribute",a,{priority:"highest"}),o.on("selection",a,{priority:"highest"});function a(){s.change(l=>{for(const c of r.values())l.removeClass(i,c),r.delete(c)})}})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function*kh(n,e){for(const t of e)t&&n.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class EE extends Q{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,i=t.document.selection,s=t.schema,r=i.isCollapsed,o=i.getFirstRange(),a=o.start.parent,l=o.end.parent;if(s.isLimit(a)||s.isLimit(l))return!r&&a==l&&t.deleteContent(i),!1;if(r){const c=kh(e.model.schema,i.getAttributes());return Ch(e,o.start),e.setSelectionAttribute(c),!0}else{const c=!(o.start.isAtStart&&o.end.isAtEnd),u=a==l;if(t.deleteContent(i,{leaveUnmerged:c}),c){if(u)return Ch(e,i.focus),!0;e.setSelection(l,0)}}return!1}}function Ch(n,e){n.split(e),n.setSelection(e.parent.nextSibling,0)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const AE={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Eh extends Me{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",(s,r)=>{i=r.shiftKey}),t.on("beforeinput",(s,r)=>{if(!this.isEnabled)return;let o=r.inputType;x.isSafari&&i&&o=="insertParagraph"&&(o="insertLineBreak");const a=r.domEvent,l=AE[o];if(!l)return;const c=new Yt(t,"enter",r.targetRanges[0]);t.fire(c,new Qt(e,a,{isSoft:l.isSoft})),c.stop.called&&s.stop()})}observe(){}stopObserving(){}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Hr extends _{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(Eh),e.commands.add("enter",new EE(e)),this.listenTo(i,"enter",(s,r)=>{i.isComposing||r.preventDefault(),!r.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class TE extends Q{execute(){const e=this.editor.model,t=e.document;e.change(i=>{SE(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=PE(e.schema,t.selection)}}function PE(n,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!n.checkChild(t,"softBreak"))return!1;const i=e.getFirstRange(),s=i.start.parent,r=i.end.parent;return!((Wr(s,n)||Wr(r,n))&&s!==r)}function SE(n,e,t){const i=t.isCollapsed,s=t.getFirstRange(),r=s.start.parent,o=s.end.parent,a=r==o;if(i){const l=kh(n.schema,t.getAttributes());Ah(n,e,s.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(l)}else{const l=!(s.start.isAtStart&&s.end.isAtEnd);n.deleteContent(t,{leaveUnmerged:l}),a?Ah(n,e,t.focus):l&&e.setSelection(o,0)}}function Ah(n,e,t){const i=e.createElement("softBreak");n.insertContent(i,t),e.setSelection(i,"after")}function Wr(n,e){return n.is("rootElement")?!1:e.isLimit(n)||Wr(n.parent,e)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class xE extends _{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,s=e.editing.view,r=s.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(o,{writer:a})=>a.createEmptyElement("br")}),s.addObserver(Eh),e.commands.add("shiftEnter",new TE(e)),this.listenTo(r,"enter",(o,a)=>{r.isComposing||a.preventDefault(),a.isSoft&&(e.execute("shiftEnter"),s.scrollToTheSelection())},{priority:"low"})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class IE extends L(){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,s=i[0];this._insertDescriptor(e);const r=i[0];s!==r&&!Ur(s,r)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:r,writer:t})}remove(e,t){const i=this._stack,s=i[0];this._removeDescriptor(e);const r=i[0];s!==r&&!Ur(s,r)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:r,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(r=>r.id===e.id);if(Ur(e,t[i]))return;i>-1&&t.splice(i,1);let s=0;for(;t[s]&&RE(t[s],e);)s++;t.splice(s,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(s=>s.id===e);i>-1&&t.splice(i,1)}}function Ur(n,e){return n&&e&&n.priority==e.priority&&zn(n.classes)==zn(e.classes)}function RE(n,e){return n.priority>e.priority?!0:n.priority<e.priority?!1:zn(n.classes)>zn(e.classes)}function zn(n){return Array.isArray(n)?n.sort().join(","):n}const OE='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const ME="ck-widget",Th="ck-widget_selected";function J(n){return n.is("element")?!!n.getCustomProperty("widget"):!1}function Hn(n,e,t={}){if(!n.is("containerElement"))throw new d("widget-to-widget-wrong-element-type",null,{element:n});return e.setAttribute("contenteditable","false",n),e.addClass(ME,n),e.setCustomProperty("widget",!0,n),n.getFillerOffset=$E,e.setCustomProperty("widgetLabel",[],n),t.label&&FE(n,t.label),t.hasSelectionHandle&&zE(n,e),BE(n,e),n}function VE(n,e,t){if(e.classes&&t.addClass(X(e.classes),n),e.attributes)for(const i in e.attributes)t.setAttribute(i,e.attributes[i],n)}function DE(n,e,t){if(e.classes&&t.removeClass(X(e.classes),n),e.attributes)for(const i in e.attributes)t.removeAttribute(i,n)}function BE(n,e,t=VE,i=DE){const s=new IE;s.on("change:top",(a,l)=>{l.oldDescriptor&&i(n,l.oldDescriptor,l.writer),l.newDescriptor&&t(n,l.newDescriptor,l.writer)});const r=(a,l,c)=>s.add(l,c),o=(a,l,c)=>s.remove(l,c);e.setCustomProperty("addHighlight",r,n),e.setCustomProperty("removeHighlight",o,n)}function FE(n,e){n.getCustomProperty("widgetLabel").push(e)}function NE(n){return n.getCustomProperty("widgetLabel").reduce((t,i)=>typeof i=="function"?t?t+". "+i():i():t?t+". "+i:i,"")}function jr(n,e){const t=n.getSelectedElement();if(t){const i=gt(n);if(i)return e.createRange(e.createPositionAt(t,i))}return uu(n,e)}function LE(n,e){return(t,i)=>{const{mapper:s,viewPosition:r}=i,o=s.findMappedViewAncestor(r);if(!e(o))return;const a=s.toModelElement(o);i.modelPosition=n.createPositionAt(a,r.isAtStart?"before":"after")}}function $E(){return null}function zE(n,e){const t=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(i){const s=this.toDomElement(i),r=new dt;return r.set("content",OE),r.render(),s.appendChild(r.element),s});e.insert(e.createPositionAt(n,0),t),e.addClass(["ck-widget_with-selection-handle"],n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const nt="widget-type-around";function Bt(n,e,t){return!!n&&J(n)&&!t.isInline(e)}function HE(n){return n.closest(".ck-widget__type-around__button")}function WE(n){return n.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function UE(n,e){const t=n.closest(".ck-widget");return e.mapDomToView(t)}function gt(n){return n.getAttribute(nt)}const jE='<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>',aS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Ph=["before","after"],qE=new DOMParser().parseFromString(jE,"image/svg+xml").firstChild,Sh="ck-widget__type-around_disabled";class GE extends _{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Hr,li]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,s,r)=>{t.change(o=>{for(const a of t.document.roots)r?o.removeClass(Sh,a):o.addClass(Sh,a)}),r||e.model.change(o=>{o.removeSelectionAttribute(nt)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,s=i.editing.view,r=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:r}),s.focus(),s.scrollToTheSelection()}_listenToIfEnabled(e,t,i,s){this.listenTo(e,t,(...r)=>{this.isEnabled&&i(...r)},s)}_insertParagraphAccordingToFakeCaretPosition(){const i=this.editor.model.document.selection,s=gt(i);if(!s)return!1;const r=i.getSelectedElement();return this._insertParagraph(r,s),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,s={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(r,o,a)=>{const l=a.mapper.toViewElement(o.item);l&&Bt(l,o.item,t)&&(KE(a.writer,s,l),l.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,s=t.schema,r=e.editing.view;this._listenToIfEnabled(r.document,"arrowKey",(a,l)=>{this._handleArrowKeyPress(a,l)},{context:[J,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(a,l)=>{l.directChange&&e.model.change(c=>{c.removeSelectionAttribute(nt)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const a=i.getSelectedElement();if(a){const l=e.editing.mapper.toViewElement(a);if(Bt(l,a,s))return}e.model.change(l=>{l.removeSelectionAttribute(nt)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(a,l,c)=>{const u=c.writer;if(this._currentFakeCaretModelElement){const p=c.mapper.toViewElement(this._currentFakeCaretModelElement);p&&(u.removeClass(Ph.map(o),p),this._currentFakeCaretModelElement=null)}const h=l.selection.getSelectedElement();if(!h)return;const f=c.mapper.toViewElement(h);if(!Bt(f,h,s))return;const m=gt(l.selection);m&&(u.addClass(o(m),f),this._currentFakeCaretModelElement=h)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(a,l,c)=>{c||e.model.change(u=>{u.removeSelectionAttribute(nt)})});function o(a){return`ck-widget_type-around_show-fake-caret_${a}`}}_handleArrowKeyPress(e,t){const i=this.editor,s=i.model,r=s.document.selection,o=s.schema,a=i.editing.view,l=t.keyCode,c=F_(l,i.locale.contentLanguageDirection),u=a.document.selection.getSelectedElement(),h=i.editing.mapper.toModelElement(u);let f;Bt(u,h,o)?f=this._handleArrowKeyPressOnSelectedWidget(c):r.isCollapsed?f=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(f=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),f&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const i=this.editor.model,s=i.document.selection,r=gt(s);return i.change(o=>{if(r){if(!(r===(e?"after":"before")))return o.removeSelectionAttribute(nt),!0}else return o.setSelectionAttribute(nt,e?"after":"before"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,s=i.schema,r=t.plugins.get("Widget"),o=r._getObjectElementNextToSelection(e),a=t.editing.mapper.toViewElement(o);return Bt(a,o,s)?(i.change(l=>{r._setSelectionOverElement(o),l.setSelectionAttribute(nt,e?"before":"after")}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,s=i.schema,r=t.editing.mapper,o=i.document.selection,a=e?o.getLastPosition().nodeBefore:o.getFirstPosition().nodeAfter,l=r.toViewElement(a);return Bt(l,a,s)?(i.change(c=>{c.setSelection(a,"on"),c.setSelectionAttribute(nt,e?"after":"before")}),!0):!1}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,s)=>{const r=HE(s.domTarget);if(!r)return;const o=WE(r),a=UE(r,t.domConverter),l=e.editing.mapper.toModelElement(a);this._insertParagraph(l,o),s.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(s,r)=>{if(s.eventPhase!="atTarget")return;const o=t.getSelectedElement(),a=e.editing.mapper.toViewElement(o),l=e.model.schema;let c;this._insertParagraphAccordingToFakeCaretPosition()?c=!0:Bt(a,o,l)&&(this._insertParagraph(o,r.isSoft?"before":"after"),c=!0),c&&(r.preventDefault(),s.stop())},{context:J})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",(i,s)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(s.selection=t.selection)},{priority:"high"}),x.isAndroid?this._listenToIfEnabled(t,"keydown",(i,s)=>{s.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(t,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,s=i.schema;this._listenToIfEnabled(t.document,"delete",(r,o)=>{if(r.eventPhase!="atTarget")return;const a=gt(i.document.selection);if(!a)return;const l=o.direction,c=i.document.selection.getSelectedElement(),u=a==="before",h=l=="forward";if(u===h)e.execute("delete",{selection:i.createSelection(c,"on")});else{const m=s.getNearestSelectionRange(i.createPositionAt(c,a),l);if(m)if(!m.isCollapsed)i.change(p=>{p.setSelection(m),e.execute(h?"deleteForward":"delete")});else{const p=i.createSelection(m.start);if(i.modifySelection(p,{direction:l}),!p.focus.isEqual(m.start))i.change(b=>{b.setSelection(m),e.execute(h?"deleteForward":"delete")});else{const b=YE(s,m.start.parent);i.deleteContent(i.createSelection(b,"on"),{doNotAutoparagraph:!0})}}}o.preventDefault(),r.stop()},{context:J})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(s,[r,o])=>{if(o&&!o.is("documentSelection"))return;const a=gt(i);if(a)return s.stop(),t.change(l=>{const c=i.getSelectedElement(),u=t.createPositionAt(c,a),h=l.createSelection(u),f=t.insertContent(r,h);return l.setSelection(h),f})},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,i=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(s,r)=>{const[,o,a={}]=r;if(o&&!o.is("documentSelection"))return;const l=gt(i);l&&(a.findOptimalPosition=l,r[3]=a)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,i=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(s,[r])=>{if(r&&!r.is("documentSelection"))return;gt(i)&&s.stop()},{priority:"high"})}}function KE(n,e,t){const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(s){const r=this.toDomElement(s);return JE(r,e),ZE(r),r});n.insert(n.createPositionAt(t,"end"),i)}function JE(n,e){for(const t of Ph){const i=new Te({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${t}`],title:e[t],"aria-hidden":"true"},children:[n.ownerDocument.importNode(qE,!0)]});n.appendChild(i.render())}}function ZE(n){const e=new Te({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});n.appendChild(e.render())}function YE(n,e){let t=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||n.isLimit(i))break;t=i}return t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function XE(n){const e=n.model;return(t,i)=>{const s=i.keyCode==O.arrowup,r=i.keyCode==O.arrowdown,o=i.shiftKey,a=e.document.selection;if(!s&&!r)return;const l=r;if(o&&tA(a,l))return;const c=QE(n,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(o)return}(c.isCollapsed||eA(n,c,l))&&(e.change(u=>{const h=l?c.end:c.start;if(o){const f=e.createSelection(a.anchor);f.setFocus(h),u.setSelection(f)}else u.setSelection(h)}),t.stop(),i.preventDefault(),i.stopPropagation())}}}function QE(n,e,t){const i=n.model;if(t){const s=e.isCollapsed?e.focus:e.getLastPosition(),r=xh(i,s,"forward");if(!r)return null;const o=i.createRange(s,r),a=Ih(i.schema,o,"backward");return a?i.createRange(s,a):null}else{const s=e.isCollapsed?e.focus:e.getFirstPosition(),r=xh(i,s,"backward");if(!r)return null;const o=i.createRange(r,s),a=Ih(i.schema,o,"forward");return a?i.createRange(a,s):null}}function xh(n,e,t){const i=n.schema,s=n.createRangeIn(e.root),r=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:o,item:a,type:l}of s.getWalker({startPosition:e,direction:t})){if(i.isLimit(a)&&!i.isInline(a))return o;if(l==r&&i.isBlock(a))return null}return null}function Ih(n,e,t){const i=t=="backward"?e.end:e.start;if(n.checkChild(i,"$text"))return i;for(const{nextPosition:s}of e.getWalker({direction:t}))if(n.checkChild(s,"$text"))return s;return null}function eA(n,e,t){const i=n.model,s=n.view.domConverter;if(t){const c=i.createSelection(e.start);i.modifySelection(c),!c.focus.isAtEnd&&!e.start.isEqual(c.focus)&&(e=i.createRange(c.focus,e.end))}const r=n.mapper.toViewRange(e),o=s.viewRangeToDom(r),a=D.getDomRangeRects(o);let l;for(const c of a){if(l===void 0){l=Math.round(c.bottom);continue}if(Math.round(c.top)>=l)return!1;l=Math.max(l,Math.round(c.bottom))}return!0}function tA(n,e){return!n.isCollapsed&&n.isBackward==e}const lS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ui extends _{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[GE,li]}init(){const e=this.editor,t=e.editing.view,i=t.document;this.editor.editing.downcastDispatcher.on("selection",(s,r,o)=>{const a=o.writer,l=r.selection;if(l.isCollapsed)return;const c=l.getSelectedElement();if(!c)return;const u=e.editing.mapper.toViewElement(c);J(u)&&o.consumable.consume(l,"selection")&&a.setSelection(a.createRangeOn(u),{fake:!0,label:NE(u)})}),this.editor.editing.downcastDispatcher.on("selection",(s,r,o)=>{this._clearPreviouslySelectedWidgets(o.writer);const a=o.writer,l=a.document.selection;let c=null;for(const u of l.getRanges())for(const h of u){const f=h.item;J(f)&&!nA(f,c)&&(a.addClass(Th,f),this._previouslySelected.add(f),c=f)}},{priority:"low"}),t.addObserver(En),this.listenTo(i,"mousedown",(...s)=>this._onMousedown(...s)),this.listenTo(i,"arrowKey",(...s)=>{this._handleSelectionChangeOnArrowKeyPress(...s)},{context:[J,"$text"]}),this.listenTo(i,"arrowKey",(...s)=>{this._preventDefaultOnArrowKeyPress(...s)},{context:"$root"}),this.listenTo(i,"arrowKey",XE(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(s,r)=>{this._handleDelete(r.direction=="forward")&&(r.preventDefault(),s.stop())},{context:"$root"})}_onMousedown(e,t){const i=this.editor,s=i.editing.view,r=s.document;let o=t.target;if(iA(o)){if((x.isSafari||x.isGecko)&&t.domEvent.detail>=3){const l=i.editing.mapper,c=o.is("attributeElement")?o.findAncestor(h=>!h.is("attributeElement")):o,u=l.toModelElement(c);t.preventDefault(),this.editor.model.change(h=>{h.setSelection(u,"in")})}return}if(!J(o)&&(o=o.findAncestor(J),!o))return;x.isAndroid&&t.preventDefault(),r.isFocused||s.focus();const a=i.editing.mapper.toModelElement(o);this._setSelectionOverElement(a)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,s=this.editor.model,r=s.schema,o=s.document.selection,a=o.getSelectedElement(),l=Vl(i,this.editor.locale.contentLanguageDirection),c=l=="down"||l=="right",u=l=="up"||l=="down";if(a&&r.isObject(a)){const f=c?o.getLastPosition():o.getFirstPosition(),m=r.getNearestSelectionRange(f,c?"forward":"backward");m&&(s.change(p=>{p.setSelection(m)}),t.preventDefault(),e.stop());return}if(!o.isCollapsed&&!t.shiftKey){const f=o.getFirstPosition(),m=o.getLastPosition(),p=f.nodeAfter,b=m.nodeBefore;(p&&r.isObject(p)||b&&r.isObject(b))&&(s.change(E=>{E.setSelection(c?m:f)}),t.preventDefault(),e.stop());return}if(!o.isCollapsed)return;const h=this._getObjectElementNextToSelection(c);if(h&&r.isObject(h)){if(r.isInline(h)&&u)return;this._setSelectionOverElement(h),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,s=i.schema,r=i.document.selection.getSelectedElement();r&&s.isObject(r)&&(t.preventDefault(),e.stop())}_handleDelete(e){const i=this.editor.model.document.selection;if(!this.editor.model.canEditAt(i)||!i.isCollapsed)return;const s=this._getObjectElementNextToSelection(e);if(s)return this.editor.model.change(r=>{let o=i.anchor.parent;for(;o.isEmpty;){const a=o;o=a.parent,r.remove(a)}this._setSelectionOverElement(s)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,s=t.document.selection,r=t.createSelection(s);if(t.modifySelection(r,{direction:e?"forward":"backward"}),r.isEqual(s))return null;const o=e?r.focus.nodeBefore:r.focus.nodeAfter;return o&&i.isObject(o)?o:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Th,t);this._previouslySelected.clear()}}function iA(n){let e=n;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(J(e))return!1;e=e.parent}return!1}function nA(n,e){return e?Array.from(n.getAncestors()).includes(e):!1}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class qr extends _{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Bn]}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",i=>{sA(e.editing.view.document.selection)&&i.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:s,balloonClassName:r="ck-toolbar-container"}){if(!i.length){G("widget-toolbar-no-items",{toolbarId:e});return}const o=this.editor,a=o.t,l=new Ar(o.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new d("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:s,balloonClassName:r,itemsConfig:i,initialized:!1};o.ui.addToolbar(l,{isContextual:!0,beforeFocus:()=>{const u=s(o.editing.view.document.selection);u&&this._showToolbar(c,u)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(e,c)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const s of this._toolbarDefinitions.values()){const r=s.getRelatedElement(this.editor.editing.view.document.selection);if(!this.isEnabled||!r)this._isToolbarInBalloon(s)&&this._hideToolbar(s);else if(!this.editor.ui.focusTracker.isFocused)this._isToolbarVisible(s)&&this._hideToolbar(s);else{const o=r.getAncestors().length;o>e&&(e=o,t=r,i=s)}}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Rh(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Oh(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const i of this._toolbarDefinitions.values())if(this._isToolbarVisible(i)){const s=i.getRelatedElement(this.editor.editing.view.document.selection);Rh(this.editor,s)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Rh(n,e){const t=n.plugins.get("ContextualBalloon"),i=Oh(n,e);t.updatePosition(i)}function Oh(n,e){const t=n.editing.view,i=le.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}function sA(n){const e=n.getSelectedElement();return!!(e&&J(e))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class rA extends H(){constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,i){const s=new D(t);this.activeHandlePosition=cA(e),this._referenceCoordinates=aA(t,uA(this.activeHandlePosition)),this._originalWidth=s.width,this._originalHeight=s.height,this._aspectRatio=s.width/s.height;const r=i.style.width;r&&r.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(r):this._originalWidthPercents=oA(i,s)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}function oA(n,e){const t=n.parentElement;let i=parseFloat(t.ownerDocument.defaultView.getComputedStyle(t).width);const s=5;let r=0,o=t;for(;isNaN(i);){if(o=o.parentElement,++r>s)return 0;i=parseFloat(t.ownerDocument.defaultView.getComputedStyle(o).width)}return e.width/i*100}function aA(n,e){const t=new D(n),i=e.split("-"),s={x:i[1]=="right"?t.right:t.left,y:i[0]=="bottom"?t.bottom:t.top};return s.x+=n.ownerDocument.defaultView.scrollX,s.y+=n.ownerDocument.defaultView.scrollY,s}function lA(n){return`ck-widget__resizer__handle-${n}`}function cA(n){const e=["top-left","top-right","bottom-right","bottom-left"];for(const t of e)if(n.classList.contains(lA(t)))return t}function uA(n){const e=n.split("-"),t={top:"bottom",bottom:"top",left:"right",right:"left"};return`${t[e[0]]}-${t[e[1]]}`}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class hA extends P{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",t=>t?`ck-orientation-${t}`:"")],style:{display:e.if("_isVisible","none",t=>!t)}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",(i,s)=>i!==null&&s!==null),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(i,s,r)=>e.unit==="px"?`${i}×${s}`:`${r}%`),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",(i,s,r)=>s<50||r<50?"above-center":i)}_dismiss(){this.unbind(),this._isVisible=!1}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Mh extends H(){constructor(e){super(),this._viewResizerWrapper=null,this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",(t,i)=>t&&i),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",t=>{!this.state.proposedWidth&&!this.state.proposedWidthPercents&&(this._cleanup(),t.stop())},{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change(t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)})}hide(){this._options.editor.editing.view.change(t=>{t.addClass("ck-hidden",this._viewResizerWrapper)})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(s=>{const r=s.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},function(o){const a=this.toDomElement(o);return e._appendHandles(a),e._appendSizeUI(a),a});s.insert(s.createPositionAt(t,"end"),r),s.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=r,this.isVisible||this.hide()}),this.on("change:isVisible",()=>{this.isVisible?(this.show(),this.redraw()):this.hide()})}begin(e){this._state=new rA(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(c=>{const u=this._options.unit||"%",h=(u==="%"?t.widthPercents:t.width)+u;c.setStyle("width",h,this._options.viewElement)});const s=this._getHandleHost(),r=new D(s),o=Math.round(r.width),a=Math.round(r.height),l=new D(s);t.width=Math.round(l.width),t.height=Math.round(l.height),this.redraw(r),this.state.update({...t,handleHostWidth:o,handleHostHeight:a})}commit(){const e=this._options.unit||"%",t=(e==="%"?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!mA(t))return;const i=t.parentElement,s=this._getHandleHost(),r=this._viewResizerWrapper,o=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(i.isSameNode(s)){const l=e||new D(s);a=[l.width+"px",l.height+"px",void 0,void 0]}else a=[s.offsetWidth+"px",s.offsetHeight+"px",s.offsetLeft+"px",s.offsetTop+"px"];ue(o,a)!=="same"&&this._options.editor.editing.view.change(l=>{l.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change(t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,i=fA(e),s=this._options.isCentered?this._options.isCentered(this):!0,r={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(r.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),s&&(r.x*=2);let o=Math.abs(t.originalWidth+r.x),a=Math.abs(t.originalHeight+r.y);return(o/t.aspectRatio>a?"width":"height")=="width"?a=o/t.aspectRatio:o=a*t.aspectRatio,{width:Math.round(o),height:Math.round(a),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*o*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)e.appendChild(new Te({tag:"div",attributes:{class:`ck-widget__resizer__handle ${dA(i)}`}}).render())}_appendSizeUI(e){this._sizeView=new hA,this._sizeView.render(),e.appendChild(this._sizeView.element)}}function dA(n){return`ck-widget__resizer__handle-${n}`}function fA(n){return{x:n.pageX,y:n.pageY}}function mA(n){return n&&n.ownerDocument&&n.ownerDocument.contains(n)}const cS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Wn extends _{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=R.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(En),this._observer=new(Ye()),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=on(()=>this.redrawSelectedResizer(),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[s,r]of this._resizers)s.isAttached()||(this._resizers.delete(s),r.destroy())},{priority:"lowest"}),this._observer.listenTo(R.window,"resize",this._redrawSelectedResizerThrottled);const i=this.editor.editing.view.document.selection;i.on("change",()=>{const s=i.getSelectedElement(),r=this.getResizerByViewElement(s)||null;r?this.select(r):this.deselect()})}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new Mh(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const o=i.get("WidgetToolbarRepository");t.on("begin",()=>{o.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{o.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{o.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const r=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(r)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;Mh.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i)||null,this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}const uS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class gA extends _{static get pluginName(){return"DragDrop"}static get requires(){return[ft,ui]}init(){const e=this.editor,t=e.editing.view;if(this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=on(i=>this._updateDropMarker(i),40),this._removeDropMarkerDelayed=Ns(()=>this._removeDropMarker(),40),this._clearDraggableAttributesDelayed=Ns(()=>this._clearDraggableAttributes(),40),e.plugins.has("DragDropExperimental")){this.forceDisabled("DragDropExperimental");return}t.addObserver(Lr),t.addObserver(En),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(i,s,r)=>{r?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(i,s,r)=>{r||this._finalizeDragging(!1)}),x.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=t.document,s=e.editing.view,r=s.document;this.listenTo(r,"dragstart",(o,a)=>{const l=i.selection;if(a.target&&a.target.is("editableElement")){a.preventDefault();return}const c=a.target?Bh(a.target):null;if(c){const m=e.editing.mapper.toModelElement(c);this._draggedRange=$e.fromRange(t.createRangeOn(m)),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!r.selection.isCollapsed){const m=r.selection.getSelectedElement();(!m||!J(m))&&(this._draggedRange=$e.fromRange(l.getFirstRange()))}if(!this._draggedRange){a.preventDefault();return}this._draggingUid=qe();const u=this.isEnabled&&e.model.canEditAt(this._draggedRange);a.dataTransfer.effectAllowed=u?"copyMove":"copy",a.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const h=t.createSelection(this._draggedRange.toRange()),f=e.data.toView(t.getSelectedContent(h));r.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:f,method:"dragstart"}),u||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(r,"dragend",(o,a)=>{this._finalizeDragging(!a.dataTransfer.isCanceled&&a.dataTransfer.dropEffect=="move")},{priority:"low"}),this.listenTo(r,"dragenter",()=>{this.isEnabled&&s.focus()}),this.listenTo(r,"dragleave",()=>{this._removeDropMarkerDelayed()}),this.listenTo(r,"dragging",(o,a)=>{if(!this.isEnabled){a.dataTransfer.dropEffect="none";return}this._removeDropMarkerDelayed.cancel();const l=Vh(e,a.targetRanges,a.target);if(!e.model.canEditAt(l)){a.dataTransfer.dropEffect="none";return}this._draggedRange||(a.dataTransfer.dropEffect="copy"),x.isGecko||(a.dataTransfer.effectAllowed=="copy"?a.dataTransfer.dropEffect="copy":["all","copyMove"].includes(a.dataTransfer.effectAllowed)&&(a.dataTransfer.dropEffect="move"));/* istanbul ignore else -- @preserve */l&&this._updateDropMarkerThrottled(l)},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,i=e.editing.view.document;this.listenTo(i,"clipboardInput",(s,r)=>{if(r.method!="drop")return;const o=Vh(e,r.targetRanges,r.target);this._removeDropMarker();/* istanbul ignore if -- @preserve */if(!o||!e.model.canEditAt(o)){this._finalizeDragging(!1),s.stop();return}if(this._draggedRange&&this._draggingUid!=r.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),Dh(r.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(o,!0)){this._finalizeDragging(!1),s.stop();return}r.targetRanges=[e.editing.mapper.toViewRange(o)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(ft);e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const s=i.targetRanges.map(r=>this.editor.editing.mapper.toModelRange(r));this.editor.model.change(r=>r.setSelection(s))},{priority:"high"}),e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const s=Dh(i.dataTransfer)=="move",r=!i.resultRange||!i.resultRange.isCollapsed;this._finalizeDragging(r&&s)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(s,r)=>{if(x.isAndroid||!r)return;this._clearDraggableAttributesDelayed.cancel();let o=Bh(r.target);if(x.isBlink&&!o&&!i.selection.isCollapsed){const a=i.selection.getSelectedElement();if(!a||!J(a)){const l=i.selection.editableElement;l&&!l.isReadOnly&&(o=l)}}o&&(t.change(a=>{a.setAttribute("draggable","true",o)}),this._draggableElement=e.editing.mapper.toModelElement(o))}),this.listenTo(i,"mouseup",()=>{x.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_setupDropMarker(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return i.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(r){const o=this.toDomElement(r);return o.append("⁠",r.createElement("span"),"⁠"),o})}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(s=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||s.updateMarker("drop-target",{range:e}):s.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_removeDropMarker(){const e=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_finalizeDragging(e){const t=this.editor,i=t.model;this._removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(e&&this.isEnabled&&i.deleteContent(i.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Vh(n,e,t){const i=n.model,s=n.editing.mapper;let r=null;const o=e?e[0].start:null;if(t.is("uiElement")&&(t=t.parent),r=pA(n,t),r)return r;const a=vA(n,t),l=o?s.toModelPosition(o):null;return l?(r=bA(n,l,a),r||(r=i.schema.getNearestSelectionRange(l,x.isGecko?"forward":"backward"),r)?r:_A(n,l.parent)):wA(n,a)}function pA(n,e){const t=n.model,i=n.editing.mapper;if(J(e))return t.createRangeOn(i.toModelElement(e));if(!e.is("editableElement")){const s=e.findAncestor(r=>J(r)||r.is("editableElement"));if(J(s))return t.createRangeOn(i.toModelElement(s))}return null}function wA(n,e){const t=n.model,i=t.schema,s=t.createPositionAt(e,0);return i.getNearestSelectionRange(s,"forward")}function bA(n,e,t){const i=n.model;if(!i.schema.checkChild(t,"$block"))return null;const s=i.createPositionAt(t,0),r=e.path.slice(0,s.path.length),a=i.createPositionFromPath(e.root,r).nodeAfter;return a&&i.schema.isObject(a)?i.createRangeOn(a):null}function _A(n,e){const t=n.model;let i=e;for(;i;){if(t.schema.isObject(i))return t.createRangeOn(i);i=i.parent}/* istanbul ignore next -- @preserve */return null}function vA(n,e){const t=n.editing.mapper,i=n.editing.view,s=t.toModelElement(e);if(s)return s;const r=i.createPositionBefore(e),o=t.findMappedViewAncestor(r);return t.toModelElement(o)}function Dh(n){return x.isGecko?n.dropEffect:["all","copyMove"].includes(n.effectAllowed)?"move":"copy"}function Bh(n){if(n.is("editableElement"))return null;if(n.hasClass("ck-widget__selection-handle"))return n.findAncestor(J);if(J(n))return n;const e=n.findAncestor(t=>J(t)||t.is("editableElement"));return J(e)?e:null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class yA extends _{static get pluginName(){return"PastePlainText"}static get requires(){return[ft]}init(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,r=t.document.selection;let o=!1;i.addObserver(Lr),this.listenTo(s,"keydown",(a,l)=>{o=l.shiftKey}),e.plugins.get(ft).on("contentInsertion",(a,l)=>{!o&&!kA(l.content,t.schema)||t.change(c=>{const u=Array.from(r.getAttributes()).filter(([f])=>t.schema.getAttributeProperties(f).isFormatting);r.isCollapsed||t.deleteContent(r,{doNotAutoparagraph:!0}),u.push(...r.getAttributes());const h=c.createRangeIn(l.content);for(const f of h.getItems())f.is("$textProxy")&&c.setAttributes(u,f)})})}}function kA(n,e){if(n.childCount>1)return!1;const t=n.getChild(0);return e.isObject(t)?!1:Array.from(t.getAttributeKeys()).length==0}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Fh extends _{static get pluginName(){return"Clipboard"}static get requires(){return[ft,gA,yA]}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class CA extends Q{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!Nh(e.schema,i))do if(i=i.parent,!i)return;while(!Nh(e.schema,i));e.change(s=>{s.setSelection(i,"in")})}}function Nh(n,e){return n.isLimit(e)&&(n.checkChild(e,"$text")||n.checkChild(e,"paragraph"))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const EA=Fs("Ctrl+A");class AA extends _{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,i=e.editing.view.document;e.commands.add("selectAll",new CA(e)),this.listenTo(i,"keydown",(s,r)=>{Jt(r)===EA&&(e.execute("selectAll"),r.preventDefault())})}}const TA='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class PA extends _{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const i=e.commands.get("selectAll"),s=new $(t),r=t.t;return s.set({label:r("Select all"),icon:TA,keystroke:"Ctrl+A",tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled"),this.listenTo(s,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),s})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class SA extends _{static get requires(){return[AA,PA]}static get pluginName(){return"SelectAll"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Lh extends Q{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,i)=>{i[1]={...i[1]};const s=i[1];s.batchType||(s.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,i)=>{i[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const s=this.editor.model,r=s.document,o=[],a=e.map(c=>c.getTransformedByOperations(i)),l=a.flat();for(const c of a){const u=c.filter(h=>h.root!=r.graveyard).filter(h=>!IA(h,l));u.length&&(xA(u),o.push(u[0]))}o.length&&s.change(c=>{c.setSelection(o,{backward:t})})}_undo(e,t){const i=this.editor.model,s=i.document;this._createdBatches.add(t);const r=e.operations.slice().filter(o=>o.isDocumentOperation);r.reverse();for(const o of r){const a=o.baseVersion+1,l=Array.from(s.history.getOperations(a)),u=Wy([o.getReversed()],l,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let h of u){const f=h.affectedSelectable;f&&!i.canEditAt(f)&&(h=new ne(h.baseVersion)),t.addOperation(h),i.applyOperation(h),s.history.setOperationAsUndone(o,h)}}}}function xA(n){n.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;e<n.length;e++){const i=n[e-1].getJoined(n[e],!0);i&&(e--,n.splice(e,2,i))}}function IA(n,e){return e.some(t=>t!==n&&t.containsRange(n,!0))}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class RA extends Lh{execute(e=null){const t=e?this._stack.findIndex(r=>r.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>{this._undo(i.batch,s);const r=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,r),this.fire("revert",i.batch,s)}),this.refresh()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class OA extends Lh{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const s=e.batch.operations[e.batch.operations.length-1].baseVersion+1,r=this.editor.model.document.history.getOperations(s);this._restoreSelection(e.selection.ranges,e.selection.isBackward,r),this._undo(e.batch,t)}),this.refresh()}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class MA extends _{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor;this._undoCommand=new RA(e),this._redoCommand=new OA(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(t,i)=>{const s=i[0];if(!s.isDocumentOperation)return;const r=s.batch,o=this._redoCommand.createdBatches.has(r),a=this._undoCommand.createdBatches.has(r);this._batchRegistry.has(r)||(this._batchRegistry.add(r),r.isUndoable&&(o?this._undoCommand.addBatch(r):a||(this._undoCommand.addBatch(r),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,i,s)=>{this._redoCommand.addBatch(s)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}const $h='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',zh='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class VA extends _{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?$h:zh,r=t.uiLanguageDirection=="ltr"?zh:$h;this._addButton("undo",i("Undo"),"CTRL+Z",s),this._addButton("redo",i("Redo"),"CTRL+Y",r)}_addButton(e,t,i,s){const r=this.editor;r.ui.componentFactory.add(e,o=>{const a=r.commands.get(e),l=new $(o);return l.set({label:t,icon:s,keystroke:i,tooltip:!0}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{r.execute(e),r.editing.view.focus()}),l})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Gr extends _{static get requires(){return[MA,VA]}static get pluginName(){return"Undo"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class DA extends _{static get requires(){return[Fh,Hr,SA,xE,vE,Gr]}static get pluginName(){return"Essentials"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class BA extends Q{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document,i=Ee(t.selection.getSelectedBlocks());this.value=!!i&&i.is("element","paragraph"),this.isEnabled=!!i&&Hh(i,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,s=e.selection||i.selection;t.canEditAt(s)&&t.change(r=>{const o=s.getSelectedBlocks();for(const a of o)!a.is("element","paragraph")&&Hh(a,t.schema)&&r.rename(a,"paragraph")})}}function Hh(n,e){return e.checkChild(n.parent,"paragraph")&&!e.isObject(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class FA extends Q{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let s=e.position;t.canEditAt(s)&&t.change(r=>{const o=r.createElement("paragraph");if(i&&t.schema.setAllowedAttributes(o,i,r),!t.schema.checkChild(s.parent,o)){const a=t.schema.findAllowedParent(s,o);if(!a)return;s=r.split(s,a).position}t.insertContent(o,s),r.setSelection(o,"in")})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Wi extends _{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new BA(e)),e.commands.add("insertParagraph",new FA(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(i,{writer:s})=>!Wi.paragraphLikeElements.has(i.name)||i.isEmpty?null:s.createElement("paragraph"),view:/.+/,converterPriority:"low"})}}Wi.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Kr=["left","right","center","justify"];function Wh(n){return Kr.includes(n)}function Uh(n,e){return e.contentLanguageDirection=="rtl"?n==="right":n==="left"}function jh(n){const e=n.map(i=>{let s;return typeof i=="string"?s={name:i}:s=i,s}).filter(i=>{const s=Kr.includes(i.name);return s||G("alignment-config-name-not-recognized",{option:i}),s}),t=e.filter(i=>!!i.className).length;if(t&&t<e.length)throw new d("alignment-config-classnames-are-missing",{configuredOptions:n});return e.forEach((i,s,r)=>{const o=r.slice(s+1);if(o.some(l=>l.name==i.name))throw new d("alignment-config-name-already-defined",{option:i,configuredOptions:n});if(i.className&&o.some(c=>c.className==i.className))throw new d("alignment-config-classname-already-defined",{option:i,configuredOptions:n})}),e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Jr="alignment";class NA extends Q{refresh(){const t=this.editor.locale,i=Ee(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!i&&this._canBeAligned(i),this.isEnabled&&i.hasAttribute("alignment")?this.value=i.getAttribute("alignment"):this.value=t.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const t=this.editor,i=t.locale,s=t.model,r=s.document,o=e.value;s.change(a=>{const l=Array.from(r.selection.getSelectedBlocks()).filter(h=>this._canBeAligned(h)),c=l[0].getAttribute("alignment");Uh(o,i)||c===o||!o?LA(l,a):$A(l,a,o)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,Jr)}}function LA(n,e){for(const t of n)e.removeAttribute(Jr,t)}function $A(n,e,t){for(const i of n)e.setAttribute(Jr,t,i)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class zA extends _{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:Kr.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,i=e.model.schema,r=jh(e.config.get("alignment.options")).filter(c=>Wh(c.name)&&!Uh(c.name,t)),o=r.some(c=>!!c.className);i.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),o?e.conversion.attributeToAttribute(jA(r)):e.conversion.for("downcast").attributeToAttribute(HA(r));const a=WA(r);for(const c of a)e.conversion.for("upcast").attributeToAttribute(c);const l=UA(r);for(const c of l)e.conversion.for("upcast").attributeToAttribute(c);e.commands.add("alignment",new NA(e))}}function HA(n){const e={};for(const{name:i}of n)e[i]={key:"style",value:{"text-align":i}};return{model:{key:"alignment",values:n.map(i=>i.name)},view:e}}function WA(n){const e=[];for(const{name:t}of n)e.push({view:{key:"style",value:{"text-align":t}},model:{key:"alignment",value:t}});return e}function UA(n){const e=[];for(const{name:t}of n)e.push({view:{key:"align",value:t},model:{key:"alignment",value:t}});return e}function jA(n){const e={};for(const i of n)e[i.name]={key:"class",value:i.className};return{model:{key:"alignment",values:n.map(i=>i.name)},view:e}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Un=new Map([["left",B.alignLeft],["right",B.alignRight],["center",B.alignCenter],["justify",B.alignJustify]]);class qA extends _{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,i=e.t,s=jh(e.config.get("alignment.options"));s.map(r=>r.name).filter(Wh).forEach(r=>this._addButton(r)),t.add("alignment",r=>{const o=it(r);In(o,()=>s.map(c=>t.create(`alignment:${c.name}`)),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:i("Text alignment toolbar")}),o.buttonView.set({label:i("Text alignment"),tooltip:!0}),o.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const a=r.contentLanguageDirection==="rtl"?Un.get("right"):Un.get("left"),l=e.commands.get("alignment");return o.buttonView.bind("icon").to(l,"value",c=>Un.get(c)||a),o.bind("isEnabled").to(l,"isEnabled"),this.listenTo(o,"execute",()=>{e.editing.view.focus()}),o})}_addButton(e){const t=this.editor;t.ui.componentFactory.add(`alignment:${e}`,i=>{const s=t.commands.get("alignment"),r=new $(i);return r.set({label:this.localizedOptionTitles[e],icon:Un.get(e),tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(s),r.bind("isOn").to(s,"value",o=>o===e),this.listenTo(r,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),r})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class GA extends _{static get requires(){return[zA,qA]}static get pluginName(){return"Alignment"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Zr extends Q{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,s=t.document.selection,r=e.forceValue===void 0?!this.value:e.forceValue;t.change(o=>{if(s.isCollapsed)r?o.setSelectionAttribute(this.attributeKey,!0):o.removeSelectionAttribute(this.attributeKey);else{const a=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const l of a)r?o.setAttribute(this.attributeKey,r,l):o.removeAttribute(this.attributeKey,l)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const s of i.getRanges())for(const r of s.getItems())if(t.checkAttribute(r,this.attributeKey))return r.hasAttribute(this.attributeKey);return!1}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const hi="bold";class KA extends _{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:hi}),e.model.schema.setAttributeProperties(hi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:hi,view:"strong",upcastAlso:["b",t=>{const i=t.getStyle("font-weight");return i&&(i=="bold"||Number(i)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(hi,new Zr(e,hi)),e.keystrokes.set("CTRL+B",hi)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Yr="bold";class JA extends _{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Yr,i=>{const s=e.commands.get(Yr),r=new $(i);return r.set({label:t("Bold"),icon:B.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(Yr),e.editing.view.focus()}),r})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ZA extends _{static get requires(){return[KA,JA]}static get pluginName(){return"Bold"}}const hS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const di="italic";class YA extends _{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:di}),e.model.schema.setAttributeProperties(di,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:di,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(di,new Zr(e,di)),e.keystrokes.set("CTRL+I",di)}}const XA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Xr="italic";class QA extends _{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Xr,i=>{const s=e.commands.get(Xr),r=new $(i);return r.set({label:t("Italic"),icon:XA,keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(Xr),e.editing.view.focus()}),r})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class eT extends _{static get requires(){return[YA,QA]}static get pluginName(){return"Italic"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Ui="underline";class tT extends _{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ui}),e.model.schema.setAttributeProperties(Ui,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Ui,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(Ui,new Zr(e,Ui)),e.keystrokes.set("CTRL+U","underline")}}const iT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Qr="underline";class nT extends _{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Qr,i=>{const s=e.commands.get(Qr),r=new $(i);return r.set({label:t("Underline"),icon:iT,keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(Qr),e.editing.view.focus()}),r})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class sT extends _{static get requires(){return[tT,nT]}static get pluginName(){return"Underline"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class rT extends Q{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=Ee(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>qh(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,s=e.value;t.change(r=>{const o=Array.from(i.selection.getSelectedBlocks()).filter(a=>qh(a,s,t.schema));for(const a of o)a.is("element",s)||r.rename(a,s)})}}function qh(n,e,t){return t.checkChild(n.parent,e)&&!t.isObject(n)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Gh="paragraph";class oT extends _{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[Wi]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),i.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new rT(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,r)=>{const o=e.model.document.selection.getFirstPosition().parent;i.some(l=>o.is("element",l.model))&&!o.is("element",Gh)&&o.childCount===0&&r.writer.rename(o,Gh)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:pe.low+1})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function aT(n){const e=n.t,t={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return n.config.get("heading.options").map(i=>{const s=t[i.title];return s&&s!=i.title&&(i.title=s),i})}const dS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class lT extends _{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=aT(e),s=t("Choose heading"),r=t("Heading");e.ui.componentFactory.add("heading",o=>{const a={},l=new Ie,c=e.commands.get("heading"),u=e.commands.get("paragraph"),h=[c];for(const m of i){const p={type:"button",model:new Nr({label:m.title,class:m.class,role:"menuitemradio",withText:!0})};m.model==="paragraph"?(p.model.bind("isOn").to(u,"value"),p.model.set("commandName","paragraph"),h.push(u)):(p.model.bind("isOn").to(c,"value",b=>b===m.model),p.model.set({commandName:"heading",commandValue:m.model})),l.add(p),a[m.model]=m.title}const f=it(o);return Tr(f,l,{ariaLabel:r,role:"menu"}),f.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),f.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),f.bind("isEnabled").toMany(h,"isEnabled",(...m)=>m.some(p=>p)),f.buttonView.bind("label").to(c,"value",u,"value",(m,p)=>{const b=m||p&&"paragraph";return typeof b=="boolean"||!a[b]?s:a[b]}),this.listenTo(f,"execute",m=>{const{commandName:p,commandValue:b}=m.source;e.execute(p,b?{value:b}:void 0),e.editing.view.focus()}),f})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class cT extends _{static get requires(){return[oT,lT]}static get pluginName(){return"Heading"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class uT extends Q{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,s=t.document.selection,r=e.value,o=e.batch,a=l=>{if(s.isCollapsed)r?l.setSelectionAttribute(this.attributeKey,r):l.removeSelectionAttribute(this.attributeKey);else{const c=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const u of c)r?l.setAttribute(this.attributeKey,r,u):l.removeAttribute(this.attributeKey,u)}};o?t.enqueueChange(o,l=>{a(l)}):t.change(l=>{a(l)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class hT extends H(Ie){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",this.length===0)})}add(e,t){return this.find(i=>i.color===e.color)?this:super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}const fS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class dT extends P{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerLabel:a,colorPickerConfig:l}){super(e),this.items=this.createCollection(),this.focusTracker=new be,this.keystrokes=new Re,this._focusables=new tt,this._colorPickerConfig=l,this._focusCycler=new Dt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsPageView=new fT(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerLabel:a,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerPageView=new mT(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerConfig:l}),this.set("_isColorGridsPageVisible",!0),this.set("_isColorPickerPageVisible",!1),this.set("selectedColor",void 0),this.colorGridsPageView.bind("isVisible").to(this,"_isColorGridsPageVisible"),this.colorPickerPageView.bind("isVisible").to(this,"_isColorPickerPageVisible"),this.on("change:selectedColor",(c,u,h)=>{this.colorGridsPageView.set("selectedColor",h),this.colorPickerPageView.set("selectedColor",h)}),this.colorGridsPageView.on("change:selectedColor",(c,u,h)=>{this.set("selectedColor",h)}),this.colorPickerPageView.on("change:selectedColor",(c,u,h)=>{this.set("selectedColor",h)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendGrids(){this.items.length||(this.items.add(this.colorGridsPageView),this.colorGridsPageView.delegate("execute").to(this),this.colorGridsPageView.delegate("showColorPicker").to(this))}appendUI(){this.appendGrids(),this._colorPickerConfig&&this._appendColorPicker()}showColorPicker(){this.colorPickerPageView.colorPickerView&&(this.set("_isColorPickerPageVisible",!0),this.colorPickerPageView.focus(),this.set("_isColorGridsPageVisible",!1))}showColorGrids(){this.set("_isColorGridsPageVisible",!0),this.set("_isColorPickerPageVisible",!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsPageView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsPageView.updateSelectedColors()}_appendColorPicker(){this.items.length!==2&&(this.items.add(this.colorPickerPageView),this.colorGridsPageView.colorPickerButtonView&&this.colorGridsPageView.colorPickerButtonView.on("execute",()=>{this.showColorPicker()}),this.colorGridsPageView.addColorPickerButton(),this.colorPickerPageView.delegate("execute").to(this),this.colorPickerPageView.delegate("cancel").to(this))}}class fT extends P{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerLabel:a,focusTracker:l,focusables:c}){super(e);const u=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=l,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=i,this.documentColors=new hT,this.documentColorsCount=o,this._focusables=c,this._removeButtonLabel=s,this._colorPickerLabel=a,this._documentColorsLabel=r,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-page-view",u.if("isVisible","ck-hidden",h=>!h)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const i=e.document,s=this.documentColorsCount;this.documentColors.clear();for(const r of i.getRootNames()){const o=i.getRoot(r),a=e.createRangeIn(o);for(const l of a.getItems())if(l.is("$textProxy")&&l.hasAttribute(t)&&(this._addColorToDocumentColors(l.getAttribute(t)),this.documentColors.length>=s))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=Te.bind(this.documentColors,this.documentColors),t=new Lu(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)}this._createColorPickerButton(),this._addColorTablesElementsToFocusTracker(),this.focus()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorTablesElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new $,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:rE.colorPaletteIcon,class:"ck-color-table__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("showColorPicker")})}_createRemoveColorButton(){const e=new $;return e.set({withText:!0,icon:B.eraser,label:this._removeButtonLabel}),e.class="ck-color-table__remove-color",e.on("execute",()=>{this.fire("execute",{value:null,source:"removeColorButton"})}),e.render(),e}_createStaticColorsGrid(){const e=new Pu(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",(t,i)=>{this.fire("execute",{value:i.value,source:"staticColorsGrid"})}),e}_createDocumentColorsGrid(){const e=Te.bind(this.documentColors,this.documentColors),t=new Pu(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(i=>{const s=new Tu;return s.set({color:i.color,hasBorder:i.options&&i.options.hasBorder}),i.label&&s.set({label:i.label,tooltip:!0}),s.on("execute",()=>{this.fire("execute",{value:i.color,source:"documentColorsGrid"})}),s}),this.documentColors.on("change:isEmpty",(i,s,r)=>{r&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(i=>i.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}class mT extends P{constructor(e,{focusTracker:t,focusables:i,keystrokes:s,colorPickerConfig:r}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=s,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=i,this._pickerConfig=r;const o=this.bindTemplate,{saveButtonView:a,cancelButtonView:l}=this._createActionButtons();this.saveButtonView=a,this.cancelButtonView=l,this.actionBarView=this._createActionBarView({saveButtonView:a,cancelButtonView:l}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-page-view",o.if("isVisible","ck-hidden",c=>!c)]},children:this.items})}render(){super.render();const e=new MC(this.locale,this._pickerConfig);this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,i,s)=>{e.color=s}),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}_executeOnEnterPress(){this.keystrokes.set("enter",e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())})}_stopPropagationOnArrowsKeys(){const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const e of this.colorPickerView.slidersView)this.focusTracker.add(e.element),this._focusables.add(e);this.focusTracker.add(this.colorPickerView.hexInputRow.children.get(1).element),this._focusables.add(this.colorPickerView.hexInputRow.children.get(1)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const i=new P,s=this.createCollection();return s.add(e),s.add(t),i.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table_action-bar"]},children:s}),i}_createActionButtons(){const e=this.locale,t=e.t,i=new $(e),s=new $(e);return i.set({icon:B.check,class:"ck-button-save",withText:!1,label:t("Accept"),type:"button"}),s.set({icon:B.cancel,class:"ck-button-cancel",withText:!1,label:t("Cancel")}),i.on("execute",()=>{this.fire("execute",{source:"saveButton",value:this.selectedColor})}),s.on("execute",()=>{this.fire("cancel")}),{saveButtonView:i,cancelButtonView:s}}_executeUponColorChange(){this.colorPickerView.on("change:color",(e,t,i)=>{this.fire("execute",{value:i,source:"colorPicker"})})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const He="fontColor";function gT(n){return e=>bT(e.getStyle(n))}function pT(n){return(e,{writer:t})=>t.createAttributeElement("span",{style:`${n}:${e}`},{priority:7})}function wT({dropdownView:n,colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerConfig:a}){const l=n.locale,c=new dT(l,{colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:r,documentColorsCount:o,colorPickerConfig:a});return n.colorTableView=c,n.panelView.children.add(c),c}function bT(n){return n.replace(/\s/g,"")}const mS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class _T extends uT{constructor(e){super(e,He)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class vT extends _{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define(He,{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:He,value:gT("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:He,value:t=>t.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:He,view:pT("color")}),e.commands.add(He,new _T(e)),e.model.schema.extend("$text",{allowAttributes:He}),e.model.schema.setAttributeProperties(He,{isFormatting:!0,copyOnEnter:!0})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class yT extends _{constructor(e,{commandName:t,componentName:i,icon:s,dropdownLabel:r}){super(e),this.commandName=t,this.componentName=i,this.icon=s,this.dropdownLabel=r,this.columns=e.config.get(`${this.componentName}.columns`),this.colorTableView=void 0}init(){const e=this.editor,t=e.locale,i=t.t,s=e.commands.get(this.commandName),r=e.config.get(this.componentName),o=M2(r.colors),a=O2(t,o),l=r.documentColors,c=r.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,u=>{const h=it(u);let f=!1;return this.colorTableView=wT({dropdownView:h,colors:a.map(m=>({label:m.label,color:m.model,options:{hasBorder:m.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:l!==0?i("Document colors"):"",documentColorsCount:l===void 0?this.columns:l,colorPickerConfig:c?r.colorPicker||{}:!1}),this.colorTableView.bind("selectedColor").to(s,"value"),h.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),h.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),h.bind("isEnabled").to(s),this.colorTableView.on("execute",(m,p)=>{h.isOpen&&e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),p.source!=="colorPicker"&&e.editing.view.focus()}),this.colorTableView.on("showColorPicker",()=>{this._undoStepBatch=e.model.createBatch()}),this.colorTableView.on("cancel",()=>{this._undoStepBatch.operations.length&&(h.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),h.on("change:isOpen",(m,p,b)=>{f||(f=!0,h.colorTableView.appendUI()),b?(l!==0&&this.colorTableView.updateDocumentColors(e.model,this.componentName),this.colorTableView.updateSelectedColors()):this.colorTableView.showColorGrids()}),Pr(h,()=>h.colorTableView.colorGridsPageView.staticColorsGrid.items.find(m=>m.isOn)),h})}}const kT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class CT extends yT{constructor(e){const t=e.locale.t;super(e,{commandName:He,componentName:He,icon:kT,dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ET extends _{static get requires(){return[vT,CT]}static get pluginName(){return"FontColor"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Kh(n,e){const t=(i,s,r)=>{if(!r.consumable.consume(s.item,i.name))return;const o=s.attributeNewValue,a=r.writer,l=r.mapper.toViewElement(s.item),c=[...l.getChildren()].find(h=>h.getCustomProperty("media-content"));a.remove(c);const u=n.getMediaViewElement(a,o,e);a.insert(a.createPositionAt(l,0),u)};return i=>{i.on("attribute:url:media",t)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function AT(n,e,t){return e.setCustomProperty("media",!0,n),Hn(n,e,{label:t})}function Jh(n,e,t,i){return n.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(n,t,i),n.createSlot()])}function Zh(n){const e=n.getSelectedElement();return e&&e.is("element","media")?e:null}function Yh(n,e,t,i){n.change(s=>{const r=s.createElement("media",{url:e});n.insertObject(r,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class TT extends Q{refresh(){const e=this.editor.model,t=e.document.selection,i=Zh(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=ST(t)||PT(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,s=Zh(i);s?t.change(r=>{r.setAttribute("url",e,s)}):Yh(t,e,i,!0)}}function PT(n,e){let i=jr(n,e).start.parent;return i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent),e.schema.checkChild(i,"media")}function ST(n){const e=n.getSelectedElement();return!!e&&e.name==="media"}const xT='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const IT="0 0 64 42";class RT{constructor(e,t){const i=t.providers,s=t.extraProviders||[],r=new Set(t.removeProviders),o=i.concat(s).filter(a=>{const l=a.name;return l?!r.has(l):(G("media-embed-no-provider-name",{provider:a}),!1)});this.locale=e,this.providerDefinitions=o}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new Xh(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,s=X(t.url);for(const r of s){const o=this._getUrlMatches(e,r);if(o)return new Xh(this.locale,e,o,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let s=e.replace(/^https?:\/\//,"");return i=s.match(t),i||(s=s.replace(/^www\./,""),i=s.match(t),i)?i:null}}class Xh{constructor(e,t,i,s){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=s}getViewElement(e,t){const i={};let s;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const r=this._getPreviewHtml(t);s=e.createRawElement("div",i,(o,a)=>{a.setContentOf(o,r)})}else this.url&&(i.url=this.url),s=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,s),s}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new dt,t=this._locale.t;return e.content=xT,e.viewBox=IT,new Te({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}const gS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class jn extends _{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],s=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${i}${s?`?start=${s}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new RT(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,i=e.t,s=e.conversion,r=e.config.get("mediaEmbed.previewsInData"),o=e.config.get("mediaEmbed.elementName"),a=this.registry;e.commands.add("mediaEmbed",new TT(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),s.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url");return Jh(c,a,u,{elementName:o,renderMediaPreview:!!u&&r})}}),s.for("dataDowncast").add(Kh(a,{elementName:o,renderMediaPreview:r})),s.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url"),h=Jh(c,a,u,{elementName:o,renderForEditingView:!0});return AT(h,c,i("media widget"))}}),s.for("editingDowncast").add(Kh(a,{elementName:o,renderForEditingView:!0})),s.for("upcast").elementToElement({view:l=>["oembed",o].includes(l.name)&&l.getAttribute("url")?{name:!0}:null,model:(l,{writer:c})=>{const u=l.getAttribute("url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(l,{writer:c})=>{const u=l.getAttribute("data-oembed-url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).add(l=>{const c=(u,h,f)=>{if(!f.consumable.consume(h.viewItem,{name:!0,classes:"media"}))return;const{modelRange:m,modelCursor:p}=f.convertChildren(h.viewItem,h.modelCursor);h.modelRange=m,h.modelCursor=p,Ee(m.getItems())||f.consumable.revert(h.viewItem,{name:!0,classes:"media"})};l.on("element:figure",c)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const OT=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class MT extends _{static get requires(){return[Fh,li,Gr]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const r=t.selection.getFirstRange(),o=oe.fromPosition(r.start);o.stickiness="toPrevious";const a=oe.fromPosition(r.end);a.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(o,a),o.detach(),a.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(R.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,s=i.plugins.get(jn).registry,r=new $e(e,t),o=r.getWalker({ignoreElementEnd:!0});let a="";for(const c of o)c.item.is("$textProxy")&&(a+=c.item.data);if(a=a.trim(),!a.match(OT)){r.detach();return}if(!s.hasMedia(a)){r.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){r.detach();return}this._positionToInsert=oe.fromPosition(e),this._timeoutId=R.window.setTimeout(()=>{i.model.change(c=>{this._timeoutId=null,c.remove(r),r.detach();let u=null;this._positionToInsert.root.rootName!=="$graveyard"&&(u=this._positionToInsert),Yh(i.model,a,u,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(li).requestUndoOnBackspace()},100)}}const pS="",wS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class VT extends P{constructor(e,t){super(t);const i=t.t;this.focusTracker=new be,this.keystrokes=new Re,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),B.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",s=>!!s),this.cancelButtonView=this._createButton(i("Cancel"),B.cancel,"ck-button-cancel","cancel"),this._focusables=new tt,this._focusCycler=new Dt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),br({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(i=>{this._focusables.add(i),this.focusTracker.add(i.element)}),this.keystrokes.listenTo(this.element);const t=i=>i.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}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 xn(this.locale,Rn),i=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,i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}_createButton(e,t,i,s){const r=new $(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:i}}),s&&r.delegate("execute").to(this,s),r}}const DT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M18.68 3.03c.6 0 .59-.03.59.55v12.84c0 .59.01.56-.59.56H1.29c-.6 0-.59.03-.59-.56V3.58c0-.58-.01-.55.6-.55h17.38zM15.77 15V5H4.2v10h11.57zM2 4v1h1V4H2zm0 2v1h1V6H2zm0 2v1h1V8H2zm0 2v1h1v-1H2zm0 2v1h1v-1H2zm0 2v1h1v-1H2zM17 4v1h1V4h-1zm0 2v1h1V6h-1zm0 2v1h1V8h-1zm0 2v1h1v-1h-1zm0 2v1h1v-1h-1zm0 2v1h1v-1h-1zM7.5 7.177a.4.4 0 0 1 .593-.351l5.133 2.824a.4.4 0 0 1 0 .7l-5.133 2.824a.4.4 0 0 1-.593-.35V7.176v.001z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class BT extends _{static get requires(){return[jn]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",i=>{const s=it(i);return this._setUpDropdown(s,t),s})}_setUpDropdown(e,t){const i=this.editor,s=i.t,r=e.buttonView,o=i.plugins.get(jn).registry;e.once("change:isOpen",()=>{const a=new(wr(VT))(FT(i.t,o),i.locale);e.panelView.children.add(a),r.on("open",()=>{a.disableCssTransitions(),a.url=t.value||"",a.urlInputView.fieldView.select(),a.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{a.isValid()&&(i.execute("mediaEmbed",a.url),i.editing.view.focus())}),e.on("change:isOpen",()=>a.resetFormStatus()),e.on("cancel",()=>{i.editing.view.focus()}),a.delegate("submit","cancel").to(e),a.urlInputView.fieldView.bind("value").to(t,"value"),a.urlInputView.bind("isEnabled").to(t,"isEnabled")}),e.bind("isEnabled").to(t),r.set({label:s("Insert media"),icon:DT,tooltip:!0})}}function FT(n,e){return[t=>{if(!t.url.length)return n("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return n("This media URL is not supported.")}]}const bS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class NT extends _{static get requires(){return[jn,BT,MT,ui]}static get pluginName(){return"MediaEmbed"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Ft(n,e,t,i){e&&LT(n,e,i),t&&st(n,t,i)}function st(n,e,t){if(e.attributes)for(const[i,s]of Object.entries(e.attributes))n.setAttribute(i,s,t);e.styles&&n.setStyle(e.styles,t),e.classes&&n.addClass(e.classes,t)}function LT(n,e,t){if(e.attributes)for(const[i]of Object.entries(e.attributes))n.removeAttribute(i,t);if(e.styles)for(const i of Object.keys(e.styles))n.removeStyle(i,t);e.classes&&n.removeClass(e.classes,t)}function $T(n,e){const t=Ze(n);let i="attributes";for(i in e)i=="classes"?t[i]=Array.from(new Set([...n[i]||[],...e[i]])):t[i]={...n[i],...e[i]};return t}function fi(n,e,t,i,s){const r=e.getAttribute(t),o={};for(const a of["attributes","styles","classes"]){if(a!=i){r&&r[a]&&(o[a]=r[a]);continue}if(i=="classes"){const c=new Set(r&&r.classes||[]);s(c),c.size&&(o[a]=Array.from(c));continue}const l=new Map(Object.entries(r&&r[a]||{}));s(l),l.size&&(o[a]=Object.fromEntries(l))}Object.keys(o).length?e.is("documentSelection")?n.setSelectionAttribute(t,o):n.setAttribute(t,o,e):r&&(e.is("documentSelection")?n.removeSelectionAttribute(t):n.removeAttribute(t,e))}function zT(n){return a_(n).replace(/ /g,"")}function Pe(n){return`html${zT(n)}Attributes`}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function eo({model:n}){return(e,t)=>t.writer.createElement(n,{htmlContent:e.getCustomProperty("$rawContent")})}function HT(n,{view:e,isInline:t}){const i=n.t;return(s,{writer:r})=>{const o=i("HTML object"),a=qn(e,s,r),l=s.getAttribute(Pe(e));r.addClass("html-object-embed__content",a),l&&st(r,l,a);const c=r.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":o},a);return Hn(c,r,{label:o})}}function qn(n,e,t){return t.createRawElement(n,null,(i,s)=>{s.setContentOf(i,e.getAttribute("htmlContent"))})}function WT({view:n,model:e},t){return i=>{i.on(`element:${n}`,(s,r,o)=>{let a=t.processViewAttributes(r.viewItem,o);if(!(!a&&!o.consumable.test(r.viewItem,{name:!0}))){a=a||{},o.consumable.consume(r.viewItem,{name:!0}),r.modelRange||(r=Object.assign(r,o.convertChildren(r.viewItem,r.modelCursor)));for(const l of r.modelRange.getItems())if(o.schema.checkAttribute(l,e)){const c=l.getAttribute(e),u=$T(a,c||{});o.writer.setAttribute(e,u,l)}}},{priority:"low"})}}function UT({priority:n,view:e}){return(t,i)=>{if(!t)return;const{writer:s}=i,r=s.createAttributeElement(e,null,{priority:n});return st(s,t,r),r}}function ji({view:n},e){return t=>{t.on(`element:${n}`,(i,s,r)=>{if(!s.modelRange||s.modelRange.isCollapsed)return;const o=e.processViewAttributes(s.viewItem,r);o&&r.writer.setAttribute(Pe(s.viewItem.name),o,s.modelRange)},{priority:"low"})}}function qi({view:n,model:e}){return t=>{t.on(`attribute:${Pe(n)}:${e}`,(i,s,r)=>{if(!r.consumable.consume(s.item,i.name))return;const{attributeOldValue:o,attributeNewValue:a}=s,l=r.writer,c=r.mapper.toViewElement(s.item);Ft(l,o,a,c)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const Qh={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{copyOnEnter:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class mi extends _{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const e of Qh.block)this.registerBlockElement(e);for(const e of Qh.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){const i=new Set;for(const s of this._getMatchingViewDefinitions(e)){if(t)for(const r of this._getReferences(s.model))i.add(r);i.add(s)}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&jT(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(s=>s.model==e);for(const{modelSchema:s}of i)if(s)for(const r of t)for(const o of X(s[r]||[])){const a=this._definitions.filter(l=>l.model==o);for(const l of a)o!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,i])=>i.model==e.model);if(t.length==0){this._definitions.push(e);return}for(const[i,s]of t)this._definitions[i]=j0({},s,e,(r,o)=>Array.isArray(r)?r.concat(o):void 0)}}function jT(n,e){return typeof n=="string"?n===e:n instanceof RegExp?n.test(e):!1}const _S="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ie extends _{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new Zt,this._disallowedAttributes=new Zt,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get requires(){return[mi,ui]}loadAllowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=id(t);this.allowElement(i),s.forEach(r=>this.allowAttributes(r))}}loadDisallowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=id(t);s.length==0?this.disallowElement(i):s.forEach(r=>this.disallowAttributes(r))}}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){return ed(e,t,this._disallowedAttributes),ed(e,t,this._allowedAttributes)}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:pe.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:pe.highest+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else if(t.isInline)this._registerInlineElement(t);else throw new d("data-filter-invalid-definition",null,t);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let s=!1;const r=this._getCoupledAttributesMap();for(const o of i){if(o.type!="attribute"||o.attributeNewValue!==null)continue;const a=r.get(o.attributeKey);if(a)for(const{item:l}of o.range.getWalker({shallow:!0}))for(const c of a)l.hasAttribute(c)&&(t.removeAttribute(c,l),s=!0)}return s})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let s=!1;for(const r of i)if(!(r.type!=="insert"||r.name==="$text"))for(const o of r.attributes.keys())!o.startsWith("html")||!o.endsWith("Attributes")||e.schema.checkAttribute(r.name,o)||(t.removeAttribute(o,r.position.nodeAfter),s=!0);return s})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,{view:r,model:o}=e;i.register(o,e.modelSchema);/* istanbul ignore next: paranoid check -- @preserve */r&&(i.extend(e.model,{allowAttributes:[Pe(r),"htmlContent"]}),t.data.registerRawContentMatcher({name:r}),s.for("upcast").elementToElement({view:r,model:eo(e),converterPriority:pe.low+2}),s.for("upcast").add(ji(e,this)),s.for("editingDowncast").elementToStructure({model:{name:o,attributes:[Pe(r)]},view:HT(t,e)}),s.for("dataDowncast").elementToElement({model:o,view:(a,{writer:l})=>qn(r,a,l)}),s.for("dataDowncast").add(qi(e)))}_registerBlockElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,{view:r,model:o}=e;if(!i.isRegistered(e.model)){if(i.register(e.model,e.modelSchema),!r)return;s.for("upcast").elementToElement({model:o,view:r,converterPriority:pe.low+2}),s.for("downcast").elementToElement({model:o,view:r})}r&&(i.extend(e.model,{allowAttributes:Pe(r)}),s.for("upcast").add(ji(e,this)),s.for("downcast").add(qi(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,r=e.model;e.appliesToBlock||(i.extend("$text",{allowAttributes:r}),e.attributeProperties&&i.setAttributeProperties(r,e.attributeProperties),s.for("upcast").add(WT(e,this)),s.for("downcast").attributeToElement({model:r,view:UT(e)}))}}function ed(n,e,t){const i=qT(n,e,t),{attributes:s,styles:r,classes:o}=KT(i),a={};if(s.size)for(const l of s)Cl(l)||s.delete(l);return s.size&&(a.attributes=td(s,l=>n.getAttribute(l))),r.size&&(a.styles=td(r,l=>n.getStyle(l))),o.size&&(a.classes=Array.from(o)),Object.keys(a).length?a:null}function qT(n,{consumable:e},t){const i=t.matchAll(n)||[],s=[];for(const r of i)GT(e,n,r),delete r.match.name,e.consume(n,r.match),s.push(r);return s}function GT(n,e,t){for(const i of["attributes","classes","styles"]){const s=t.match[i];if(s)for(const r of Array.from(s))n.test(e,{[i]:[r]})||s_(s,r)}}function KT(n){const e={attributes:new Set,classes:new Set,styles:new Set};for(const t of n)for(const i in e)(t.match[i]||[]).forEach(r=>e[i].add(r));return e}function td(n,e){const t={};for(const i of n)e(i)!==void 0&&(t[i]=e(i));return t}function to(n,e){const{name:t}=n,i=n[e];return fe(i)?Object.entries(i).map(([s,r])=>({name:t,[e]:{[s]:r}})):Array.isArray(i)?i.map(s=>({name:t,[e]:[s]})):[n]}function id(n){const{name:e,attributes:t,classes:i,styles:s}=n,r=[];return t&&r.push(...to({name:e,attributes:t},"attributes")),i&&r.push(...to({name:e,classes:i},"classes")),s&&r.push(...to({name:e,styles:s},"styles")),r}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class JT extends _{static get requires(){return[ie]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(ie);e.on("register:pre",(t,i)=>{if(i.model!=="codeBlock")return;const s=this.editor,r=s.model.schema,o=s.conversion;r.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),o.for("upcast").add(ZT(e)),o.for("downcast").add(YT()),t.stop()})}}function ZT(n){return e=>{e.on("element:code",(t,i,s)=>{const r=i.viewItem,o=r.parent;if(!o||!o.is("element","pre"))return;a(o,"htmlPreAttributes"),a(r,"htmlContentAttributes");function a(l,c){const u=n.processViewAttributes(l,s);u&&s.writer.setAttribute(c,u,i.modelRange)}},{priority:"low"})}}function YT(){return n=>{n.on("attribute:htmlPreAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:s,attributeNewValue:r}=t,a=i.mapper.toViewElement(t.item).parent;Ft(i.writer,s,r,a)}),n.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:s,attributeNewValue:r}=t,o=i.mapper.toViewElement(t.item);Ft(i.writer,s,r,o)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class XT extends _{static get requires(){return[ie]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(ie).on("register",(t,i)=>{const s=i,r=this.editor,o=r.model.schema,a=r.conversion;if(!s.paragraphLikeModel||o.isRegistered(s.model)||o.isRegistered(s.paragraphLikeModel))return;const l={model:s.paragraphLikeModel,view:s.view};o.register(s.model,s.modelSchema),o.register(l.model,{inheritAllFrom:"$block"}),a.for("upcast").elementToElement({view:s.view,model:(c,{writer:u})=>this._hasBlockContent(c)?u.createElement(s.model):u.createElement(l.model),converterPriority:pe.low+.5}),a.for("downcast").elementToElement({view:s.view,model:s.model}),this._addAttributeConversion(s),a.for("downcast").elementToElement({view:l.view,model:l.model}),this._addAttributeConversion(l),t.stop()})}_hasBlockContent(e){const t=this.editor.editing.view,i=t.domConverter.blockElements;for(const s of t.createRangeIn(e).getItems())if(s.is("element")&&i.includes(s.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,i=t.conversion,s=t.plugins.get(ie);t.model.schema.extend(e.model,{allowAttributes:Pe(e.view)}),i.for("upcast").add(ji(e,s)),i.for("downcast").add(qi(e))}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class QT extends _{static get requires(){return[mi,Hr]}static get pluginName(){return"HeadingElementSupport"}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){const i=e.plugins.get(mi),s=[];for(const r of t)"model"in r&&"view"in r&&(i.registerBlockElement({view:r.view,model:r.model}),s.push(r.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:s}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function Gn(n,e,t){const i=n.createRangeOn(e);for(const{item:s}of i.getWalker())if(s.is("element",t))return s}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class eP extends _{static get requires(){return[ie]}static get pluginName(){return"ImageElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(ie);s.on("register:figure",()=>{i.for("upcast").add(iP(s))}),s.on("register:img",(r,o)=>{o.model!=="imageBlock"&&o.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(tP(s)),i.for("downcast").add(nP()),r.stop())})}}function tP(n){return e=>{e.on("element:img",(t,i,s)=>{if(!i.modelRange)return;const r=i.viewItem,o=r.parent;a(r,"htmlImgAttributes"),o.is("element","a")&&l(o);function a(c,u){const h=n.processViewAttributes(c,s);h&&s.writer.setAttribute(u,h,i.modelRange)}function l(c){i.modelRange&&i.modelRange.getContainedElement().is("element","imageBlock")&&a(c,"htmlLinkAttributes")}},{priority:"low"})}}function iP(n){return e=>{e.on("element:figure",(t,i,s)=>{const r=i.viewItem;if(!i.modelRange||!r.hasClass("image"))return;const o=n.processViewAttributes(r,s);o&&s.writer.setAttribute("htmlFigureAttributes",o,i.modelRange)},{priority:"low"})}}function nP(){return n=>{e("htmlImgAttributes"),t("img","htmlImgAttributes"),t("figure","htmlFigureAttributes"),t("a","htmlLinkAttributes");function e(i){n.on(`attribute:${i}:imageInline`,(s,r,o)=>{if(!o.consumable.consume(r.item,s.name))return;const{attributeOldValue:a,attributeNewValue:l}=r,c=o.mapper.toViewElement(r.item);Ft(o.writer,a,l,c)},{priority:"low"})}function t(i,s){n.on(`attribute:${s}:imageBlock`,(r,o,a)=>{if(!a.consumable.test(o.item,r.name))return;const{attributeOldValue:l,attributeNewValue:c}=o,u=a.mapper.toViewElement(o.item),h=Gn(a.writer,u,i);h&&(Ft(a.writer,l,c,h),a.consumable.consume(o.item,r.name))},{priority:"low"}),i==="a"&&n.on("attribute:linkHref:imageBlock",(r,o,a)=>{if(!a.consumable.consume(o.item,"attribute:htmlLinkAttributes:imageBlock"))return;const l=a.mapper.toViewElement(o.item),c=Gn(a.writer,l,"a");st(a.writer,o.item.getAttribute("htmlLinkAttributes"),c)},{priority:"low"})}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class sP extends _{static get requires(){return[ie]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,s=this.editor.plugins.get(ie),r=this.editor.plugins.get(mi),o=e.config.get("mediaEmbed.elementName");r.registerBlockElement({model:"media",view:o}),s.on("register:figure",()=>{i.for("upcast").add(oP(s))}),s.on(`register:${o}`,(a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:[Pe(o),"htmlFigureAttributes"]}),i.for("upcast").add(rP(s,o)),i.for("dataDowncast").add(aP(o)),a.stop())})}}function rP(n,e){const t=(i,s,r)=>{const o=s.viewItem;a(o,Pe(e));function a(l,c){const u=n.processViewAttributes(l,r);u&&r.writer.setAttribute(c,u,s.modelRange)}};return i=>{i.on(`element:${e}`,t,{priority:"low"})}}function oP(n){return e=>{e.on("element:figure",(t,i,s)=>{const r=i.viewItem;if(!i.modelRange||!r.hasClass("media"))return;const o=n.processViewAttributes(r,s);o&&s.writer.setAttribute("htmlFigureAttributes",o,i.modelRange)},{priority:"low"})}}function aP(n){return e=>{t(n,Pe(n)),t("figure","htmlFigureAttributes");function t(i,s){e.on(`attribute:${s}:media`,(r,o,a)=>{if(!a.consumable.consume(o.item,r.name))return;const{attributeOldValue:l,attributeNewValue:c}=o,u=a.mapper.toViewElement(o.item),h=Gn(a.writer,u,i);Ft(a.writer,l,c,h)})}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class lP extends _{static get requires(){return[ie]}static get pluginName(){return"ScriptElementSupport"}init(){const e=this.editor.plugins.get(ie);e.on("register:script",(t,i)=>{const s=this.editor,r=s.model.schema,o=s.conversion;r.register("htmlScript",i.modelSchema),r.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),s.data.registerRawContentMatcher({name:"script"}),o.for("upcast").elementToElement({view:"script",model:eo(i)}),o.for("upcast").add(ji(i,e)),o.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>qn("script",a,l)}),o.for("downcast").add(qi(i)),t.stop()})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class cP extends _{static get requires(){return[ie]}static get pluginName(){return"TableElementSupport"}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(ie),r=e.plugins.get("TableUtils");s.on("register:figure",()=>{i.for("upcast").add(dP(s))}),s.on("register:table",(o,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(hP(s)),i.for("downcast").add(fP()),e.model.document.registerPostFixer(uP(e.model,r)),o.stop())})}}function uP(n,e){return t=>{const i=n.document.differ.getChanges();let s=!1;for(const r of i){if(r.type!="attribute"||r.attributeKey!="headingRows")continue;const o=r.range.start.nodeAfter,a=o.getAttribute("htmlTheadAttributes"),l=o.getAttribute("htmlTbodyAttributes");a&&!r.attributeNewValue?(t.removeAttribute("htmlTheadAttributes",o),s=!0):l&&r.attributeNewValue==e.getRows(o)&&(t.removeAttribute("htmlTbodyAttributes",o),s=!0)}return s}}function hP(n){return e=>{e.on("element:table",(t,i,s)=>{if(!i.modelRange)return;const r=i.viewItem;o(r,"htmlTableAttributes");for(const a of r.getChildren())a.is("element","thead")&&o(a,"htmlTheadAttributes"),a.is("element","tbody")&&o(a,"htmlTbodyAttributes");function o(a,l){const c=n.processViewAttributes(a,s);c&&s.writer.setAttribute(l,c,i.modelRange)}},{priority:"low"})}}function dP(n){return e=>{e.on("element:figure",(t,i,s)=>{const r=i.viewItem;if(!i.modelRange||!r.hasClass("table"))return;const o=n.processViewAttributes(r,s);o&&s.writer.setAttribute("htmlFigureAttributes",o,i.modelRange)},{priority:"low"})}}function fP(){return n=>{e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes");function e(t,i){n.on(`attribute:${i}:table`,(s,r,o)=>{if(!o.consumable.test(r.item,s.name))return;const a=o.mapper.toViewElement(r.item),l=Gn(o.writer,a,t);l&&(o.consumable.consume(r.item,s.name),Ft(o.writer,r.attributeOldValue,r.attributeNewValue,l))})}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class mP extends _{static get requires(){return[ie]}static get pluginName(){return"StyleElementSupport"}init(){const e=this.editor.plugins.get(ie);e.on("register:style",(t,i)=>{const s=this.editor,r=s.model.schema,o=s.conversion;r.register("htmlStyle",i.modelSchema),r.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),s.data.registerRawContentMatcher({name:"style"}),o.for("upcast").elementToElement({view:"style",model:eo(i)}),o.for("upcast").add(ji(i,e)),o.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>qn("style",a,l)}),o.for("downcast").add(qi(i)),t.stop()})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class gP extends _{static get requires(){return[ie]}static get pluginName(){return"DocumentListElementSupport"}init(){const e=this.editor;if(!e.plugins.has("DocumentListEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(ie),r=e.plugins.get("DocumentListEditing"),o=["ul","ol","li"];r.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:st}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:st}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:st}),s.on("register",(a,l)=>{if(!o.includes(l.view)||(a.stop(),t.checkAttribute("$block","htmlLiAttributes")))return;const c=o.map(u=>Pe(u));t.extend("$block",{allowAttributes:c}),t.extend("$blockObject",{allowAttributes:c}),t.extend("$container",{allowAttributes:c}),i.for("upcast").add(u=>{u.on("element:ul",io("htmlUlAttributes",s),{priority:"low"}),u.on("element:ol",io("htmlOlAttributes",s),{priority:"low"}),u.on("element:li",io("htmlLiAttributes",s),{priority:"low"})})}),r.on("postFixer",(a,{listNodes:l,writer:c})=>{const u=[];for(const{node:h,previous:f}of l){if(!f)continue;const m=h.getAttribute("listIndent"),p=f.getAttribute("listIndent");let b=null;if(m>p?u[p]=f:m<p?(b=u[m],u.length=m):b=f,!!b){if(b.getAttribute("listType")==h.getAttribute("listType")){const E=nd(b.getAttribute("listType")),T=b.getAttribute(E);!rn(h.getAttribute(E),T)&&c.model.schema.checkAttribute(h,E)&&(c.setAttribute(E,T,h),a.return=!0)}if(b.getAttribute("listItemId")==h.getAttribute("listItemId")){const E=b.getAttribute("htmlLiAttributes");!rn(h.getAttribute("htmlLiAttributes"),E)&&c.model.schema.checkAttribute(h,"htmlLiAttributes")&&(c.setAttribute("htmlLiAttributes",E,h),a.return=!0)}}}}),r.on("postFixer",(a,{listNodes:l,writer:c})=>{for(const{node:u}of l){const h=u.getAttribute("listType");h==="bulleted"&&u.getAttribute("htmlOlAttributes")&&(c.removeAttribute("htmlOlAttributes",u),a.return=!0),h==="numbered"&&u.getAttribute("htmlUlAttributes")&&(c.removeAttribute("htmlUlAttributes",u),a.return=!0)}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(i,s)=>{e.model.change(r=>{for(const o of s){const a=nd(o.getAttribute("listType"));e.model.schema.checkAttribute(o,a)&&r.setAttribute(a,{},o)}})})}}function io(n,e){return(t,i,s)=>{const r=i.viewItem;i.modelRange||Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor));const o=e.processViewAttributes(r,s);for(const a of i.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(n)||s.writer.model.schema.checkAttribute(a,n)&&s.writer.setAttribute(n,o||{},a))}}function nd(n){return n==="bulleted"?"htmlUlAttributes":"htmlOlAttributes"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class pP extends _{static get requires(){return[ie,mi]}static get pluginName(){return"CustomElementSupport"}init(){const e=this.editor.plugins.get(ie),t=this.editor.plugins.get(mi);e.on("register:$customElement",(i,s)=>{i.stop();const r=this.editor,o=r.model.schema,a=r.conversion,l=r.editing.view.domConverter.unsafeElements,c=r.data.htmlProcessor.domConverter.preElements;o.register(s.model,s.modelSchema),o.extend(s.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),a.for("upcast").elementToElement({view:/.*/,model:(u,h)=>{if(u.name=="$comment"||!wP(u.name)||t.getDefinitionsForView(u.name).size)return null;l.includes(u.name)||l.push(u.name),c.includes(u.name)||c.push(u.name);const f=h.writer.createElement(s.model,{htmlElementName:u.name}),m=e.processViewAttributes(u,h);m&&h.writer.setAttribute("htmlCustomElementAttributes",m,f);const b=new fr(u.document).createDocumentFragment(u),E=r.data.processor.toData(b);h.writer.setAttribute("htmlContent",E,f);for(const{item:T}of r.editing.view.createRangeIn(u))h.consumable.consume(T,{name:!0});return f},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:s.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:h})=>{const f=u.getAttribute("htmlElementName"),m=h.createRawElement(f);return u.hasAttribute("htmlCustomElementAttributes")&&st(h,u.getAttribute("htmlCustomElementAttributes"),m),m}}),a.for("dataDowncast").elementToElement({model:{name:s.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:h})=>{const f=u.getAttribute("htmlElementName"),m=u.getAttribute("htmlContent"),p=h.createRawElement(f,null,(b,E)=>{E.setContentOf(b,m);const T=b.firstChild;for(T.remove();T.firstChild;)b.appendChild(T.firstChild)});return u.hasAttribute("htmlCustomElementAttributes")&&st(h,u.getAttribute("htmlCustomElementAttributes"),p),p}})})}}function wP(n){try{document.createElement(n)}catch{return!1}return!0}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class bP extends _{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[ie,JT,XT,QT,eP,sP,lP,cP,mP,gP,pP]}init(){const e=this.editor,t=e.plugins.get(ie);t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(e){const t=this.editor.plugins.get("DataSchema"),i=Array.from(t.getDefinitionsForView(e,!1)),s=i.find(r=>r.isInline&&!i[0].isObject);return s?s.model:Pe(e)}addModelHtmlClass(e,t,i){const s=this.editor.model,r=this.getGhsAttributeNameForElement(e);s.change(o=>{for(const a of gi(s,i,r))fi(o,a,r,"classes",l=>{for(const c of X(t))l.add(c)})})}removeModelHtmlClass(e,t,i){const s=this.editor.model,r=this.getGhsAttributeNameForElement(e);s.change(o=>{for(const a of gi(s,i,r))fi(o,a,r,"classes",l=>{for(const c of X(t))l.delete(c)})})}setModelHtmlAttributes(e,t,i){const s=this.editor.model,r=this.getGhsAttributeNameForElement(e);s.change(o=>{for(const a of gi(s,i,r))fi(o,a,r,"attributes",l=>{for(const[c,u]of Object.entries(t))l.set(c,u)})})}removeModelHtmlAttributes(e,t,i){const s=this.editor.model,r=this.getGhsAttributeNameForElement(e);s.change(o=>{for(const a of gi(s,i,r))fi(o,a,r,"attributes",l=>{for(const c of X(t))l.delete(c)})})}setModelHtmlStyles(e,t,i){const s=this.editor.model,r=this.getGhsAttributeNameForElement(e);s.change(o=>{for(const a of gi(s,i,r))fi(o,a,r,"styles",l=>{for(const[c,u]of Object.entries(t))l.set(c,u)})})}removeModelHtmlStyles(e,t,i){const s=this.editor.model,r=this.getGhsAttributeNameForElement(e);s.change(o=>{for(const a of gi(s,i,r))fi(o,a,r,"styles",l=>{for(const c of X(t))l.delete(c)})})}}function*gi(n,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)n.schema.checkAttributeInSelection(e,t)&&(yield e);else for(const i of _P(n,e,t))yield*i.getItems({shallow:!0})}function _P(n,e,t){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?n.schema.checkAttribute(e,t)?[n.createRangeOn(e)]:[]:n.schema.getValidRanges(n.createSelection(e).getRanges(),t)}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class vP{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,s)=>{if(!s.consumable.test(i.item,"attribute:linkHref")||!(i.item.is("selection")||s.schema.isInline(i.item)))return;const r=s.writer,o=r.document.selection;for(const a of this._definitions){const l=r.createAttributeElement("a",a.attributes,{priority:5});a.classes&&r.addClass(a.classes,l);for(const c in a.styles)r.setStyle(c,a.styles[c],l);r.setCustomProperty("link",!0,l),a.callback(i.attributeNewValue)?i.item.is("selection")?r.wrap(o.getFirstRange(),l):r.wrap(s.mapper.toViewRange(i.range),l):r.unwrap(s.mapper.toViewRange(i.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:s,mapper:r})=>{const o=r.toViewElement(i.item),a=Array.from(o.getChildren()).find(l=>l.is("element","a"));for(const l of this._definitions){const c=Xe(l.attributes);if(l.callback(i.attributeNewValue)){for(const[u,h]of c)u==="class"?s.addClass(h,a):s.setAttribute(u,h,a);l.classes&&s.addClass(l.classes,a);for(const u in l.styles)s.setStyle(u,l.styles[u],a)}else{for(const[u,h]of c)u==="class"?s.removeClass(h,a):s.removeAttribute(u,a);l.classes&&s.removeClass(l.classes,a);for(const u in l.styles)s.removeStyle(u,a)}}})}}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const yP=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,kP=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,CP=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,EP=/^((\w+:(\/{2,})?)|(\W))/i,no="Ctrl+K";function AP(n){return n.is("attributeElement")&&!!n.getCustomProperty("link")}function sd(n,{writer:e}){const t=e.createAttributeElement("a",{href:n},{priority:5});return e.setCustomProperty("link",!0,t),t}function rd(n){const e=String(n);return TP(e)?e:"#"}function TP(n){return!!n.replace(yP,"").match(kP)}function PP(n,e){const t={"Open in a new tab":n("Open in a new tab"),Downloadable:n("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function SP(n){const e=[];if(n)for(const[t,i]of Object.entries(n)){const s=Object.assign({},i,{id:`link${ha(t)}`});e.push(s)}return e}function so(n,e){return n?e.checkAttribute(n.name,"linkHref"):!1}function xP(n){return CP.test(n)}function ro(n,e){const t=xP(n)?"mailto:":e,i=!!t&&!od(n);return n&&i?t+n:n}function od(n){return EP.test(n)}function ad(n){window.open(n,"_blank","noopener")}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class IP extends Q{constructor(){super(...arguments),this.manualDecorators=new Ie,this.automaticDecorators=new vP}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||Ee(t.getSelectedBlocks());so(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={}){const i=this.editor.model,s=i.document.selection,r=[],o=[];for(const a in t)t[a]?r.push(a):o.push(a);i.change(a=>{if(s.isCollapsed){const l=s.getFirstPosition();if(s.hasAttribute("linkHref")){const c=ld(s);let u=ci(l,"linkHref",s.getAttribute("linkHref"),i);s.getAttribute("linkHref")===c&&(u=this._updateLinkContent(i,a,u,e)),a.setAttribute("linkHref",e,u),r.forEach(h=>{a.setAttribute(h,!0,u)}),o.forEach(h=>{a.removeAttribute(h,u)}),a.setSelection(a.createPositionAfter(u.end.nodeBefore))}else if(e!==""){const c=Xe(s.getAttributes());c.set("linkHref",e),r.forEach(h=>{c.set(h,!0)});const{end:u}=i.insertContent(a.createText(e,c),l);a.setSelection(u)}["linkHref",...r,...o].forEach(c=>{a.removeSelectionAttribute(c)})}else{const l=i.schema.getValidRanges(s.getRanges(),"linkHref"),c=[];for(const h of s.getSelectedBlocks())i.schema.checkAttribute(h,"linkHref")&&c.push(a.createRangeOn(h));const u=c.slice();for(const h of l)this._isRangeToUpdate(h,c)&&u.push(h);for(const h of u){let f=h;if(u.length===1){const m=ld(s);s.getAttribute("linkHref")===m&&(f=this._updateLinkContent(i,a,h,e),a.setSelection(a.createSelection(f)))}a.setAttribute("linkHref",e,f),r.forEach(m=>{a.setAttribute(m,!0,f)}),o.forEach(m=>{a.removeAttribute(m,f)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return so(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,s){const r=t.createText(s,{linkHref:s});return e.insertContent(r,i)}}function ld(n){if(n.isCollapsed){const e=n.getFirstPosition();return e.textNode&&e.textNode.data}else{const e=Array.from(n.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class RP extends Q{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();so(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,s=e.commands.get("link");t.change(r=>{const o=i.isCollapsed?[ci(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const a of o)if(r.removeAttribute("linkHref",a),s)for(const l of s.manualDecorators)r.removeAttribute(l.id,a)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class OP extends H(){constructor({id:e,label:t,attributes:i,classes:s,styles:r,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=i,this.classes=s,this.styles=r}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const vS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const MP="ck-link_selected",cd="automatic",VP="manual",DP=/^(https?:)?\/\//;class BP extends _{static get pluginName(){return"LinkEditing"}static get requires(){return[vh,mh,ft]}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:sd}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(s,r)=>sd(rd(s),r)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:s=>s.getAttribute("href")}}),e.commands.add("link",new IP(e)),e.commands.add("unlink",new RP(e));const t=PP(e.t,SP(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(s=>s.mode===cd)),this._enableManualDecorators(t.filter(s=>s.mode===VP)),e.plugins.get(vh).registerAttribute("linkHref"),CE(e,"linkHref","a",MP),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:cd,callback:r=>!!r&&DP.test(r),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(r=>{t.model.schema.extend("$text",{allowAttributes:r.id});const o=new OP(r);s.add(o),t.conversion.for("downcast").attributeToElement({model:o.id,view:(a,{writer:l,schema:c},{item:u})=>{if((u.is("selection")||c.isInline(u))&&a){const h=l.createAttributeElement("a",o.attributes,{priority:5});o.classes&&l.addClass(o.classes,h);for(const f in o.styles)l.setStyle(f,o.styles[f],h);return l.setCustomProperty("link",!0,h),h}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...o._createPattern()},model:{key:o.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document;this.listenTo(i,"click",(s,r)=>{if(!(x.isMac?r.domEvent.metaKey:r.domEvent.ctrlKey))return;let a=r.domTarget;if(a.tagName.toLowerCase()!="a"&&(a=a.closest("a")),!a)return;const l=a.getAttribute("href");l&&(s.stop(),r.preventDefault(),ad(l))},{context:"$capture"}),this.listenTo(i,"keydown",(s,r)=>{const a=e.commands.get("link").value;a&&r.keyCode===O.enter&&r.altKey&&(s.stop(),ad(a))})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(t,"insertContent",()=>{const s=i.anchor.nodeBefore,r=i.anchor.nodeAfter;i.hasAttribute("linkHref")&&s&&s.hasAttribute("linkHref")&&(r&&r.hasAttribute("linkHref")||t.change(o=>{oo(o,ao(t.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(En);let i=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{i=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!i)return;i=!1;const s=t.document.selection;if(!s.isCollapsed||!s.hasAttribute("linkHref"))return;const r=s.getFirstPosition(),o=ci(r,"linkHref",s.getAttribute("linkHref"),t);(r.isTouching(o.start)||r.isTouching(o.end))&&t.change(a=>{oo(a,ao(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i=null,s=!1;this.listenTo(t.document,"delete",()=>{s=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const r=e.model.document.selection;if(!r.isCollapsed){if(s){s=!1;return}ud(e)&&FP(e.model)&&(i=r.getAttributes())}},{priority:"high"}),this.listenTo(e.model,"insertContent",(r,[o])=>{s=!1,ud(e)&&i&&(e.model.change(a=>{for(const[l,c]of i)a.setAttribute(l,c,o)}),i=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view;let r=!1,o=!1;this.listenTo(s.document,"delete",(a,l)=>{o=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const a=i.getFirstPosition(),l=i.getAttribute("linkHref");if(!l)return;const c=ci(a,"linkHref",l,t);r=c.containsPosition(a)||c.end.isEqual(a)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{o&&(o=!1,!r&&e.model.enqueueChange(a=>{oo(a,ao(t.schema))}))},{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,r)=>{t.change(o=>{const a=o.createRangeIn(r.content);for(const l of a.getItems())if(l.hasAttribute("linkHref")){const c=ro(l.getAttribute("linkHref"),i);o.setAttribute("linkHref",c,l)}})})}}function oo(n,e){n.removeSelectionAttribute("linkHref");for(const t of e)n.removeSelectionAttribute(t)}function FP(n){const e=n.document.selection,t=e.getFirstPosition(),i=e.getLastPosition(),s=t.nodeAfter;if(!s||!s.is("$text")||!s.hasAttribute("linkHref"))return!1;const r=i.textNode||i.nodeBefore;return s===r?!0:ci(t,"linkHref",s.getAttribute("linkHref"),n).containsRange(n.createRange(t,i),!0)}function ud(n){return n.model.change(t=>t.batch).isTyping}function ao(n){return n.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}const yS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class NP extends P{constructor(e,t){super(e),this.focusTracker=new be,this.keystrokes=new Re,this._focusables=new tt;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),B.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),B.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new Dt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const s=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&s.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:s,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),br({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new xn(this.locale,Rn);return t.label=e("Link URL"),t}_createButton(e,t,i,s){const r=new $(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:i}}),s&&r.delegate("execute").to(this,s),r}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const s=new yr(this.locale);s.set({name:i.id,label:i.label,withText:!0}),s.bind("isOn").toMany([i,e],"value",(r,o)=>o===void 0&&r===void 0?!!i.defaultValue:!!r),s.on("execute",()=>{i.set("value",!s.isOn)}),t.add(s)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const i=new P;i.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(s=>({tag:"li",children:[s],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(i)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}const kS="",LP='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class $P extends P{constructor(e){super(e),this.focusTracker=new be,this.keystrokes=new Re,this._focusables=new tt;const t=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),LP,"unlink"),this.editButtonView=this._createButton(t("Edit link"),B.pencil,"edit"),this.set("href",void 0),this._focusCycler=new Dt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const s=new $(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s.delegate("execute").to(this,i),s}_createPreviewButton(){const e=new $(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",s=>s&&rd(s)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",s=>s||i("This link has no URL")),e.bind("isEnabled").to(this,"href",s=>!!s),e.template.tag="a",e.template.eventListeners={},e}}const zP='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>';/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const We="link-ui";class HP extends _{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Bn]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(Sk),this._balloon=e.plugins.get(Bn),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:We,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:We,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new $P(e.locale),i=e.commands.get("link"),s=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(s),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(r,o)=>{this._hideUI(),o()}),t.keystrokes.set(no,(r,o)=>{this._addFormView(),o()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),s=new(wr(NP))(e.locale,t);return s.urlInputView.fieldView.bind("value").to(t,"value"),s.urlInputView.bind("isEnabled").to(t,"isEnabled"),s.saveButtonView.bind("isEnabled").to(t),this.listenTo(s,"submit",()=>{const{value:r}=s.urlInputView.fieldView.element,o=ro(r,i);e.execute("link",o,s.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(s,"cancel",()=>{this._closeFormView()}),s.keystrokes.set("Esc",(r,o)=>{this._closeFormView(),o()}),s}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.ui.componentFactory.add("link",s=>{const r=new $(s);return r.isEnabled=!0,r.label=i("Link"),r.icon=zP,r.keystroke=no,r.tooltip=!0,r.isToggleable=!0,r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",o=>!!o),this.listenTo(r,"execute",()=>this._showUI(!0)),r})}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(no,(i,s)=>{s(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){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())}),pr({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),!this._areActionsInPanel&&this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?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.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),s=o();const r=()=>{const a=this._getSelectedLinkElement(),l=o();i&&!a||!i&&l!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=a,s=l};function o(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let s;if(t.markers.has(We)){const r=Array.from(this.editor.editing.mapper.markerNameToElements(We)),o=e.createRange(e.createPositionBefore(r[0]),e.createPositionAfter(r[r.length-1]));s=e.domConverter.viewRangeToDom(o)}else s=()=>{const r=this._getSelectedLinkElement();return r?e.domConverter.mapViewToDom(r):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:s}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&J(i))return lo(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),r=lo(s.start),o=lo(s.end);return!r||r!=o?null:e.createRangeIn(r).getTrimmed().isEqual(s)?r:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(We))t.updateMarker(We,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:r})=>!e.schema.isContent(r),{boundaries:i});t.addMarker(We,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(We,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(We)&&e.change(t=>{t.removeMarker(We)})}}function lo(n){return n.getAncestors().find(e=>AP(e))||null}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const WP=4,UP=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),jP=2;class qP extends _{static get requires(){return[li]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new yE(e.model,i=>{if(!GP(i))return;const s=hd(i.substr(0,i.length-1));if(s)return{url:s}});t.on("matched:data",(i,s)=>{const{batch:r,range:o,url:a}=s;if(!r.isTyping)return;const l=o.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),u=e.model.createRange(c,l);this._applyAutoLink(a,u)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition();if(!s.parent.previousSibling)return;const r=t.createRangeIn(s.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(r)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition(),r=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(r)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:s}=_h(e,t),r=hd(i);if(r){const o=t.createRange(s.end.getShiftedBy(-r.length),s.end);this._applyAutoLink(r,o)}}_applyAutoLink(e,t){const i=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),r=ro(e,s);!this.isEnabled||!KP(t,i)||!od(r)||JP(t)||this._persistAutoLink(r,t)}_persistAutoLink(e,t){const i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(r=>{r.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function GP(n){return n.length>WP&&n[n.length-1]===" "&&n[n.length-2]!==" "}function hd(n){const e=UP.exec(n);return e?e[jP]:null}function KP(n,e){return e.schema.checkAttributeInSelection(e.createSelection(n),"linkHref")}function JP(n){const e=n.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class ZP extends _{static get requires(){return[BP,HP,qP]}static get pluginName(){return"Link"}}const CS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function YP(n){return n.createContainerElement("span",{class:"image-inline"},n.createEmptyElement("img"))}function dd(n){return n.createContainerElement("figure",{class:"image"},[n.createEmptyElement("img"),n.createSlot("children")])}function fd(n,e){const t=n.plugins.get("ImageUtils"),i=n.plugins.has("ImageInlineEditing")&&n.plugins.has("ImageBlockEditing");return r=>t.isInlineImageView(r)?i&&(r.getStyle("display")=="block"||r.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:s(r):null;function s(r){const o={name:!0};return r.hasAttribute("src")&&(o.attributes=["src"]),o}}function co(n,e){const t=Ee(e.getSelectedBlocks());return!t||n.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class rt extends _{static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null){const s=this.editor,r=s.model,o=r.document.selection;i=md(s,t||o,i),e={...Object.fromEntries(o.getAttributes()),...e};for(const a in e)r.schema.checkAttribute(i,a)||delete e[a];return r.change(a=>{const l=a.createElement(i,e);return r.insertObject(l,t,null,{setSelection:"on",findOptimalPosition:!t&&i!="imageInline"?"auto":void 0}),l.parent?l:null})}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let s=t.parent;for(;s;){if(s.is("element")&&this.isImageWidget(s))return s;s=s.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const t=this.editor.model.document.selection;return XP(this.editor,t)&&QP(t)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),Hn(e,t,{label:()=>{const o=this.findViewImgElement(e).getAttribute("alt");return o?`${o} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&J(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}}function XP(n,e){if(md(n,e,null)=="imageBlock"){const i=e5(e,n.model);if(n.model.schema.checkChild(i,"imageBlock"))return!0}else if(n.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}function QP(n){return[...n.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function e5(n,e){const i=jr(n,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function md(n,e,t){const i=n.model.schema,s=n.config.get("image.insert.type");return n.plugins.has("ImageBlockEditing")?n.plugins.has("ImageInlineEditing")?t||(s==="inline"?"imageInline":s==="block"?"imageBlock":e.is("selection")?co(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class t5 extends Q{refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled&&i.hasAttribute("alt")?this.value=i.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),s=t.model,r=i.getClosestSelectedImageElement(s.document.selection);s.change(o=>{o.setAttribute("alt",e.newValue,r)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class i5 extends _{static get requires(){return[rt]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new t5(this.editor))}}const ES="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class n5 extends P{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new be,this.keystrokes=new Re,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),B.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),B.cancel,"ck-button-cancel","cancel"),this._focusables=new tt,this._focusCycler=new Dt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),br({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,s){const r=new $(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:i}}),s&&r.delegate("execute").to(this,s),r}_createLabeledInputView(){const e=this.locale.t,t=new xn(this.locale,Rn);return t.label=e("Text alternative"),t}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function s5(n){const e=n.plugins.get("ContextualBalloon");if(n.plugins.get("ImageUtils").getClosestSelectedImageWidget(n.editing.view.document.selection)){const i=gd(n);e.updatePosition(i)}}function gd(n){const e=n.editing.view,t=le.defaultPositions,i=n.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class r5 extends _{static get requires(){return[Bn]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const s=e.commands.get("imageTextAlternative"),r=new $(i);return r.set({label:t("Change image text alternative"),icon:B.lowVision,tooltip:!0}),r.bind("isEnabled").to(s,"isEnabled"),r.bind("isOn").to(s,"value",o=>!!o),this.listenTo(r,"execute",()=>{this._showForm()}),r})}_createForm(){const e=this.editor,i=e.editing.view.document,s=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(wr(n5))(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",(r,o)=>{this._hideForm(!0),o()}),this.listenTo(e.ui,"update",()=>{s.getClosestSelectedImageWidget(i.selection)?this._isVisible&&s5(e):this._hideForm(!0)}),pr({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:gd(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){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&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class pd extends _{static get requires(){return[i5,r5]}static get pluginName(){return"ImageTextAlternative"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function o5(n){const e=(t,i,s)=>{if(!s.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const r=n.findViewImgElement(i.viewItem);if(!r||!s.consumable.test(r,{name:!0}))return;s.consumable.consume(i.viewItem,{name:!0,classes:"image"});const o=s.convertItem(r,i.modelCursor),a=Ee(o.modelRange.getItems());if(!a){s.consumable.revert(i.viewItem,{name:!0,classes:"image"});return}s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i)};return t=>{t.on("element:figure",e)}}function wd(n,e){const t=(i,s,r)=>{if(!r.consumable.consume(s.item,i.name))return;const o=r.writer,a=r.mapper.toViewElement(s.item),l=n.findViewImgElement(a);if(s.attributeNewValue===null){const c=s.attributeOldValue;c&&c.data&&(o.removeAttribute("srcset",l),o.removeAttribute("sizes",l),c.width&&o.removeAttribute("width",l))}else{const c=s.attributeNewValue;c&&c.data&&(o.setAttribute("srcset",c.data,l),o.setAttribute("sizes","100vw",l),c.width&&o.setAttribute("width",c.width,l))}};return i=>{i.on(`attribute:srcset:${e}`,t)}}function Kn(n,e,t){const i=(s,r,o)=>{if(!o.consumable.consume(r.item,s.name))return;const a=o.writer,l=o.mapper.toViewElement(r.item),c=n.findViewImgElement(l);a.setAttribute(r.attributeKey,r.attributeNewValue||"",c)};return s=>{s.on(`attribute:${t}:${e}`,i)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class bd extends Me{observe(e){this.listenTo(e,"load",(t,i)=>{const s=i.target;this.checkShouldIgnoreEventFromTarget(s)||s.tagName=="IMG"&&this._fireEvents(i)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class a5 extends Q{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&G("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&G("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=X(e.source),i=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(i.getAttributes());t.forEach((o,a)=>{const l=i.getSelectedElement();if(typeof o=="string"&&(o={src:o}),a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);s.insertImage({...o,...r},c)}else s.insertImage({...o,...r})})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class l5 extends Q{refresh(){const t=this.editor.plugins.get("ImageUtils"),i=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(i),this.value=this.isEnabled?i.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement();this.editor.model.change(i=>{i.setAttribute("src",e.source,t),i.removeAttribute("srcset",t),i.removeAttribute("sizes",t)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class _d extends _{static get requires(){return[rt]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(bd),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:r=>{const o={data:r.getAttribute("srcset")};return r.hasAttribute("width")&&(o.width=r.getAttribute("width")),o}}});const i=new a5(e),s=new l5(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",s),e.commands.add("imageInsert",i)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class vd extends Q{constructor(e,t){super(e),this._modelElementName=t}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(i):this.isEnabled=t.isBlockImage(i)}execute(){const e=this.editor,t=this.editor.model,i=e.plugins.get("ImageUtils"),s=i.getClosestSelectedImageElement(t.document.selection),r=Object.fromEntries(s.getAttributes());return!r.src&&!r.uploadId?null:t.change(o=>{const a=Array.from(t.markers).filter(u=>u.getRange().containsItem(s)),l=i.insertImage(r,t.createSelection(s,"on"),this._modelElementName);if(!l)return null;const c=o.createRangeOn(l);for(const u of a){const h=u.getRange(),f=h.root.rootName!="$graveyard"?h.getJoined(c,!0):c;o.updateMarker(u,{range:f})}return{oldElement:s,newElement:l}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class c5 extends _{static get requires(){return[_d,rt,ft]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new vd(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,s=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(r,{writer:o})=>dd(o)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(r,{writer:o})=>s.toImageWidget(dd(o),o,t("image widget"))}),i.for("downcast").add(Kn(s,"imageBlock","src")).add(Kn(s,"imageBlock","alt")).add(wd(s,"imageBlock")),i.for("upcast").elementToElement({view:fd(e,"imageBlock"),model:(r,{writer:o})=>o.createElement("imageBlock",r.hasAttribute("src")?{src:r.getAttribute("src")}:void 0)}).add(o5(s))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,s=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",(o,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isInlineImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(co(t.schema,u)==="imageBlock"){const h=new fr(i.document),f=l.map(m=>h.createElement("figure",{class:"image"},m));a.content=h.createDocumentFragment(f)}})}}const AS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class u5 extends _{static get requires(){return[c5,ui,pd]}static get pluginName(){return"ImageBlock"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class h5 extends _{static get requires(){return[_d,rt,ft]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((i,s)=>{if(i.endsWith("caption")&&s.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new vd(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,s=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(r,{writer:o})=>o.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(r,{writer:o})=>s.toImageWidget(YP(o),o,t("image widget"))}),i.for("downcast").add(Kn(s,"imageInline","src")).add(Kn(s,"imageInline","alt")).add(wd(s,"imageInline")),i.for("upcast").elementToElement({view:fd(e,"imageInline"),model:(r,{writer:o})=>o.createElement("imageInline",r.hasAttribute("src")?{src:r.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,s=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",(o,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isBlockImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(co(t.schema,u)==="imageInline"){const h=new fr(i.document),f=l.map(m=>m.childCount===1?(Array.from(m.getAttributes()).forEach(p=>h.setAttribute(...p,s.findViewImgElement(m))),m.getChild(0)):m);a.content=h.createDocumentFragment(f)}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class d5 extends _{static get requires(){return[h5,ui,pd]}static get pluginName(){return"ImageInline"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class f5 extends _{static get requires(){return[u5,d5]}static get pluginName(){return"Image"}}const TS="",PS="",SS="",xS="",IS="",RS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class m5 extends Q{refresh(){const e=this.editor,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!i,!i||!i.hasAttribute("width")?this.value=null:this.value={width:i.getAttribute("width"),height:null}}execute(e){const t=this.editor,i=t.model,r=t.plugins.get("ImageUtils").getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},r&&i.change(o=>{o.setAttribute("width",e.width,r)})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class yd extends _{static get requires(){return[rt]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new m5(e);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:"width"}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:"width"})}_registerConverters(e){const t=this.editor;t.conversion.for("downcast").add(i=>i.on(`attribute:width:${e}`,(s,r,o)=>{if(!o.consumable.consume(r.item,s.name))return;const a=o.writer,l=o.mapper.toViewElement(r.item);r.attributeNewValue!==null?(a.setStyle("width",r.attributeNewValue,l),a.addClass("image_resized",l)):(a.removeStyle("width",l),a.removeClass("image_resized",l))})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:i=>i.getStyle("width")}})}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const uo={small:B.objectSizeSmall,medium:B.objectSizeMedium,large:B.objectSizeLarge,original:B.objectSizeFull};class g5 extends _{static get requires(){return[yd]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const s of t)this._registerImageResizeButton(s);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:s,icon:r}=e,o=s?s+this._resizeUnit:null;t.ui.componentFactory.add(i,a=>{const l=new $(a),c=t.commands.get("resizeImage"),u=this._getOptionLabelValue(e,!0);if(!uo[r])throw new d("imageresizebuttons-missing-icon",t,e);return l.set({label:u,icon:uo[r],tooltip:u,isToggleable:!0}),l.bind("isEnabled").to(this),l.bind("isOn").to(c,"value",kd(o)),this.listenTo(l,"execute",()=>{t.execute("resizeImage",{width:o})}),l})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,s=e.find(o=>!o.value),r=o=>{const a=t.commands.get("resizeImage"),l=it(o,Cr),c=l.buttonView,u=i("Resize image");return c.set({tooltip:u,commandValue:s.value,icon:uo.medium,isToggleable:!0,label:this._getOptionLabelValue(s),withText:!0,class:"ck-resize-image-button",ariaLabel:u,ariaLabelledBy:void 0}),c.bind("label").to(a,"value",h=>h&&h.width?h.width:this._getOptionLabelValue(s)),l.bind("isEnabled").to(this),Tr(l,()=>this._getResizeDropdownListItemDefinitions(e,a),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(l,"execute",h=>{t.execute(h.source.commandName,{width:h.source.commandValue}),t.editing.view.focus()}),l};t.ui.componentFactory.add("resizeImage",r),t.ui.componentFactory.add("imageResize",r)}_getOptionLabelValue(e,t=!1){const i=this.editor.t;return e.label?e.label:t?e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const i=new Ie;return e.map(s=>{const r=s.value?s.value+this._resizeUnit:null,o={type:"button",model:new Nr({commandName:"resizeImage",commandValue:r,label:this._getOptionLabelValue(s),role:"menuitemradio",withText:!0,icon:null})};o.model.bind("isOn").to(t,"value",kd(r)),i.add(o)}),i}}function kd(n){return e=>{const t=e;return n===null&&t===n?!0:t!==null&&t.width===n}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const p5="figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img",w5=/(image|image-inline)/,ho="image_resized";class b5 extends _{static get requires(){return[Wn]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view;t.addObserver(bd),this.listenTo(t.document,"imageLoaded",(i,s)=>{if(!s.target.matches(p5))return;const r=e.editing.view.domConverter,a=r.domToView(s.target).findAncestor({classes:w5});let l=this.editor.plugins.get(Wn).getResizerByViewElement(a);if(l){l.redraw();return}const c=e.editing.mapper,u=c.toModelElement(a);l=e.plugins.get(Wn).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:u,viewElement:a,editor:e,getHandleHost(h){return h.querySelector("img")},getResizeHost(){return r.mapViewToDom(c.toViewElement(u.parent))},isCentered(){const h=u.getAttribute("imageStyle");return!h||h=="block"||h=="alignCenter"},onCommit(h){t.change(f=>{f.removeClass(ho,a)}),e.execute("resizeImage",{width:h})}}),l.on("updateSize",()=>{a.hasClass(ho)||t.change(h=>{h.addClass(ho,a)})}),l.bind("isEnabled").to(this)})}}const OS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class _5 extends _{static get requires(){return[yd,b5,g5]}static get pluginName(){return"ImageResize"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class v5 extends Q{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(const s of i.modelElements)this._defaultStyles[s]=i.name;return[i.name,i]}))}refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled?i.hasAttribute("imageStyle")?this.value=i.getAttribute("imageStyle"):this.value=this._defaultStyles[i.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,s=t.plugins.get("ImageUtils");i.change(r=>{const o=e.value;let a=s.getClosestSelectedImageElement(i.document.selection);o&&this.shouldConvertImageType(o,a)&&(this.editor.execute(s.isBlockImage(a)?"imageTypeInline":"imageTypeBlock"),a=s.getClosestSelectedImageElement(i.document.selection)),!o||this._styles.get(o).isDefault?r.removeAttribute("imageStyle",a):r.setAttribute("imageStyle",o,a)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */const{objectFullWidth:y5,objectInline:Cd,objectLeft:Ed,objectRight:fo,objectCenter:mo,objectBlockLeft:Ad,objectBlockRight:Td}=B,Jn={get inline(){return{name:"inline",title:"In line",icon:Cd,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Ed,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Ad,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:mo,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:fo,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Td,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:mo,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:fo,modelElements:["imageBlock"],className:"image-style-side"}}},Pd={full:y5,left:Ad,right:Td,center:mo,inlineLeft:Ed,inlineRight:fo,inline:Cd},Sd=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function k5(n){return(n.configuredStyles.options||[]).map(i=>A5(i)).filter(i=>T5(i,n))}function C5(n,e){return n&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:n?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function E5(n){return n.has("ImageBlockEditing")&&n.has("ImageInlineEditing")?[...Sd]:[]}function A5(n){return typeof n=="string"?Jn[n]?n={...Jn[n]}:n={name:n}:n=P5(Jn[n.name],n),typeof n.icon=="string"&&(n.icon=Pd[n.icon]||n.icon),n}function T5(n,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){const{modelElements:i,name:s}=n;if(!i||!i.length||!s)return xd({style:n}),!1;{const r=[e?"imageBlock":null,t?"imageInline":null];if(!i.some(o=>r.includes(o)))return G("image-style-missing-dependency",{style:n,missingPlugins:i.map(o=>o==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function P5(n,e){const t={...e};for(const i in n)Object.prototype.hasOwnProperty.call(e,i)||(t[i]=n[i]);return t}function xd(n){G("image-style-configuration-definition-invalid",n)}const go={normalizeStyles:k5,getDefaultStylesConfiguration:C5,getDefaultDropdownDefinitions:E5,warnInvalidStyle:xd,DEFAULT_OPTIONS:Jn,DEFAULT_ICONS:Pd,DEFAULT_DROPDOWN_DEFINITIONS:Sd};/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */function S5(n){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const s=Id(t.attributeNewValue,n),r=Id(t.attributeOldValue,n),o=i.mapper.toViewElement(t.item),a=i.writer;r&&a.removeClass(r.className,o),s&&a.addClass(s.className,o)}}function x5(n){const e={imageInline:n.filter(t=>!t.isDefault&&t.modelElements.includes("imageInline")),imageBlock:n.filter(t=>!t.isDefault&&t.modelElements.includes("imageBlock"))};return(t,i,s)=>{if(!i.modelRange)return;const r=i.viewItem,o=Ee(i.modelRange.getItems());if(o&&s.schema.checkAttribute(o,"imageStyle"))for(const a of e[o.name])s.consumable.consume(r,{classes:a.className})&&s.writer.setAttribute("imageStyle",a.name,o)}}function Id(n,e){for(const t of e)if(t.name===n)return t}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class Rd extends _{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[rt]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=go,i=this.editor,s=i.plugins.has("ImageBlockEditing"),r=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(s,r)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:s,isInlinePluginLoaded:r}),this._setupConversion(s,r),this._setupPostFixer(),i.commands.add("imageStyle",new v5(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,s=i.model.schema,r=S5(this.normalizedStyles),o=x5(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",r),i.data.downcastDispatcher.on("attribute:imageStyle",r),e&&(s.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",o,{priority:"low"})),t&&(s.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",o,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(rt),s=new Map(this.normalizedStyles.map(r=>[r.name,r]));t.registerPostFixer(r=>{let o=!1;for(const a of t.differ.getChanges())if(a.type=="insert"||a.type=="attribute"&&a.attributeKey=="imageStyle"){let l=a.type=="insert"?a.position.nodeAfter:a.range.start.nodeAfter;if(l&&l.is("element","paragraph")&&l.childCount>0&&(l=l.getChild(0)),!i.isImage(l))continue;const c=l.getAttribute("imageStyle");if(!c)continue;const u=s.get(c);(!u||!u.modelElements.includes(l.name))&&(r.removeAttribute("imageStyle",l),o=!0)}return o})}}const MS="";/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class I5 extends _{static get requires(){return[Rd]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=e.get("ImageStyleEditing"),s=Od(i.normalizedStyles,this.localizedDefaultStylesTitles);for(const o of s)this._createButton(o);const r=Od([...t.filter(K),...go.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const o of r)this._createDropdown(o,s)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,s=>{let r;const{defaultItem:o,items:a,title:l}=e,c=a.filter(m=>t.find(({name:p})=>Md(p)===m)).map(m=>{const p=i.create(m);return m===o&&(r=p),p});a.length!==c.length&&go.warnInvalidStyle({dropdown:e});const u=it(s,ju),h=u.buttonView,f=h.arrowView;return In(u,c,{enableActiveItemFocusOnDropdownOpen:!0}),h.set({label:Vd(l,r.label),class:null,tooltip:!0}),f.unbind("label"),f.set({label:l}),h.bind("icon").toMany(c,"isOn",(...m)=>{const p=m.findIndex(bt);return p<0?r.icon:c[p].icon}),h.bind("label").toMany(c,"isOn",(...m)=>{const p=m.findIndex(bt);return Vd(l,p<0?r.label:c[p].label)}),h.bind("isOn").toMany(c,"isOn",(...m)=>m.some(bt)),h.bind("class").toMany(c,"isOn",(...m)=>m.some(bt)?"ck-splitbutton_flatten":void 0),h.on("execute",()=>{c.some(({isOn:m})=>m)?u.isOpen=!u.isOpen:r.fire("execute")}),u.bind("isEnabled").toMany(c,"isEnabled",(...m)=>m.some(bt)),this.listenTo(u,"execute",()=>{this.editor.editing.view.focus()}),u})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(Md(t),i=>{const s=this.editor.commands.get("imageStyle"),r=new $(i);return r.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(s,"isEnabled"),r.bind("isOn").to(s,"value",o=>o===t),r.on("execute",this._executeCommand.bind(this,t)),r})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Od(n,e){for(const t of n)e[t.title]&&(t.title=e[t.title]);return n}function Md(n){return`imageStyle:${n}`}function Vd(n,e){return(n?n+": ":"")+e}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class R5 extends _{static get requires(){return[Rd,I5]}static get pluginName(){return"ImageStyle"}}/**
 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */class O5 extends _{static get requires(){return[qr,rt]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(qr),s=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:M5(e.config.get("image.toolbar")||[]),getRelatedElement:r=>s.getClosestSelectedImageWidget(r)})}}function M5(n){return n.map(e=>K(e)?e.name:e)}A.Alignment=GA,A.Bold=ZA,A.ButtonView=$,A.Collection=Ie,A.Command=Q,A.DropdownButtonView=Cr,A.Essentials=DA,A.FontColor=ET,A.GeneralHtmlSupport=bP,A.Heading=cT,A.Image=f5,A.ImageResize=_5,A.ImageStyle=R5,A.ImageToolbar=O5,A.ImageUtils=rt,A.InlineEditor=Fn,A.Italic=eT,A.Link=ZP,A.MediaEmbed=NT,A.Model=Nr,A.Observer=Me,A.Paragraph=Wi,A.Plugin=_,A.Underline=sT,A.Undo=Gr,A.Widget=ui,A.WidgetResize=Wn,A.WidgetToolbarRepository=qr,A.addListToDropdown=Tr,A.createDropdown=it,A.findOptimalInsertionRange=jr,A.isWidget=J,A.toWidget=Hn,A.viewToModelPositionOutsideModelElement=LE,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
