1var CKEDITOR5=(()=>{var _r=Object.defineProperty;var Gf=Object.getOwnPropertyDescriptor;var Zf=Object.getOwnPropertyNames;var Jf=Object.prototype.hasOwnProperty;var Yf=(e,t)=>{for(var i in t)_r(e,i,{get:t[i],enumerable:!0})},Qf=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Zf(t))!Jf.call(e,n)&&n!==i&&_r(e,n,{get:()=>t[n],enumerable:!(s=Gf(t,n))||s.enumerable});return e};var Xf=e=>Qf(_r({},"__esModule",{value:!0}),e);var $v={};Yf($v,{Bold:()=>lf,ClassicEditor:()=>yh,Essentials:()=>sf,Indent:()=>qf,Italic:()=>cf,Link:()=>_f,List:()=>zf,Paragraph:()=>Uf,SourceEditing:()=>$f,Subscript:()=>uf,Superscript:()=>df,deTranslations:()=>Kf});function Ea(e){return Number.isSafeInteger(e)&&e>=0}function sn(e){return e!=null&&typeof e!="function"&&Ea(e.length)}function nn(e){return e}function Tt(e){return e==="__proto__"}function rn(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function At(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function Qi(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(Qi).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function mi(e){if(Array.isArray(e))return e.map(At);if(typeof e=="symbol")return[e];e=Qi(e);let t=[],i=e.length;if(i===0)return t;let s=0,n="",r="",o=!1;for(e.charCodeAt(0)===46&&(t.push(""),s++);s<i;){let a=e[s];r?a==="\\"&&s+1<i?(s++,n+=e[s]):a===r?r="":n+=a:o?a==='"'||a==="'"?r=a:a==="]"?(o=!1,t.push(n),n=""):n+=a:a==="["?(o=!0,n&&(t.push(n),n="")):a==="."?n&&(t.push(n),n=""):n+=a,s++}return n&&t.push(n),t}function _e(e,t,i){if(e==null)return i;switch(typeof t){case"string":{if(Tt(t))return i;let s=e[t];return s===void 0?rn(t)?_e(e,mi(t),i):i:s}case"number":case"symbol":{typeof t=="number"&&(t=At(t));let s=e[t];return s===void 0?i:s}default:{if(Array.isArray(t))return em(e,t,i);if(Object.is(t?.valueOf(),-0)?t="-0":t=String(t),Tt(t))return i;let s=e[t];return s===void 0?i:s}}}function em(e,t,i){if(t.length===0)return i;let s=e;for(let n=0;n<t.length;n++){if(s==null||Tt(t[n]))return i;s=s[t[n]]}return s===void 0?i:s}function Ta(e){return function(t){return _e(t,e)}}function re(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function Fe(e){return e==null||typeof e!="object"&&typeof e!="function"}function lt(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function yr(e,t,i){return typeof i!="function"?yr(e,t,()=>{}):vr(e,t,function s(n,r,o,a,l,c){let u=i(n,r,o,a,l,c);return u!==void 0?!!u:vr(n,r,s,c)},new Map)}function vr(e,t,i,s){if(t===e)return!0;switch(typeof t){case"object":return tm(e,t,i,s);case"function":return Object.keys(t).length>0?vr(e,{...t},i,s):lt(e,t);default:return re(e)?typeof t=="string"?t==="":!0:lt(e,t)}}function tm(e,t,i,s){if(t==null)return!0;if(Array.isArray(t))return Aa(e,t,i,s);if(t instanceof Map)return im(e,t,i,s);if(t instanceof Set)return sm(e,t,i,s);let n=Object.keys(t);if(e==null||Fe(e))return n.length===0;if(n.length===0)return!0;if(s?.has(t))return s.get(t)===e;s?.set(t,e);try{for(let r=0;r<n.length;r++){let o=n[r];if(!Fe(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!i(e[o],t[o],o,e,t,s))return!1}return!0}finally{s?.delete(t)}}function im(e,t,i,s){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[n,r]of t.entries()){let o=e.get(n);if(i(o,r,n,e,t,s)===!1)return!1}return!0}function Aa(e,t,i,s){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let n=new Set;for(let r=0;r<t.length;r++){let o=t[r],a=!1;for(let l=0;l<e.length;l++){if(n.has(l))continue;let c=e[l],u=!1;if(i(c,o,r,e,t,s)&&(u=!0),u){n.add(l),a=!0;break}}if(!a)return!1}return!0}function sm(e,t,i,s){return t.size===0?!0:e instanceof Set?Aa([...e],[...t],i,s):!1}function on(e,t){return yr(e,t,()=>{})}function Ut(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ae(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var Wt="[object RegExp]",Ge="[object String]",ct="[object Number]",ut="[object Boolean]",Ze="[object Arguments]",qt="[object Symbol]",$t="[object Date]",Kt="[object Map]",jt="[object Set]",gi="[object Array]",Sa="[object Function]",Gt="[object ArrayBuffer]",Je="[object Object]",Pa="[object Error]",Zt="[object DataView]",pi="[object Uint8Array]",wi="[object Uint8ClampedArray]",bi="[object Uint16Array]",_i="[object Uint32Array]",La="[object BigUint64Array
1]",vi="[object Int8Array]",yi="[object Int16Array]",ki="[object Int32Array]",Va="[object BigInt64Array]",Ci="[object Float32Array]",Ii="[object Float64Array]";function xi(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ma(e,t){return St(e,void 0,e,new Map,t)}function St(e,t,i,s=new Map,n=void 0){let r=n?.(e,t,i,s);if(r!==void 0)return r;if(Fe(e))return e;if(s.has(e))return s.get(e);if(Array.isArray(e)){let o=new Array(e.length);s.set(e,o);for(let a=0;a<e.length;a++)o[a]=St(e[a],a,i,s,n);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){let o=new Map;s.set(e,o);for(let[a,l]of e)o.set(a,St(l,a,i,s,n));return o}if(e instanceof Set){let o=new Set;s.set(e,o);for(let a of e)o.add(St(a,void 0,i,s,n));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(xi(e)){let o=new(Object.getPrototypeOf(e)).constructor(e.length);s.set(e,o);for(let a=0;a<e.length;a++)o[a]=St(e[a],a,i,s,n);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return s.set(e,o),Se(o,e,i,s,n),o}if(typeof File<"u"&&e instanceof File){let o=new File([e],e.name,{type:e.type});return s.set(e,o),Se(o,e,i,s,n),o}if(typeof Blob<"u"&&e instanceof Blob){let o=new Blob([e],{type:e.type});return s.set(e,o),Se(o,e,i,s,n),o}if(e instanceof Error){let o=structuredClone(e);return s.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,o.constructor=e.constructor,Se(o,e,i,s,n),o}if(e instanceof Boolean){let o=new Boolean(e.valueOf());return s.set(e,o),Se(o,e,i,s,n),o}if(e instanceof Number){let o=new Number(e.valueOf());return s.set(e,o),Se(o,e,i,s,n),o}if(e instanceof String){let o=new String(e.valueOf());return s.set(e,o),Se(o,e,i,s,n),o}if(typeof e=="object"&&nm(e)){let o=Object.create(Object.getPrototypeOf(e));return s.set(e,o),Se(o,e,i,s,n),o}return e}function Se(e,t,i=e,s,n){let r=[...Object.keys(t),...Ut(t)];for(let o=0;o<r.length;o++){let a=r[o],l=Object.getOwnPropertyDescriptor(e,a);(l==null||l.writable)&&(e[a]=St(t[a],a,i,s,n))}}function nm(e){switch(Ae(e)){case Ze:case gi:case Gt:case Zt:case ut:case $t:case Ci:case Ii:case vi:case yi:case ki:case Kt:case ct:case Je:case Wt:case jt:case Ge:case qt:case pi:case wi:case bi:case _i:return!0;default:return!1}}function Ba(e){return St(e,void 0,e,new Map,void 0)}function Oa(e){return e=Ba(e),t=>on(t,e)}function dt(e,t){return Ma(e,(i,s,n,r)=>{let o=t?.(i,s,n,r);if(o!==void 0)return o;if(typeof e=="object"){if(Ae(e)===Je&&typeof e.constructor!="function"){let a={};return r.set(e,a),Se(a,e,n,r),a}switch(Object.prototype.toString.call(e)){case ct:case Ge:case ut:{let a=new e.constructor(e?.valueOf());return Se(a,e),a}case Ze:{let a={};return Se(a,e),a.length=e.length,a[Symbol.iterator]=e[Symbol.iterator],a}default:return}}})}function ie(e){return dt(e)}var rm=/^(?:0|[1-9]\d*)$/;function an(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return rm.test(e)}}function Xi(e){return e!==null&&typeof e=="object"&&Ae(e)==="[object Arguments]"}function Ra(e,t){let i;if(Array.isArray(t)?i=t:typeof t=="string"&&rn(t)&&e?.[t]==null?i=mi(t):i=[t],i.length===0)return!1;let s=e;for(let n=0;n<i.length;n++){let r=i[n];if((s==null||!Object.hasOwn(s,r))&&!((Array.isArray(s)||Xi(s))&&an(r)&&r<s.length))return!1;s=s[r]}return!0}function Fa(e,t){switch(typeof e){case"object":{Object.is(e?.valueOf(),-0)&&(e="-0");break}case"number":{e=At(e);break}}return t=ie(t),function(i){let s=_e(i,e);return s===void 0?Ra(i,e):t===void 0?s===void 0:on(s,t)}}function Da(e){if(e==null)return nn;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?Fa(e[0],e[1]):Oa(e);case"string":case"symbol":case"number":return Ta(e)}}function Jt(e){return typeof e=="object"&&e!==null}function Na(e){return Jt(e)&&sn(e)}function ln(e){return typeof e=="symbol"||e instanceof Symbol}function za(e){return ln(e)?NaN:Number(e)}function Ha(e){return e?(e=za(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function Ua(e){let t=Ha(e),i=t%1;return i?t-i:t}function cn(e){return typeof e=="string"||e instanceof String}var om=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,am=/^\w*$/;function Wa(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||ln(e)?!0:typeof e=="string"&&(am.test(e)||!om.test(e))||t!=null&&Object.hasOwn(t,e)}function qa(e){return Array.isArray(e)}var $a=(e,t,i)=>{let s=e[t];(!(Object.hasOwn(e,t)&<(s,i))||i===void 0&&!(t in e))&&(e[t]=i)};function Ka(e,t,i,s){if(e==null&&!re(e))return e;let n;Wa(t,e)?n=[t]:Array.isArray(t)?n=t:n=mi(t);let r=i(_e(e,n)),o=e;for(let a=0;a<n.length&&o!=null;a++){let l=At(n[a]);if(Tt(l))continue;let c;if(a===n.length-1)c=r;else{let u=o[l],d=s?.(u,l,e);c=d!==void 0?d:re(u)?u:an(n[a+1])?[]:{}}$a(o,l,c),o=o[l]}return e}function es(e,t,i){return Ka(e,t,()=>i,()=>{})}function ja(e,t,{signal:i,edges:s}={}){let n,r=null,o=s!=null&&s.includes("leading"),a=s==null||s.includes("trailing"),l=()=>{r!==null&&(e.apply(n,r),n=void 0,r=null)},c=()=>{a&&l(),m()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,c()},t)},h=()=>{u!==null&&(clearTimeout(u),u=null)},m=()=>{h(),n=void 0,r=null},g=()=>{l()},w=function(...T){if(i?.aborted)return;n=this,r=T;let E=u==null;d(),o&&E&&l()};return w.schedule=d,w.cancel=m,w.flush=g,i?.addEventListener("abort",m,{once:!0}),w}function Pe(e,t=0,i={}){typeof i!="object"&&(i={});let{leading:s=!1,trailing:n=!0,maxWait:r}=i,o=Array(2);
1s&&(o[0]="leading"),n&&(o[1]="trailing");let a,l=null,c=ja(function(...h){a=e.apply(this,h),l=null},t,{edges:o}),u=function(...h){return r!=null&&(l===null&&(l=Date.now()),Date.now()-l>=r)?(a=e.apply(this,h),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,h),a)},d=()=>(c.flush(),a);return u.cancel=c.cancel,u.flush=d,u}function Pt(e,t=0,i={}){let{leading:s=!0,trailing:n=!0}=i;return Pe(e,t,{leading:s,maxWait:t,trailing:n})}function kr(e){if(!e||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)==="[object Object]":!1}function un(e,t,i){return ts(e,t,void 0,void 0,void 0,void 0,i)}function ts(e,t,i,s,n,r,o){let a=o(e,t,i,s,n,r);if(a!==void 0)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return e===t;case"number":return e===t||Object.is(e,t);case"function":return e===t;case"object":return is(e,t,r,o)}return is(e,t,r,o)}function is(e,t,i,s){if(Object.is(e,t))return!0;let n=Ae(e),r=Ae(t);if(n===Ze&&(n=Je),r===Ze&&(r=Je),n!==r)return!1;switch(n){case Ge:return e.toString()===t.toString();case ct:{let l=e.valueOf(),c=t.valueOf();return lt(l,c)}case ut:case $t:case qt:return Object.is(e.valueOf(),t.valueOf());case Wt:return e.source===t.source&&e.flags===t.flags;case Sa:return e===t}i=i??new Map;let o=i.get(e),a=i.get(t);if(o!=null&&a!=null)return o===t;i.set(e,t),i.set(t,e);try{switch(n){case Kt:{if(e.size!==t.size)return!1;for(let[l,c]of e.entries())if(!t.has(l)||!ts(c,t.get(l),l,e,t,i,s))return!1;return!0}case jt:{if(e.size!==t.size)return!1;let l=Array.from(e.values()),c=Array.from(t.values());for(let u=0;u<l.length;u++){let d=l[u],h=c.findIndex(m=>ts(d,m,void 0,e,t,i,s));if(h===-1)return!1;c.splice(h,1)}return!0}case gi:case pi:case wi:case bi:case _i:case La:case vi:case yi:case ki:case Va:case Ci:case Ii:{if(typeof Buffer<"u"&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let l=0;l<e.length;l++)if(!ts(e[l],t[l],l,e,t,i,s))return!1;return!0}case Gt:return e.byteLength!==t.byteLength?!1:is(new Uint8Array(e),new Uint8Array(t),i,s);case Zt:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:is(new Uint8Array(e),new Uint8Array(t),i,s);case Pa:return e.name===t.name&&e.message===t.message;case Je:{if(!(is(e.constructor,t.constructor,i,s)||kr(e)&&kr(t)))return!1;let c=[...Object.keys(e),...Ut(e)],u=[...Object.keys(t),...Ut(t)];if(c.length!==u.length)return!1;for(let d=0;d<c.length;d++){let h=c[d],m=e[h];if(!Object.hasOwn(t,h))return!1;let g=t[h];if(!ts(m,g,h,e,t,i,s))return!1}return!0}default:return!1}}finally{i.delete(e),i.delete(t)}}function dn(){}function ss(e,t){return un(e,t,dn)}function Ga(e){return typeof Buffer<"u"&&Buffer.isBuffer(e)}function Za(e){let t=e?.constructor,i=typeof t=="function"?t.prototype:Object.prototype;return e===i}function Lt(e){return xi(e)}function Ja(e,t){if(e=Ua(e),e<1||!Number.isSafeInteger(e))return[];let i=new Array(e);for(let s=0;s<e;s++)i[s]=typeof t=="function"?t(s):s;return i}function Ya(e){if(e==null)return[];switch(typeof e){case"object":case"function":return sn(e)?cm(e):Za(e)?lm(e):hn(e);default:return hn(Object(e))}}function hn(e){let t=[];for(let i in e)t.push(i);return t}function lm(e){return hn(e).filter(i=>i!=="constructor")}function cm(e){let t=Ja(e.length,n=>`${n}`),i=new Set(t);Ga(e)&&(i.add("offset"),i.add("parent")),Lt(e)&&(i.add("buffer"),i.add("byteLength"),i.add("byteOffset"));let s=hn(e).filter(n=>!i.has(n));return Array.isArray(e)?[...t,...s]:[...t.filter(n=>Object.hasOwn(e,n)),...s]}function ns(e,...t){for(let i=0;i<t.length;i++)um(e,t[i]);return e}function um(e,t){let i=Ya(t);for(let s=0;s<i.length;s++){let n=i[s];(!(n in e)||!lt(e[n],t[n]))&&(e[n]=t[n])}}function Ir(e){if(Fe(e))return e;let t=Ae(e);if(!dm(e))return{};if(qa(e)){let s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Lt(e)){let s=e,n=s.constructor;return new n(s.buffer,s.byteOffset,s.length)}if(t===Gt)return new ArrayBuffer(e.byteLength);if(t===Zt){let s=e,n=s.buffer,r=s.byteOffset,o=s.byteLength,a=new ArrayBuffer(o),l=new Uint8Array(n,r,o);return new Uint8Array(a).set(l),new DataView(a)}if(t===ut||t===ct||t===Ge){let s=e.constructor,n=new s(e.valueOf());return t===Ge?fm(n,e):Cr(n,e),n}if(t===$t)return new Date(Number(e));if(t===Wt){let s=e,n=new RegExp(s.source,s.flags);return n.lastIndex=s.lastIndex,n}if(t===qt)return Object(Symbol.prototype.valueOf.call(e));if(t===Kt){let s=e,n=new Map;
1return s.forEach((r,o)=>{n.set(o,r)}),n}if(t===jt){let s=e,n=new Set;return s.forEach(r=>{n.add(r)}),n}if(t===Ze){let s=e,n={};return Cr(n,s),n.length=s.length,n[Symbol.iterator]=s[Symbol.iterator],n}let i={};return mm(i,e),Cr(i,e),hm(i,e),i}function dm(e){switch(Ae(e)){case Ze:case gi:case Gt:case Zt:case ut:case $t:case Ci:case Ii:case vi:case yi:case ki:case Kt:case ct:case Je:case Wt:case jt:case Ge:case qt:case pi:case wi:case bi:case _i:return!0;default:return!1}}function Cr(e,t){for(let i in t)Object.hasOwn(t,i)&&(e[i]=t[i])}function hm(e,t){let i=Object.getOwnPropertySymbols(t);for(let s=0;s<i.length;s++){let n=i[s];Object.prototype.propertyIsEnumerable.call(t,n)&&(e[n]=t[n])}}function fm(e,t){let i=t.valueOf().length;for(let s in t)Object.hasOwn(t,s)&&(Number.isNaN(Number(s))||Number(s)>=i)&&(e[s]=t[s])}function mm(e,t){let i=Object.getPrototypeOf(t);i!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,i)}function se(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){let i=e[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${i}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Qa(e,t){let i={},s=Object.keys(e);for(let n=0;n<s.length;n++){let r=s[n],o=e[r];i[r]=t(o,r,e)}return i}function xr(e,t=nn){return e==null?{}:Qa(e,Da(t))}function Xa(e){if(Fe(e))return e;if(Array.isArray(e)||xi(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let i=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new i(e);if(e instanceof RegExp){let s=new i(e);return s.lastIndex=e.lastIndex,s}if(e instanceof DataView)return new i(e.buffer.slice(0));if(e instanceof Error){let s;return e instanceof AggregateError?s=new i(e.errors,e.message,{cause:e.cause}):s=new i(e.message,{cause:e.cause}),s.stack=e.stack,Object.assign(s,e),s}if(typeof File<"u"&&e instanceof File)return new i([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e=="object"){let s=Object.create(t);return Object.assign(s,e)}return e}function el(e,...t){let i=t.slice(0,-1),s=t[t.length-1],n=e;for(let r=0;r<i.length;r++){let o=i[r];n=fn(n,o,s,new Map)}return n}function fn(e,t,i,s){if(Fe(e)&&(e=Object(e)),t==null||typeof t!="object")return e;if(s.has(t))return Xa(s.get(t));if(s.set(t,e),Array.isArray(t)){t=t.slice();for(let r=0;r<t.length;r++)t[r]=t[r]??void 0}let n=[...Object.keys(t),...Ut(t)];for(let r=0;r<n.length;r++){let o=n[r];if(Tt(o))continue;let a=t[o],l=e[o];if(Xi(a)&&(a={...a}),Xi(l)&&(l={...l}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=ie(a)),Array.isArray(a))if(Array.isArray(l)){let u=[],d=Reflect.ownKeys(l);for(let h=0;h<d.length;h++){let m=d[h];u[m]=l[m]}l=u}else if(Na(l)){let u=[];for(let d=0;d<l.length;d++)u[d]=l[d];l=u}else l=[];let c=i(l,a,o,e,t,s);c!==void 0?e[o]=c:Array.isArray(a)||Jt(l)&&Jt(a)&&(se(l)||se(a)||Lt(l)||Lt(a))?e[o]=fn(l,a,i,s):l==null&&se(a)?e[o]=fn({},a,i,s):l==null&&Lt(a)?e[o]=ie(a):(l===void 0||a!==void 0)&&(e[o]=a)}return e}function Ei(e,...t){return el(e,...t,dn)}function Yt(e){return typeof e=="function"}function he(e){return Jt(e)&&e.nodeType===1&&!se(e)}function Er(e,t){if(!Number.isInteger(e)||e<0)throw new Error("n must be a non-negative integer.");let i=0;return(...s)=>{if(++i>=e)return t(...s)}}function rs(e,t,i){return typeof i!="function"&&(i=()=>{}),un(e,t,(...s)=>{let n=i(...s);if(n!==void 0)return!!n;if(e instanceof Map&&t instanceof Map)return rs(Array.from(e),Array.from(t),Er(2,i));if(e instanceof Set&&t instanceof Set)return rs(Array.from(e),Array.from(t),Er(2,i))})}function tl(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function Tr(e){return tl(Qi(e))}var _;try{_={window,document}}catch{_={window:{},document:{}}}function gm(){try{return navigator.userAgent.toLowerCase()}catch{return""}}var Qt=gm(),I={isMac:bl(Qt),isWindows:pm(Qt),isGecko:wm(Qt),isSafari:bm(Qt),isiOS:_m(Qt),isAndroid:vm(Qt),isBlink:ym(Qt),get isMediaForcedColors(){return Cm()},get isMotionReduced(){return Im()},features:{isRegExpUnicodePropertySupported:km()}};function bl(e){return e.indexOf("macintosh")>-1}function pm(e){return e.indexOf("windows")>-1}function wm(e){return!!e.match(/gecko\/\d+/)}function bm(e){return e.indexOf(" applewebkit/")>-1&&e.indexOf("chrome")===-1}function _m(e){return!!e.match(/iphone|ipad/i)||bl(e)&&navigator.maxTouchPoints>0}function vm(e){return e.indexOf("android")>-1}function ym(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function km(){let e=!1;
1try{e="\u0107".search(new RegExp("[\\p{L}]","u"))===0}catch{}return e}function Cm(){return _.window.matchMedia?_.window.matchMedia("(forced-colors: active)").matches:!1}function Im(){return _.window.matchMedia?_.window.matchMedia("(prefers-reduced-motion)").matches:!1}function Or(e,t,i,s){i=i||function(a,l){return a===l};let n=Array.isArray(e)?e:Array.prototype.slice.call(e),r=Array.isArray(t)?t:Array.prototype.slice.call(t),o=xm(n,r,i);return s?Tm(o,r.length):Em(r,o)}function xm(e,t,i){let s=il(e,t,i);if(s===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};let n=il(sl(e,s),sl(t,s),i);return{firstIndex:s,lastIndexOld:e.length-n,lastIndexNew:t.length-n}}function il(e,t,i){for(let s=0;s<Math.max(e.length,t.length);s++)if(e[s]===void 0||t[s]===void 0||!i(e[s],t[s]))return s;return-1}function sl(e,t){return e.slice(t).reverse()}function Em(e,t){let i=[],{firstIndex:s,lastIndexOld:n,lastIndexNew:r}=t;return r-s>0&&i.push({index:s,type:"insert",values:e.slice(s,r)}),n-s>0&&i.push({index:s+(r-s),type:"delete",howMany:n-s}),i}function Tm(e,t){let{firstIndex:i,lastIndexOld:s,lastIndexNew:n}=e;if(i===-1)return Array(t).fill("equal");let r=[];return i>0&&(r=r.concat(Array(i).fill("equal"))),n-i>0&&(r=r.concat(Array(n-i).fill("insert"))),s-i>0&&(r=r.concat(Array(s-i).fill("delete"))),n<t&&(r=r.concat(Array(t-n).fill("equal"))),r}var Vt=function(e,t,i){i=i||function(w,T){return w===T};let s=e.length,n=t.length;if(s>200||n>200||s+n>300)return Vt.fastDiff(e,t,i,!0);let r,o;if(n<s){let w=e;e=t,t=w,r="delete",o="insert"}else r="insert",o="delete";let a=e.length,l=t.length,c=l-a,u={},d={};function h(w){let T=(d[w-1]!==void 0?d[w-1]:-1)+1,E=d[w+1]!==void 0?d[w+1]:-1,G=T>E?-1:1;u[w+G]&&(u[w]=u[w+G].slice(0)),u[w]||(u[w]=[]),u[w].push(T>E?r:o);let V=Math.max(T,E),ce=V-w;for(;ce<a&&V<l&&i(e[ce],t[V]);)ce++,V++,u[w].push("equal");return V}let m=0,g;do{for(g=-m;g<c;g++)d[g]=h(g);for(g=c+m;g>c;g--)d[g]=h(g);d[c]=h(c),m++}while(d[c]!==l);return u[c].slice(1)};Vt.fastDiff=Or;function nl(){return function e(){e.called=!0}}var Le=class{source;name;path;stop;off;return;constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=nl(),this.off=nl()}};var fe=new Array(256).fill("").map((e,t)=>("0"+t.toString(16)).slice(-2));function X(){let[e,t,i,s]=crypto.getRandomValues(new Uint32Array(4));return"e"+fe[e>>0&255]+fe[e>>8&255]+fe[e>>16&255]+fe[e>>24&255]+fe[t>>0&255]+fe[t>>8&255]+fe[t>>16&255]+fe[t>>24&255]+fe[i>>0&255]+fe[i>>8&255]+fe[i>>16&255]+fe[i>>24&255]+fe[s>>0&255]+fe[s>>8&255]+fe[s>>16&255]+fe[s>>24&255]}var me={get(e="normal"){return typeof e!="number"?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function Rr(e,t){let i=me.get(t.priority),s=0,n=e.length;for(;s<n;){let r=s+n>>1;me.get(e[r].priority)<i?n=r:s=r+1}e.splice(s,0,t)}var Am="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html",f=class _l extends Error{context;data;constructor(t,i,s,n){super(Sm(t,s,n)),this.name="CKEditorError",this.context=i,this.data=s,n&&(this.stack=n.stack)}is(t){return t==="CKEditorError"}static rethrowUnexpectedError(t,i){throw t.is&&t.is("CKEditorError")?t:new _l("unexpected-error",i,void 0,t)}};function N(e,t){console.warn(...kl(e,t))}function vl(e,t){console.error(...kl(e,t))}function yl(e){return` 2Read more: ${Am}#error-${e}`}function Sm(e,t,i){let s=new WeakSet,r=t?` ${JSON.stringify(t,(l,c)=>{if(typeof c=="object"&&c!==null){if(s.has(c))return`[object ${c.constructor.name}]`;s.add(c)}return c})}`:"",o=yl(e),a=i?` 3Original error: ${i.name}: ${i.message}`:"";return e+r+o+a}function kl(e,t){let i=yl(e);return t?[e,t,i]:[e,i]}var Pm="48.4.0",Cl=new Date(2026,5,2);if(globalThis.CKEDITOR_VERSION)throw new f("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=Pm;var Ti=Symbol("listeningTo"),Vr=Symbol("emitterId"),ht=Symbol("delegations"),Lm=F(Object);function F(e){if(!e)return Lm;class t extends e{on(s,n,r){this.listenTo(this,s,n,r)}once(s,n,r){let o=!1,a=(l,...c)=>{o||(o=!0,l.off(),n.call(this,l,...c))};this.listenTo(this,s,a,r)}off(s,n){this.stopListening(this,s,n)}listenTo(s,n,r,o={}){let a,l;this[Ti]||(this[Ti]={});let c=this[Ti];Ar(s)||Il(s);let u=Ar(s);(a=c[u])||(a=c[u]={emitter:s,callbacks:{}}),(l=a.callbacks[n])||(l=a.callbacks[n]=[]),l.push(r),Rm(this,s,n,r,o)}stopListening(s,n,r){let o=this[Ti],a=s&&Ar(s),l=o&&a?o[a]:void 0,c=l&&n?l.callbacks[n]:void 0;if(!(!o||s&&!l||n&&!c))if(r)Sr(this,s,n,r),c.indexOf(r)!==-1&&(c.length===1?delete l.callbacks[n]:Sr(this,s,n,r));else if(c){for(;r=c.pop();)Sr(this,s,n,r);delete l.callbacks[n]}else if(l){for(n in l.callbacks)this.stopListening(s,n);delete o[a]}else{for(a in o)this.stopListening(o[a].emitter);delete this[Ti]}}
3fire(s,...n){try{let r=s instanceof Le?s:new Le(this,s),o=r.name,a=Om(this,o);if(r.path.push(this),a){a=a.slice();for(let c=0;c<a.length;c++){let u=a[c].callback;if(u.call(this,r,...n),r.off.called&&(delete r.off.called,this._removeEventListener(o,u)),r.stop.called)break}}let l=this[ht];if(l){let c=l.get(o),u=l.get("*");c&&rl(c,r,n),u&&rl(u,r,n)}return r.return}catch(r){f.rethrowUnexpectedError(r,this)}}delegate(...s){return{to:(n,r)=>{this[ht]||(this[ht]=new Map),s.forEach(o=>{let a=this[ht].get(o);a?a.set(n,r):this[ht].set(o,new Map([[n,r]]))})}}}stopDelegating(s,n){if(this[ht])if(!s)this[ht].clear();else if(!n)this[ht].delete(s);else{let r=this[ht].get(s);r&&r.delete(n)}}_addEventListener(s,n,r){Bm(this,s);let o=Mr(this,s),a={callback:n,priority:me.get(r.priority)};for(let l of o)Rr(l,a)}_removeEventListener(s,n){let r=Mr(this,s);for(let o of r)for(let a=0;a<o.length;a++)o[a].callback==n&&(o.splice(a,1),a--)}}return t}function Vm(e,t){let i=e[Ti];return i&&i[t]?i[t].emitter:null}function Il(e,t){e[Vr]||(e[Vr]=t||X())}function Ar(e){return e[Vr]}function xl(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function Mm(){return{callbacks:[],childEvents:[]}}function Bm(e,t){let i=xl(e);if(i[t])return;let s=t,n=null,r=[];for(;s!==""&&!i[s];)i[s]=Mm(),r.push(i[s]),n&&i[s].childEvents.push(n),n=s,s=s.substr(0,s.lastIndexOf(":"));if(s!==""){for(let o of r)o.callbacks=i[s].callbacks.slice();i[s].childEvents.push(n)}}function Mr(e,t){let i=xl(e)[t];if(!i)return[];let s=[i.callbacks];for(let n=0;n<i.childEvents.length;n++){let r=Mr(e,i.childEvents[n]);s=s.concat(r)}return s}function Om(e,t){if(!e._events)return null;let i=t;do{let s=e._events[i];if(s&&s.callbacks&&s.callbacks.length)return s.callbacks;let n=i.lastIndexOf(":");i=n>-1?i.substring(0,n):""}while(i);return null}function rl(e,t,i){for(let[s,n]of e){n?typeof n=="function"&&(n=n(t.name)):n=t.name;let r=new Le(t.source,n);r.path=[...t.path],s.fire(r,...i)}}function Rm(e,t,i,s,n){t._addEventListener?t._addEventListener(i,s,n):e._addEventListener.call(t,i,s,n)}function Sr(e,t,i,s){t._removeEventListener?t._removeEventListener(i,s):e._removeEventListener.call(t,i,s)}var os=Symbol("observableProperties"),ls=Symbol("boundObservables"),as=Symbol("boundProperties"),Xt=Symbol("decoratedMethods"),ol=Symbol("decoratedOriginal"),Fm=z(F());function z(e){if(!e)return Fm;class t extends e{set(s,n){if(re(s)){Object.keys(s).forEach(o=>{this.set(o,s[o])},this);return}Pr(this);let r=this[os];if(s in this&&!r.has(s))throw new f("observable-set-cannot-override",this);Object.defineProperty(this,s,{enumerable:!0,configurable:!0,get(){return r.get(s)},set(o){let a=r.get(s),l=this.fire(`set:${s}`,s,o,a);l===void 0&&(l=o),(a!==l||!r.has(s))&&(r.set(s,l),this.fire(`change:${s}`,s,l,a))}}),this[s]=n}bind(...s){if(!s.length||!al(s))throw new f("observable-bind-wrong-properties",this);if(new Set(s).size!==s.length)throw new f("observable-bind-duplicate-properties",this);Pr(this);let n=this[as];s.forEach(o=>{if(n.has(o))throw new f("observable-bind-rebind",this)});let r=new Map;return s.forEach(o=>{let a={property:o,to:[]};n.set(o,a),r.set(o,a)}),{to:Dm,toMany:Nm,_observable:this,_bindProperties:s,_to:[],_bindings:r}}unbind(...s){if(!this[os])return;let n=this[as],r=this[ls];if(s.length){if(!al(s))throw new f("observable-unbind-wrong-properties",this);s.forEach(o=>{let a=n.get(o);a&&(a.to.forEach(([l,c])=>{let u=r.get(l),d=u[c];d.delete(a),d.size||delete u[c],Object.keys(u).length||(r.delete(l),this.stopListening(l,"change"))}),n.delete(o))})}else r.forEach((o,a)=>{this.stopListening(a,"change")}),r.clear(),n.clear()}decorate(s){Pr(this);let n=this[s];if(!n)throw new f("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:s});this.on(s,(r,o)=>{r.return=n.apply(this,o)}),this[s]=function(...r){return this.fire(s,r)},this[s][ol]=n,this[Xt]||(this[Xt]=[]),this[Xt].push(s)}stopListening(s,n,r){if(!s&&this[Xt]){for(let o of this[Xt])this[o]=this[o][ol];delete this[Xt]}super.stopListening(s,n,r)}[os];[Xt];[as];[ls]}return t}function Pr(e){e[os]||(Object.defineProperty(e,os,{value:new Map}),Object.defineProperty(e,ls,{value:new Map}),Object.defineProperty(e,as,{value:new Map}))}function Dm(...e){let t=Hm(...e),i=Array.from(this._bindings.keys()),s=i.length;if(!t.callback&&t.to.length>1)throw new f("observable-bind-to-no-callback",this);if(s>1&&t.callback)throw new f("observable-bind-to-extra-callback",this);t.to.forEach(n=>{if(n.properties.length&&n.properties.length!==s)throw new f("observable-bind-to-properties-length",this);n.properties.length||(n.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),qm(this._observable,this._to),Wm(this),this._bindProperties.forEac
3h(n=>{El(this._observable,n)})}function Nm(e,t,i){if(this._bindings.size>1)throw new f("observable-bind-to-many-not-one-binding",this);this.to(...zm(e,t),i)}function zm(e,t){let i=e.map(s=>[s,t]);return Array.prototype.concat.apply([],i)}function al(e){return e.every(t=>typeof t=="string")}function Hm(...e){if(!e.length)throw new f("observable-bind-to-parse-error",null);let t={to:[]},i;return typeof e[e.length-1]=="function"&&(t.callback=e.pop()),e.forEach(s=>{if(typeof s=="string")i.properties.push(s);else if(typeof s=="object")i={observable:s,properties:[]},t.to.push(i);else throw new f("observable-bind-to-parse-error",null)}),t}function Um(e,t,i,s){let n=e[ls],r=n.get(i),o=r||{};o[s]||(o[s]=new Set),o[s].add(t),r||n.set(i,o)}function Wm(e){let t;e._bindings.forEach((i,s)=>{e._to.forEach(n=>{t=n.properties[i.callback?0:e._bindProperties.indexOf(s)],i.to.push([n.observable,t]),Um(e._observable,i,n.observable,t)})})}function El(e,t){let i=e[as].get(t),s;i.callback?s=i.callback.apply(e,i.to.map(n=>n[0][n[1]])):(s=i.to[0],s=s[0][s[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=s:e.set(t,s)}function qm(e,t){t.forEach(i=>{let s=e[ls],n;s.get(i.observable)||e.listenTo(i.observable,"change",(r,o)=>{n=s.get(i.observable)[o],n&&n.forEach(a=>{El(e,a.property)})})})}var wn=class{_replacedElements;constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach(({element:e,newElement:t})=>{e.style.display="",t&&t.remove()}),this._replacedElements=[]}};function cs(e){let t=0;for(let i of e)t++;return t}function ne(e,t){let i=Math.min(e.length,t.length);for(let s=0;s<i;s++)if(e[s]!=t[s])return s;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}function ve(e){return!!(e&&e[Symbol.iterator])}function ue(e,t,i={},s=[]){let n=i&&i.xmlns,r=n?e.createElementNS(n,t):e.createElement(t);for(let o in i)r.setAttribute(o,i[o]);(cn(s)||!ve(s))&&(s=[s]);for(let o of s)cn(o)&&(o=e.createTextNode(o)),r.appendChild(o);return r}var Fr=class{_config;constructor(e,t){this._config=Object.create(null),t&&this.define(ll(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(let e of Object.keys(this._config))yield e}_setToTarget(e,t,i,s=!1){if(se(t)){this._setObjectToTarget(e,t,s);return}let n=t.split(".");t=n.pop();for(let r of n)se(e[r])||(e[r]=Object.create(null)),e=e[r];if(se(i)){se(e[t])||(e[t]=Object.create(null)),e=e[t],this._setObjectToTarget(e,i,s);return}s&&typeof e[t]<"u"||(e[t]=i)}_getFromSource(e,t){let i=t.split(".");t=i.pop();for(let s of i){if(!se(e[s])){e=null;break}e=e[s]}return e?ll(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(s=>{this._setToTarget(e,s,t[s],i)})}};function ll(e){return dt(e,$m)}function $m(e){return he(e)||typeof e=="function"?e:void 0}function Qe(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}function pn(e){let t=Object.prototype.toString.apply(e);return t=="[object Window]"||t=="[object global]"}var Km=ge(F()),jm=F();function ge(e){if(!e)return Km;class t extends e{listenTo(s,n,r,o={}){if(Qe(s)||pn(s)||s instanceof _.window.EventTarget){let a={capture:!!o.useCapture,passive:!!o.usePassive},l=this._getProxyEmitter(s,a)||new Gm(s,a);this.listenTo(l,n,r,o)}else super.listenTo(s,n,r,o)}stopListening(s,n,r){if(Qe(s)||pn(s)||s instanceof _.window.EventTarget){let o=this._getAllProxyEmitters(s);for(let a of o)this.stopListening(a,n,r)}else super.stopListening(s,n,r)}_getProxyEmitter(s,n){return Vm(this,Tl(s,n))}_getAllProxyEmitters(s){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(n=>this._getProxyEmitter(s,n)).filter(n=>!!n)}}return t}var Gm=class extends jm{_domNode;_options;
3constructor(e,t){super(),Il(this,Tl(e,t)),this._domNode=e,this._options=t}_domListeners;attach(e){if(this._domListeners&&this._domListeners[e])return;let 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),F().prototype._addEventListener.call(this,e,t,i)}_removeEventListener(e,t){F().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){let t=i=>{this.fire(e,i)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}};function Zm(e){return e["data-ck-expando"]||(e["data-ck-expando"]=X())}function Tl(e,t){let i=Zm(e);for(let s of Object.keys(t).sort())t[s]&&(i+="-"+s);return i}function Dr(e){let t=[],i=e;for(;i&&i.nodeType!=Node.DOCUMENT_NODE;)t.unshift(i),i=i.parentNode;return t}function Al(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function Nr(e){let t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}function bn(e){if(!e.target)return null;let t=e.target.ownerDocument,i=e.clientX,s=e.clientY,n=null;return t.caretRangeFromPoint&&t.caretRangeFromPoint(i,s)?n=t.caretRangeFromPoint(i,s):e.rangeParent&&(n=t.createRange(),n.setStart(e.rangeParent,e.rangeOffset),n.collapse(!0)),n}function Sl(e){return!e||!e.parentNode||e.offsetParent===_.document.body?null:e.offsetParent}function q(e){return Object.prototype.toString.call(e)=="[object Text]"}function us(e){return Object.prototype.toString.apply(e)=="[object Range]"}var Pl=["top","right","bottom","left","width","height"],Jm=new Set(["relative","absolute","fixed","sticky"]),O=class Ye{top;right;bottom;left;width;height;_source;constructor(t){let i=us(t);if(Object.defineProperty(this,"_source",{value:t._source||t,writable:!0,enumerable:!1}),Br(t)||i)if(i){let s=Ye.getDomRangeRects(t);mn(this,Ye.getBoundingRect(s))}else mn(this,t.getBoundingClientRect());else if(pn(t)){let{innerWidth:s,innerHeight:n}=t;mn(this,{top:0,right:s,bottom:n,left:0,width:s,height:n})}else mn(this,t)}clone(){return new Ye(this)}moveTo(t,i){return this.top=i,this.right=t+this.width,this.bottom=i+this.height,this.left=t,this}moveBy(t,i){return this.top+=i,this.right+=t,this.left+=t,this.bottom+=i,this}getIntersection(t){let i={top:Math.max(this.top,t.top),right:Math.min(this.right,t.right),bottom:Math.min(this.bottom,t.bottom),left:Math.max(this.left,t.left),width:0,height:0};if(i.width=i.right-i.left,i.height=i.bottom-i.top,i.width<0||i.height<0)return null;{let s=new Ye(i);return s._source=this._source,s}}getIntersectionArea(t){let i=this.getIntersection(t);return i?i.getArea():0}getArea(){return this.width*this.height}getVisible(){let t=this._source,i=this.clone();if(cl(t))return i;let s=t,n=t.parentNode||t.commonAncestorContainer,r;for(;n&&!cl(n);){let o=Ym(n)==="visible";if(ul(s)&&(r=s),o||r&&Ll(r)==="absolute"&&!ul(n)){s=n,n=n.parentNode;continue}let a=new Ye(n),l=i.getIntersection(a);if(l)l.getArea()<i.getArea()&&(i=l);else return null;s=n,n=n.parentNode}return i}isEqual(t){for(let i of Pl)if(this[i]!==t[i])return!1;return!0}contains(t){let i=this.getIntersection(t);return!!(i&&i.isEqual(t))}toAbsoluteRect(){let{scrollX:t,scrollY:i}=_.window,s=this.clone().moveBy(t,i);if(Br(s._source)){let n=Sl(s._source);n&&Qm(s,n)}return s}excludeScrollbarsAndBorders(){let t=this._source,i,s,n;if(pn(t))i=t.innerWidth-t.document.documentElement.clientWidth,s=t.innerHeight-t.document.documentElement.clientHeight,n=t.getComputedStyle(t.document.documentElement).direction;else{let r=Nr(t);i=t.offsetWidth-t.clientWidth-r.left-r.right,s=t.offsetHeight-t.clientHeight-r.top-r.bottom,n=t.ownerDocument.defaultView.getComputedStyle(t).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-=i,n==="ltr"?this.right-=i:this.left+=i,this.height-=s,this.bottom-=s,this}static getDomRangeRects(t){let i=[],s=Array.from(t.getClientRects());if(s.length)for(let n of s){let r=new Ye(n);r._source=t,i.push(r)}else{let n=t.startContainer;q(n)&&(n=n.parentNode);let r=new Ye(n.getBoundingClientRect());r.right=r.left,r.width=0,i.push(r)}return i}static getDomElementRects(t){return Array.from(t.getClientRects()).map(i=>{let s=new Ye(i);return s._source=t,s})}
3static getBoundingRect(t){let i={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0},s=0;for(let n of t)s++,i.left=Math.min(i.left,n.left),i.top=Math.min(i.top,n.top),i.right=Math.max(i.right,n.right),i.bottom=Math.max(i.bottom,n.bottom);return s==0?null:(i.width=i.right-i.left,i.height=i.bottom-i.top,new Ye(i))}};function mn(e,t){for(let i of Pl)e[i]=t[i]}function cl(e){return Br(e)?e===e.ownerDocument.body:!1}function Br(e){return e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.getBoundingClientRect=="function"}function Ll(e){return e.ownerDocument.defaultView.getComputedStyle(e).position}function Ym(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).overflow:"visible"}function ul(e){return e instanceof HTMLElement&&Jm.has(Ll(e))}function Qm(e,t){let i=new O(t),s=Nr(t),n=0,r=0;n-=i.left,r-=i.top,n+=t.scrollLeft,r+=t.scrollTop,n-=s.left,r-=s.top,e.moveBy(n,r)}var ds=class Q{_element;_callback;static _observerInstance=null;static _elementCallbacks=null;constructor(t,i){Q._observerInstance||Q._createObserver(),this._element=t,this._callback=i,Q._addElementCallback(t,i),Q._observerInstance.observe(t)}get element(){return this._element}destroy(){Q._deleteElementCallback(this._element,this._callback)}static _addElementCallback(t,i){Q._elementCallbacks||(Q._elementCallbacks=new Map);let s=Q._elementCallbacks.get(t);s||(s=new Set,Q._elementCallbacks.set(t,s)),s.add(i)}static _deleteElementCallback(t,i){let s=Q._getElementCallbacks(t);s&&(s.delete(i),s.size||(Q._elementCallbacks.delete(t),Q._observerInstance.unobserve(t))),Q._elementCallbacks&&!Q._elementCallbacks.size&&(Q._observerInstance=null,Q._elementCallbacks=null)}static _getElementCallbacks(t){return Q._elementCallbacks?Q._elementCallbacks.get(t):null}static _createObserver(){Q._observerInstance=new _.window.ResizeObserver(t=>{for(let i of t){let s=Q._getElementCallbacks(i.target);if(s)for(let n of s)n(i)}})}};function zr(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function ei(e){return t=>t+e}function ti(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Hr(e,t,i){e.insertBefore(i,e.childNodes[t]||null)}function Ai(e){return e&&e.nodeType===Node.COMMENT_NODE}function Vl(e){try{_.document.createAttribute(e)}catch{return!1}return!0}function Xe(e){return e?q(e)?Xe(e.parentElement):e.getClientRects?!!e.getClientRects().length:!1:!1}function _n({element:e,target:t,positions:i,limiter:s,fitInViewport:n,viewportOffsetConfig:r}){Yt(t)&&(t=t()),Yt(s)&&(s=s());let o=Sl(e),a=Ur(r),l=new O(e),c=dl(t,a),u;if(!c||!a.getIntersection(c))return null;let d={targetRect:c,elementRect:l,positionedElementAncestor:o,viewportRect:a};if(!s&&!n)u=new Ml(i[0],d);else{if(s){let h=dl(s,a);h&&(d.limiterRect=h)}u=Xm(i,d)}return u}function dl(e,t){let i=new O(e).getVisible();return i?i.getIntersection(t):null}function Ur(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);let t=new O(_.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t.left+=e.left,t.right-=e.right,t.width-=e.left+e.right,t}function Xm(e,t){let{elementRect:i}=t,s=i.getArea(),n=e.map(a=>new Ml(a,t)).filter(a=>!!a.name),r=0,o=null;for(let a of n){let{limiterIntersectionArea:l,viewportIntersectionArea:c}=a;if(l===s)return a;let u=c**2+l**2;u>r&&(r=u,o=a)}return o}var Ml=class{name;config;_positioningFunctionCoordinates;_options;_cachedRect;_cachedAbsoluteRect;constructor(e,t){let i=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!i)return;let{left:s,top:n,name:r,config:o}=i;this.name=r,this.config=o,this._positioningFunctionCoordinates={left:s,top:n},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){let e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect?this._cachedRect:(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top),this._cachedRect)}get _absoluteRect(){return this._cachedAbsoluteRect?this._cachedAbsoluteRect:(this._cachedAbsoluteRect=this._rect.toAbsoluteRect(),this._cachedAbsoluteRect)}};function Wr(e){let t=e.parentNode;t&&t.removeChild(e)}
3function hs(){let e=_.window.visualViewport;return!e||!(I.isiOS||I.isSafari)?{left:0,top:0}:{left:Math.max(Math.round(e.offsetLeft),0),top:Math.max(Math.round(e.offsetTop),0)}}function Bl({target:e,viewportOffset:t=0,ancestorOffset:i=0,alignToTop:s,forceScroll:n}){let r=qr(e),o=r,a=null;for(t=ig(t);o;){let l;o==r?l=hl(e):l=hl(a),tg({parent:l,getRect:()=>Lr(e,o),alignToTop:s,ancestorOffset:i,forceScroll:n});let c=Lr(e,o),u=Lr(l,o);if(c.height>u.height){let d=c.getIntersection(u);d&&(c=d)}if(eg({window:o,rect:c,viewportOffset:t,alignToTop:s,forceScroll:n}),o.parent!=o){if(a=o.frameElement,o=o.parent,!a)return}else o=null}}function eg({window:e,rect:t,alignToTop:i,forceScroll:s,viewportOffset:n}){let r=t.clone().moveBy(0,n.bottom),o=t.clone().moveBy(0,-n.top),a=new O(e).excludeScrollbarsAndBorders(),l=[o,r],c=i&&s,u=l.every(w=>a.contains(w)),{scrollX:d,scrollY:h}=e,m=d,g=h;c?h-=a.top-t.top+n.top:u||(Rl(o,a)?h-=a.top-t.top+n.top:Ol(r,a)&&(i?h+=t.top-a.top-n.top:h+=t.bottom-a.bottom+n.bottom)),u||(Fl(t,a)?d-=a.left-t.left+n.left:Dl(t,a)&&(d+=t.right-a.right+n.right)),(d!=m||h!==g)&&e.scrollTo(d,h)}function tg({parent:e,getRect:t,alignToTop:i,forceScroll:s,ancestorOffset:n=0,limiterElement:r}){let o=qr(e),a=i&&s,l,c,u,d=r||o.document.body;for(;e!=d;)c=t(),l=new O(e).excludeScrollbarsAndBorders(),u=l.contains(c),a?e.scrollTop-=l.top-c.top+n:u||(Rl(c,l)?e.scrollTop-=l.top-c.top+n:Ol(c,l)&&(i?e.scrollTop+=c.top-l.top-n:e.scrollTop+=c.bottom-l.bottom+n)),u||(Fl(c,l)?e.scrollLeft-=l.left-c.left+n:Dl(c,l)&&(e.scrollLeft+=c.right-l.right+n)),e=e.parentNode}function Ol(e,t){return e.bottom>t.bottom}function Rl(e,t){return e.top<t.top}function Fl(e,t){return e.left<t.left}function Dl(e,t){return e.right>t.right}function qr(e){return us(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function hl(e){if(us(e)){let t=e.commonAncestorContainer;return q(t)&&(t=t.parentNode),t}else return e.parentNode}function Lr(e,t){let i=qr(e),s=new O(e);if(i===t)return s;{let n=i;for(;n!=t;){let r=n.frameElement,o=new O(r).excludeScrollbarsAndBorders();s.moveBy(o.left,o.top),n=n.parent}}return s}function ig(e){return typeof e=="number"?{top:e,bottom:e,left:e,right:e}:e}var sg={ctrl:"\u2303",cmd:"\u2318",alt:"\u2325",shift:"\u21E7"},ng={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},fl={37:"\u2190",38:"\u2191",39:"\u2192",40:"\u2193",9:"\u21E5",33:"Page Up",34:"Page Down"},L=ag(),rg=Object.fromEntries(Object.entries(L).map(([e,t])=>{let i;return t in fl?i=fl[t]:i=e.charAt(0).toUpperCase()+e.slice(1),[t,i]}));function ft(e){let t;if(typeof e=="string"){if(t=L[e.toLowerCase()],!t)throw new f("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?L.alt:0)+(e.ctrlKey?L.ctrl:0)+(e.shiftKey?L.shift:0)+(e.metaKey?L.cmd:0);return t}function fs(e){return typeof e=="string"&&(e=lg(e)),e.map(t=>typeof t=="string"?og(t):t).reduce((t,i)=>i+t,0)}function ms(e,t){let i=fs(e),s=t?t==="Mac":I.isMac||I.isiOS;return Object.entries(s?sg:ng).reduce((n,[r,o])=>((i&L[r])!=0&&(i&=~L[r],n+=o),n),"")+(i?rg[i]:"")}function Nl(e){return e==L.arrowright||e==L.arrowleft||e==L.arrowup||e==L.arrowdown}function vn(e,t){let i=t==="ltr";switch(e){case L.arrowleft:return i?"left":"right";case L.arrowright:return i?"right":"left";case L.arrowup:return"up";case L.arrowdown:return"down"}}function og(e){if(e.endsWith("!"))return ft(e.slice(0,-1));let t=ft(e);return(I.isMac||I.isiOS)&&t==L.ctrl?L.cmd:t}function zl(e,t){let i=vn(e,t);return i==="down"||i==="right"}function ag(){let e={pageup:33,pagedown:34,end:35,home:36,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 t=65;t<=90;t++){let i=String.fromCharCode(t);e[i.toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return Object.assign(e,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),e}function lg(e){return e.split("+").map(t=>t.trim())}var cg=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig","ur","urd"];function ml(e){return cg.includes(e)?"rtl":"ltr"}function U(e){return Array.isArray(e)?e:[e]}_.window.CKEDITOR_TRANSLATIONS||(_.window.CKEDITOR_TRANSLATIONS={});
3function ug(e,t,i=1,s){if(typeof i!="number")throw new f("translation-service-quantity-not-a-number",null,{quantity:i});let n=s||_.window.CKEDITOR_TRANSLATIONS,r=fg(n);r===1&&(e=Object.keys(n)[0]);let o=t.id||t.string;if(r===0||!hg(e,o,n))return i!==1?t.plural:t.string;let a=n[e].dictionary,l=n[e].getPluralForm||(u=>u===1?0:1),c=a[o];return typeof c=="string"?c:c[Number(l(i))]}function dg(e){return Array.isArray(e)?e.reduce((t,i)=>Ei(t,i)):e}function hg(e,t,i){return!!i[e]&&!!i[e].dictionary[t]}function fg(e){return Object.keys(e).length}var Hl=class{uiLanguage;uiLanguageDirection;contentLanguage;contentLanguageDirection;t;translations;constructor({uiLanguage:e="en",contentLanguage:t,translations:i}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=ml(this.uiLanguage),this.contentLanguageDirection=ml(this.contentLanguage),this.translations=dg(i),this.t=(s,n)=>this._t(s,n)}_t(e,t=[]){t=U(t),typeof e=="string"&&(e={string:e});let i=e.plural?t[0]:1;return mg(ug(this.uiLanguage,e,i,this.translations),t)}};function mg(e,t){return e.replace(/%(\d+)/g,(i,s)=>s<t.length?t[s]:i)}var gg=F(),pe=class extends gg{_items;_itemMap;_idProperty;_bindToCollection;_bindToExternalToInternalMap;_bindToInternalToExternalMap;_skippedIndexesFromExternal;constructor(e={},t={}){super();let i=ve(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(let 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 f("collection-add-item-invalid-index",this);let i=0;for(let s of e){let n=this._getItemIdBeforeAdding(s),r=t+i;this._items.splice(r,0,s),this._itemMap.set(n,s),this.fire("add",s,r),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 f("collection-get-invalid-arg",this);return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{let t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return typeof e=="string"?t=this._itemMap.get(e):t=e,t?this._items.indexOf(t):-1}remove(e){let[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}forEach(e,t){this._items.forEach(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);let 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 f("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){let t=this._bindToCollection,i=(s,n,r)=>{let o=t._bindToCollection==this,a=t._bindToInternalToExternalMap.get(n);if(o&&a)this._bindToExternalToInternalMap.set(n,a),this._bindToInternalToExternalMap.set(a,n);else{let l=e(n);if(!l){this._skippedIndexesFromExternal.push(r);return}let c=r;for(let u of this._skippedIndexesFromExternal)r>u&&c--;for(let u of t._skippedIndexesFromExternal)c>=u&&c++;this._bindToExternalToInternalMap.set(n,l),this._bindToInternalToExternalMap.set(l,n),this.add(l,c);for(let u=0;u<t._skippedIndexesFromExternal.length;u++)c<=t._skippedIndexesFromExternal[u]&&t._skippedIndexesFromExternal[u]++}};for(let s of t)i(null,s,t.getIndex(s));this.listenTo(t,"add",i),this.listenTo(t,"remove",(s,n,r)=>{let o=this._bindToExternalToInternalMap.get(n);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((a,l)=>(r<l&&a.push(l-1),r>l&&a.push(l),a),[])})}_getItemIdBeforeAdding(e){let t=this._idProperty,i;
3if(t in e){if(i=e[t],typeof i!="string")throw new f("collection-add-invalid-id",this);if(this.get(i))throw new f("collection-add-item-already-exists",this)}else e[t]=i=X();return i}_remove(e){let t,i,s,n,r=this._idProperty;if(typeof e=="string"?(i=e,s=this._itemMap.get(i),n=!s,s&&(t=this._items.indexOf(s))):typeof e=="number"?(t=e,s=this._items[t],n=!s,s&&(i=s[r])):(s=e,i=s[r],t=this._items.indexOf(s),n=t==-1||!this._itemMap.get(i)),n)throw new f("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);let o=this._bindToInternalToExternalMap.get(s);return this._bindToInternalToExternalMap.delete(s),this._bindToExternalToInternalMap.delete(o),this.fire("remove",s,t),[s,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}};function ye(e){let t=e.next();return t.done?null:t.value}var pg=ge(z()),oe=class extends pg{_elements=new Set;_externalViews=new Set;_blurTimeout=null;constructor(){super(),this.set("isFocused",!1),this.set("focusedElement",null)}get elements(){return Array.from(this._elements.values())}get externalViews(){return Array.from(this._externalViews.values())}add(e){if(pl(e))this._addElement(e);else if(gl(e))this._addView(e);else{if(!e.element)throw new f("focustracker-add-view-missing-element",{focusTracker:this,view:e});this._addElement(e.element)}}remove(e){pl(e)?this._removeElement(e):gl(e)?this._removeView(e):this._removeElement(e.element)}_addElement(e){if(this._elements.has(e))throw new f("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>{let t=this.externalViews.find(i=>wg(e,i));t?this._focus(t.element):this._focus(e)},{useCapture:!0}),this.listenTo(e,"blur",()=>{this._blur()},{useCapture:!0}),this._elements.add(e)}_removeElement(e){this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e)),e===this.focusedElement&&this._blur()}_addView(e){e.element&&this._addElement(e.element),this.listenTo(e.focusTracker,"change:focusedElement",()=>{e.focusTracker.focusedElement?e.element&&this._focus(e.element):this._blur()}),this._externalViews.add(e)}_removeView(e){e.element&&this._removeElement(e.element),this.stopListening(e.focusTracker),this._externalViews.delete(e)}destroy(){this.stopListening(),this._elements.clear(),this._externalViews.clear(),this.isFocused=!1,this.focusedElement=null}_focus(e){this._clearBlurTimeout(),this.focusedElement=e,this.isFocused=!0}_blur(){this.elements.find(e=>e.contains(document.activeElement))||this.externalViews.find(e=>e.focusTracker.isFocused&&!e.focusTracker._blurTimeout)||(this._clearBlurTimeout(),this._blurTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0))}_clearBlurTimeout(){clearTimeout(this._blurTimeout),this._blurTimeout=null}};function gl(e){return"focusTracker"in e&&e.focusTracker instanceof oe}function pl(e){return he(e)}function wg(e,t){return wl(e,t)?!0:!!t.focusTracker.externalViews.find(i=>wl(e,i))}function wl(e,t){return!!t.element&&t.element.contains(document.activeElement)&&e.contains(t.element)}var we=class{_listener;constructor(){this._listener=new(ge())}listenTo(e){this._listener.listenTo(e,"keydown",(t,i)=>{this._listener.fire("_keydown:"+ft(i),i)})}set(e,t,i={}){let s=fs(e),n=i.priority;this._listener.listenTo(this._listener,"_keydown:"+s,(r,o)=>{i.filter&&!i.filter(o)||(t(o,()=>{o.preventDefault(),o.stopPropagation(),r.stop()}),r.return=!0)},{priority:n})}press(e){return!!this._listener.fire("_keydown:"+ft(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}};function bg(e){let t=new Map;for(let i in e)t.set(i,e[i]);return t}function De(e){return ve(e)?new Map(e):bg(e)}function $r(e,t,i){let s=e.length,n=t.length;for(let r=s-1;r>=i;r--)e[r+n]=e[r];for(let r=0;r<n;r++)e[i+r]=t[r]}function gs(e,t){let i;function s(...n){s.cancel(),i=setTimeout(()=>e(...n),t)}return s.cancel=()=>{clearTimeout(i)},s}function yn(e){try{if(!e.startsWith("ey"))return null;let t=atob(e.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(t)}catch{return null}}function _g(){let e=[];for(let t=0;t<256;t++){let i=t;for(let s=0;s<8;s++)i&1?i=3988292384^i>>>1:i=i>>>1;e[t]=i}return e}function Ul(e){let t=Array.isArray(e)?e:[e],i=_g(),s=-1,n=t.map(r=>Array.isArray(r)?r.join(""):String(r)).join("");for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);s=s>>>8^i[(s^o)&255]}return s=(s^-1)>>>0,s.toString(16).padStart(8,"0")}function Wl(e){let t=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tfoot",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],i=t.map(o=>o.name).join("|"),s=e.replace(new RegExp(`</?(${i})( .*?)?>`,"g"),` 4$& 5`).replace(/<br[^>]*>/g,`$& 6`).split(` 7`),n=0,r=!1;return s.map(o=>
7(r=kg(o,r),!o.length&&!r?"":vg(o,t)?gn(o,n++):yg(o,t)?gn(o,--n):r==="middle"||r==="last"?gn(o,0):gn(o,n))).join("").trimEnd()}function vg(e,t){return t.some(i=>!(i.isVoid||!new RegExp(`<${i.name}( .*?)?>`).test(e)))}function yg(e,t){return t.some(i=>new RegExp(`</${i.name}>`).test(e))}function gn(e,t,i=" "){return`${i.repeat(Math.max(0,t))}${e} 8`}function kg(e,t){let i=/<pre( .*?)?>/.test(e),s=/<\/pre>/.test(e);return i&&s?!1:i?"first":s?"last":t==="first"||t==="middle"?"middle":!1}function Cg(e){return!!e&&e.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(e)}function Ig(e){return!!e&&e.length==1&&/[\ud800-\udbff]/.test(e)}function xg(e){return!!e&&e.length==1&&/[\udc00-\udfff]/.test(e)}function ps(e,t){return Ig(e.charAt(t-1))&&xg(e.charAt(t))}function ws(e,t){return Cg(e.charAt(t))}var Eg=Tg();function kn(e,t){let i=String(e).matchAll(Eg);return Array.from(i).some(s=>s.index<t&&t<s.index+s[0].length)}function Tg(){let e=[/\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],t=/\p{Regional_Indicator}{2}/u.source,i="(?:"+e.map(n=>n.source).join("|")+")",s=`${t}|${i}(?:\u200D${i})*`;return new RegExp(s,"ug")}function Kr(e){if(!e)return null;let t=Ag(e);return t?yn(t):null}function Ag(e){let t=e.split(".");return t.length!=3?null:t[1]}function ql(e,t){return(e.removeFeatures||[]).includes(t)}var bs=new WeakMap,$l=!1;function bo({view:e,element:t,text:i,isDirectHost:s=!0,keepOnFocus:n=!1}){let r=e.document;bs.has(r)||(bs.set(r,new Map),r.registerPostFixer(a=>jr(bs.get(r),a)),r.on("change:isComposing",()=>{e.change(a=>jr(bs.get(r),a))},{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",(a,l,c)=>o(c)),t.placeholder?o(t.placeholder):i&&o(i),i&&Mg();function o(a){let l={text:a,isDirectHost:s,keepOnFocus:n,hostElement:s?t:null};bs.get(r).set(t,l),e.change(c=>jr([[t,l]],c))}}function Sg(e,t){return t.hasClass("ck-placeholder")?!1:(e.addClass("ck-placeholder",t),!0)}function Vc(e,t){return t.hasClass("ck-placeholder")?(e.removeClass("ck-placeholder",t),!0):!1}function Pg(e,t){if(!e.isAttached()||Lg(e))return!1;let i=e.document,s=i.selection.anchor;return i.isComposing&&s&&s.parent===e?!1:t||!i.isFocused?!0:!!s&&s.parent!==e}function Lg(e){for(let t of e.getChildren())if(!t.is("uiElement"))return!0;return!1}function jr(e,t){let i=[],s=!1;for(let[n,r]of e)r.isDirectHost&&(i.push(n),Kl(t,n,r)&&(s=!0));for(let[n,r]of e){if(r.isDirectHost)continue;let o=Vg(n);o!==r.hostElement&&r.hostElement&&(t.removeAttribute("data-placeholder",r.hostElement),Vc(t,r.hostElement),r.hostElement=null,s=!0),o&&(i.includes(o)||(r.hostElement=o,Kl(t,n,r)&&(s=!0)))}return s}function Kl(e,t,i){let{text:s,isDirectHost:n,hostElement:r}=i,o=!1;return r.getAttribute("data-placeholder")!==s&&(e.setAttribute("data-placeholder",s,r),o=!0),(n||t.childCount==1)&&Pg(r,i.keepOnFocus)?Sg(e,r)&&(o=!0):Vc(e,r)&&(o=!0),o}function Vg(e){if(e.childCount){let t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}function Mg(){$l||N("enableViewPlaceholder-deprecated-text-option"),$l=!0}var ri=class{is(){throw new Error("is() method is abstract")}};var Bg=F(ri),oi=class extends Bg{document;parent;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 f("view-node-not-found-in-parent",this);return e}get nextSibling(){let e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){let 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(){let e=[],t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){let t=[],i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){let i=this.getAncestors(t),s=e.getAncestors(t),n=0;for(;i[n]==s[n]&&i[n];)n++;return n===0?null:i[n-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;let t=this.getPath(),i=e.getPath(),s=ne(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)}
8_fireChange(e,t,i){this.fire(`change:${e}`,t,i),this.parent&&this.parent._fireChange(e,t,i)}toJSON(){let e={path:this.getPath(),type:"Node"};return this!==this.root&&this.root.is("rootElement")&&(e.root=this.root.toJSON()),e}};oi.prototype.is=function(e){return e==="node"||e==="view:node"};var be=class no extends oi{_textData;constructor(t,i){super(t),this._textData=i}get data(){return this._textData}get _data(){return this.data}set _data(t){this._fireChange("text",this),this._textData=t}isSimilar(t){return t instanceof no?this===t||this.data===t.data:!1}toJSON(){let t=super.toJSON();return t.type="Text",t.data=this.data,t}_clone(){return new no(this.document,this.data)}};be.prototype.is=function(e){return e==="$text"||e==="view:$text"||e==="text"||e==="view:text"||e==="node"||e==="view:node"};var pt=class extends ri{textNode;data;offsetInText;constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new f("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new f("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={}){let t=[],i=e.includeSelf?this.textNode:this.parent;for(;i!==null;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}};pt.prototype.is=function(e){return e==="$textProxy"||e==="view:$textProxy"||e==="textProxy"||e==="view:textProxy"};var Og=class ro{_consumables=new Map;add(t,i){let s;if(t.is("$text")||t.is("documentFragment")){this._consumables.set(t,!0);return}this._consumables.has(t)?s=this._consumables.get(t):(s=new Rg(t),this._consumables.set(t,s)),s.add(i?Is(i):t._getConsumables())}test(t,i){let s=this._consumables.get(t);return s===void 0?null:t.is("$text")||t.is("documentFragment")?s:s.test(Is(i))}consume(t,i){if(t.is("$text")||t.is("documentFragment"))return this.test(t,i)?(this._consumables.set(t,!1),!0):!1;let s=this._consumables.get(t);return s===void 0?!1:s.consume(Is(i))}revert(t,i){let s=this._consumables.get(t);s!==void 0&&(t.is("$text")||t.is("documentFragment")?this._consumables.set(t,!0):s.revert(Is(i)))}static createFrom(t,i){if(i||(i=new ro),t.is("$text"))i.add(t);else if(t.is("element")||t.is("documentFragment")){i.add(t);for(let s of t.getChildren())ro.createFrom(s,i)}return i}},Rg=class{element;_canConsumeName=null;_attributes=new Map;constructor(e){this.element=e}add(e){e.name&&(this._canConsumeName=!0);for(let[t,i]of e.attributes)if(i){let s=this._attributes.get(t);(!s||typeof s=="boolean")&&(s=new Map,this._attributes.set(t,s)),s.set(i,!0)}else{if(t=="style"||t=="class")throw new f("viewconsumable-invalid-attribute",this);this._attributes.set(t,!0)}}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(let[t,i]of e.attributes){let s=this._attributes.get(t);if(s===void 0)return null;if(s===!1)return!1;if(s!==!0){if(i){let n=s.get(i);if(n===void 0)return null;if(!n)return!1}else for(let n of s.values())if(!n)return!1}}return!0}consume(e){if(!this.test(e))return!1;e.name&&(this._canConsumeName=!1);for(let[t,i]of e.attributes){let s=this._attributes.get(t);if(typeof s=="boolean")for(let[n]of this.element._getConsumables(t,i).attributes)this._attributes.set(n,!1);else if(i)for(let[,n]of this.element._getConsumables(t,i).attributes)s.set(n,!1);else for(let n of s.keys())s.set(n,!1)}return!0}revert(e){e.name&&(this._canConsumeName=!0);for(let[t,i]of e.attributes){let s=this._attributes.get(t);if(s===!1){this._attributes.set(t,!0);continue}if(!(s===void 0||s===!0))if(i)s.get(i)===!1&&s.set(i,!0);else for(let n of s.keys())s.set(n,!0)}}};function Is(e){let t=[];return"attributes"in e&&e.attributes&&Gr(t,e.attributes),"classes"in e&&e.classes&&Gr(t,e.classes,"class"),"styles"in e&&e.styles&&Gr(t,e.styles,"style"),{name:e.name||!1,attributes:t}}function Gr(e,t,i){if(typeof t=="string"){e.push(i?[i,t]:[t]);return}for(let s of t)Array.isArray(s)?e.push(s):e.push(i?[i,s]:[s])}var ni=class{_patterns=[];constructor(...e){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(let t of e)for(let i of this._patterns){let s=this._isElementMatching(t,i);if(s)return{element:t,pattern:i,match:s}}return null}matchAll(...e){let t=[];for(let i of e)for(let s of this._patterns){let n=this._isElementMatching(i,s);
8n&&t.push({element:i,pattern:s,match:n})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;let e=this._patterns[0],t=e.name;return typeof e!="function"&&t&&!(t instanceof RegExp)?t:null}_isElementMatching(e,t){if(typeof t=="function"){let n=t(e);return!n||typeof n!="object"?n:Is(n)}let i={};if(t.name&&(i.name=Fg(t.name,e.name),!i.name))return null;let s=[];return t.attributes&&!Dg(t.attributes,e,s)||t.classes&&!Ng(t.classes,e,s)||t.styles&&!zg(t.styles,e,s)?null:(s.length&&(i.attributes=s),i)}};function Rn(e,t){return e===!0||e===t||e instanceof RegExp&&!!String(t).match(e)}function Fg(e,t){return e instanceof RegExp?!!t.match(e):e===t}function _o(e,t){if(Array.isArray(e))return e.map(s=>typeof s!="object"||s instanceof RegExp?t?[t,s,!0]:[s,!0]:((s.key===void 0||s.value===void 0)&&N("matcher-pattern-missing-key-or-value",s),t?[t,s.key,s.value]:[s.key,s.value]));if(typeof e!="object"||e instanceof RegExp)return[t?[t,e,!0]:[e,!0]];let i=[];for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(t?[t,s,e[s]]:[s,e[s]]);return i}function Dg(e,t,i){let s;return typeof e=="object"&&!(e instanceof RegExp)&&!Array.isArray(e)?(e.style!==void 0&&N("matcher-pattern-deprecated-attributes-style-key",e),e.class!==void 0&&N("matcher-pattern-deprecated-attributes-class-key",e)):s=["class","style"],t._collectAttributesMatch(_o(e),i,s)}function Ng(e,t,i){return t._collectAttributesMatch(_o(e,"class"),i)}function zg(e,t,i){return t._collectAttributesMatch(_o(e,"style"),i)}var xs=class{_styles;_cachedStyleNames=null;_cachedExpandedStyleNames=null;_styleProcessor;constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();let t=Hg(e);for(let[i,s]of t)this._styleProcessor.toNormalizedForm(i,s,this._styles);return this}has(e){if(this.isEmpty)return!1;let t=this._styleProcessor.getReducedForm(e,this._styles).find(([i])=>i===e);return Array.isArray(t)}set(e,t){if(this._cachedStyleNames=null,this._cachedExpandedStyleNames=null,re(e))for(let[i,s]of Object.entries(e))this._styleProcessor.toNormalizedForm(i,s,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){let t={};for(let i of U(e)){let s=oo(i),n=_e(this._styles,s);if(n)Tn(t,s,n);else{let r=this.getAsString(i);r!==void 0&&this._styleProcessor.toNormalizedForm(i,r,t)}}Object.keys(t).length&&(Bc(this._styles,t),this._cachedStyleNames=null,this._cachedExpandedStyleNames=null)}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]&&!re(this._styles[e]))return this._styles[e];let t=this._styleProcessor.getReducedForm(e,this._styles).find(([i])=>i===e);if(Array.isArray(t))return t[1]}getStyleNames(e=!1){return this.isEmpty?[]:e?(this._cachedExpandedStyleNames||=this._styleProcessor.getStyleNames(this._styles),this._cachedExpandedStyleNames):(this._cachedStyleNames||=this.getStylesEntries().map(([t])=>t),this._cachedStyleNames)}keys(){return this.getStyleNames()}clear(){this._styles={},this._cachedStyleNames=null,this._cachedExpandedStyleNames=null}isSimilar(e){if(this.size!==e.size)return!1;for(let t of this.getStyleNames())if(!e.has(t)||e.getAsString(t)!==this.getAsString(t))return!1;return!0}getStylesEntries(){let e=[],t=Object.keys(this._styles);for(let i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_clone(){let e=new this.constructor(this._styleProcessor);return e.set(this.getNormalized()),e}_getTokensMatch(e,t){let i=[];
8for(let s of this.getStyleNames(!0))if(Rn(e,s)){if(t===!0){i.push(s);continue}Rn(t,this.getAsString(s))&&i.push(s)}return i.length?i:void 0}_getConsumables(e){let t=[];if(e){t.push(e);for(let i of this._styleProcessor.getRelatedStyles(e))t.push(i)}else for(let i of this.getStyleNames()){for(let s of this._styleProcessor.getRelatedStyles(i))t.push(s);t.push(i)}return t}_canMergeFrom(e){for(let t of e.getStyleNames())if(this.has(t)&&this.getAsString(t)!==e.getAsString(t))return!1;return!0}_mergeFrom(e){for(let t of e.getStyleNames())this.has(t)||this.set(t,e.getAsString(t))}_isMatching(e){for(let t of e.getStyleNames())if(!this.has(t)||this.getAsString(t)!==e.getAsString(t))return!1;return!0}},Mc=class{_normalizers;_extractors;_reducers;_consumables;constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(re(t)){Tn(i,oo(e),t);return}if(this._normalizers.has(e)){let{path:s,value:n}=this._normalizers.get(e)(t);Tn(i,s,n)}else Tn(i,e,t)}getNormalized(e,t){if(!e)return Ei({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){let i=this._extractors.get(e);if(typeof i=="string")return _e(t,i);let s=i(e,t);if(s)return s}return _e(t,oo(e))}getReducedForm(e,t){let i=this.getNormalized(e,t);return i===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(i):[[e,i]]}getStyleNames(e){let t=new Set;for(let i of this._consumables.keys()){let s=this.getNormalized(i,e);s&&(typeof s!="object"||Object.keys(s).length)&&t.add(i)}for(let i of Object.keys(e))t.add(i);return Array.from(t)}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(let 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 Hg(e){let t=null,i=0,s=0,n=null,r=new Map;if(e==="")return r;e.charAt(e.length-1)!=";"&&(e=e+";");for(let o=0;o<e.length;o++){let a=e.charAt(o);if(t===null)switch(a){case":":n||(n=e.substr(i,o-i),s=o+1);break;case'"':case"'":t=a;break;case";":{let l=e.substr(s,o-s);n&&r.set(n.trim(),l.trim()),n=null,i=o+1;break}}else a===t&&(t=null)}return r}function oo(e){return e.replace("-",".")}function Tn(e,t,i){let s=i;re(i)&&!Array.isArray(i)&&(s=Ei({},_e(e,t),i)),es(e,t,s)}function Bc(e,t){for(let i of Object.keys(t))e[i]!==null&&!Array.isArray(e[i])&&typeof e[i]=="object"&&typeof t[i]=="object"?(Bc(e[i],t[i]),Object.keys(e[i]).length||delete e[i]):delete e[i]}var Zr=class{_set=new Set;get isEmpty(){return this._set.size==0}get size(){return this._set.size}has(e){return this._set.has(e)}keys(){return Array.from(this._set.keys())}setTo(e){this.clear();for(let t of e.split(/\s+/))t&&this._set.add(t);return this}set(e){for(let t of U(e))t&&this._set.add(t)}remove(e){for(let t of U(e))this._set.delete(t)}clear(){this._set.clear()}toString(){return Array.from(this._set).join(" ")}isSimilar(e){if(this.size!==e.size)return!1;for(let t of this.keys())if(!e.has(t))return!1;return!0}_clone(){let e=new this.constructor;return e._set=new Set(this._set),e}_getTokensMatch(e){let t=[];if(e===!0){for(let i of this._set.keys())t.push(i);return t}if(typeof e=="string"){for(let i of e.split(/\s+/))if(this._set.has(i))t.push(i);else return;return t}for(let i of this._set.keys())i.match(e)&&t.push(i);return t.length?t:void 0}_getConsumables(e){return e?[e]:this.keys()}_canMergeFrom(){return!0}_mergeFrom(e){for(let t of e._set.keys())this._set.has(t)||this._set.add(t)}_isMatching(e){for(let t of e._set.keys())if(!this._set.has(t))return!1;return!0}};var ai=class Oc extends oi{name;_unsafeAttributesToRender=[];_attrs;_children;_customProperties=new Map;get _classes(){return this._attrs.get("class")}get _styles(){return this._attrs.get("style")}constructor(t,i,s,n){super(t),this.name=i,this._attrs=this._parseAttributes(s),this._children=[],n&&this._insertChild(0,n)}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(t){return this._children[t]}getChildIndex(t){return this._children.indexOf(t)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes&&(yield"class"),this._styles&&(yield"style");for(let t of this._attrs.keys())t!="class"&&t!="style"&&(yield t)}*getAttributes(){for(let[t,i]of this._attrs.entries())yield[t,String(i)]}getAttribute(t){return this._attrs.has(t)?String(this._attrs.get(t)):void 0}hasAttribute(t,i){return this._attrs.has(t)?i!==void 0?Si(this.name,t)||_s(this.name,t)?this._attrs.get(t).has(i):this._attrs.get(t)===i:!0:!1}isSimilar(t){if(!(t instanceof Oc))return!1;if(this===t)return!0;
8if(this.name!=t.name||this._attrs.size!==t._attrs.size)return!1;for(let[i,s]of this._attrs){let n=t._attrs.get(i);if(n===void 0)return!1;if(typeof s=="string"||typeof n=="string"){if(n!==s)return!1}else if(!s.isSimilar(n))return!1}return!0}hasClass(...t){for(let i of t)if(!this._classes||!this._classes.has(i))return!1;return!0}getClassNames(){let t=this._classes?this._classes.keys():[],i=t[Symbol.iterator]();return Object.assign(t,{next:i.next.bind(i)})}getStyle(t){return this._styles&&this._styles.getAsString(t)}getNormalizedStyle(t){return this._styles&&this._styles.getNormalized(t)}getStyleNames(t){return this._styles?this._styles.getStyleNames(t):[]}hasStyle(...t){for(let i of t)if(!this._styles||!this._styles.has(i))return!1;return!0}findAncestor(...t){let i=new ni(...t),s=this.parent;for(;s&&!s.is("documentFragment");){if(i.match(s))return s;s=s.parent}return null}getCustomProperty(t){return this._customProperties.get(t)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){let t=this._classes?this._classes.keys().sort().join(","):"",i=this._styles&&String(this._styles),s=Array.from(this._attrs).filter(([n])=>n!="style"&&n!="class").map(n=>`${n[0]}="${n[1]}"`).sort().join(" ");return this.name+(t==""?"":` class="${t}"`)+(i?` style="${i}"`:"")+(s==""?"":` ${s}`)}shouldRenderUnsafeAttribute(t){return this._unsafeAttributesToRender.includes(t)}toJSON(){let t=super.toJSON();if(t.name=this.name,t.type="Element",this._attrs.size&&(t.attributes=Object.fromEntries(this.getAttributes())),this._children.length>0){t.children=[];for(let i of this._children)t.children.push(i.toJSON())}return t}_clone(t=!1){let i=[];if(t)for(let n of this.getChildren())i.push(n._clone(t));let s=new this.constructor(this.document,this.name,this._attrs,i);return s._customProperties=new Map(this._customProperties),s.getFillerOffset=this.getFillerOffset,s._unsafeAttributesToRender=this._unsafeAttributesToRender,s}_appendChild(t){return this._insertChild(this.childCount,t)}_insertChild(t,i){this._fireChange("children",this,{index:t});let s=0,n=Ug(this.document,i);for(let r of n)r.parent!==null&&r._remove(),r.parent=this,r.document=this.document,this._children.splice(t,0,r),t++,s++;return s}_removeChildren(t,i=1){this._fireChange("children",this,{index:t});for(let s=t;s<t+i;s++)this._children[s].parent=null;return this._children.splice(t,i)}_setAttribute(t,i,s=!0){if(this._fireChange("attributes",this),Si(this.name,t)||_s(this.name,t)){let n=this._attrs.get(t);n||(n=Si(this.name,t)?new xs(this.document.stylesProcessor):new Zr,this._attrs.set(t,n)),s?n.setTo(String(i)):Si(this.name,t)?Array.isArray(i)?n.set(i[0],i[1]):n.set(i):n.set(typeof i=="string"?i.split(/\s+/):i)}else this._attrs.set(t,String(i))}_removeAttribute(t,i){if(this._fireChange("attributes",this),i!==void 0&&(Si(this.name,t)||_s(this.name,t))){let s=this._attrs.get(t);return s?(_s(this.name,t)&&typeof i=="string"&&(i=i.split(/\s+/)),s.remove(i),s.isEmpty?this._attrs.delete(t):!1):!1}return this._attrs.delete(t)}_addClass(t){this._setAttribute("class",t,!1)}_removeClass(t){this._removeAttribute("class",t)}_setStyle(t,i){typeof t!="string"?this._setAttribute("style",t,!1):this._setAttribute("style",[t,i],!1)}_removeStyle(t){this._removeAttribute("style",t)}_collectAttributesMatch(t,i,s){for(let[n,r,o]of t){let a=!1,l=!1;for(let[c,u]of this._attrs)if(!(s&&s.includes(c)||!Rn(n,c)))if(a=!0,typeof u=="string"){if(Rn(r,u))i.push([c]),l=!0;else if(!(n instanceof RegExp))return!1}else{let d=u._getTokensMatch(r,o||!0);if(d){l=!0;for(let h of d)i.push([c,h])}else if(!(n instanceof RegExp))return!1}if(!a||!l)return!1}return!0}_getConsumables(t,i){let s=[];if(t){let n=this._attrs.get(t);if(n!==void 0)if(typeof n=="string")s.push([t]);else for(let r of n._getConsumables(i))s.push([t,r])}else for(let[n,r]of this._attrs)if(typeof r=="string")s.push([n]);else for(let o of r._getConsumables())s.push([n,o]);return{name:!t,attributes:s}}_canMergeAttributesFrom(t){if(this.name!=t.name)return!1;for(let[i,s]of t._attrs){let n=this._attrs.get(i);if(n!==void 0){if(typeof n=="string"||typeof s=="string"){if(n!==s)return!1}else if(!n._canMergeFrom(s))return!1}}return!0}_mergeAttributesFrom(t){this._fireChange("attributes",this);for(let[i,s]of t._attrs){let n=this._attrs.get(i);n===void 0||typeof n=="string"||typeof s=="string"?this._setAttribute(i,s):n._mergeFrom(s)}}_canSubtractAttributesOf(t){if(this.name!=t.name)return!1;for(let[i,s]of t._attrs){let n=this._attrs.get(i);if(n===void 0)return!1;if(typeof n=="string"||typeof s=="string"){if(n!==s)return!1}else if(!n._isMatching(s))return!1}return!0}_subtractAttributesOf(t){this._fireChange("attributes",this);for(let[i,s]of t._attrs){let n=this._attrs.get(i);typeof n=="string"||typeof s=="string"?this._attrs.delete(i):(n.remove(s.keys()),n.isEmpty&&this._attrs.delete(i))}}_setCustomProperty(t,i){this._customProperties.set(t,i)}_removeCustomProperty(t){return this._customProperties.delete(t)}_parseAttributes(t){let i=De(t);for(let[s,n]of i)if(n===null)i.delete(s);else if(Si(this.name,s)){let r=n instanceof xs?n._clone():new xs(this.document.stylesProcessor).setTo(String(n));i.set(s,r)}else if(_s(this.name,s)){let r=n instanceof Zr?n._clone():new Zr().setTo(String(n));i.set(s,r)}
8else typeof n!="string"&&i.set(s,String(n));return i}};ai.prototype.is=function(e,t){return t?t===this.name&&(e==="element"||e==="view:element"):e==="element"||e==="view:element"||e==="node"||e==="view:node"};function Ug(e,t){if(typeof t=="string")return[new be(e,t)];ve(t)||(t=[t]);let i=[];for(let s of t)typeof s=="string"?i.push(new be(e,s)):s instanceof pt?i.push(new be(e,s.data)):i.push(s);return i}function _s(e,t){return t=="class"||e=="a"&&t=="rel"}function Si(e,t){return t=="style"}var Ss=class extends ai{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=Rc}toJSON(){let e=super.toJSON();return e.type="ContainerElement",e}};Ss.prototype.is=function(e,t){return t?t===this.name&&(e==="containerElement"||e==="view:containerElement"||e==="element"||e==="view:element"):e==="containerElement"||e==="view:containerElement"||e==="element"||e==="view:element"||e==="node"||e==="view:node"};function Rc(){let e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(;t&&t.is("attributeElement");)if(t=t.getChild(t.childCount-1),t&&t.is("element","br"))return this.childCount;for(let i of e)if(!i.is("uiElement"))return null;return this.childCount}var Wg=z(Ss),Dn=class extends Wg{constructor(e,t,i,s){super(e,t,i,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",n=>n&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}toJSON(){let e=super.toJSON();return e.type="EditableElement",e.isReadOnly=this.isReadOnly,e.isFocused=this.isFocused,e}};Dn.prototype.is=function(e,t){return t?t===this.name&&(e==="editableElement"||e==="view:editableElement"||e==="containerElement"||e==="view:containerElement"||e==="element"||e==="view:element"):e==="editableElement"||e==="view:editableElement"||e==="containerElement"||e==="view:containerElement"||e==="element"||e==="view:element"||e==="node"||e==="view:node"};var jl=Symbol("rootName"),Fc=class extends Dn{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(jl)}set rootName(e){this._setCustomProperty(jl,e)}toJSON(){return this.rootName}set _name(e){this.name=e}};Fc.prototype.is=function(e,t){return t?t===this.name&&(e==="rootElement"||e==="view:rootElement"||e==="editableElement"||e==="view:editableElement"||e==="containerElement"||e==="view:containerElement"||e==="element"||e==="view:element"):e==="rootElement"||e==="view:rootElement"||e==="editableElement"||e==="view:editableElement"||e==="containerElement"||e==="view:containerElement"||e==="element"||e==="view:element"||e==="node"||e==="view:node"};var si=class{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new f("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new f("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)}jumpTo(e){this._boundaryStartParent&&e.isBefore(this.boundaries.start)?e=this.boundaries.start:this._boundaryEndParent&&e.isAfter(this.boundaries.end)&&(e=this.boundaries.end),this._position=e.clone()}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone(),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&&i.is("view:$text")){if(e.isAtEnd)return this._position=v._createAfter(i),this._next();s=i.data[e.offset]}else s=i.getChild(e.offset);if(typeof s=="string"){let n;this.singleCharacters?n=1:n=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;let r=new pt(i,e.offset,n);return e.offset+=n,this._position=e,this._formatReturnValue("text",r,t,e,n)}if(s&&s.is("view:element")){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&&s.is("view:$text")){if(this.singleCharacters)return e=new v(s,0),this._position=e,this._next();let n=s.data.length,r;return s==this._boundaryEndParent?(n=this.boundaries.end.offset,r=new pt(s,0,n),e=v._createAfter(r)):(r=new pt(s,0,s.data.length),e.offset++),this._position=e,this._formatReturnValue("text",r,t,e,n)}return e=v._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone(),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.is("view:$text")){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(typeof s=="string"){let n;if(this.singleCharacters)n=1;else{let o=i===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-o}e.offset-=n;let r=new pt(i,e.offset,n);return this._position=e,this._formatReturnValue("text",r,t,e,n)}if(s&&s.is("view:element"))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&&s.is("view:$text")){if(this.singleCharacters)return e=new v(s,s.data.length),this._position=e,this._previous();let n=s.data.length,r;if(s==this._boundaryStartParent){let o=this.boundaries.start.offset;r=new pt(s,o,s.data.length-o),n=r.data.length,e=v._createBefore(r)}else r=new pt(s,0,s.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",r,t,e,n)}return e=v._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,s,n){return t.is("view:$textProxy")&&(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:n}}}};var v=class mt extends ri{parent;offset;constructor(t,i){super(),this.parent=t,this.offset=i}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(){let t=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===t}get root(){return this.parent.root}get editableElement(){let t=this.parent;for(;!(t instanceof Dn);)if(t.parent)t=t.parent;else return null;return t}getShiftedBy(t){let i=mt._createAt(this),s=i.offset+t;return i.offset=s<0?0:s,i}getLastMatchingPosition(t,i={}){i.startPosition=this;let s=new si(i);return s.skip(t),s.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(t){let i=this.getAncestors(),s=t.getAncestors(),n=0;for(;i[n]==s[n]&&i[n];)n++;return n===0?null:i[n-1]}isEqual(t){return this.parent==t.parent&&this.offset==t.offset}isBefore(t){return this.compareWith(t)=="before"}isAfter(t){return this.compareWith(t)=="after"}compareWith(t){if(this.root!==t.root)return"different";if(this.isEqual(t))return"same";let i=this.parent.is("node")?this.parent.getPath():[],s=t.parent.is("node")?t.parent.getPath():[];i.push(this.offset),s.push(t.offset);let n=ne(i,s);switch(n){case"prefix":return"before";case"extension":return"after";default:return i[n]<s[n]?"before":"after"}}getWalker(t={}){return t.startPosition=this,new si(t)}clone(){return new mt(this.parent,this.offset)}toJSON(){return{parent:this.parent.toJSON(),offset:this.offset}}static _createAt(t,i){if(t instanceof mt)return new this(t.parent,t.offset);{let s=t;if(i=="end")i=s.is("$text")?s.data.length:s.childCount;else{if(i=="before")return this._createBefore(s);if(i=="after")return this._createAfter(s);if(i!==0&&!i)throw new f("view-createpositionat-offset-required",s)}return new mt(s,i)}}static _createAfter(t){if(t.is("$textProxy"))return new mt(t.textNode,t.offsetInText+t.data.length);if(!t.parent)throw new f("view-position-after-root",t,{root:t});return new mt(t.parent,t.index+1)}static _createBefore(t){if(t.is("$textProxy"))return new mt(t.textNode,t.offsetInText);if(!t.parent)throw new f("view-position-before-root",t,{root:t});return new mt(t.parent,t.index)}};v.prototype.is=function(e){return e==="position"||e==="view:position"};var M=class Mt extends ri{start;end;constructor(t,i=null){super(),this.start=t.clone(),this.end=i?i.clone():t.clone()}*[Symbol.iterator](){yield*new si({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 t=this.start.getLastMatchingPosition(Cn,{direction:"backward"}),i=this.end.getLastMatchingPosition(Cn);return t.parent.is("$text")&&t.isAtStart&&(t=v._createBefore(t.parent)),i.parent.is("$text")&&i.isAtEnd&&(i=v._createAfter(i.parent)),new Mt(t,i)}getTrimmed(){let t=this.start.getLastMatchingPosition(Cn);if(t.isAfter(this.end)||t.isEqual(this.end))return new Mt(t,t);let i=this.end.getLastMatchingPosition(Cn,{direction:"backward"}),s=t.nodeAfter,n=i.nodeBefore;return s&&s.is("$text")&&(t=new v(s,0)),n&&n.is("$text")&&(i=new v(n,n.data.length)),new Mt(t,i)}isEqual(t){return this==t||this.start.isEqual(t.start)&&this.end.isEqual(t.end
8)}containsPosition(t){return t.isAfter(this.start)&&t.isBefore(this.end)}containsRange(t,i=!1){t.isCollapsed&&(i=!1);let s=this.containsPosition(t.start)||i&&this.start.isEqual(t.start),n=this.containsPosition(t.end)||i&&this.end.isEqual(t.end);return s&&n}getDifference(t){let i=[];return this.isIntersecting(t)?(this.containsPosition(t.start)&&i.push(new Mt(this.start,t.start)),this.containsPosition(t.end)&&i.push(new Mt(t.end,this.end))):i.push(this.clone()),i}getIntersection(t){if(this.isIntersecting(t)){let i=this.start,s=this.end;return this.containsPosition(t.start)&&(i=t.start),this.containsPosition(t.end)&&(s=t.end),new Mt(i,s)}return null}getWalker(t={}){return t.boundaries=this,new si(t)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let t=this.start.nodeAfter,i=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(t=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(i=this.end.parent.previousSibling),t&&t.is("element")&&t===i?t:null}clone(){return new Mt(this.start,this.end)}*getItems(t={}){t.boundaries=this,t.ignoreElementEnd=!0;let i=new si(t);for(let s of i)yield s.item}*getPositions(t={}){t.boundaries=this;let i=new si(t);yield i.position;for(let s of i)yield s.nextPosition}isIntersecting(t){return this.start.isBefore(t.end)&&this.end.isAfter(t.start)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static _createFromParentsAndOffsets(t,i,s,n){return new this(new v(t,i),new v(s,n))}static _createFromPositionAndShift(t,i){let s=t,n=t.getShiftedBy(i);return i>0?new this(s,n):new this(n,s)}static _createIn(t){return this._createFromParentsAndOffsets(t,0,t,t.childCount)}static _createOn(t){let i=t.is("$textProxy")?t.offsetSize:1;return this._createFromPositionAndShift(v._createBefore(t),i)}};M.prototype.is=function(e){return e==="range"||e==="view:range"};function Cn(e){return!!(e.item.is("attributeElement")||e.item.is("uiElement"))}var qg=F(ri),Bt=class Dc extends qg{_ranges;_lastRangeBackward;_isFake;_fakeSelectionLabel;constructor(...t){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",t.length&&this.setTo(...t)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;let t=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?t.end:t.start).clone()}get focus(){if(!this._ranges.length)return null;let t=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?t.start:t.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(let t of this._ranges)yield t.clone()}getFirstRange(){let t=null;for(let i of this._ranges)(!t||i.start.isBefore(t.start))&&(t=i);return t?t.clone():null}getLastRange(){let t=null;for(let i of this._ranges)(!t||i.end.isAfter(t.end))&&(t=i);return t?t.clone():null}getFirstPosition(){let t=this.getFirstRange();return t?t.start.clone():null}getLastPosition(){let t=this.getLastRange();return t?t.end.clone():null}isEqual(t){if(this.isFake!=t.isFake||this.isFake&&this.fakeSelectionLabel!=t.fakeSelectionLabel||this.rangeCount!=t.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(t.anchor)||!this.focus.isEqual(t.focus))return!1;for(let i of this._ranges){let s=!1;for(let n of t._ranges)if(i.isEqual(n)){s=!0;break}if(!s)return!1}return!0}isSimilar(t){if(this.isBackward!=t.isBackward)return!1;let i=cs(this.getRanges());if(i!=cs(t.getRanges()))return!1;if(i==0)return!0;for(let s of this.getRanges()){s=s.getTrimmed();let n=!1;for(let r of t.getRanges())if(r=r.getTrimmed(),s.start.isEqual(r.start)&&s.end.isEqual(r.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...t){let[i,s,n]=t;if(typeof s=="object"&&(n=s,s=void 0),i===null)this._setRanges([]),this._setFakeOptions(n);else if(i instanceof Dc||i instanceof vo)this._setRanges(i.getRanges(),i.isBackward),this._setFakeOptions({fake:i.isFake,label:i.fakeSelectionLabel});else if(i instanceof M)this._setRanges([i],n&&n.backward),this._setFakeOptions(n);else if(i instanceof v)this._setRanges([new M(i)]),this._setFakeOptions(n);else if(i instanceof oi){let r=!!n&&!!n.backward,o;if(s===void 0)throw new f("view-selection-setto-required-second-parameter",this);s=="in"?o=M._createIn(i):s=="on"?o=M._createOn(i):o=new M(v._createAt(i,s)),this._setRanges([o],r),this._setFakeOptions(n)}else if(ve(i))this._setRanges(i,n&&n.backward),this._setFakeOptions(n);else throw new f("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(t,i){if(this.anchor===null)throw new f("view-selection-setfocus-no-ranges",this);let s=v._createAt(t,i);if(s.compareWith(this.focus)=="same")return;let n=this.anchor;this._ranges.pop(),s.compareWith(n)=="before"?this._addRange(new M(s,n),!0):this._addRange(new M(n,s)),this.fire("change")}toJSON(){let t={ranges:Array.from(this.getRanges()).map(i=>i.toJSON())};return this.isBackward&&(t.isBackward=!0),this.isFake&&(t.isFake=!0),t}_setRanges(t,i=!1){t=Array.from(t),this._ranges=[];for(let s of t)this._addRange(s);this._lastRangeBackward=!!i}_setFakeOptions(t={}){this._isFake=!!t.fake,this._fakeSelectionLabel=t.fake&&t.label||""}_addRange(t,i=!1){if(!(t instanceof M))throw new f("view-selection-add-range-not-range",this);this._pushRange(t),this._lastRangeBackward=!!i}_pushRange(t){for(let i of this._ranges)if(t.isIntersecting(i))throw new f("view-selection-range-intersects",this,{addedRange:t,intersectingRange:i});this._ranges.push(new M(t.start,t.end))}};Bt.prototype.is=function(e){return e==="selection"||e==="view:selection"};var $g=F(ri),vo=class extends $g{_selection;constructor(...e){super(),this._selection=new Bt,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)}toJSON(){return this._selection.toJSON()}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};vo.prototype.is=function(e){return e==="selection"||e=="documentSelection"||e=="view:selection"||e=="view:documentSelection"};var wt=class extends Le{startRange;_eventPhase;_currentTarget;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}};var Jr=Symbol("bubblingEmitter"),Yr=Symbol("bubblingCallbacks"),Qr=Symbol("bubblingContexts");function Kg(e){class t extends e{fire(s,...n){try{let r=s instanceof Le?s:new Le(this,s),o=Xr(this),a=Zl(this);if(vs(r,"capturing",this),In(o,"$capture",r,...n))return r.return;let l=r.startRange||this.selection.getFirstRange(),c=l?l.getContainedElement():null,u=c?Gg(a,c):!1,d=c||Zg(l);if(vs(r,"atTarget",d),!u){if(In(o,"$text",r,...n))return r.return;vs(r,"bubbling",d)}for(;d;){if(d.is("element")&&In(o,d,r,...n))return r.return;d=d.parent,vs(r,"bubbling",d)}return vs(r,"bubbling",this),In(o,"$document",r,...n),r.return}catch(r){f.rethrowUnexpectedError(r,this)}}_addEventListener(s,n,r){let o=U(r.context||"$document"),a=Xr(this),l=Gl(this);for(let u of o)typeof u=="function"&&Zl(this).add(u);let c=jg(this,o,n);l.set(n,c),this.listenTo(a,s,c,r)}_removeEventListener(s,n){let r=Xr(this),o=Gl(this),a=o.get(n);a&&(o.delete(n),this.stopListening(r,s,a))}}return t}function vs(e,t,i){e instanceof wt&&(e._eventPhase=t,e._currentTarget=i)}function In(e,t,i,...s){return e.fire(i,{currentTarget:t,eventArgs:s}),!!i.stop.called}function jg(e,t,i){return function(s,n){let{currentTarget:r,eventArgs:o}=n;if(typeof r=="string"){t.includes(r)&&i.call(e,s,...o);return}if(r.is("rootElement")&&t.includes("$root")){i.call(e,s,...o);return}if(t.includes(r.name)){i.call(e,s,...o);return}for(let a of t)if(typeof a=="function"&&a(r)){i.call(e,s,...o);return}}}function Xr(e){return e[Jr]||(e[Jr]=new(F())),e[Jr]}function Gl(e){return e[Yr]||(e[Yr]=new Map),e[Yr]}function Zl(e){return e[Qr]||(e[Qr]=new Set),e[Qr]}function Gg(e,t){for(let i of e)if(i(t))return!0;return!1}function Zg(e){if(!e)return null;let t=e.start.parent,i=e.end.parent,s=t.getPath(),n=i.getPath();return s.length>n.length?t:i}var Jg=Kg(z()),Nc=class extends Jg{selection;roots;stylesProcessor;_postFixers=new Set;constructor(e){super(),this.selection=new vo,this.roots=new pe({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)}getRoots(){return Array.from(this.roots)}registerPostFixer(e){this._postFixers.add(e)}
8destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(let i of this._postFixers)if(t=i(e),t)break;while(t)}};var Jl=10,Bi=class extends ai{static DEFAULT_PRIORITY=Jl;_priority=Jl;_id=null;_clonesGroup=null;constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=Yg}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new f("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}toJSON(){let e=super.toJSON();return e.type="AttributeElement",e}_clone(e=!1){let t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}_canMergeAttributesFrom(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canMergeAttributesFrom(e)}_canSubtractAttributesOf(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canSubtractAttributesOf(e)}};Bi.prototype.is=function(e,t){return t?t===this.name&&(e==="attributeElement"||e==="view:attributeElement"||e==="element"||e==="view:element"):e==="attributeElement"||e==="view:attributeElement"||e==="element"||e==="view:element"||e==="node"||e==="view:node"};function Yg(){if(eo(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(eo(e)>1)return null;e=e.parent}return!e||eo(e)>1?null:this.childCount}function eo(e){return Array.from(e.getChildren()).filter(t=>!t.is("uiElement")).length}var yo=class extends ai{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=Qg}toJSON(){let e=super.toJSON();return e.type="EmptyElement",e}_insertChild(e,t){if(t&&(t instanceof oi||Array.from(t).length>0))throw new f("view-emptyelement-cannot-add",[this,t]);return 0}};yo.prototype.is=function(e,t){return t?t===this.name&&(e==="emptyElement"||e==="view:emptyElement"||e==="element"||e==="view:element"):e==="emptyElement"||e==="view:emptyElement"||e==="element"||e==="view:element"||e==="node"||e==="view:node"};function Qg(){return null}var Nn=class extends ai{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=e0}_insertChild(e,t){if(t&&(t instanceof oi||Array.from(t).length>0))throw new f("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){let t=e.createElement(this.name);for(let i of this.getAttributeKeys())t.setAttribute(i,this.getAttribute(i));return t}toJSON(){let e=super.toJSON();return e.type="UIElement",e}};Nn.prototype.is=function(e,t){return t?t===this.name&&(e==="uiElement"||e==="view:uiElement"||e==="element"||e==="view:element"):e==="uiElement"||e==="view:uiElement"||e==="element"||e==="view:element"||e==="node"||e==="view:node"};function Xg(e){e.document.on("arrowKey",(t,i)=>t0(t,i,e.domConverter),{priority:"low"})}function e0(){return null}function t0(e,t,i){if(t.keyCode==L.arrowright){let s=t.domTarget.ownerDocument.defaultView.getSelection(),n=s.rangeCount==1&&s.getRangeAt(0).collapsed;if(n||t.shiftKey){let r=s.focusNode,o=s.focusOffset,a=i.domPositionToView(r,o);if(a===null)return;let l=!1,c=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){let u=i.viewPositionToDom(c);n?s.collapse(u.parent,u.offset):s.extend(u.parent,u.offset)}}}}var ko=class extends ai{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=i0}toJSON(){let e=super.toJSON();return e.type="RawElement",e}_insertChild(e,t){if(t&&(t instanceof oi||Array.from(t).length>0))throw new f("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}};ko.prototype.is=function(e,t){return t?t===this.name&&(e==="rawElement"||e==="view:rawElement"||e==="element"||e==="view:element"):e==="rawElement"||e==="view:rawElement"||e===this.name||e==="view:"+this.name||e==="element"||e==="view:element"||e==="node"||e==="view:node"};function i0(){return null}var s0=F(ri),Oi=class extends s0{document;_children=[];_customProperties=new Map;constructor(e,t){super(),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(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}toJSON(){let e=[];for(let t of this._children)e.push(t.toJSON());return e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this,{index:e});let i=0,s=n0(this.document,t);for(let n of s)n.parent!==null&&n._remove(),n.parent=this,this._children.splice(e,0,n),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t,i){this.fire(`change:${e}`,t,i)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};Oi.prototype.is=function(e){return e==="documentFragment"||e==="view:documentFragment"};function n0(e,t){return typeof t=="string"?[new be(e,t)]:(ve(t)||(t=[t]),Array.from(t).map(i=>typeof i=="string"?new be(e,i):i instanceof pt?new be(e,i.data):i))}var zc=class{document;_cloneGroups=new Map;_slotFactory=null;constructor(e){this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new Oi(this.document,e)}createText(e){return new be(this.document,e)}createAttributeElement(e,t,i={}){let s=new Bi(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 n;l0(i)?s=i:n=i;let r=new Ss(this.document,e,t,n);return s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}createEditableElement(e,t,i={}){let s=new Dn(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEmptyElement(e,t,i={}){let s=new yo(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createUIElement(e,t,i){let s=new Nn(this.document,e,t);return i&&(s.render=i),s}createRawElement(e,t,i,s={}){let n=new ko(this.document,e,t);return i&&(n.render=i),s.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),n}setAttribute(e,t,i,s){s!==void 0?s._setAttribute(e,t,i):i._setAttribute(e,t)}removeAttribute(e,t,i){i!==void 0?i._removeAttribute(e,t):t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){se(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){let t=e.parent;if(!t.is("containerElement"))throw new f("view-writer-break-non-container-element",this.document);if(!t.parent)throw new f("view-writer-break-root",this.document);if(e.isAtStart)return v._createBefore(t);if(!e.isAtEnd){let i=t._clone(!1);this.insert(v._createAfter(t),i);let s=new M(e,v._createAt(t,"end")),n=new v(i,0);this.move(s,n)}return v._createAfter(t)}mergeAttributes(e){let t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&i.childCount===0){let r=i.parent,o=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new v(r,o))}let s=i.getChild(t-1),n=i.getChild(t);if(!s||!n)return e;if(s.is("$text")&&n.is("$text"))return Ql(s,n);if(s.is("attributeElement")&&n.is("attributeElement")&&s.isSimilar(n)){let r=s.childCount;return s._appendChild(n.getChildren()),n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new v(s,r))}return e}mergeContainers(e){let t=e.nodeBefore,i=e.nodeAfter;if(!t||!i||!t.is("containerElement")||!i.is("containerElement"))throw new f("view-writer-merge-containers-invalid-position",this.document);let s=t.getChild(t.childCount-1),n=s instanceof be?v._createAt(s,"end"):v._createAt(t,"end");return this.move(M._createIn(i),v._createAt(t,"end")),this.remove(M._createOn(i)),n}insert(e,t){t=ve(t)?[...t]:[t],Hc(t,this.document);let i=t.reduce((r,o)=>{let a=r[r.length-1],l=!o.is("uiElement");return!a||a.breakAttributes!=l?r.push({breakAttributes:l,nodes:[o]}):a.nodes.push(o),r},[]),s=null,n=e;for(let{nodes:r,breakAttributes:o}of i){let a=this._insertNodes(n,r,o);s||(s=a.start),n=a.end}return s?new M(s,n):new M(e)}remove(e){let t=e instanceof M?e:M._createOn(e);if(ys(t,this.document),t.isCollapsed)return new Oi(this.document);let{start:i,end:s}=this._breakAttributesRange(t,!0),n=i.parent,r=s.offset-i.offset,o=n._removeChildren(i.offset,r);for(let l of o)this._removeFromClonedElementsGroup(l);let a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new Oi(this.document,o)}clear(e,t){ys(e,this.document);let i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(let s of i){let n=s.item,r;if(n.is("element")&&t.isSimilar(n))r=M._createOn(n);else if(!s.nextPosition.isAfter(e.start)&&n.is("$textProxy")){let o=n.getAncestors().find(a=>a.is("element")&&t.isSimilar(a));o&&(r=M._createIn(o))}r&&(r.end.isAfter(e.end)&&(r.end=e.end),r.start.isBefore(e.start)&&(r.start=e.start),this.remove(r))}}move(e,t){let i;if(t.isAfter(e.end)){t=this._breakAttributes(t,!0);let s=t.parent,n=s.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=s.childCount-n}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof Bi))throw new f("view-writer-wrap-invalid-attribute",this.document);if(ys(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&!r0(i.parent)&&(i=i.getLastMatchingPosition(n=>n.item.is("uiElement"))),i=this._wrapPosition(i,t);let s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new M(i)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof Bi))throw new f("view-writer-unwrap-invalid-attribute",this.document);if(ys(e,this.document),e.isCollapsed)return e;let{start:i,end:s}=this._breakAttributesRange(e,!0),n=i.parent,r=this._unwrapChildren(n,i.offset,s.offset,t),o=this.mergeAttributes(r.start);return o.isEqual(r.start)||r.end.offset--,new M(o,this.mergeAttributes(r.end
8))}rename(e,t){let i=new Ss(this.document,e,t.getAttributes());return this.insert(v._createAfter(t),i),this.move(M._createIn(t),v._createAt(i,0)),this.remove(M._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 M(e,t)}createRangeOn(e){return M._createOn(e)}createRangeIn(e){return M._createIn(e)}createSelection(...e){return new Bt(...e)}createSlot(e="children"){if(!this._slotFactory)throw new f("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=ao(e):s=e.parent.is("$text")?e.parent.parent:e.parent,!s)throw new f("view-writer-invalid-position-container",this.document);let n;i?n=this._breakAttributes(e,!0):n=e.parent.is("$text")?to(e):e;let r=s._insertChild(n.offset,t);for(let l of t)this._addToClonedElementsGroup(l);let o=n.getShiftedBy(r),a=this.mergeAttributes(n);
8return a.isEqual(n)||o.offset--,new M(a,this.mergeAttributes(o))}_wrapChildren(e,t,i,s){let n=t,r=[];for(;n<i;){let a=e.getChild(n),l=a.is("$text"),c=a.is("attributeElement");if(c&&a._canMergeAttributesFrom(s))a._mergeAttributesFrom(s),r.push(new v(e,n));else if(l||!c||o0(s,a)){let u=s._clone();a._remove(),u._appendChild(a),e._insertChild(n,u),this._addToClonedElementsGroup(u),r.push(new v(e,n))}else this._wrapChildren(a,0,a.childCount,s);n++}let o=0;for(let a of r)a.offset-=o,a.offset!=t&&(this.mergeAttributes(a).isEqual(a)||(o++,i--));return M._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,s){let n=t,r=[];for(;n<i;){let a=e.getChild(n);if(!a.is("attributeElement")){n++;continue}if(a.isSimilar(s)){let l=a.getChildren(),c=a.childCount;a._remove(),e._insertChild(n,l),this._removeFromClonedElementsGroup(a),r.push(new v(e,n),new v(e,n+c)),n+=c,i+=c-1;continue}if(a._canSubtractAttributesOf(s)){a._subtractAttributesOf(s),r.push(new v(e,n),new v(e,n+1)),n++;continue}this._unwrapChildren(a,0,a.childCount,s),n++}let o=0;for(let a of r)a.offset-=o,!(a.offset==t||a.offset==i)&&(this.mergeAttributes(a).isEqual(a)||(o++,i--));return M._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){let{start:i,end:s}=this._breakAttributesRange(e,!0),n=i.parent,r=this._wrapChildren(n,i.offset,s.offset,t),o=this.mergeAttributes(r.start);return o.isEqual(r.start)||r.end.offset--,new M(o,this.mergeAttributes(r.end))}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Yl(e.clone());e.parent.is("$text")&&(e=to(e));let i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);let s=new M(e,e.getShiftedBy(1));this.wrap(s,t);let n=new v(i.parent,i.index);i._remove();let r=n.nodeBefore,o=n.nodeAfter;return r&&r.is("view:$text")&&o&&o.is("view:$text")?Ql(r,o):Yl(n)}_breakAttributesRange(e,t=!1){let i=e.start,s=e.end;if(ys(e,this.document),e.isCollapsed){let a=this._breakAttributes(e.start,t);return new M(a,a)}let n=this._breakAttributes(s,t),r=n.parent.childCount,o=this._breakAttributes(i,t);return n.offset+=n.parent.childCount-r,new M(o,n)}_breakAttributes(e,t=!1){let i=e.offset,s=e.parent;if(e.parent.is("emptyElement"))throw new f("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new f("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new f("view-writer-cannot-break-raw-element",this.document);if(!t&&s.is("$text")&&lo(s.parent)||lo(s))return e.clone();if(s.is("$text"))return this._breakAttributes(to(e),t);if(i==s.childCount){let n=new v(s.parent,s.index+1);return this._breakAttributes(n,t)}else if(i===0){let n=new v(s.parent,s.index);return this._breakAttributes(n,t)}else{let n=s.index+1,r=s._clone();s.parent._insertChild(n,r),this._addToClonedElementsGroup(r);let o=s.childCount-i,a=s._removeChildren(i,o);r._appendChild(a);let l=new v(s.parent,n);return this._breakAttributes(l,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(let s of e.getChildren())this._addToClonedElementsGroup(s);let 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(let s of e.getChildren())this._removeFromClonedElementsGroup(s);let t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i&&i.delete(e)}};function r0(e){return Array.from(e.getChildren()).some(t=>!t.is("uiElement"))}function ao(e){let t=e.parent;for(;!lo(t);){if(!t)return;t=t.parent}return t}function o0(e,t){return e.priority<t.priority?!0:e.priority>t.priority?!1:e.getIdentity()<t.getIdentity()}function Yl(e){let t=e.nodeBefore;if(t&&t.is("$text"))return new v(t,t.data.length);let i=e.nodeAfter;return i&&i.is("$text")?new v(i,0):e}function to(e){if(e.offset==e.parent.data.length)return new v(e.parent.parent,e.parent.index+1);if(e.offset===0)return new v(e.parent.parent,e.parent.index);let t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new be(e.root.document,t)),new v(e.parent.parent,e.parent.index+1)}function Ql(e,t){let i=e.data.length;return e._data+=t.data,t._remove(),new v(e,i)}var a0=[be,Bi,Ss,yo,ko,Nn];function Hc(e,t){for(let i of e){if(!a0.some(s=>i instanceof s))throw new f("view-writer-insert-invalid-node-type",t);i.is("$text")||Hc(i.getChildren(),t)}}function lo(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function ys(e,t){let i=ao(e.start),s=ao(e.end);if(!i||!s||i!==s)throw new f("view-writer-invalid-range-container",t)}function l0(e){return se(e)}var Uc=e=>e.createTextNode("\xA0"),Wc=e=>{let t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText="\xA0",t},qc=e=>{let t=e.createElement("br");return t.dataset.ckeFiller="true",t};var Ps="\u2060".repeat(7);function ke(e){return typeof e=="string"?e.substr(0,7)===Ps:q(e)&&e.data.substr(0,7)===Ps}function Vi(e){return e.data.length==7&&ke(e)}function Xl(e){let t=typeof e=="string"?e:e.data;return ke(e)?t.slice(7):t}function c0(e){e.document.on("arrowKey",u0,{priority:"low"})}function u0(e,t){if(t.keyCode==L.arrowleft){let i=t.domTarget.ownerDocument.defaultView.getSelection();if(i.rangeCount==1&&i.getRangeAt(0).collapsed){let s=i.getRangeAt(0).startContainer,n=i.getRangeAt(0).startOffset;ke(s)&&n<=7&&i.collapse(s,0)}}}var d0=z(),h0=class extends d0{domDocuments=new Set;domConverter;markedAttributes=new Set;markedChildren=new Set;markedTexts=new Set;selection;_inlineFiller=null;_fakeSelectionContainer=null;constructor(e,t){super(),this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),I.isBlink&&!I.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||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 f("view-renderer-unknown-type",this)}}
8render(){if(this.isComposing&&!I.isAndroid)return;let e=null,t=I.isBlink&&!I.isAndroid?!this.isSelecting:!0;for(let 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(let i of this.markedAttributes)this._updateAttrs(i);for(let i of this.markedChildren)this._updateChildren(i,{inlineFillerPosition:e});for(let i of this.markedTexts)!this.markedChildren.has(i.parent)&&this.domConverter.mapViewToDom(i.parent)&&this._updateText(i,{inlineFillerPosition:e});if(t)if(e){let i=this.domConverter.viewPositionToDom(e),s=i.parent.ownerDocument;ke(i.parent)?this._inlineFiller=i.parent:this._inlineFiller=ec(s,i.parent,i.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){let t=this.domConverter.mapViewToDom(e);if(!t)return;let i=Array.from(t.childNodes),s=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),n=this._diffNodeLists(i,s),r=this._findUpdateActions(n,i,s,m0);if(r.indexOf("update")!==-1){let o={equal:0,insert:0,delete:0};for(let a of r)if(a==="update"){let l=o.equal+o.insert,c=o.equal+o.delete,u=e.getChild(l);u&&!u.is("uiElement")&&!u.is("rawElement")&&this._updateElementMappings(u,i[c]),Wr(s[l]),o.equal++}else o[a]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){let 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;let e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&q(t.parent)&&ke(t.parent))}_removeInlineFiller(){let e=this._inlineFiller;if(!ke(e))throw new f("view-renderer-filler-was-lost",this);Vi(e)?e.remove():e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;let e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!f0(t))return!1;let s=e.nodeBefore,n=e.nodeAfter;return!(s instanceof be||n instanceof be||i===t.getFillerOffset()&&(!s||!s.is("element","br"))||I.isAndroid&&(s||n))}_updateText(e,t){let i=this.domConverter.findCorrespondingDomText(e),s=this.domConverter.viewToDom(e).data,n=t.inlineFillerPosition;n&&n.parent==e.parent&&n.offset==e.index&&(s=Ps+s),this._updateTextNode(i,s)}_updateAttrs(e){let t=this.domConverter.mapViewToDom(e);if(t){for(let i of Array.from(t.attributes)){let s=i.name;e.hasAttribute(s)||this.domConverter.removeDomElementAttribute(t,s)}for(let i of e.getAttributeKeys())this.domConverter.setDomElementAttribute(t,i,e.getAttribute(i),e)}}_updateChildren(e,t){let i=this.domConverter.mapViewToDom(e);if(!i)return;if(I.isAndroid){let u=null;for(let d of Array.from(i.childNodes)){if(u&&q(u)&&q(d)){i.normalize();break}u=d}}let s=t.inlineFillerPosition,n=i.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));s&&s.parent===e&&ec(i.ownerDocument,r,s.offset);let o=this._diffNodeLists(n,r),a=this._findUpdateActions(o,n,r,g0),l=0,c=new Set;for(let u of a)u==="delete"?(c.add(n[l]),Wr(n[l])):(u==="equal"||u==="update")&&l++;l=0;for(let u of a)u==="insert"?(Hr(i,l,r[l]),l++):u==="update"?(this._updateTextNode(n[l],r[l].data),l++):u==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(r[l])),l++);for(let u of c)u.parentNode||this.domConverter.unbindDomElement(u)}_diffNodeLists(e,t){return e=b0(e,this._fakeSelectionContainer),Vt(e,t,p0.bind(null,this.domConverter))}
8_findUpdateActions(e,t,i,s){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let n=[],r=[],o=[],a={equal:0,insert:0,delete:0};for(let l of e)l==="insert"?o.push(i[a.equal+a.insert]):l==="delete"?r.push(t[a.equal+a.delete]):(n=n.concat(Vt(r,o,s).map(c=>c==="equal"?"update":c)),n.push("equal"),r=[],o=[]),a[l]++;return n.concat(Vt(r,o,s).map(l=>l==="equal"?"update":l))}_updateTextNode(e,t){let i=e.data;i!=t&&(I.isAndroid&&this.isComposing&&i.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){let i=Or(e.data,t);for(let s of i)s.type==="insert"?e.insertData(s.index,s.values.join("")):e.deleteData(s.index,s.howMany)}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(let t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(I.isBlink&&!I.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}let e=this.domConverter.mapViewToDom(this.selection.editableElement);if(!this.isFocused||!e){!this.selection.isFake&&this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected&&this._removeFakeSelection();return}this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&I.isAndroid||this._updateDomSelection(e)}_updateFakeSelection(e){let t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=_0(t));let 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||"\xA0";let s=t.getSelection(),n=t.createRange();s.removeAllRanges(),n.selectNodeContents(i),s.addRange(n)}_updateDomSelection(e){let t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;let i=this.domConverter.viewPositionToDom(this.selection.anchor),s=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(i.parent,i.offset,s.parent,s.offset),I.isGecko&&w0(s,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;let t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){let 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(let e of this.domDocuments){let t=e.getSelection();if(t.rangeCount){let i=e.activeElement,s=this.domConverter.mapDomToView(i);i&&s&&t.removeAllRanges()}}}_removeFakeSelection(){let e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){let e=this.selection.editableElement;e&&this.domConverter.focus(e)}}};function f0(e){if(e.getAttribute("contenteditable")=="false")return!1;let t=e.findAncestor(i=>i.hasAttribute("contenteditable"));return!t||t.getAttribute("contenteditable")=="true"}function ec(e,t,i){let s=t instanceof Array?t:t.childNodes,n=s[i];if(q(n))return n.data=Ps+n.data,n;{let r=e.createTextNode(Ps);return Array.isArray(t)?s.splice(i,0,r):Hr(t,i,r),r}}function m0(e,t){return Qe(e)&&Qe(t)&&!q(e)&&!q(t)&&!Ai(e)&&!Ai(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function g0(e,t){return Qe(e)&&Qe(t)&&q(e)&&q(t)}function p0(e,t,i){return t===i?!0:q(t)&&q(i)?t.data===i.data:!!(e.isBlockFiller(t)&&e.isBlockFiller(i))}function w0(e,t){let i=e.parent,s=e.offset;if(q(i)&&Vi(i)&&(s=ti(i)+1,i=i.parentNode),i.nodeType!=Node.ELEMENT_NODE||s!=i.childNodes.length-1)return;let n=i.childNodes[s];n&&n.tagName=="BR"&&t.addRange(t.getRangeAt(0))}function b0(e,t){let i=Array.from(e);return i.length==0||!t||i[i.length-1]==t&&i.pop(),i}function _0(e){let t=e.createElement("div");
8return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent="\xA0",t}var v0=qc(_.document),y0=Uc(_.document),k0=Wc(_.document),xn="data-ck-unsafe-attribute-",tc="data-ck-unsafe-element",$c=class{document;renderingMode;blockFillerMode;preElements;blockElements;inlineObjectElements;unsafeElements;_domDocument;_domToViewMapping=new WeakMap;_viewToDomMapping=new WeakMap;_fakeSelectionMapping=new WeakMap;_rawContentElementMatcher=new ni;_inlineObjectElementMatcher=new ni;_elementsWithTemporaryCustomProperties=new Set;constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this.document=e,this.renderingMode=i,this.blockFillerMode=t||(i==="editing"?"br":"nbsp"),this.preElements=["pre","textarea"],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"?_.document:_.document.implementation.createHTMLDocument("")}get domDocument(){return this._domDocument}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new Bt(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){let t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(let i of 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"?!1:i==="img"&&(e==="src"||e==="srcset")||i==="source"&&e==="srcset"?!0:!t.replace(/\s+/g,"").match(/^(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data"){e.innerHTML=t;return}let i=new DOMParser().parseFromString(t,"text/html"),s=i.createDocumentFragment(),n=i.body.childNodes;for(;n.length>0;)s.appendChild(n[0]);let r=i.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),o=[],a;for(;a=r.nextNode();)o.push(a);for(let l of o){for(let u of l.getAttributeNames())this.setDomElementAttribute(l,u,l.getAttribute(u));let c=l.tagName.toLowerCase();this._shouldRenameElement(c)&&(rc(c),l.replaceWith(this._createReplacementDomElement(c,l)))}for(;e.firstChild;)e.firstChild.remove();e.append(s)}viewToDom(e,t={}){if(e.is("$text")){let i=this._processDataFromViewText(e);return this._domDocument.createTextNode(i)}else{let i=e;if(this.mapViewToDom(i))if(i.getCustomProperty("editingPipeline:doNotReuseOnce"))this._elementsWithTemporaryCustomProperties.add(i);else return this.mapViewToDom(i);let s;if(i.is("documentFragment"))s=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(s,i);else{if(i.is("uiElement"))return i.name==="$comment"?s=this._domDocument.createComment(i.getCustomProperty("$rawContent")):s=i.render(this._domDocument,this),t.bind&&this.bindElements(s,i),s;this._shouldRenameElement(i.name)?(rc(i.name),s=this._createReplacementDomElement(i.name)):i.hasAttribute("xmlns")?s=this._domDocument.createElementNS(i.getAttribute("xmlns"),i.name):s=this._domDocument.createElement(i.name),i.is("rawElement")&&i.render(s,this),t.bind&&this.bindElements(s,i);for(let n of i.getAttributeKeys())this.setDomElementAttribute(s,n,i.getAttribute(n),i)}if(t.withChildren!==!1)for(let n of this.viewChildrenToDom(i,t))s instanceof HTMLTemplateElement?s.content.appendChild(n):s.appendChild(n);return s}}setDomElementAttribute(e,t,i,s){let n=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(t);if(n||N("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),!Vl(t)){N("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});return}e.hasAttribute(t)&&!n?e.removeAttribute(t):e.hasAttribute(xn+t)&&n&&e.removeAttribute(xn+t),e.setAttribute(n?t:xn+t,i)}removeDomElementAttribute(e,t){t!=tc&&(e.removeAttribute(t),e.removeAttribute(xn+t))}*viewChildrenToDom(e,t={}){let i=e.getFillerOffset&&e.getFillerOffset(),s=0;for(let n of e.getChildren()){i===s&&(yield this._getBlockFiller());let r=n.is("element")&&!!n.getCustomProperty("dataPipeline:transparentRendering")&&!ye(n.getAttributes());if(r&&this.renderingMode=="data")if(n.is("rawElement")){let o=this._domDocument.createElement(n.name);n.render(o,this),yield*[...o.childNodes]}else yield*this.viewChildrenToDom(n,t);else r&&N("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:n}),yield this.viewToDom(n,t);s++}i===s&&(yield this._getBlockFiller())}viewRangeToDom(e){let 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){let t=e.parent;if(t.is("$text")){let i=this.findCorrespondingDomText(t);if(!i)return null;let s=e.offset;return ke(i)&&(s+=7),i.data&&s>i.data.length&&(s=i.data.length),{parent:i,offset:s}}else{let i,s,n;if(e.offset===0){if(i=this.mapViewToDom(t),!i)return null;
8n=i.childNodes[0]}else{let o=e.nodeBefore;if(s=o.is("$text")?this.findCorrespondingDomText(o):this.mapViewToDom(o),!s)return null;i=s.parentNode,n=s.nextSibling}if(q(n)&&ke(n))return{parent:n,offset:7};let r=s?ti(s)+1:0;return{parent:i,offset:r}}}domToView(e,t={}){let i=[],s=this._domToView(e,t,i),n=s.next().value;return!n||(s.next(),this._processDomInlineNodes(null,i,t),this.blockFillerMode=="br"&&sc(n))||n.is("$text")&&n.data.length==0?null:n}*domChildrenToView(e,t={},i=[]){let s;e instanceof HTMLTemplateElement?s=[...e.content.childNodes]:s=[...e.childNodes];for(let n=0;n<s.length;n++){let r=s[n],o=this._domToView(r,t,i),a=o.next().value;a!==null&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,i,t),this.blockFillerMode=="br"&&sc(a)||(yield a),o.next())}this._processDomInlineNodes(e,i,t)}domSelectionToView(e){if(T0(e))return new Bt([]);if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;q(s)&&(s=s.parentNode);let n=this.fakeSelectionToView(s);if(n)return n}let t=this.isDomSelectionBackward(e),i=[];for(let s=0;s<e.rangeCount;s++){let n=e.getRangeAt(s),r=this.domRangeToView(n);r&&i.push(r)}return new Bt(i,{backward:t})}domRangeToView(e){let t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new M(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,ti(e));let i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return v._createBefore(i);if(q(e)){if(Vi(e))return this.domPositionToView(e.parentNode,ti(e));let s=this.findCorrespondingViewText(e),n=t;return s?(ke(e)&&(n-=7,n=n<0?0:n),new v(s,n)):null}else{if(t===0){let s=this.mapDomToView(e);if(s)return new v(s,0)}else{let s=e.childNodes[t-1];if(q(s)&&Vi(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,ti(s));let n=q(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(n&&n.parent)return new v(n.parent,n.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Vi(e))return null;let t=this.getHostViewElement(e);if(t)return t;let i=e.previousSibling;if(i){if(!this.isElement(i))return null;let s=this.mapDomToView(i);if(s){let n=s.nextSibling;return n instanceof be?n:null}}else{let s=this.mapDomToView(e.parentNode);if(s){let n=s.getChild(0);return n instanceof be?n:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){let 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){let t=this.mapViewToDom(e);if(!t||t.ownerDocument.activeElement===t)return;let{scrollX:i,scrollY:s}=_.window,n=[];ic(t,r=>{let{scrollLeft:o,scrollTop:a}=r;n.push([o,a])}),t.focus({preventScroll:!0}),ic(t,r=>{let[o,a]=n.shift();r.scrollLeft=o,r.scrollTop=a}),_.window.scrollTo(i,s)}_clearDomSelection(){let e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;let t=e.ownerDocument.defaultView.getSelection(),i=this.domSelectionToView(t);i&&i.rangeCount>0&&t.removeAllRanges()}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(v0):nc(e,this.blockElements)?!0:e.isEqualNode(k0)||I0(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;let t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}let i=t.collapsed;return t.detach(),i}getHostViewElement(e){let t=Dr(e);for(t.pop();t.length;){let 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)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(let e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Uc(this._domDocument);case"markedNbsp":return Wc(this._domDocument);case"br":return qc(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(q(e)&&ke(e)&&t<7||this.isElement(e)&&ke(e.childNodes[t]))return!1;let i=this.mapDomToView(e);return!(i&&(i.is("uiElement")||i.is("rawElement")))}*_domToView(e,t,i){if(this.blockFillerMode!="br"&&nc(e,this.blockElements))return null;let s=this.getHostViewElement(e);
8if(s)return s;if(Ai(e)&&t.skipComments)return null;if(q(e)){if(Vi(e))return null;{let n=e.data;if(n==="")return null;let r=new be(this.document,n);return i.push(r),r}}else{let n=this.mapDomToView(e);if(n)return this._isInlineObjectElement(n)&&i.push(n),n;if(this.isDocumentFragment(e))n=new Oi(this.document),t.bind&&this.bindDocumentFragments(e,n);else{n=this._createViewElement(e,t),t.bind&&this.bindElements(e,n);let o=e.attributes;if(o)for(let a=o.length,l=0;l<a;l++)n._setAttribute(o[l].name,o[l].value);if(this._isViewElementWithRawContent(n,t))return n._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(n)||i.push(n),n;if(Ai(e))return n._setCustomProperty("$rawContent",e.data),n}yield n;let r=[];if(t.withChildren!==!1)for(let o of this.domChildrenToView(e,t,r))n._appendChild(o);if(this._isInlineObjectElement(n))i.push(n),this._processDomInlineNodes(null,r,t);else for(let o of r)i.push(o)}}_processDomInlineNodes(e,t,i){if(!t.length||e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let s=!1;for(let n=0;n<t.length;n++){let r=t[n];if(!r.is("$text")){s=!1;continue}let o,a=!1;if(this._isPreFormatted(r))o=Xl(r.data);else{o=r.data.replace(/[ \n\t\r]{1,}/g," "),a=/[^\S\u00A0]/.test(o.charAt(o.length-1));let l=n>0?t[n-1]:null,c=n+1<t.length?t[n+1]:null,u=!l||l.is("element")&&l.name=="br"||s,d=c?!1:!ke(r.data);i.withChildren!==!1&&(u&&(o=o.replace(/^ /,"")),d&&(o=o.replace(/ $/,""))),o=Xl(o),this.blockFillerMode!="br"&&r.parent&&(E0(r.parent,o)?(o="",r.parent.parent&&(r.parent.parent._setCustomProperty("$hasBlockFiller",!0),r.parent._remove())):x0(r.parent,o,this.blockElements)&&(o="",r.parent._setCustomProperty("$hasBlockFiller",!0))),o=o.replace(/ \u00A0/g," ");let h=c&&c.is("element")&&c.name!="br",m=c&&c.is("$text")&&c.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(o)||!c||h||m)&&(o=o.replace(/\u00A0$/," ")),(u||l&&l.is("element")&&l.name!="br")&&(o=o.replace(/^\u00A0/," "))}o.length==0&&r.parent?(r._remove(),t.splice(n,1),n--):(r._data=o,s=a)}t.length=0}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(t.charAt(0)==" "){let i=this._getTouchingInlineViewNode(e,!1);(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i)||!i)&&(t="\xA0"+t.substr(1))}if(t.charAt(t.length-1)==" "){let 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)+"\xA0")}return t.replace(/ {2}/g," \xA0")}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return!1;let t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_isPreFormatted(e){if(C0(e,this.preElements))return!0;for(let t of e.getAncestors({parentFirst:!0}))if(!(!t.is("element")||!t.hasStyle("white-space")||t.getStyle("white-space")==="inherit"))return["pre","pre-wrap","break-spaces"].includes(t.getStyle("white-space"));return!1}_getTouchingInlineViewNode(e,t){let i=new si({startPosition:t?v._createAfter(e):v._createBefore(e),direction:t?"forward":"backward"});for(let{item:s}of i){if(s.is("$textProxy"))return s;if(s.is("element")&&s.getCustomProperty("dataPipeline:transparentRendering"))continue;if(s.is("element","br"))return null;if(this._isInlineObjectElement(s))return s;if(s.is("containerElement")||this._isBlockViewElement(s))return null}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return e.is("element")?e.name=="br"||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e):!1}_createViewElement(e,t){if(Ai(e))return new Nn(this.document,"$comment");let i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new ai(this.document,i)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){let t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){let i=this._domDocument.createElement("span");if(i.setAttribute(tc,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(let s of t.getAttributeNames())i.setAttribute(s,t.getAttribute(s))}return i}};function C0(e,t){return e.getAncestors().some(i=>i.is("element")&&t.includes(i.name))}function ic(e,t){let i=e;for(;i;)t(i),i=i.parentElement}function I0(e,t){return e.isEqualNode(y0)&&Kc(e,t)&&e.parentNode.childNodes.length===1}function Kc(e,t){let i=e.parentNode;return!!i&&!!i.tagName&&t.includes(i.tagName.toLowerCase())}function x0(e,t,i){return t=="\xA0"&&e&&e.is("element")&&e.childCount==1&&i.includes(e.name)}function E0(e,t){return t=="\xA0"&&e&&e.is("element","span")&&e.childCount==1&&e.hasAttribute("data-cke-filler")}function sc(e){return e.is("element","br")&&e.hasAttribute("data-cke-filler")}function nc(e,t){return e.tagName==="BR"&&Kc(e,t)&&e.parentNode.childNodes.length===1}function rc(e){e==="script"&&N("domconverter-unsafe-script-element-detected"),e==="style"&&N("domconverter-unsafe-style-element-detected")}function T0(e){if(!I.isGecko||!e.rangeCount)return!1;let t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch{return!0}return!1}var A0=ge(),Te=class extends A0{view;document;_isEnabled=!1;constructor(e){super(),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] *")}};var bt=class{view;document;domEvent;domTarget;constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,ns(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}};var We=class extends Te{useCapture=!1;usePassive=!1;observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(i,s)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(s.target)&&this.onDomEvent(s)},{useCapture:this.useCapture,usePassive:this.usePassive})})}stopObserving(e){this.stopListening(e)}fire(e,t,i){this.isEnabled&&this.document.fire(e,new bt(this.view,t,i))}};var S0=class extends We{domEventType=["keydown","keyup"];onDomEvent(e){let t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return ft(this)}};this.fire(e.type,e,t)}};var P0=class extends Te{_fireSelectionChangeDoneDebounced;constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Pe(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){let 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){let t=this.document.selection,i=new Bt(t.getRanges(),{backward:t.isBackward,fake:!1});(e==L.arrowleft||e==L.arrowup)&&i.setTo(i.getFirstPosition()),(e==L.arrowright||e==L.arrowdown)&&i.setTo(i.getLastPosition());let s={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",s),this._fireSelectionChangeDoneDebounced(s)}};var jc=class extends Te{domConverter;_config;_domElements;_mutationObserver;constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,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(let t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(let 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;let t=this.domConverter,i=new Set,s=new Set;for(let r of e){let o=t.mapDomToView(r.target);o&&(o.is("uiElement")||o.is("rawElement")||r.type==="childList"&&!this._isBogusBrMutation(r)&&s.add(o))}for(let r of e){let o=t.mapDomToView(r.target);if(!(o&&(o.is("uiElement")||o.is("rawElement")))&&r.type==="characterData"){let a=t.findCorrespondingViewText(r.target);a&&!s.has(a.parent)?i.add(a):!a&&ke(r.target)&&s.add(t.mapDomToView(r.target.parentNode))}}let n=[];for(let r of i)n.push({type:"text",node:r});for(let r of s){let o=t.mapViewToDom(r);rs(Array.from(r.getChildren()),Array.from(t.domChildrenToView(o,{withChildren:!1})),L0)||n.push({type:"children",node:r})}n.length&&this.document.fire("mutations",{mutations:n})}_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 L0(e,t){if(!Array.isArray(e))return e===t?!0:e.is("$text")&&t.is("$text")?e.data===t.data:!1}var Ls=class extends We{_renderTimeoutId=null;_isFocusChanging=!1;
8domEventType=["focus","blur"];constructor(e){super(e),this.useCapture=!0;let t=this.document;t.on("focus",()=>this._handleFocus()),t.on("blur",(i,s)=>this._handleBlur(s)),t.on("beforeinput",()=>{t.isFocused||this._handleFocus()},{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this._renderTimeoutId=null,this.flush(),this.view.change(()=>{})},50)}_handleBlur(e){let t=this.document.selection.editableElement;(t===null||t===e.target)&&(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change(()=>{}))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}};var V0=class extends Te{mutationObserver;focusObserver;selection;domConverter;_documents=new WeakSet;_fireSelectionChangeDoneDebounced;_clearInfiniteLoopInterval;_documentIsSelectingInactivityTimeoutDebounced;_loopbackCounter=0;_pendingSelectionChange=new Set;constructor(e){super(e),this.mutationObserver=e.getObserver(jc),this.focusObserver=e.getObserver(Ls),this.selection=this.document.selection,this.domConverter=e.domConverter,this._fireSelectionChangeDoneDebounced=Pe(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=Pe(()=>this.document.isSelecting=!1,5e3),this.view.document.on("change:isFocused",(t,i,s)=>{if(s&&this._pendingSelectionChange.size){for(let n of Array.from(this._pendingSelectionChange))this._handleSelectionChange(n);this._pendingSelectionChange.clear()}})}observe(e){let t=e.ownerDocument,i=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},s=()=>{this.document.isSelecting&&(this._handleSelectionChange(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",()=>{this.document.isComposing&&!I.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced())}),this.listenTo(this.view.document,"compositionstart",()=>{this._handleSelectionChange(t)},{priority:"lowest"}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;let t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();let i=this.domConverter.domSelectionToView(t);if(i.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.view.document.isFocused&&!this.view.document.isReadOnly){this._pendingSelectionChange.add(e);return}if(this._pendingSelectionChange.delete(e),!(this.selection.isEqual(i)&&this.domConverter.isDomSelectionCorrect(t))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(!M0(i))this.view.forceRender();else if(this.selection.isSimilar(i))this.view.forceRender();else{let s={oldSelection:this.selection,newSelection:i,domSelection:t};this.document.fire("selectionChange",s),this._fireSelectionChangeDoneDebounced(s)}}}_clearInfiniteLoop(){this._loopbackCounter=0}};function M0(e){return Array.from(e.getRanges()).flatMap(t=>[t.start.root,t.end.root]).every(t=>t&&t.is("rootElement"))}var B0=class extends We{domEventType=["compositionstart","compositionupdate","compositionend"];constructor(e){super(e);let t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}};var Co=class{_files;_native;constructor(e,t={}){this._files=t.cacheFiles?oc(e):null,this._native=e}get files(){return this._files||(this._files=oc(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 oc(e){let t=Array.from(e.files||[]),i=Array.from(e.items||[]);return t.length?t:i.filter(s=>s.kind==="file").map(s=>s.getAsFile())}var O0=class extends We{domEventType="beforeinput";onDomEvent(e){let t=e.getTargetRanges(),i=this.view,s=i.document,n=null,r=null,o=[];if(e.dataTransfer&&(n=new Co(e.dataTransfer)),e.data!==null?r=e.data:n&&(r=n.getData("text/plain")),s.selection.isFake)o=Array.from(s.selection.getRanges()),e.preventDefault();else if(t.length)o=t.map(a=>{let l=i.domConverter.domPositionToView(a.startContainer,a.startOffset),c=i.domConverter.domPositionToView(a.endContainer,a.endOffset);if(l&&ke(a.startContainer)&&a.startOffset<7){e.preventDefault();let u=7-a.startOffset;l=l.getLastMatchingPosition(d=>!!(d.item.is("attributeElement")||d.item.is("uiElement")||d.item.is("$textProxy")&&u--),{direction:"backward",singleCharacters:!0})}if(R0(a.endContainer,a.endOffset)&&e.preventDefault(),l)return i.createRange(l,c);if(c)return i.createRange(c)}).filter(a=>!!a);else if(I.isAndroid){let a=e.target.ownerDocument.defaultView.getSelection();o=Array.from(i.domConverter.domSelectionToView(a).getRanges())}if(I.isAndroid&&e.inputType=="insertCompositionText"&&r&&r.endsWith(` 9`)){this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(o[0].end)]});return}if(["insertText","insertReplacementText"].includes(e.inputType)&&r&&r.includes(` 10`)){let a=r.split(/\n{1,2}/g),l=o;e.preventDefault();for(let c=0;c<a.length;c++){let u=a[c];u!=""&&(this.fire(e.type,e,{data:u,dataTransfer:n,targetRanges:l,inputType:e.inputType,isComposing:e.isComposing}),l=[s.selection.getFirstRange()]),c+1<a.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:l}),l=[s.selection.getFirstRange()])}return}this.fire(e.type,e,{data:r,dataTransfer:n,targetRanges:o,inputType:e.inputType,isComposing:e.isComposing})}};function R0(e,t){for(;e.parentNode;){if(q(e)){if(t!=e.data.length)return!1}else if(t!=e.childNodes.length)return!1;if(t=ti(e)+1,e=e.parentNode,t<e.childNodes.length&&ke(e.childNodes[t]))return!0}return!1}var F0=class extends Te{constructor(e){super(e),this.document.on("key
10down",(t,i)=>{if(this.isEnabled&&Nl(i.keyCode)){let s=new wt(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(s,i),s.stop.called&&t.stop()}})}observe(){}stopObserving(){}};var D0=class extends Te{constructor(e){super(e);let t=this.document;t.on("keydown",(i,s)=>{if(!this.isEnabled||s.keyCode!=L.tab||s.ctrlKey)return;let n=new wt(t,"tab",t.selection.getFirstRange());t.fire(n,s),n.stop.called&&i.stop()})}observe(){}stopObserving(){}};var N0=z(),z0=class extends N0{document;domConverter;domRoots=new Map;_renderer;_initialDomRootAttributes=new WeakMap;_observers=new Map;_writer;_ongoingChange=!1;_postFixersInProgress=!1;_renderingDisabled=!1;_hasChangedSinceTheLastRendering=!1;constructor(e){super(),this.document=new Nc(e),this.domConverter=new $c(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new h0(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new zc(this.document),this.addObserver(jc),this.addObserver(Ls),this.addObserver(V0),this.addObserver(S0),this.addObserver(P0),this.addObserver(B0),this.addObserver(F0),this.addObserver(O0),this.addObserver(D0),c0(this),Xg(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}),I.isiOS&&this.listenTo(this.document,"blur",(t,i)=>{this.domConverter.mapDomToView(i.domEvent.relatedTarget)||this.domConverter._clearDomSelection()}),this.listenTo(this.document,"mutations",(t,{mutations:i})=>{i.forEach(s=>this._renderer.markToSync(s.type,s.node))},{priority:"low"}),this.listenTo(this.document,"mutations",()=>{this.forceRender()},{priority:"lowest"})}attachDomRoot(e,t="main"){let i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();let s={};for(let{name:r,value:o}of Array.from(e.attributes))s[r]=o,r==="class"?this._writer.addClass(o.split(" "),i):i.hasAttribute(r)||this._writer.setAttribute(r,o,i);this._initialDomRootAttributes.set(e,s);let n=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};n(),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",(r,o)=>this._renderer.markToSync("children",o)),i.on("change:attributes",(r,o)=>this._renderer.markToSync("attributes",o)),i.on("change:text",(r,o)=>this._renderer.markToSync("text",o)),i.on("change:isReadOnly",()=>this.change(n)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(let r of this._observers.values())r.observe(e,t)}detachDomRoot(e){let t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:s})=>t.removeAttribute(s));let i=this._initialDomRootAttributes.get(t);for(let s in i)t.setAttribute(s,i[s]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(let 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(let[i,s]of this.domRoots)t.observe(s,i);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(let e of this._observers.values())e.disable()}enableObservers(){for(let e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:i=20,ancestorOffset:s=20}={}){let n=this.document.selection.getFirstRange();if(!n)return;let r=ie({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:s});typeof i=="number"&&(i={top:i,bottom:i,left:i,right:i});let o={target:this.domConverter.viewRangeToDom(n),viewportOffset:i,ancestorOffset:s,alignToTo
10p:e,forceScroll:t};this.fire("scrollToTheSelection",o,r),Bl(o)}focus(){if(!this.document.isFocused){let e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new f("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;let 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){f.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(Ls).flush(),this.change(()=>{})}destroy(){for(let 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 M(e,t)}createRangeOn(e){return M._createOn(e)}createRangeIn(e){return M._createIn(e)}createSelection(...e){return new Bt(...e)}_disableRendering(e){this._renderingDisabled=e,e==!1&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}};var Ot=class{is(){throw new Error("is() method is abstract")}};var tt=class extends Ot{textNode;data;offsetInText;constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new f("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new f("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(){let e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){let t=[],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()}};tt.prototype.is=function(e){return e==="$textProxy"||e==="model:$textProxy"||e==="textProxy"||e==="model:textProxy"};var He=class{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;_visitedParent;constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new f("model-tree-walker-no-start-position",null);let t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new f("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=b._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,n;do s=this.position,n=this._visitedParent,{done:t,value:i}=this.next();while(!t&&e(i));t||(this._position=s,this._visitedParent=n)}jumpTo(e){this._boundaryStartParent&&e.isBefore(this.boundaries.start)?e=this.boundaries.start:this._boundaryEndParent&&e.isAfter(this.boundaries.end)&&(e=this.boundaries.end),this._position=e.clone(),this._visitedParent=e.parent}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let 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};let s=Es(t,i),n=s||Gc(t,i,s);if(n&&n.is("model:element")){if(!this.shallow)t.path.push(0),this._visitedParent=n;else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,ii("elementStart",n,e,t,1)}if(n&&n.is("model:$text")){let r;if(this.singleCharacters)r=1;else{let a=n.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<a&&(a=this.boundaries.end.offset),r=a-t.offset}let o=new tt(n,t.offset-n.startOffset,r);return t.offset+=r,this._position=t,ii("text",o,e,t,r)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():ii("elementEnd",i,e,t)}_previous(){let 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};let s=t.parent,n=Es(t,s),r=n||Zc(t,s,n);if(r&&r.is("model:element"))return t.offset--,this.shallow?(this._position=t,ii("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this._position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():ii("elementEnd",r,e,t));if(r&&r.is("model:$text")){let o;if(this.singleCharacters)o=1;else{let l=r.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>l&&(l=this.boundaries.start.offset),o=t.offset-l}let a=new tt(r,t.offset-r.startOffset-o,o);return t.offset-=o,this._position=t,ii("text",a,e,t,o)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,ii("elementStart",i,e,t,1)}};function ii(e,t,i,s,n){return{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:s,length:n}}}var b=class Ne extends Ot{root;path;stickiness;constructor(t,i,s="toNone"){if(super(),!t.is("element")&&!t.is("documentFragment"))throw new f("model-position-root-invalid",t);if(!Array.isArray(i)||i.length===0)throw new f("model-position-path-incorrect-format",t,{path:i});t.is("rootElement")?i=i.slice():(i=[...t.getPath(),...i],t=t.root),this.root=t,this.path=i,this.stickiness=s}get offset(){return this.path[this.path.length-1]}set offset(t){this.path[this.path.length-1]=t}get parent(){let t=this.root;for(let i=0;i<this.path.length-1;i++)if(t=t.getChildAtOffset(this.path[i]),!t)throw new f("model-position-path-incorrect",this,{position:this});if(t.is("$text"))throw new f("model-position-path-incorrect",this,{position:this});return t}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Es(this,this.parent)}get nodeAfter(){let t=this.parent;return Gc(this,t,Es(this,t))}get nodeBefore(){let t=this.parent;return Zc(this,t,Es(this,t))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}isValid(){if(this.offset<0)return!1;let t=this.root;for(let i=0;i<this.path.length-1;i++)if(t=t.getChildAtOffset(this.path[i]),!t)return!1;return this.offset<=t.maxOffset}compareWith(t){if(this.root!=t.root)return"different";let i=ne(this.path,t.path);switch(i){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[i]<t.path[i]?"before":"after"}}
10getLastMatchingPosition(t,i={}){i.startPosition=this;let s=new He(i);return s.skip(t),s.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){let t=this.parent;return t.is("documentFragment")?[t]:t.getAncestors({includeSelf:!0})}findAncestor(t){let i=this.parent;return i.is("element")?i.findAncestor(t,{includeSelf:!0}):null}getCommonPath(t){if(this.root!=t.root)return[];let i=ne(this.path,t.path),s=typeof i=="string"?Math.min(this.path.length,t.path.length):i;return this.path.slice(0,s)}getCommonAncestor(t){let i=this.getAncestors(),s=t.getAncestors(),n=0;for(;i[n]==s[n]&&i[n];)n++;return n===0?null:i[n-1]}getShiftedBy(t){let i=this.clone(),s=i.offset+t;return i.offset=s<0?0:s,i}isAfter(t){return this.compareWith(t)=="after"}isBefore(t){return this.compareWith(t)=="before"}isEqual(t){return this.compareWith(t)=="same"}isTouching(t){if(this.root!==t.root)return!1;let i=Math.min(this.path.length,t.path.length);for(let s=0;s<i;s++){let n=this.path[s]-t.path[s];if(n<-1||n>1)return!1;if(n===1)return ac(t,this,s);if(n===-1)return ac(this,t,s)}return this.path.length===t.path.length?!0:this.path.length>t.path.length?co(this.path,i):co(t.path,i)}hasSameParentAs(t){return this.root!==t.root?!1:ne(this.getParentPath(),t.getParentPath())=="same"}getTransformedByOperation(t){let i;switch(t.type){case"insert":i=this._getTransformedByInsertOperation(t);break;case"move":case"remove":case"reinsert":i=this._getTransformedByMoveOperation(t);break;case"split":i=this._getTransformedBySplitOperation(t);break;case"merge":i=this._getTransformedByMergeOperation(t);break;case"detach":i=this._getTransformedByDetachOperation(t);break;default:i=Ne._createAt(this);break}return i}_getTransformedByDetachOperation(t){return this._getTransformedByDeletion(t.sourcePosition,t.howMany)||Ne._createAt(t.sourcePosition)}_getTransformedByInsertOperation(t){return this._getTransformedByInsertion(t.position,t.howMany)}_getTransformedByMoveOperation(t){return this._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany)}_getTransformedBySplitOperation(t){let i=t.movedRange;return i.containsPosition(this)||i.start.isEqual(this)&&this.stickiness=="toNext"?this._getCombined(t.splitPosition,t.moveTargetPosition):t.graveyardPosition?this._getTransformedByMove(t.graveyardPosition,t.insertionPosition,1):this._getTransformedByInsertion(t.insertionPosition,1)}_getTransformedByMergeOperation(t){let i=t.movedRange,s=i.containsPosition(this)||i.start.isEqual(this),n;return s?(n=this._getCombined(t.sourcePosition,t.targetPosition),t.sourcePosition.isBefore(t.targetPosition)&&(n=n._getTransformedByDeletion(t.deletionPosition,1))):this.isEqual(t.deletionPosition)?n=Ne._createAt(t.deletionPosition):n=this._getTransformedByMove(t.deletionPosition,t.graveyardPosition,1),n}_getTransformedByDeletion(t,i){let s=Ne._createAt(this);if(this.root!=t.root)return s;if(ne(t.getParentPath(),this.getParentPath())=="same"){if(t.offset<this.offset){if(t.offset+i>this.offset)return null;s.offset-=i}}else if(ne(t.getParentPath(),this.getParentPath())=="prefix"){let n=t.path.length-1;if(t.offset<=this.path[n]){if(t.offset+i>this.path[n])return null;s.path[n]-=i}}return s}_getTransformedByInsertion(t,i){let s=Ne._createAt(this);if(this.root!=t.root)return s;if(ne(t.getParentPath(),this.getParentPath())=="same")(t.offset<this.offset||t.offset==this.offset&&this.stickiness!="toPrevious")&&(s.offset+=i);else if(ne(t.getParentPath(),this.getParentPath())=="prefix"){let n=t.path.length-1;t.offset<=this.path[n]&&(s.path[n]+=i)}return s}_getTransformedByMove(t,i,s){if(i=i._getTransformedByDeletion(t,s),t.isEqual(i))return Ne._createAt(this);let n=this._getTransformedByDeletion(t,s);return n===null||t.isEqual(this)&&this.stickiness=="toNext"||t.getShiftedBy(s).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(t,i):n._getTransformedByInsertion(i,s)}_getCombined(t,i){let s=t.path.length-1,n=Ne._createAt(i);return n.stickiness=this.stickiness,n.offset=n.offset+this.path[s]-t.offset,n.path=[...n.path,...this.path.slice(s+1)],n}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(t,i,s="toNone"){if(t.is("model:position"))return new Ne(t.root,t.path,t.stickiness);{let n=t;if(i=="end")i=n.maxOffset;else{if(i=="before")return this._createBefore(n,s);if(i=="after")return this._createAfter(n,s);if(i!==0&&!i)throw new f("model-createpositionat-offset-required",[this,t])}if(!n.is("element")&&!n.is("documentFragment"))throw new f("model-position-parent-incorrect",[this,t]);let r=n.getPath();return r.push(i),new this(n.root,r,s)}}static _createAfter(t,i){if(!t.parent)throw new f("model-position-after-root",[this,t],{root:t});return this._createAt(t.parent,t.endOffset,i)}static _createBefore(t,i){if(!t.parent)throw new f("model-position-before-root",t,{root:t});return this._createAt(t.parent,t.startOffset,i)}static fromJSON(t,i){if(t.root==="$graveyard"){let s=new Ne(i.graveyard,t.path);return s.stickiness=t.stickiness,s}if(!i.getRoot(t.root))throw new f("model-position-fromjson-no-root",i,{rootName:t.root});return new Ne(i.getRoot(t.root),t.path,t.stickiness)}};b.prototype.is=function(e){return e==="position"||e==="model:position"};function Es(e,t){let i=t.getChildAtOffset(e.offset);return i&&i.is("$text")&&i.startOffset<e.offset?i:null}function Gc(e,t,i){return i!==null?null:t.getChildAtOffset(e.offset)}function Zc(e,t,i){return i!==null?null:t.getChild(t.offsetToIndex(e.offset)-1)}function ac(e,t,i){return!(i+1===e.path.length||!co(t.path,i+1)||!H0(e,i+1))}function co(e,t){for(;t<e.length;){if(e[t]!==0)return!1;t++}return!0}function H0(e,t){let i=e.parent,s=e.path.length-1,n=0;for(;s>=t;){if(e.path[s]+n!==i.maxOffset)return!1;n=1,s--,i=i.parent}return!0}var p=class K extends Ot{start;end;constructor(t,i){super(),this.start=b._createAt(t),this.end=i?b._createAt(i):b._createAt(t),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new He({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return ne(this.start.getParentPath(),this.end.getParentPath())=="same"}get root(){return this.start.root}containsPosition(t){return t.isAfter(this.start)&&t.isBefore(this.end)}containsRange(t,i=!1){t.isCollapsed&&(i=!1);let s=this.containsPosition(t.start)||i&&this.start.isEqual(t.start),n=this.containsPosition(t.end)||i&&this.end.isEqual(t.end
10);return s&&n}containsItem(t){let i=b._createBefore(t);return this.containsPosition(i)||this.start.isEqual(i)}isEqual(t){return this.start.isEqual(t.start)&&this.end.isEqual(t.end)}isIntersecting(t){return this.start.isBefore(t.end)&&this.end.isAfter(t.start)}getDifference(t){let i=[];return this.isIntersecting(t)?(this.containsPosition(t.start)&&i.push(new K(this.start,t.start)),this.containsPosition(t.end)&&i.push(new K(t.end,this.end))):i.push(new K(this.start,this.end)),i}getIntersection(t){if(this.isIntersecting(t)){let i=this.start,s=this.end;return this.containsPosition(t.start)&&(i=t.start),this.containsPosition(t.end)&&(s=t.end),new K(i,s)}return null}getJoined(t,i=!1){let s=this.isIntersecting(t);if(s||(this.start.isBefore(t.start)?s=i?this.end.isTouching(t.start):this.end.isEqual(t.start):s=i?t.end.isTouching(this.start):t.end.isEqual(this.start)),!s)return null;let n=this.start,r=this.end;return t.start.isBefore(n)&&(n=t.start),t.end.isAfter(r)&&(r=t.end),new K(n,r)}getMinimalFlatRanges(){let t=[],i=this.start.getCommonPath(this.end).length,s=b._createAt(this.start),n=s.parent;for(;s.path.length>i+1;){let r=n.maxOffset-s.offset;r!==0&&t.push(new K(s,s.getShiftedBy(r))),s.path=s.path.slice(0,-1),s.offset++,n=n.parent}for(;s.path.length<=this.end.path.length;){let r=this.end.path[s.path.length-1],o=r-s.offset;o!==0&&t.push(new K(s,s.getShiftedBy(o))),s.offset=r,s.path.push(0)}return t}getWalker(t={}){return t.boundaries=this,new He(t)}*getItems(t={}){t.boundaries=this,t.ignoreElementEnd=!0;let i=new He(t);for(let s of i)yield s.item}*getPositions(t={}){t.boundaries=this;let i=new He(t);yield i.position;for(let s of i)yield s.nextPosition}getTransformedByOperation(t){switch(t.type){case"insert":return this._getTransformedByInsertOperation(t);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(t);case"split":return[this._getTransformedBySplitOperation(t)];case"merge":return[this._getTransformedByMergeOperation(t)];case"detach":return this._getTransformedByDetachOperation(t)}return[new K(this.start,this.end)]}getTransformedByOperations(t){let i=[new K(this.start,this.end)];for(let s of t)for(let n=0;n<i.length;n++){let r=i[n].getTransformedByOperation(s);i.splice(n,1,...r),n+=r.length-1}for(let s=0;s<i.length;s++){let n=i[s];for(let r=s+1;r<i.length;r++){let o=i[r];(n.containsRange(o)||o.containsRange(n)||n.isEqual(o))&&i.splice(r,1)}}return i}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let t=this.start.nodeAfter,i=this.end.nodeBefore;return t&&t.is("element")&&t===i?t:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(t,i=!1){return this._getTransformedByInsertion(t.position,t.howMany,i)}_getTransformedByMoveOperation(t,i=!1){let s=t.sourcePosition,n=t.howMany,r=t.targetPosition;return this._getTransformedByMove(s,r,n,i)}_getTransformedBySplitOperation(t){let i=this.start._getTransformedBySplitOperation(t),s=this.end._getTransformedBySplitOperation(t);return this.end.isEqual(t.insertionPosition)&&(s=this.end.getShiftedBy(1)),i.root!=s.root&&(s=this.end.getShiftedBy(-1)),new K(i,s)}_getTransformedByMergeOperation(t){if(this.start.isEqual(t.targetPosition)&&this.end.isEqual(t.deletionPosition))return new K(this.start);let i=this.start._getTransformedByMergeOperation(t),s=this.end._getTransformedByMergeOperation(t);return i.root!=s.root&&(s=this.end.getShiftedBy(-1)),i.isAfter(s)?(t.sourcePosition.isBefore(t.targetPosition)?(i=b._createAt(s),i.offset=0):(t.deletionPosition.isEqual(i)||(s=t.deletionPosition),i=t.targetPosition),new K(i,s)):new K(i,s)}_getTransformedByDetachOperation(t){let i=this._getTransformedByDeletion(t.sourcePosition,t.howMany);return i?[i]:[]}_getTransformedByInsertion(t,i,s=!1){if(s&&this.containsPosition(t))return[new K(this.start,t),new K(t.getShiftedBy(i),this.end._getTransformedByInsertion(t,i))];{let n=new K(this.start,this.end);return n.start=n.start._getTransformedByInsertion(t,i),n.end=n.end._getTransformedByInsertion(t,i),[n]}}_getTransformedByMove(t,i,s,n=!1){if(this.isCollapsed){let d=this.start._getTransformedByMove(t,i,s);
10return[new K(d)]}let r=K._createFromPositionAndShift(t,s),o=i._getTransformedByDeletion(t,s);if(this.containsPosition(i)&&!n&&(r.containsPosition(this.start)||r.containsPosition(this.end))){let d=this.start._getTransformedByMove(t,i,s),h=this.end._getTransformedByMove(t,i,s);return[new K(d,h)]}let a,l=this.getDifference(r),c=null,u=this.getIntersection(r);if(l.length==1?c=new K(l[0].start._getTransformedByDeletion(t,s),l[0].end._getTransformedByDeletion(t,s)):l.length==2&&(c=new K(this.start,this.end._getTransformedByDeletion(t,s))),c?a=c._getTransformedByInsertion(o,s,u!==null||n):a=[],u){let d=new K(u.start._getCombined(r.start,o),u.end._getCombined(r.start,o));a.length==2?a.splice(1,0,d):a.push(d)}return a}_getTransformedByDeletion(t,i){let s=this.start._getTransformedByDeletion(t,i),n=this.end._getTransformedByDeletion(t,i);return s==null&&n==null?null:(s==null&&(s=t),n==null&&(n=t),new K(s,n))}static _createFromPositionAndShift(t,i){let s=t,n=t.getShiftedBy(i);return i>0?new this(s,n):new this(n,s)}static _createIn(t){return new this(b._createAt(t,0),b._createAt(t,t.maxOffset))}static _createOn(t){return this._createFromPositionAndShift(b._createBefore(t),t.offsetSize)}static _createFromRanges(t){if(t.length===0)throw new f("range-create-from-ranges-empty-array",null);if(t.length==1)return t[0].clone();let i=t[0];t.sort((r,o)=>r.start.isAfter(o.start)?1:-1);let s=t.indexOf(i),n=new this(i.start,i.end);for(let r=s-1;r>=0&&t[r].end.isEqual(n.start);r--)n.start=b._createAt(t[r].start);for(let r=s+1;r<t.length&&t[r].start.isEqual(n.end);r++)n.end=b._createAt(t[r].end);return n}static fromJSON(t,i){return new this(b.fromJSON(t.start,i),b.fromJSON(t.end,i))}};p.prototype.is=function(e){return e==="range"||e==="model:range"};var U0=F(),W0=F(),Jc=class extends U0{_modelToViewMapping=new WeakMap;_viewToModelMapping=new WeakMap;_viewToModelLengthCallbacks=new Map;_markerNameToElements=new Map;_elementToMarkerNames=new Map;_deferredBindingRemovals=new Map;_unboundMarkerNames=new Set;_cache=new q0;constructor(){super(),this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;let i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new f("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;let i=this.findMappedViewAncestor(t.viewPosition),s=this._viewToModelMapping.get(i),n=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=b._createAt(s,n)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){let i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(let s of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(s);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e)&&this._cache.stopTracking(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i))}unbindModelElement(e){let t=this.toViewElement(e);if(this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e){this._viewToModelMapping.delete(t)&&this._cache.stopTracking(t)}}bindElementToMarker(e,t){let i=this._markerNameToElements.get(t)||new Set;i.add(e);let s=this._elementToMarkerNames.get(e)||new Set;s.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,s)}unbindElementFromMarkerName(e,t){let i=this._markerNameToElements.get(t);i&&(i.delete(e),i.size==0&&this._markerNameToElements.delete(t));let s=this._elementToMarkerNames.get(e);s&&(s.delete(t),s.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){let e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(let[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 p(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new M(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){let t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){let i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){let t=this._markerNameToElements.get(e);if(!t)return null;let i=new Set;for(let s of t)if(s.is("attributeElement"))for(let n of s.getElementsWithSameId())i.add(n);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}
10_toModelOffset(e,t,i){if(i!=e)return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e);if(e.is("$text"))return t;let s=0;for(let n=0;n<t;n++)s+=this.getModelLength(e.getChild(n));return s}getModelLength(e){let t=[e],i=0;for(;t.length>0;){let s=t.pop(),n=s.name&&this._viewToModelLengthCallbacks.size>0&&this._viewToModelLengthCallbacks.get(s.name);if(n)i+=n(s);else if(this._viewToModelMapping.has(s))i+=1;else if(s.is("$text"))i+=s.data.length;else{if(s.is("uiElement"))continue;for(let r of s.getChildren())t.push(r)}}return i}findPositionIn(e,t){if(t===0)return this._moveViewPositionToTextNode(new v(e,0));if(this._viewToModelLengthCallbacks.size==0&&this._viewToModelMapping.has(e)){let i=this._cache.getClosest(e,t);return this._findPositionStartingFrom(i.viewPosition,i.modelOffset,t,e,!0)}else return this._findPositionStartingFrom(new v(e,0),0,t,e,!1)}_findPositionStartingFrom(e,t,i,s,n){let r=e.parent,o=e.offset;if(r.is("$text"))return new v(r,i-t);let a,l=t,c=0;for(;l<i;){if(a=r.getChild(o),!a){if(r==s)throw new f("mapping-model-offset-not-found",this,{modelOffset:i,viewContainer:s});o=r.parent.getChildIndex(r)+1,r=r.parent,n&&this._cache.save(r,o,s,l);continue}n?c=this._getModelLengthAndCache(a,s,l):c=this.getModelLength(a),l+=c,o++}let u=new v(r,o);if(n)for(;u.isAtEnd&&u.parent!==s&&u.parent.parent;){let d=u.parent.parent,h=d.getChildIndex(u.parent)+1;this._cache.save(d,h,s,l),u=new v(d,h)}return l==i?this._moveViewPositionToTextNode(u):this._findPositionStartingFrom(new v(a,0),l-c,i,s,n)}_getModelLengthAndCache(e,t,i){let s=0;if(this._viewToModelMapping.has(e))s=1;else if(e.is("$text"))s=e.data.length;else if(!e.is("uiElement"))for(let n of e.getChildren())s+=this._getModelLengthAndCache(n,t,i+s);return this._cache.save(e.parent,e.index+1,t,i+s),s}_moveViewPositionToTextNode(e){let t=e.nodeBefore,i=e.nodeAfter;return t&&t.is("view:$text")?new v(t,t.data.length):i&&i.is("view:$text")?new v(i,0):e}},q0=class extends W0{_cachedMapping=new WeakMap;_nodeToCacheListIndex=new WeakMap;_invalidateOnChildrenChangeCallback=(e,t,i)=>{this._clearCacheInsideParent(t,i.index)};_invalidateOnTextChangeCallback=(e,t)=>{this._clearCacheAfter(t)};save(e,t,i,s){let n=this._cachedMapping.get(i),r=n.cacheMap.get(s);if(r){let l=e.getChild(t-1),c=r.viewPosition.nodeBefore?this._nodeToCacheListIndex.get(r.viewPosition.nodeBefore):0;this._nodeToCacheListIndex.set(l,c);return}let o={viewPosition:new v(e,t),modelOffset:s};n.maxModelOffset=s>n.maxModelOffset?s:n.maxModelOffset,n.cacheMap.set(s,o);let a=n.cacheList.length-1;for(;a>=0&&n.cacheList[a].modelOffset>s;)a--;if(n.cacheList.splice(a+1,0,o),t>0){let l=e.getChild(t-1);this._nodeToCacheListIndex.set(l,a+1)}}getClosest(e,t){let i=this._cachedMapping.get(e),s;if(i)if(t>i.maxModelOffset)s=i.cacheList[i.cacheList.length-1];else{let n=i.cacheMap.get(t);n?s=n:s=this._findInCacheList(i.cacheList,t)}else s=this.startTracking(e);return{modelOffset:s.modelOffset,viewPosition:s.viewPosition.clone()}}startTracking(e){let t={viewPosition:new v(e,0),modelOffset:0},i={maxModelOffset:0,cacheList:[t],cacheMap:new Map([[0,t]])};return this._cachedMapping.set(e,i),e.on("change:children",this._invalidateOnChildrenChangeCallback),e.on("change:text",this._invalidateOnTextChangeCallback),t}stopTracking(e){e.off("change:children",this._invalidateOnChildrenChangeCallback),e.off("change:text",this._invalidateOnTextChangeCallback),this._cachedMapping.delete(e)}_clearCacheInsideParent(e,t){if(t==0)this._cachedMapping.has(e)?this._clearCacheAll(e):this._clearCacheInsideParent(e.parent,e.index);else{let i=e.getChild(t-1);this._clearCacheAfter(i)}}_clearCacheAll(e){let t=this._cachedMapping.get(e);t.maxModelOffset>0&&(t.maxModelOffset=0,t.cacheList.length=1,t.cacheMap.clear(),t.cacheMap.set(0,t.cacheList[0]))}_clearCacheAfter(e){let t=this._nodeToCacheListIndex.get(e);if(t===void 0){let s=e.parent;this._cachedMapping.has(s)||this._clearCacheInsideParent(s.parent,s.index);return}let i=e.parent;for(;!this._cachedMapping.has(i);)i=i.parent;this._clearCacheFromCacheIndex(i,t)}_clearCacheFromCacheIndex(e,t){t===0&&(t=1);let i=this._cachedMapping.get(e),s=i.cacheList[t-1];if(!s)return;
10i.maxModelOffset=s.modelOffset;let n=i.cacheList.splice(t);for(let r of n){i.cacheMap.delete(r.modelOffset);let o=r.viewPosition.nodeBefore;this._nodeToCacheListIndex.delete(o)}}_findInCacheList(e,t){let i=0,s=e.length-1,n=s-i>>1,r=e[n];for(;i<s;)r.modelOffset<t?i=n+1:s=n-1,n=i+(s-i>>1),r=e[n];return r.modelOffset<=t?r:e[n-1]}};var $0=class{_consumable=new Map;_textProxyRegistry=new Map;add(e,t){t=En(t),e instanceof tt&&(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=En(t),e instanceof tt&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=En(t),e instanceof tt&&(e=this._getSymbolForTextProxy(e));let i=this._consumable.get(e);if(i===void 0)return null;let s=i.get(t);return s===void 0?null:s}revert(e,t){t=En(t),e instanceof tt&&(e=this._getSymbolForTextProxy(e));let i=this.test(e,t);return i===!1?(this._consumable.get(e).set(t,!0),!0):i===!0?!1:null}verifyAllConsumed(e){let t=[];for(let[i,s]of this._consumable)for(let[n,r]of s){let o=n.split(":")[0];r&&e==o&&t.push({event:n,item:i.name||i.description})}if(t.length)throw new f("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null,i=this._textProxyRegistry.get(e.startOffset);if(i){let s=i.get(e.endOffset);s&&(t=s.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){let t=e.startOffset,i=e.endOffset,s=e.parent,n=Symbol("$textProxy:"+e.data),r,o;return r=this._textProxyRegistry.get(t),r||(r=new Map,this._textProxyRegistry.set(t,r)),o=r.get(i),o||(o=new Map,r.set(i,o)),o.set(s,n),n}};function En(e){let t=e.split(":");return t[0]=="insert"?t[0]:t[0]=="addMarker"||t[0]=="removeMarker"?e:t.length>1?t[0]+":"+t[1]:t[0]}function lc([e,t],[i,s]){if(t.end.compareWith(s.start)!=="after")return 1;if(t.start.compareWith(s.end)!=="before")return-1;switch(t.start.compareWith(s.start)){case"before":return 1;case"after":return-1;default:switch(t.end.compareWith(s.end)){case"before":return-1;case"after":return 1;default:return i.localeCompare(e)}}}var K0=F(),Yc=class extends K0{_conversionApi;_firedEventsMap;constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,i){let s=e.getRefreshedItems(),n=this._createConversionApi(i,s);for(let a of e.getMarkersToRemove())this._convertMarkerRemove(a.name,a.range,n);let r=this._reduceChanges(e.getChanges(),s);for(let a of r)a.type==="insert"?this._convertInsert(p._createFromPositionAndShift(a.position,a.length),n):a.type==="reinsert"?this._convertReinsert(p._createFromPositionAndShift(a.position,a.length),n):a.type==="remove"?this._convertRemove(a.position,a.length,a.name,n):this._convertAttribute(a.range,a.attributeKey,a.attributeOldValue,a.attributeNewValue,n);n.mapper.flushDeferredBindings();for(let a of n.mapper.flushUnboundMarkerNames()){let l=t.get(a).getRange();this._convertMarkerRemove(a,l,n),this._convertMarkerAdd(a,l,n)}let o=e.getMarkersToAdd().sort((a,l)=>lc([a.name,a.range],[l.name,l.range]));for(let a of o)this._convertMarkerAdd(a.name,a.range,n);n.consumable.verifyAllConsumed("insert")}convert(e,t,i,s={}){let n=this._createConversionApi(i,void 0,s);this._convertInsert(e,n);for(let[r,o]of Array.from(t).sort(lc))this._convertMarkerAdd(r,o,n);n.consumable.verifyAllConsumed("insert")}convertSelection(e,t,i){let s=this._createConversionApi(i);this.fire("cleanSelection",{selection:e},s);let n=e.getFirstPosition().root;if(!s.mapper.toViewElement(n))return;let r=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(s.consumable,e,r),this.fire("selection",{selection:e},s),!!e.isCollapsed){for(let o of r)if(s.consumable.test(e,"addMarker:"+o.name)){let a=o.getRange();if(!j0(e.getFirstPosition(),o,s.mapper))continue;let l={item:e,markerName:o.name,markerRange:a};this.fire(`addMarker:${o.name}`,l,s)}for(let o of e.getAttributeKeys())if(s.consumable.test(e,"attribute:"+o)){let a={item:e,range:e.getFirstRange(),attributeKey:o,attributeOldValue:null,attributeNewValue:e.getAttribute(o)};this.fire(`attribute:${o}:$text`,a,s)}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(let s of e.getWalker({shallow:!0}))this._testAndFire("insert",cc(s),t)}_convertRemove(e,t,i,s){this.fire(`remove:${i}`,{position:e,length:t},s)}_convertAttribute(e,t,i,s,n){this._addConsumablesForRange(n.consumable,e,`attribute:${t}`);for(let r of e){let o={item:r.item,range:p._createFromPositionAndShift(r.previousPosition,r.length),attributeKey:t,attributeOldValue:i,attributeNewValue:s};this._testAndFire(`attribute:${t}`,o,n)}}_convertReinsert(e,t){let i=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,i);for(let s of i.map(cc))this.fire(`remove:${s.item.is("element")?s.item.name:"$text"}`,{position:s.range.start,length:s.item.offsetSize,reconversion:!0},t),this._testAndFire("insert",{...s,reconversion:!0},t)}_convertMarkerAdd(e,t,i){if(t.root.rootName=="$graveyard")return;let 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(let n of t.getItems()){if(!i.consumable.test(n,s))continue;let r={item:n,range:p._createOn(n),markerName:e,markerRange:t};this.fire(s,r,i)}}}_convertMarkerRemove(e,t,i){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},i)}_reduceChanges(e,t){let i={changes:e,refreshedItems:t};return this.fire("reduceChanges",i),i.changes}_addConsumablesForInsert(e,t){for(let i of t){let s=i.item;if(e.test(s,"insert")===null){e.add(s,"insert");for(let n of s.getAttributeKeys())e.add(s,"attribute:"+n)}}return e}_addConsumablesForRange(e,t,i){for(let s of t.getItems())e.add(s,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(let s of i)e.add(t,"addMarker:"+s.name);for(let s of t.getAttributeKeys())e.add(t,"attribute:"+s);return e}_testAndFire(e,t,i){let s=G0(e,t),n=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,r=this._firedEventsMap.get(i),o=r.get(n);if(!o)r.set(n,new Set([s]));else if(!o.has(s))o.add(s);else return;this.fire(s,t,i)}_testAndFireAddAttributes(e,t){let i={item:e,range:p._createOn(e)};for(let 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={}
10){let s={...this._conversionApi,consumable:new $0,writer:e,options:i,convertItem:n=>this._convertInsert(p._createOn(n),s),convertChildren:n=>this._convertInsert(p._createIn(n),s,{doNotAddConsumables:!0}),convertAttributes:n=>this._testAndFireAddAttributes(n,s),canReuseView:n=>!t.has(s.mapper.toModelElement(n))};return this._firedEventsMap.set(s,new Map),s}};function j0(e,t,i){let s=t.getRange(),n=Array.from(e.getAncestors());return n.shift(),n.reverse(),!n.some(r=>{if(s.containsItem(r))return!!i.toViewElement(r).getCustomProperty("addHighlight")})}function G0(e,t){return`${e}:${t.item.is("element")?t.item.name:"$text"}`}function cc(e){return{item:e.item,range:p._createFromPositionAndShift(e.previousPosition,e.length)}}var li=class extends Ot{parent=null;_attrs;_index=null;_startOffset=null;constructor(e){super(),this._attrs=De(e)}get document(){return null}get index(){return this._index}get startOffset(){return this._startOffset}get offsetSize(){return 1}get endOffset(){return this.startOffset===null?null:this.startOffset+this.offsetSize}get nextSibling(){let e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){let 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(){let e=[],t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){let t=[],i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){let i=this.getAncestors(t),s=e.getAncestors(t),n=0;for(;i[n]==s[n]&&i[n];)n++;return n===0?null:i[n-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;let t=this.getPath(),i=e.getPath(),s=ne(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(){let 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=De(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};li.prototype.is=function(e){return e==="node"||e==="model:node"};var Z0=F(Ot),ze=class Qc extends Z0{_lastRangeBackward=!1;_attrs=new Map;_ranges=[];constructor(...t){super(),t.length&&this.setTo(...t)}get anchor(){if(this._ranges.length>0){let t=this._ranges[this._ranges.length-1];return this._lastRangeBackward?t.end:t.start}return null}get focus(){if(this._ranges.length>0){let t=this._ranges[this._ranges.length-1];return this._lastRangeBackward?t.start:t.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(t){if(this.rangeCount!=t.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(t.anchor)||!this.focus.isEqual(t.focus))return!1;for(let i of this._ranges){let s=!1;for(let n of t._ranges)if(i.isEqual(n)){s=!0;break}if(!s)return!1}return!0}*getRanges(){for(let t of this._ranges)yield new p(t.start,t.end)}getFirstRange(){let t=null;for(let i of this._ranges)(!t||i.start.isBefore(t.start))&&(t=i);return t?new p(t.start,t.end):null}getLastRange(){let t=null;for(let i of this._ranges)(!t||i.end.isAfter(t.end))&&(t=i);return t?new p(t.start,t.end):null}getFirstPosition(){let t=this.getFirstRange();return t?t.start.clone():null}getLastPosition(){let t=this.getLastRange();return t?t.end.clone():null}setTo(...t){let[i,s,n]=t;if(typeof s=="object"&&(n=s,s=void 0),i===null)this._setRanges([]);else if(i instanceof Qc)this._setRanges(i.getRanges(),i.isBackward);else if(i&&typeof i.getRanges=="function")this._setRanges(i.getRanges(),i.isBackward);else if(i instanceof p)this._setRanges([i],!!n&&!!n.backward);else if(i instanceof b)this._setRanges([new p(i)]);else if(i instanceof li){let r=!!n&&!!n.backward,o;if(s=="in")o=p._createIn(i);else if(s=="on")o=p._createOn(i);
10else if(s!==void 0)o=new p(b._createAt(i,s));else throw new f("model-selection-setto-required-second-parameter",[this,i]);this._setRanges([o],r)}else if(ve(i))this._setRanges(i,n&&!!n.backward);else throw new f("model-selection-setto-not-selectable",[this,i])}_setRanges(t,i=!1){let s=Array.from(t),n=s.some(r=>{if(!(r instanceof p))throw new f("model-selection-set-ranges-not-range",[this,t]);return this._ranges.every(o=>!o.isEqual(r))});s.length===this._ranges.length&&!n||(this._replaceAllRanges(s),this._lastRangeBackward=!!i,this.fire("change:range",{directChange:!0}))}setFocus(t,i){if(this.anchor===null)throw new f("model-selection-setfocus-no-ranges",[this,t]);let s=b._createAt(t,i);if(s.compareWith(this.focus)=="same")return;let n=this.anchor;this._ranges.length&&this._popRange(),s.compareWith(n)=="before"?(this._pushRange(new p(s,n)),this._lastRangeBackward=!0):(this._pushRange(new p(n,s)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(t){return this._attrs.get(t)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(t){return this._attrs.has(t)}removeAttribute(t){this.hasAttribute(t)&&(this._attrs.delete(t),this.fire("change:attribute",{attributeKeys:[t],directChange:!0}))}setAttribute(t,i){this.getAttribute(t)!==i&&(this._attrs.set(t,i),this.fire("change:attribute",{attributeKeys:[t],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){let t=new WeakSet;for(let i of this.getRanges()){let s=uc(i.start,t);Y0(s,i)&&(yield s);let n=i.getWalker();for(let o of n){let a=o.item;o.type=="elementEnd"&&J0(a,t,i)?yield a:o.type=="elementStart"&&a.is("model:element")&&a.root.document.model.schema.isBlock(a)&&n.jumpTo(b._createAt(a,"end"))}let r=uc(i.end,t);Q0(r,i)&&(yield r)}}containsEntireContent(t=this.anchor.root){let i=b._createAt(t,0),s=b._createAt(t,"end");return i.isTouching(this.getFirstPosition())&&s.isTouching(this.getLastPosition())}toJSON(){let t={ranges:Array.from(this.getRanges()).map(s=>s.toJSON())},i=Object.fromEntries(this.getAttributes());return Object.keys(i).length&&(t.attributes=i),this.isBackward&&(t.isBackward=!0),t}_pushRange(t){this._checkRange(t),this._ranges.push(new p(t.start,t.end))}_checkRange(t){for(let i=0;i<this._ranges.length;i++)if(t.isIntersecting(this._ranges[i]))throw new f("model-selection-range-intersects",[this,t],{addedRange:t,intersectingRange:this._ranges[i]})}_replaceAllRanges(t){this._removeAllRanges();for(let i of t)this._pushRange(i)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}};ze.prototype.is=function(e){return e==="selection"||e==="model:selection"};function Xc(e,t){return t.has(e)?!1:(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function J0(e,t,i){return Xc(e,t)&&Io(e,i)}function uc(e,t){let i=e.parent.root.document.model.schema,s=e.parent.getAncestors({parentFirst:!0,includeSelf:!0}),n=!1,r=s.find(o=>n?!1:(n=i.isLimit(o),!n&&Xc(o,t)));return s.forEach(o=>t.add(o)),r}function Io(e,t){let i=X0(e);return i?!t.containsRange(p._createOn(i),!0):!0}function Y0(e,t){return e?t.isCollapsed||e.isEmpty?!0:t.start.isTouching(b._createAt(e,e.maxOffset))?!1:Io(e,t):!1}function Q0(e,t){return e?t.isCollapsed||e.isEmpty?!0:t.end.isTouching(b._createAt(e,0))?!1:Io(e,t):!1}function X0(e){let t=e.root.document.model.schema,i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent}}var e1=F(p),xe=class eu extends e1{constructor(t,i,s){super(t,i);let n=this.root,r=s||(n.is("rootElement")?n.document.model:null);if(!r)throw new f("model-liverange-no-model-reference",n);t1.call(this,r)}detach(){this.stopListening()}toRange(){return new p(this.start,this.end)}static fromRange(t){return new eu(t.start,t.end)}static _fromRangeInDocumentFragment(t,i){return new this(t.start,t.end,i)}};xe.prototype.is=function(e){return e==="liveRange"||e==="model:liveRange"||e=="range"||e==="model:range"};function t1(e){let t=!this.root.is("rootElement");this.listenTo(e,"applyOperation",(i,s)=>{let n=s[0];!t&&!n.isDocumentOperation||i1.call(this,n)},{priority:"low"})}function i1(e){let t=this.getTransformedByOperation(e);if(t.length===0){let o=e.sourcePosition;this.start=o,this.end=o,this.fire("change:drop",this.toRange(),{deletionPosition:o});return}let i=p._createFromRanges(t),s=!i.isEqual(this),n=s1(this,e),r=null;if(s){i.root.rootName=="$graveyard"&&(e.type=="remove"?r=e.sourcePosition:r=e.deletionPosition);let o=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",o,{deletionPosition:r})}else n&&this.fire("change:content",this.toRange(),{deletionPosition:r})}function s1(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}var J=class uo extends li{_data;constructor(t,i){super(i),this._data=t||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){let t=super.toJSON();return t.data=this.data,t}_clone(){return new uo(this.data,this.getAttributes())}static fromJSON(t){return new uo(t.data,t.attributes)}};J.prototype.is=function(e){return e==="$text"||e==="model:$text"||e==="text"||e==="model:text"||e==="node"||e==="model:node"};var Ts="selection:",n1=F(Ot),le=class extends n1{_selection;constructor(e){super(),this._selection=new r1(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)}toJSON(){return this._selection.toJSON()}_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 Ts+e}static _isStoreAttributeKey(e){return e.startsWith(Ts)}static _dropStoreAttributeKeyPrefix(e){return e.startsWith(Ts)?e.substring(10):e}};le.prototype.is=function(e){return e==="selection"||e=="model:selection"||e=="documentSelection"||e=="model:documentSelection"};var r1=class extends ze{markers=new pe({idProperty:"name"});_model;_document;_attributePriority=new Map;_selectionRestorePosition=null;_hasChangedRange=!1;_overriddenGravityRegister=new Set;_observedMarkers=new Set;constructor(e){super(),this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,i)=>{let 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",()=>
10{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,i,s,n)=>{this._updateMarker(i,n)}),this.listenTo(this._document,"change",(t,i)=>{a1(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)){let i=[e];this.fire("change:attribute",{attributeKeys:i,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){let t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){let e=X();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new f("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){let t=this._prepareRange(e);t&&this._ranges.push(t)}toJSON(){let e=super.toJSON();return this.markers.length&&(e.markers=this.markers.map(t=>t.toJSON())),e}_validateSelectionRanges(e){for(let t of e)if(!this._document._validateSelectionRange(t))throw new f("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;let t=xe.fromRange(e);return t.on("change:range",(i,s,n)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=n.deletionPosition;let r=this._ranges.indexOf(t);this._ranges.splice(r,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;let e=[],t=!1;for(let s of this._model.markers){let n=s.name.split(":",1)[0];if(!this._observedMarkers.has(n))continue;let r=s.getRange();for(let o of this.getRanges())r.containsRange(o,!o.isCollapsed)&&e.push(s)}let i=Array.from(this.markers);for(let s of e)this.markers.has(s)||(this.markers.add(s),t=!0);for(let 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){let i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let s=!1,n=Array.from(this.markers),r=this.markers.has(e);if(!t)r&&(this.markers.remove(e),s=!0);else{let o=!1;for(let a of this.getRanges())if(t.containsRange(a,!a.isCollapsed)){o=!0;break}o&&!r?(this.markers.add(e),s=!0):!o&&r&&(this.markers.remove(e),s=!0)}s&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){let t=De(this._getSurroundingAttributes()),i=De(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(let[n,r]of this._attributePriority)r=="low"&&(this._attrs.delete(n),this._attributePriority.delete(n));this._setAttributesTo(t);let s=[];for(let[n,r]of this.getAttributes())(!i.has(n)||i.get(n)!==r)&&s.push(n);for(let[n]of i)this.hasAttribute(n)||s.push(n);s.length>0&&this.fire("change:attribute",{attributeKeys:s,directChange:!1})}_setAttribute(e,t,i=!0){let 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){let 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){let t=new Set;for(let[i,s]of this.getAttributes())e.get(i)!==s&&this._removeAttribute(i,!1);for(let[i,s]of e)this._setAttribute(i,s,!1)&&t.add(i);return t}*getStoredAttributes(){let e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(let t of e.getAttributeKeys())t.startsWith(Ts)&&
10(yield[t.substr(10),e.getAttribute(t)])}_getSurroundingAttributes(){let e=this.getFirstPosition(),t=this._model.schema;if(e.root.rootName=="$graveyard")return null;let i=null;if(this.isCollapsed){let s=e.textNode?e.textNode:e.nodeBefore,n=e.textNode?e.textNode:e.nodeAfter;this.isGravityOverridden||(i=ks(s,t)),i||(i=ks(n,t)),!this.isGravityOverridden&&!i&&(i=ks(s,t,"backward")),i||(i=ks(n,t,"forward")),i||(i=this.getStoredAttributes())}else{let s=this.getFirstRange();for(let n of s){if(n.item.is("element")&&t.isObject(n.item)){i=ks(n.item,t);break}if(n.type=="text"){i=n.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){let t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}};function ks(e,t,i="self"){if(!e)return null;for(let s of o1(e,i)){if(!s)return null;if(s instanceof J)return s.getAttributes();if(!t.isInline(s))continue;let n=t.isObject(s),r=[];for(let[o,a]of s.getAttributes())t.checkAttribute("$text",o)&&(!n||t.getAttributeProperties(o).copyFromObject!==!1)&&r.push([o,a]);return r}return null}function*o1(e,t){if(t=="self")yield e;else{let i=e;for(;i;)i=t=="backward"?i.previousSibling:i.nextSibling,yield i}return null}function a1(e,t){let i=e.document.differ;for(let s of i.getChanges()){if(s.type!="insert")continue;let n=s.position.parent;s.length===n.maxOffset&&e.enqueueChange(t,r=>{let o=Array.from(n.getAttributeKeys()).filter(a=>a.startsWith(Ts));for(let a of o)r.removeAttribute(a,n)})}}var As=class{_nodes=[];_offsetToNode=[];constructor(e){e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._offsetToNode.length}getNode(e){return this._nodes[e]||null}getNodeAtOffset(e){return this._offsetToNode[e]||null}getNodeIndex(e){return e.index}getNodeStartOffset(e){return e.startOffset}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;let t=this._nodes[e];if(!t)throw new f("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){if(e==this._offsetToNode.length)return this._nodes.length;let t=this._offsetToNode[e];if(!t)throw new f("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.getNodeIndex(t)}
10_insertNodes(e,t){let i=[];for(let n of t){if(!(n instanceof li))throw new f("model-nodelist-insertnodes-not-node",this);i.push(n)}let s=this.indexToOffset(e);$r(this._nodes,i,e),$r(this._offsetToNode,l1(i),s);for(let n=e;n<this._nodes.length;n++)this._nodes[n]._index=n,this._nodes[n]._startOffset=s,s+=this._nodes[n].offsetSize}_removeNodes(e,t=1){if(t==0)return[];let i=this.indexToOffset(e),s=this._nodes.splice(e,t),n=s[s.length-1],r=n.startOffset+n.offsetSize-i;this._offsetToNode.splice(i,r);for(let o of s)o._index=null,o._startOffset=null;for(let o=e;o<this._nodes.length;o++)this._nodes[o]._index=o,this._nodes[o]._startOffset=i,i+=this._nodes[o].offsetSize;return s}_removeNodesArray(e){if(e.length==0)return;for(let i of e)i._index=null,i._startOffset=null;this._nodes=this._nodes.filter(i=>i.index!==null),this._offsetToNode=this._offsetToNode.filter(i=>i.index!==null);let t=0;for(let i=0;i<this._nodes.length;i++)this._nodes[i]._index=i,this._nodes[i]._startOffset=t,t+=this._nodes[i].offsetSize}toJSON(){return this._nodes.map(e=>e.toJSON())}};function l1(e){let t=[],i=0;for(let s of e)for(let n=0;n<s.offsetSize;n++)t[i++]=s;return t}var Z=class An extends li{name;_children=new As;constructor(t,i,s){super(i),this.name=t,s&&this._insertChild(0,s)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(t){return this._children.getNode(t)}getChildAtOffset(t){return this._children.getNodeAtOffset(t)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(t){return this._children.getNodeIndex(t)}getChildStartOffset(t){return this._children.getNodeStartOffset(t)}offsetToIndex(t){return this._children.offsetToIndex(t)}getNodeByPath(t){let i=this;for(let s of t)i=i.getChildAtOffset(s);return i}findAncestor(t,i={}){let s=i.includeSelf?this:this.parent;for(;s;){if(s.name===t)return s;s=s.parent}return null}toJSON(){let t=super.toJSON();if(t.name=this.name,this._children.length>0){t.children=[];for(let i of this._children)t.children.push(i.toJSON())}return t}_clone(t=!1){let i=t?u1(this._children):void 0;return new An(this.name,this.getAttributes(),i)}_appendChild(t){this._insertChild(this.childCount,t)}_insertChild(t,i){let s=c1(i);for(let n of s)n.parent!==null&&n._remove(),n.parent=this;this._children._insertNodes(t,s)}_removeChildren(t,i=1){let s=this._children._removeNodes(t,i);for(let n of s)n.parent=null;return s}_removeChildrenArray(t){this._children._removeNodesArray(t);for(let i of t)i.parent=null}static fromJSON(t){let i;if(t.children){i=[];for(let s of t.children)s.name?i.push(An.fromJSON(s)):i.push(J.fromJSON(s))}return new An(t.name,t.attributes,i)}};Z.prototype.is=function(e,t){return t?t===this.name&&(e==="element"||e==="model:element"):e==="element"||e==="model:element"||e==="node"||e==="model:node"};function c1(e){if(typeof e=="string")return[new J(e)];ve(e)||(e=[e]);let t=[];for(let i of e)typeof i=="string"?t.push(new J(i)):i instanceof tt?t.push(new J(i.data,i.getAttributes())):t.push(i);return t}function u1(e){let t=[];for(let i of e)t.push(i._clone(!0));return t}var tu=class{_dispatchers;constructor(e){this._dispatchers=e}add(e){for(let t of this._dispatchers)e(t);return this}};var d1=class extends tu{elementToElement(e){return this.add(S1(e))}elementToStructure(e){return this.add(P1(e))}attributeToElement(e){return this.add(L1(e))}attributeToAttribute(e){return this.add(V1(e))}markerToElement(e){return this.add(M1(e))}markerToHighlight(e){return this.add(O1(e))}markerToData(e){return this.add(B1(e))}};function iu(){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;let s=i.writer,n=i.mapper.toViewPosition(t.range.start),r=s.createText(t.item.data);s.insert(n,r)}}function su(){return(e,t,i)=>{i.convertAttributes(t.item),!t.reconversion&&t.item.is("element")&&!t.item.isEmpty&&i.convertChildren(t.item)}}function h1(){return(e,t,i)=>{if(t.reconversion)return;let s=i.mapper.toViewPosition(t.position),n=t.position.getShiftedBy(t.length),r=i.mapper.toViewPosition(n,{isPhantom:!0});ru(i.writer.createRange(s,r).getTrimmed(),i)}}function nu(e,t){let i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),typeof t.priority=="number"&&(i._priority=t.priority),i._id=t.id,i}function f1(){return(e,t,i)=>{let s=t.selection;if(s.isCollapsed||!i.consumable.consume(s,"selection"))return;let n=[];for(let r of s.getRanges())n.push(i.mapper.toViewRange(r));i.writer.setSelection(n,{backward:s.isBackward})}}function m1(){return(e,t,i)=>{let s=t.selection;if(!s.isCollapsed||!i.consumable.consume(s,"selection"))return;let n=i.writer,r=s.getFirstPosition(),o=i.mapper.toViewPosition(r),a=n.breakAttributes(o);n.setSelection(a)}}function g1(){return(e,t,i)=>{let s=i.writer,n=s.document.selection;for(let r of n.getRanges())r.isCollapsed&&r.end.parent.isAttached()&&i.writer.mergeAttributes(r.start);s.setSelection(null)}}function p1(e){return(t,i,s)=>{if(!s.consumable.test(i.item,t.name))return;
10let n=e(i.attributeOldValue,s,i),r=e(i.attributeNewValue,s,i);if(!n&&!r)return;s.consumable.consume(i.item,t.name);let o=s.writer,a=o.document.selection;if(i.item instanceof ze||i.item instanceof le)o.wrap(a.getFirstRange(),r);else{let l=s.mapper.toViewRange(i.range);i.attributeOldValue!==null&&n&&(l=o.unwrap(l,n)),i.attributeNewValue!==null&&r&&o.wrap(l,r)}}}function w1(e,t=U1){return(i,s,n)=>{if(!t(s.item,n.consumable,{preflight:!0}))return;let r=e(s.item,n,s);if(!r)return;t(s.item,n.consumable);let o=s.reconversion&&ou(s.item,n)||n.mapper.toViewPosition(s.range.start);n.mapper.bindElements(s.item,r),n.writer.insert(o,r),n.convertAttributes(s.item),du(r,s.item.getChildren(),n,{reconversion:s.reconversion})}}function b1(e,t){return(i,s,n)=>{if(!t(s.item,n.consumable,{preflight:!0}))return;let r=new Map;n.writer._registerSlotFactory(D1(s.item,r,n));let o=e(s.item,n,s);if(n.writer._clearSlotFactory(),!o)return;N1(s.item,r,n),t(s.item,n.consumable);let a=s.reconversion&&ou(s.item,n)||n.mapper.toViewPosition(s.range.start);n.mapper.bindElements(s.item,o),n.writer.insert(a,o),n.convertAttributes(s.item),z1(o,r,n,{reconversion:s.reconversion})}}function _1(e){return(t,i,s)=>{i.isOpening=!0;let n=e(i,s);i.isOpening=!1;let r=e(i,s);if(!n||!r)return;let{markerRange:o,markerName:a}=i;if(o.isCollapsed&&!s.consumable.consume(o,t.name))return;for(let h of o)if(!s.consumable.consume(h.item,t.name))return;let l=s.mapper,c=s.writer;c.setCustomProperty("markerBoundaryType","start",n),c.setCustomProperty("markerBoundaryName",a,n),c.setCustomProperty("markerBoundaryType","end",r),c.setCustomProperty("markerBoundaryName",a,r);let u=(h,m)=>{let g=l.markerNameToElements(h);if(g){for(let w of g)if(w.getCustomProperty("markerBoundaryType")===m)return l.toModelPosition(c.createPositionBefore(w))}return null};if(!o.isCollapsed){let h=l.toViewPosition(o.end).getLastMatchingPosition(({item:m})=>{if(!m.is("uiElement")||m.getCustomProperty("markerBoundaryType")!=="end")return!1;let g=m.getCustomProperty("markerBoundaryName"),w=u(g,"start");if(!w)return!1;let T=w.compareWith(o.start);return T==="same"?g.localeCompare(a)>0:T==="after"});c.insert(h,r),l.bindElementToMarker(r,a)}let d=l.toViewPosition(o.start).getLastMatchingPosition(({item:h})=>{if(!h.is("uiElement"))return!1;let m=h.getCustomProperty("markerBoundaryType");if(!m)return!1;if(m==="end")return!0;let g=h.getCustomProperty("markerBoundaryName"),w=u(g,"end");if(!w)return o.isCollapsed;if(o.isCollapsed)return!0;let T=w.compareWith(o.end);return T==="same"?g.localeCompare(a)<0:T==="after"});c.insert(d,n),l.bindElementToMarker(n,a),t.stop()}}function ru(e,t){let i=t.writer.remove(e);for(let s of t.writer.createRangeIn(i).getItems())t.mapper.unbindViewElement(s,{defer:!0});return e.start}function ou(e,t){let i=t.mapper.toViewElement(e);return i&&ru(t.writer.createRangeOn(i),t)}function v1(){return(e,t,i)=>{let s=i.mapper.markerNameToElements(t.markerName);if(s){for(let n of s)i.mapper.unbindElementFromMarkerName(n,t.markerName),i.writer.clear(i.writer.createRangeOn(n),n);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}}function y1(e){return(t,i,s)=>{let n=e(i.markerName,s);if(!n)return;let r=i.markerRange;s.consumable.consume(r,t.name)&&(dc(r,!1,s,i,n),dc(r,!0,s,i,n),t.stop())}}function dc(e,t,i,s,n){let r=t?e.start:e.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 l,c;t&&o||!t&&!a?(l=o,c=!0):(l=a,c=!1);let u=i.mapper.toViewElement(l);if(u){k1(u,t,c,i,s,n);return}}C1(i.mapper.toViewPosition(r),t,i,s,n)}function k1(e,t,i,s,n,r){let o=`data-${r.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(o)?e.getAttribute(o).split(","):[];a.unshift(r.name),s.writer.setAttribute(o,a.join(","),e),s.mapper.bindElementToMarker(e,n.markerName)}function C1(e,t,i,s,n){let r=`${n.group}-${t?"start":"end"}`,o=n.name?{name:n.name}:null,a=i.writer.createUIElement(r,o);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,s.markerName)}function I1(e){return(t,i,s)=>{let n=e(i.markerName,s);if(!n)return;let r=s.mapper.markerNameToElements(i.markerName);if(!r)return;for(let a of r)s.mapper.unbindElementFromMarkerName(a,i.markerName),a.is("containerElement")?(o(`data-${n.group}-start-before`,a),o(`data-${n.group}-start-after`,a),o(`data-${n.group}-end-before`,a),o(`data-${n.group}-end-after`,a)):s.writer.clear(s.writer.createRangeOn(a),a);s.writer.clearClonedElementsGroup(i.markerName),t.stop();function o(a,l){if(l.hasAttribute(a)){let c=new Set(l.getAttribute(a).split(","));c.delete(n.name),c.size==0?s.writer.removeAttribute(a,l):s.writer.setAttribute(a,Array.from(c).join(","),l)}}}}function x1(e){return(t,i,s)=>{if(!s.consumable.test(i.item,t.name))return;
10let n=e(i.attributeOldValue,s,i),r=e(i.attributeNewValue,s,i);if(!n&&!r)return;s.consumable.consume(i.item,t.name);let o=s.mapper.toViewElement(i.item),a=s.writer;if(!o)throw new f("conversion-attribute-to-attribute-on-text",s.dispatcher,i);if(i.attributeOldValue!==null&&n){let l=n.value;n.key=="style"&&(typeof n.value=="string"?l=new xs(a.document.stylesProcessor).setTo(n.value).getStylesEntries().map(([c])=>c):l=Object.keys(n.value)),a.removeAttribute(n.key,l,o)}if(i.attributeNewValue!==null&&r){let l=r.value;r.key=="style"&&typeof r.value=="string"&&(l=Object.fromEntries(new xs(a.document.stylesProcessor).setTo(r.value).getStylesEntries())),a.setAttribute(r.key,l,!1,o)}}}function E1(e){return(t,i,s)=>{if(!i.item||!(i.item instanceof ze||i.item instanceof le)&&!i.item.is("$textProxy"))return;let n=xo(e,i,s);if(!n||!s.consumable.consume(i.item,t.name))return;let r=s.writer,o=nu(r,n),a=r.document.selection;if(i.item instanceof ze||i.item instanceof le)r.wrap(a.getFirstRange(),o);else{let l=s.mapper.toViewRange(i.range),c=r.wrap(l,o);for(let u of c.getItems())if(u.is("attributeElement")&&u.isSimilar(o)){s.mapper.bindElementToMarker(u,i.markerName);break}}}}function T1(e){return(t,i,s)=>{if(!i.item||!(i.item instanceof Z))return;let n=xo(e,i,s);if(!n||!s.consumable.test(i.item,t.name))return;let r=s.mapper.toViewElement(i.item);if(r&&r.getCustomProperty("addHighlight")){s.consumable.consume(i.item,t.name);for(let o of p._createIn(i.item))s.consumable.consume(o.item,t.name);r.getCustomProperty("addHighlight")(r,n,s.writer),s.mapper.bindElementToMarker(r,i.markerName)}}}function A1(e){return(t,i,s)=>{if(i.markerRange.isCollapsed)return;let n=xo(e,i,s);if(!n)return;let r=nu(s.writer,n),o=s.mapper.markerNameToElements(i.markerName);if(o){for(let a of o)s.mapper.unbindElementFromMarkerName(a,i.markerName),a.is("attributeElement")?s.writer.unwrap(s.writer.createRangeOn(a),r):a.getCustomProperty("removeHighlight")(a,n.id,s.writer);s.writer.clearClonedElementsGroup(i.markerName),t.stop()}}}function S1(e){let t=au(e.model),i=Vs(e.view,"container");return t.attributes.length&&(t.children=!0),s=>{s.on(`insert:${t.name}`,w1(i,uu(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&s.on("reduceChanges",cu(t),{priority:"low"})}}function P1(e){let t=au(e.model),i=Vs(e.view,"container");return t.children=!0,s=>{if(s._conversionApi.schema.checkChild(t.name,"$text"))throw new f("conversion-element-to-structure-disallowed-text",s,{elementName:t.name});s.on(`insert:${t.name}`,b1(i,uu(t)),{priority:e.converterPriority||"normal"}),s.on("reduceChanges",cu(t),{priority:"low"})}}function L1(e){e=ie(e);let t=e.model;typeof t=="string"&&(t={key:t});let i=`attribute:${t.key}`;if(t.name&&(i+=":"+t.name),t.values)for(let n of t.values)e.view[n]=Vs(e.view[n],"attribute");else e.view=Vs(e.view,"attribute");let s=lu(e);return n=>{n.on(i,p1(s),{priority:e.converterPriority||"normal"})}}function V1(e){e=ie(e);let t=e.model;typeof t=="string"&&(t={key:t});let i=`attribute:${t.key}`;if(t.name&&(i+=":"+t.name),t.values)for(let n of t.values)e.view[n]=hc(e.view[n]);else e.view=hc(e.view);let s=lu(e);return n=>{n.on(i,x1(s),{priority:e.converterPriority||"normal"})}}function M1(e){let t=Vs(e.view,"ui");return i=>{i.on(`addMarker:${e.model}`,_1(t),{priority:e.converterPriority||"normal"}),i.on(`removeMarker:${e.model}`,v1(),{priority:e.converterPriority||"normal"})}}function B1(e){e=ie(e);let t=e.model,i=e.view;return i||(i=s=>({group:t,name:s.substr(e.model.length+1)})),s=>{s.on(`addMarker:${t}`,y1(i),{priority:e.converterPriority||"normal"}),s.on(`removeMarker:${t}`,I1(i),{priority:e.converterPriority||"normal"})}}function O1(e){return t=>{t.on(`addMarker:${e.model}`,E1(e.view),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,T1(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,A1(e.view),{priority:e.converterPriority||"normal"})}}function au(e){return typeof e=="string"&&(e={name:e}),{name:e.name,attributes:e.attributes?U(e.attributes):[],children:!!e.children}}function Vs(e,t){return typeof e=="function"?e:((i,s)=>R1(e,s,t))}function R1(e,t,i){typeof e=="string"&&(e={name:e});let s,n=t.writer,r=Object.assign({},e.attributes);if(i=="container")s=n.createContainerElement(e.name,r);else if(i=="attribute"){let o={priority:e.priority||Bi.DEFAULT_PRIORITY};s=n.createAttributeElement(e.name,r,o)}else s=n.createUIElement(e.name,r);
10if(e.styles){let o=Object.keys(e.styles);for(let a of o)n.setStyle(a,e.styles[a],s)}if(e.classes){let o=e.classes;if(typeof o=="string")n.addClass(o,s);else for(let a of o)n.addClass(a,s)}return s}function lu(e){return e.model.values?((t,i,s)=>{let n=e.view[t];return n?n(t,i,s):null}):e.view}function hc(e){return typeof e=="string"?t=>({key:e,value:t}):typeof e=="object"?e.value?()=>e:t=>({key:e.key,value:t}):e}function xo(e,t,i){let s=typeof e=="function"?e(t,i):{...e};return s?(s.priority||(s.priority=10),s.id||(s.id=t.markerName),s):null}function F1(e){return(t,i)=>{if(!t.is("element",e.name))return!1;if(i.type=="attribute"){if(e.attributes.includes(i.attributeKey))return!0}else if(e.children)return!0;return!1}}function cu(e){let t=F1(e);return(i,s)=>{let n=[];s.reconvertedElements||(s.reconvertedElements=new Set);for(let r of s.changes){let o=r.type=="attribute"?r.range.start.nodeAfter:r.position.parent;if(!o||!t(o,r)||r.type=="reinsert"){n.push(r);continue}if(r.type=="insert"&&r.action=="rename"&&s.refreshedItems.add(r.position.nodeAfter),!s.reconvertedElements.has(o)){s.reconvertedElements.add(o);let a=b._createBefore(o),l=n.length;for(let c=n.length-1;c>=0;c--){let u=n[c],d=(u.type=="attribute"?u.range.start:u.position).compareWith(a);if(d=="before"||u.type=="remove"&&d=="same")break;l=c}n.splice(l,0,{type:"reinsert",name:o.name,position:a,length:1})}}s.changes=n}}function uu(e){return(t,i,s={})=>{let n=["insert"];for(let r of e.attributes)t.hasAttribute(r)&&n.push(`attribute:${r}`);return n.every(r=>i.test(t,r))?(s.preflight||n.forEach(r=>i.consume(t,r)),!0):!1}}function D1(e,t,i){return(s,n)=>{let r=s.createContainerElement("$slot"),o;if(n==="children")o=Array.from(e.getChildren());else if(typeof n=="function")o=Array.from(e.getChildren()).filter(a=>n(a));else throw new f("conversion-slot-mode-unknown",i.dispatcher,{modeOrFilter:n});return t.set(r,o),r}}function N1(e,t,i){let s=Array.from(t.values()).flat(),n=new Set(s);if(n.size!=s.length)throw new f("conversion-slot-filter-overlap",i.dispatcher,{element:e});if(n.size!=e.childCount)throw new f("conversion-slot-filter-incomplete",i.dispatcher,{element:e})}function z1(e,t,i,s){i.mapper.on("modelToViewPosition",o,{priority:"highest"});let n=null,r=null;for([n,r]of t)du(e,r,i,s),i.writer.setCustomProperty("$structureSlotParent",!0,n.parent),i.writer.move(i.writer.createRangeIn(n),i.writer.createPositionBefore(n)),i.writer.remove(n);i.mapper.off("modelToViewPosition",o);function o(a,l){let c=l.modelPosition.nodeAfter,u=r.indexOf(c);u<0||(l.viewPosition=l.mapper.findPositionIn(n,u))}}function du(e,t,i,s){for(let n of t)H1(e.root,n,i,s)||i.convertItem(n)}function H1(e,t,i,s){let{writer:n,mapper:r}=i;if(!s.reconversion)return!1;let o=r.toViewElement(t);return!o||o.root==e||!i.canReuseView(o)?!1:(n.move(n.createRangeOn(o),r.toViewPosition(b._createBefore(t))),!0)}function U1(e,t,{preflight:i}={}){return i?t.test(e,"insert"):t.consume(e,"insert")}function hu(e){let{schema:t,document:i}=e.model;for(let s of i.getRoots())if(s.isEmpty&&!t.checkChild(s,"$text")&&t.checkChild(s,"paragraph"))return e.insertElement("paragraph",s),!0;return!1}function Eo(e,t,i){let s=i.createContext(e);return!(!i.checkChild(s,"paragraph")||!i.checkChild(s.push("paragraph"),t))}function fu(e,t){let i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}var W1=class extends tu{elementToElement(e){return this.add(mu(e))}elementToAttribute(e){return this.add(K1(e))}attributeToAttribute(e){return this.add(j1(e))}elementToMarker(e){return this.add(G1(e))}dataToMarker(e){return this.add(Z1(e))}};function fc(){return(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){let{modelRange:s,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=s,t.modelCursor=n}}}function q1(){return(e,t,{schema:i,consumable:s,writer:n})=>{let r=t.modelCursor;if(!s.test(t.viewItem))return;if(!i.checkChild(r,"$text")){if(!Eo(r,"$text",i)||t.viewItem.data.trim().length==0)return;r=fu(r,n)}s.consume(t.viewItem);let o=n.createText(t.viewItem.data);n.insert(o,r),t.modelRange=n.createRange(r,r.getShiftedBy(o.offsetSize)),t.modelCursor=t.modelRange.end}}function $1(e,t){return(i,s)=>{let n=s.newSelection,r=[];for(let a of n.getRanges())r.push(t.toModelRange(a));let o=e.createSelection(r,{backward:n.isBackward});o.isEqual(e.document.selection)||e.change(a=>{a.setSelection(o)})}}function mu(e){e=ie(e);
10let t=ho(e),i=To(e.view),s=i?`element:${i}`:"element";return n=>{n.on(s,t,{priority:e.converterPriority||"normal"})}}function K1(e){e=ie(e),gu(e);let t=pu(e,!1),i=To(e.view),s=i?`element:${i}`:"element";return n=>{n.on(s,t,{priority:e.converterPriority||"low"})}}function j1(e){e=ie(e);let t=null;(typeof e.view=="string"||e.view.key)&&(t=Q1(e)),gu(e,t);let i=pu(e,!0);return s=>{s.on("element",i,{priority:e.converterPriority||"low"})}}function G1(e){let t=tp(e.model);return mu({...e,model:t})}function Z1(e){e=ie(e),e.model||(e.model=n=>n?e.view+":"+n:e.view);let t={view:e.view,model:e.model},i=ho(mc(t,"start")),s=ho(mc(t,"end"));return n=>{n.on(`element:${e.view}-start`,i,{priority:e.converterPriority||"normal"}),n.on(`element:${e.view}-end`,s,{priority:e.converterPriority||"normal"});let r=me.low,o=me.highest,a=me.get(e.converterPriority)/o;n.on("element",J1(t),{priority:r+a})}}function J1(e){return(t,i,s)=>{let n=`data-${e.view}`;if(!s.consumable.test(i.viewItem,{attributes:n+"-end-after"})&&!s.consumable.test(i.viewItem,{attributes:n+"-start-after"})&&!s.consumable.test(i.viewItem,{attributes:n+"-end-before"})&&!s.consumable.test(i.viewItem,{attributes:n+"-start-before"}))return;i.modelRange||Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor)),s.consumable.consume(i.viewItem,{attributes:n+"-end-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-end-after").split(",")),s.consumable.consume(i.viewItem,{attributes:n+"-start-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-start-after").split(",")),s.consumable.consume(i.viewItem,{attributes:n+"-end-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-end-before").split(",")),s.consumable.consume(i.viewItem,{attributes:n+"-start-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-start-before").split(","));function r(o,a){for(let l of a){let c=e.model(l,s),u=s.writer.createElement("$marker",{"data-name":c});s.writer.insert(u,o),i.modelCursor.isEqual(o)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(o,1),i.modelRange=i.modelRange._getTransformedByInsertion(o,1)[0]}}}}function To(e){return typeof e=="string"?e:typeof e=="object"&&typeof e.name=="string"?e.name:null}
10function ho(e){let t=new ni(e.view);return(i,s,n)=>{let r=t.match(s.viewItem);if(!r)return;let o=r.match;if(o.name=!0,!n.consumable.test(s.viewItem,o))return;let a=Y1(e.model,s.viewItem,n);a&&n.safeInsert(a,s.modelCursor)&&(n.consumable.consume(s.viewItem,o),n.convertChildren(s.viewItem,a),n.updateConversionResult(a,s))}}function Y1(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}function Q1(e){typeof e.view=="string"&&(e.view={key:e.view});let t=e.view.key,i=typeof e.view.value>"u"?/[\s\S]*/:e.view.value,s;return t=="class"||t=="style"?s={[t=="class"?"classes":"styles"]:i}:s={attributes:{[t]:i}},e.view.name&&(s.name=e.view.name),e.view=s,t}function gu(e,t=null){let i=t===null?!0:s=>s.getAttribute(t);e.model={key:typeof e.model!="object"?e.model:e.model.key,value:typeof e.model!="object"||typeof e.model.value>"u"?i:e.model.value}}function pu(e,t){let i=new ni(e.view);return(s,n,r)=>{if(!n.modelRange&&t)return;let o=i.match(n.viewItem);if(!o||(X1(e.view,n.viewItem)?o.match.name=!0:delete o.match.name,!r.consumable.test(n.viewItem,o.match)))return;let a=e.model.key,l=typeof e.model.value=="function"?e.model.value(n.viewItem,r,n):e.model.value;l!=null&&(n.modelRange||Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor)),ep(n.modelRange,{key:a,value:l},t,r)&&(r.consumable.test(n.viewItem,{name:!0})&&(o.match.name=!0),r.consumable.consume(n.viewItem,o.match)))}}function X1(e,t){let i=typeof e=="function"?e(t):e;return typeof i=="object"&&!To(i)?!1:!i.classes&&!i.attributes&&!i.styles}function ep(e,t,i,s){let n=!1;for(let r of Array.from(e.getItems({shallow:i})))s.schema.checkAttribute(r,t.key)&&(n=!0,!r.hasAttribute(t.key)&&s.writer.setAttribute(t.key,t.value,r));return n}function tp(e){return(t,i)=>{let s=typeof e=="string"?e:e(t,i);return i.writer.createElement("$marker",{"data-name":s})}}function mc(e,t){let i=(s,n)=>{let r=s.getAttribute("name"),o=e.model(r,n);return n.writer.createElement("$marker",{"data-name":o})};return{view:`${e.view}-${t}`,model:i}}var ip=z(),wu=class extends ip{model;view;mapper;downcastDispatcher;constructor(e,t){super(),this.model=e,this.view=new z0(t),this.mapper=new Jc,this.downcastDispatcher=new Yc({mapper:this.mapper,schema:e.schema});let i=this.model.document,s=i.selection,n=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(r=>{this.downcastDispatcher.convertChanges(i.differ,n,r),this.downcastDispatcher.convertSelection(s,n,r)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",$1(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",iu(),{priority:"lowest"}),this.downcastDispatcher.on("insert",su(),{priority:"lowest"}),this.downcastDispatcher.on("remove",h1(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",g1()),this.downcastDispatcher.on("selection",f1(),{priority:"low"}),this.downcastDispatcher.on("selection",m1(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(r=>{if(r.rootName=="$graveyard")return null;let o=new Fc(this.view.document,r.name);return o.rootName=r.rootName,this.mapper.bindElements(r,o),o})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){let t=typeof e=="string"?e:e.name,i=this.model.markers.get(t);if(!i)throw new f("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)})}};var sp=z(),np=class extends sp{_sourceDefinitions={};_attributeProperties=Object.create(null);_customChildChecks=new Map;_customAttributeChecks=new Map;_genericCheckSymbol=Symbol("$generic");_compiledDefinitions;constructor(){super(),this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new Sn(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Sn(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new f("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 f("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){let t=this.getDefinition(e);return!!(t&&t.isBlock)}isLimit(e){let t=this.getDefinition(e);return t?!!(t.isLimit||t.isObject):!1}isObject(e){let t=this.getDefinition(e);return t?!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent):!1}isInline(e){let t=this.getDefinition(e);return!!(t&&t.isInline)}isSelectable(e){let t=this.getDefinition(e);return t?!!(t.isSelectable||t.isObject):!1}isContent(e){let t=this.getDefinition(e);return t?!!(t.isContent||t.isObject):!1}checkChild(e,t){return t?this._checkContextMatch(e,t):!1}checkAttribute(e,t){let i=this.getDefinition(e.last);if(!i)return!1;let s=this._evaluateAttributeChecks(e,t);return s!==void 0?s:i.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof b){let i=e.nodeBefore,s=e.nodeAfter;if(!(i instanceof Z))throw new f("schema-check-merge-no-element-before",this);if(!(s instanceof Z))throw new f("schema-check-merge-no-element-after",this);return this.checkMerge(i,s)}if(this.isLimit(e)||this.isLimit(t))return!1;for(let i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e,t){let i=t!==void 0?t:this._genericCheckSymbol,s=this._customChildChecks.get(i)||[];s.push(e),this._customChildChecks.set(i,s)}addAttributeCheck(e,t){let i=t!==void 0?t:this._genericCheckSymbol,s=this._customAttributeChecks.get(i)||[];s.push(e),this._customAttributeChecks.set(i,s)}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||Object.create(null)}getLimitElement(e){let t;for(e instanceof b?t=e.parent:t=(e instanceof p?[e]:Array.from(e.getRanges())).reduce((i,s)=>{let n=s.getCommonAncestor();return i?i.getCommonAncestor(n,{includeSelf:!0}):n},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){let i=[...e.getFirstPosition().getAncestors(),new J("",e.getAttributes())];return this.checkAttribute(i,t)}else{let i=e.getRanges();for(let s of i)for(let n of s)if(this.checkAttribute(n.item,t))return!0}return!1}*getValidRanges(e,t,i={}){e=vp(e);for(let s of e)yield*this._getValidRangesForRange(s,t,i)}getNearestSelectionRange(e,t="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new p(e);let i,s,n=e.getAncestors().reverse().find(r=>this.isLimit(r))||e.root;(t=="both"||t=="backward")&&(i=new He({boundaries:p._createIn(n),startPosition:e,direction:"backward"})),(t=="both"||t=="forward")&&(s=new He({boundaries:p._createIn(n),startPosition:e}));for(let r of _p(i,s)){let o=r.walker==i?"elementEnd":"elementStart",a=r.value;if(a.type==o&&this.isObject(a.item))return p._createOn(a.item);if(this.checkChild(a.nextPosition,"$text"))return new p(a.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){let s=i.model;for(let[n,r]of Object.entries(t))s.schema.checkAttribute(e,n)&&i.setAttribute(n,r,e)}removeDisallowedAttributes(e,t){for(let i of e)if(i.is("$text"))gc(this,i,t);else{let s=p._createIn(i).getPositions();for(let n of s){let r=n.nodeBefore||n.parent;gc(this,r,t)}}}getAttributesWithProperty(e,t,i){let s={};for(let[n,r]of e.getAttributes()){let o=this.getAttributeProperties(n);o[t]!==void 0&&(i===void 0||i===o[t])&&(s[n]=r)}return s}createContext(e){return new Sn(e)}_clearCache(){this._compiledDefinitions=null}_compile(){let e={},t=this._sourceDefinitions,i=Object.keys(t);
10for(let n of i)e[n]=rp(t[n],n);let s=Object.values(e);for(let n of s)op(e,n),ap(e,n),lp(e,n),cp(e,n);for(let n of s)up(e,n);for(let n of s)dp(e,n);for(let n of s)hp(e,n);for(let n of s)mp(e,n);for(let n of s)gp(e,n);this._compiledDefinitions=fp(e)}_checkContextMatch(e,t){let i=e.last,s=this._evaluateChildChecks(e,t);if(s=s!==void 0?s:t.allowIn.includes(i.name),!s)return!1;let n=this.getDefinition(i),r=e.trimLast();return n?r.length==0?!0:this._checkContextMatch(r,n):!1}_evaluateChildChecks(e,t){let i=this._customChildChecks.get(this._genericCheckSymbol)||[],s=this._customChildChecks.get(t.name)||[];for(let n of[...i,...s]){let r=n(e,t);if(r!==void 0)return r}}_evaluateAttributeChecks(e,t){let i=this._customAttributeChecks.get(this._genericCheckSymbol)||[],s=this._customAttributeChecks.get(t)||[];for(let n of[...i,...s]){let r=n(e,t);if(r!==void 0)return r}}*_getValidRangesForRange(e,t,i){let s=e.start,n=e.start;for(let r of e.getItems({shallow:!0})){if(r.is("element"))if(i.includeEmptyRanges&&r.isEmpty){let o=this.createContext(r);this.checkChild(o,"$text")&&this.checkAttribute(o.push("$text"),t)&&(yield p._createIn(r))}else yield*this._getValidRangesForRange(p._createIn(r),t,i);this.checkAttribute(r,t)||(s.isEqual(n)||(yield new p(s,n)),s=b._createAfter(r)),n=b._createAfter(r)}s.isEqual(n)||(yield new p(s,n))}findOptimalInsertionRange(e,t){let i=e.getSelectedElement();if(i&&this.isObject(i)&&!this.isInline(i))return t=="before"||t=="after"?new p(b._createAt(i,t)):p._createOn(i);let s=ye(e.getSelectedBlocks());if(!s)return new p(e.focus);if(s.isEmpty)return new p(b._createAt(s,0));let n=b._createAfter(s);return e.focus.isTouching(n)?new p(n):new p(b._createBefore(s))}},Sn=class Pn{_items;constructor(t){if(t instanceof Pn)return t;let i;typeof t=="string"?i=[t]:Array.isArray(t)?i=t:i=t.getAncestors({includeSelf:!0}),this._items=i.map(bp)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(t){let i=new Pn([t]);return i._items=[...this._items,...i._items],i}trimLast(){let t=new Pn([]);return t._items=this._items.slice(0,-1),t}getItem(t){return this._items[t]}*getNames(){yield*this._items.map(t=>t.name)}endsWith(t){return Array.from(this.getNames()).join(" ").endsWith(t)}startsWith(t){return Array.from(this.getNames()).join(" ").startsWith(t)}};function rp(e,t){let i={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return pp(e,i),et(e,i,"allowIn"),et(e,i,"allowChildren"),et(e,i,"disallowIn"),et(e,i,"disallowChildren"),et(e,i,"allowContentOf"),et(e,i,"allowWhere"),et(e,i,"allowAttributes"),et(e,i,"disallowAttributes"),et(e,i,"allowAttributesOf"),et(e,i,"inheritTypesFrom"),wp(e,i),i}function op(e,t){for(let i of t.allowIn){let s=e[i];s?s.allowChildren.add(t.name):t.allowIn.delete(i)}}function ap(e,t){for(let i of t.allowChildren){let s=e[i];s?s.allowIn.add(t.name):t.allowChildren.delete(i)}}function lp(e,t){for(let i of t.disallowIn){let s=e[i];s?s.disallowChildren.add(t.name):t.disallowIn.delete(i)}}function cp(e,t){for(let i of t.disallowChildren){let s=e[i];s?s.disallowIn.add(t.name):t.disallowChildren.delete(i)}}function up(e,t){for(let i of t.disallowChildren)t.allowChildren.delete(i);for(let i of t.disallowIn)t.allowIn.delete(i);for(let i of t.disallowAttributes)t.allowAttributes.delete(i)}function dp(e,t){for(let i of t.allowContentOf){let s=e[i];s&&(s.disallowChildren.forEach(n=>{t.allowChildren.has(n)||(t.disallowChildren.add(n),e[n].disallowIn.add(t.name))}),s.allowChildren.forEach(n=>{t.disallowChildren.has(n)||(t.allowChildren.add(n),e[n].allowIn.add(t.name))}))}}function hp(e,t){for(let i of t.allowWhere){let s=e[i];s&&(s.disallowIn.forEach(n=>{t.allowIn.has(n)||(t.disallowIn.add(n),e[n].disallowChildren.add(t.name))}),s.allowIn.forEach(n=>{t.disallowIn.has(n)||(t.allowIn.add(n),e[n].allowChildren.add(t.name))}))}}function fp(e){let t={};for(let i of Object.values(e))t[i.name]={name:i.name,isBlock:!!i.isBlock,isContent:!!i.isContent,isInline:!!i.isInline,isLimit:!!i.isLimit,isObject:!!i.isObject,isSelectable:!!i.isSelectable,allowIn:Array.from(i.allowIn).filter(s=>!!e[s]),allowChildren:Array.from(i.allowChildren).filter(s=>!!e[s]),allowAttributes:Array.from(i.allowAttributes)};return t}function mp(e,t){for(let i of t.allowAttributesOf){let s=e[i];if(!s)return;
10s.allowAttributes.forEach(n=>{t.disallowAttributes.has(n)||t.allowAttributes.add(n)})}}function gp(e,t){for(let i of t.inheritTypesFrom){let s=e[i];if(s){let n=Object.keys(s).filter(r=>r.startsWith("is"));for(let r of n)r in t||(t[r]=s[r])}}}function pp(e,t){for(let i of e){let s=Object.keys(i).filter(n=>n.startsWith("is"));for(let n of s)t[n]=!!i[n]}}function et(e,t,i){for(let s of e){let n=s[i];typeof n=="string"&&(n=[n]),Array.isArray(n)&&n.forEach(r=>t[i].add(r))}}function wp(e,t){for(let i of e){let s=i.inheritAllFrom;s&&(t.allowContentOf.add(s),t.allowWhere.add(s),t.allowAttributesOf.add(s),t.inheritTypesFrom.add(s))}}function bp(e){return typeof e=="string"||e.is("documentFragment")?{name:typeof e=="string"?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute(t){return e.getAttribute(t)}}}function*_p(e,t){let i=!1;for(;!i;){if(i=!0,e){let s=e.next();s.done||(i=!1,yield{walker:e,value:s.value})}if(t){let s=t.next();s.done||(i=!1,yield{walker:t,value:s.value})}}}function*vp(e){for(let t of e)yield*t.getMinimalFlatRanges()}function gc(e,t,i){for(let s of t.getAttributeKeys())e.checkAttribute(t,s)||i.removeAttribute(s,t)}var yp=F(),kp=class extends yp{conversionApi;_splitParts=new Map;_cursorParents=new Map;_modelCursor=null;_emptyElementsToKeep=new Set;constructor(e){super(),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=Ip(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=Og.createFrom(e),this.conversionApi.store={};let{modelRange:s}=this._convertItem(e,this._modelCursor),n=t.createDocumentFragment();if(s){this._removeEmptyElements();let r=this._modelCursor.parent,o=r._removeChildren(0,r.childCount);n._insertChild(0,o),n.markers=Cp(n,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,n}_convertItem(e,t){let 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 p))throw new f("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:b._createAt(t,0),s=new p(i);for(let n of Array.from(e.getChildren())){let r=this._convertItem(n,i);r.modelRange instanceof p&&(s.end=r.modelRange.end,i=r.modelCursor)}return{modelRange:s,modelCursor:i}}_safeInsert(e,t){let i=this._splitToAllowedParent(e,t);return i?(this.conversionApi.writer.insert(e,i.position),!0):!1}_updateConversionResult(e,t){let i=this._getSplitParts(e),s=this.conversionApi.writer;t.modelRange||(t.modelRange=s.createRange(s.createPositionBefore(e),s.createPositionAfter(i[i.length-1])));let n=this._cursorParents.get(e);n?t.modelCursor=s.createPositionAt(n,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){let{schema:i,writer:s}=this.conversionApi,n=i.findAllowedParent(t,e);if(n){if(n===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(n)&&(n=null)}if(!n)return Eo(t,e,i)?{position:fu(t,s)}:null;let r=this.conversionApi.writer.split(t,n),o=[];for(let l of r.range.getWalker())if(l.type=="elementEnd")o.push(l.item);else{let c=o.pop(),u=l.item;this._registerSplitPair(c,u)}let a=r.range.end.parent;return this._cursorParents.set(e,a),{position:r.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);let 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=new Map;
10for(let t of this._splitParts.keys())if(t.isEmpty&&!this._emptyElementsToKeep.has(t)){let i=e.get(t.parent)||[];i.push(t),this._splitParts.delete(t),e.set(t.parent,i)}for(let[t,i]of e)t._removeChildrenArray(i);e.size&&this._removeEmptyElements()}};function Cp(e,t){let i=new Set,s=new Map,n=p._createIn(e).getItems();for(let r of n)r.is("element","$marker")&&i.add(r);for(let r of i){let o=r.getAttribute("data-name"),a=t.createPositionBefore(r);s.has(o)?s.get(o).end=a.clone():s.set(o,new p(a.clone())),t.remove(r)}return s}function Ip(e,t){let i;for(let s of new Sn(e)){let n={};for(let o of s.getAttributeKeys())n[o]=s.getAttribute(o);let r=t.createElement(s.name,n);i&&t.insert(r,i),i=b._createAt(r,0)}return i}var xp=class{getHtml(e){let t=_.document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}};var Ep=class{domParser;domConverter;htmlWriter;skipComments=!0;constructor(e){this.domParser=new DOMParser,this.domConverter=new $c(e,{renderingMode:"data"}),this.htmlWriter=new xp}toData(e){let t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){let 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){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4))||(e=`<body>${e}</body>`);let t=this.domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),s=t.body.childNodes;for(;s.length>0;)i.appendChild(s[0]);return i}};var Tp=F(),bu=class extends Tp{model;mapper;downcastDispatcher;upcastDispatcher;viewDocument;stylesProcessor;htmlProcessor;processor;_viewWriter;constructor(e,t){super(),this.model=e,this.mapper=new Jc,this.downcastDispatcher=new Yc({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",iu(),{priority:"lowest"}),this.downcastDispatcher.on("insert",su(),{priority:"lowest"}),this.upcastDispatcher=new kp({schema:e.schema}),this.viewDocument=new Nc(t),this.stylesProcessor=t,this.htmlProcessor=new Ep(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new zc(this.viewDocument),this.upcastDispatcher.on("text",q1(),{priority:"lowest"}),this.upcastDispatcher.on("element",fc(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",fc(),{priority:"lowest"}),z().prototype.decorate.call(this,"init"),z().prototype.decorate.call(this,"set"),z().prototype.decorate.call(this,"get"),z().prototype.decorate.call(this,"toView"),z().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},hu)},{priority:"lowest"})}get(e={}){let{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new f("datacontroller-get-non-existent-root",this);let s=this.model.document.getRoot(t);return s.isAttached()||N("datacontroller-get-detached-root",this),i==="empty"&&!this.model.hasContent(s,{ignoreWhitespaces:!0})?"":this.stringify(s,e)}stringify(e,t={}){let i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){let i=this.viewDocument,s=this._viewWriter;this.mapper.clearBindings();let n=p._createIn(e),r=new Oi(i);this.mapper.bindElements(e,r);let o=e.is("documentFragment")?e.markers:Ap(e);return this.downcastDispatcher.convert(n,o,s,t),r}init(e){if(this.model.document.version)throw new f("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new f("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},i=>{for(let s of Object.keys(t)){let n=this.model.document.getRoot(s);i.insert(this.parse(t[s],n),n,0)}}),Promise.resolve()}set(e,t={}){let i={};if(typeof e=="string"?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new f("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},s=>{s.setSelection(null),s.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(let n of Object.keys(i)){let r=this.model.document.getRoot(n);s.remove(s.createRangeIn(r)),s.insert(this.parse(i[n],r),r,0)}})}parse(e,t="$root"){let 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(let t of e)if(!this.model.document.getRoot(t))return!1;return!0}};function Ap(e){let t=[],i=e.root.document;if(!i)return new Map;let s=p._createIn(e);for(let n of i.model.markers){let r=n.getRange(),o=r.isCollapsed,a=r.start.isEqual(s.start)||r.end.isEqual(s.end);if(o&&a)t.push([n.name,r]);else{let l=s.getIntersection(r);l&&t.push([n.name,l])}}return new Map(t)}var _u=class{_helpers=new Map;_downcast;_upcast;constructor(e,t){this._downcast=U(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=U(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){let i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new f("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new f("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(let{model:t,view:i}of io(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(let{model:t,view:i}of io(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(let{model:t,view:i}of io(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new f("conversion-group-exists",this);let s=i?new d1(t):new W1(t);this._helpers.set(e,s)}};function*io(e){if(e.model.values)for(let t of e.model.values){let i={key:e.model.key,value:t},s=e.view[t];yield*pc(i,s,e.upcastAlso?e.upcastAlso[t]:void 0)}else yield*pc(e.model,e.view,e.upcastAlso)}function*pc(e,t,i){if(yield{model:e,view:t},i)for(let s of U(i))yield{model:e,view:s}}var Ee=class{baseVersion;isDocumentOperation;batch;constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){let 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)}};function Ao(e,t){let i=yu(t),s=i.reduce((o,a)=>o+a.offsetSize,0),n=e.parent;Os(e);let r=e.index;return n._insertChild(r,i),Bs(n,r+i.length),Bs(n,r),new p(e,e.getShiftedBy(s))}function vu(e){if(!e.isFlat)throw new f("operation-utils-remove-range-not-flat",this);let t=e.start.parent;Os(e.start),Os(e.end);let i=t._removeChildren(e.start.index,e.end.index-e.start.index);return Bs(t,e.start.index),i}function Ms(e,t){if(!e.isFlat)throw new f("operation-utils-move-range-not-flat",this);let i=vu(e);return t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),Ao(t,i)}function Sp(e,t,i){Os(e.start),Os(e.end);for(let s of e.getItems({shallow:!0})){let n=s.is("$textProxy")?s.textNode:s;i!==null?n._setAttribute(t,i):n._removeAttribute(t),Bs(n.parent,n.index)}Bs(e.end.parent,e.end.index)}function yu(e){let t=[];
10function i(s){if(typeof s=="string")t.push(new J(s));else if(s instanceof tt)t.push(new J(s.data,s.getAttributes()));else if(s instanceof li)t.push(s);else if(ve(s))for(let n of s)i(n)}i(e);for(let s=1;s<t.length;s++){let n=t[s],r=t[s-1];n instanceof J&&r instanceof J&&ku(n,r)&&(t.splice(s-1,2,new J(r.data+n.data,r.getAttributes())),s--)}return t}function Bs(e,t){let i=e.getChild(t-1),s=e.getChild(t);if(i&&s&&i.is("$text")&&s.is("$text")&&ku(i,s)){let n=new J(i.data+s.data,i.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,n)}}function Os(e){let t=e.textNode,i=e.parent;if(t){let s=e.offset-t.startOffset,n=t.index;i._removeChildren(n,1);let r=new J(t.data.substr(0,s),t.getAttributes()),o=new J(t.data.substr(s),t.getAttributes());i._insertChild(n,[r,o])}}function ku(e,t){let i=e.getAttributes(),s=t.getAttributes();for(let n of i){if(n[1]!==t.getAttribute(n[0]))return!1;s.next()}return s.next().done}var H=class fo extends Ee{sourcePosition;howMany;targetPosition;constructor(t,i,s,n){super(n),this.sourcePosition=t.clone(),this.sourcePosition.stickiness="toNext",this.howMany=i,this.targetPosition=s.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName==this.sourcePosition.root.rootName?"move":this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[this.sourceRange,p._createFromPositionAndShift(this.targetPosition,0)]}get sourceRange(){return p._createFromPositionAndShift(this.sourcePosition,this.howMany)}clone(){return new fo(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){let t=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new fo(this.getMovedRangeStart(),this.howMany,t,this.baseVersion+1)}_validate(){let t=this.sourcePosition.parent,i=this.targetPosition.parent,s=this.sourcePosition.offset,n=this.targetPosition.offset;if(s+this.howMany>t.maxOffset)throw new f("move-operation-nodes-do-not-exist",this);if(t===i&&s<n&&n<s+this.howMany)throw new f("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&ne(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){let r=this.sourcePosition.path.length-1;if(this.targetPosition.path[r]>=s&&this.targetPosition.path[r]<s+this.howMany)throw new f("move-operation-node-into-itself",this)}}_execute(){Ms(this.sourceRange,this.targetPosition)}toJSON(){let t=super.toJSON();return t.sourcePosition=this.sourcePosition.toJSON(),t.targetPosition=this.targetPosition.toJSON(),t}static get className(){return"MoveOperation"}static fromJSON(t,i){let s=b.fromJSON(t.sourcePosition,i),n=b.fromJSON(t.targetPosition,i);return new this(s,t.howMany,n,t.baseVersion)}};
10var Ce=class mo extends Ee{position;nodes;shouldReceiveAttributes;constructor(t,i,s){super(s),this.position=t.clone(),this.position.stickiness="toNone",this.nodes=new As(yu(i)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){let t=new As([...this.nodes].map(s=>s._clone(!0))),i=new mo(this.position,t,this.baseVersion);return i.shouldReceiveAttributes=this.shouldReceiveAttributes,i}getReversed(){let t=this.position.root.document.graveyard,i=new b(t,[0]);return new H(this.position,this.nodes.maxOffset,i,this.baseVersion+1)}_validate(){let t=this.position.parent;if(!t||t.maxOffset<this.position.offset)throw new f("insert-operation-position-invalid",this)}_execute(){let t=this.nodes;this.nodes=new As([...t].map(i=>i._clone(!0))),Ao(this.position,t)}toJSON(){let t=super.toJSON();return t.position=this.position.toJSON(),t.nodes=this.nodes.toJSON(),t}static get className(){return"InsertOperation"}static fromJSON(t,i){let s=[];for(let r of t.nodes)r.name?s.push(Z.fromJSON(r)):s.push(J.fromJSON(r));let n=new mo(b.fromJSON(t.position,i),s,t.baseVersion);return n.shouldReceiveAttributes=t.shouldReceiveAttributes,n}};var $=class Cu extends Ee{splitPosition;howMany;insertionPosition;graveyardPosition;constructor(t,i,s,n,r){super(r),this.splitPosition=t.clone(),this.splitPosition.stickiness="toNext",this.howMany=i,this.insertionPosition=s,this.graveyardPosition=n?n.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){let t=this.insertionPosition.path.slice();return t.push(0),new b(this.insertionPosition.root,t)}get movedRange(){let t=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new p(this.splitPosition,t)}get affectedSelectable(){let t=[p._createFromPositionAndShift(this.splitPosition,0),p._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&t.push(p._createFromPositionAndShift(this.graveyardPosition,0)),t}clone(){return new Cu(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){let t=this.splitPosition.root.document.graveyard,i=new b(t,[0]);return new ee(this.moveTargetPosition,this.howMany,this.splitPosition,i,this.baseVersion+1)}_validate(){let t=this.splitPosition.parent,i=this.splitPosition.offset;if(!t||t.maxOffset<i)throw new f("split-operation-position-invalid",this);if(t.parent){if(this.howMany!==Number.NEGATIVE_INFINITY&&this.howMany!=t.maxOffset-this.splitPosition.offset)throw new f("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new f("split-operation-graveyard-position-invalid",this)}else throw new f("split-operation-split-in-root",this);this.howMany=this.splitPosition.parent.maxOffset-this.splitPosition.offset}_execute(){let t=this.splitPosition.parent;if(this.graveyardPosition)Ms(p._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{let i=t._clone();Ao(this.insertionPosition,i)}Ms(new p(b._createAt(t,this.splitPosition.offset),b._createAt(t,t.maxOffset)),this.moveTargetPosition)}toJSON(){let t=super.toJSON();return t.splitPosition=this.splitPosition.toJSON(),t.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(t.graveyardPosition=this.graveyardPosition.toJSON()),t}static get className(){return"SplitOperation"}static getInsertionPosition(t){let i=t.path.slice(0,-1);return i[i.length-1]++,new b(t.root,i,"toPrevious")}static fromJSON(t,i){let s=b.fromJSON(t.splitPosition,i),n=b.fromJSON(t.insertionPosition,i),r=t.graveyardPosition?b.fromJSON(t.graveyardPosition,i):null;return new this(s,t.howMany,n,r,t.baseVersion)}};var ee=class Iu extends Ee{sourcePosition;howMany;targetPosition;graveyardPosition;constructor(t,i,s,n,r){super(r),this.sourcePosition=t.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=i,this.targetPosition=s.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=n.clone()}get type(){return"merge"}get deletionPosition(){return new b(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){let t=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new p(this.sourcePosition,t)}get affectedSelectable(){let t=this.sourcePosition.parent;return[p._createOn(t),p._createFromPositionAndShift(this.targetPosition,0),p._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new Iu(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){let t=this.targetPosition._getTransformedByMergeOperation(this),i=this.sourcePosition.path.slice(0,-1),s=new b(this.sourcePosition.root,
10i)._getTransformedByMergeOperation(this);return new $(t,this.howMany,s,this.graveyardPosition,this.baseVersion+1)}_validate(){let t=this.sourcePosition.parent,i=this.targetPosition.parent;if(t.parent)if(i.parent){if(this.howMany!==Number.NEGATIVE_INFINITY&&this.howMany!=t.maxOffset)throw new f("merge-operation-how-many-invalid",this)}else throw new f("merge-operation-target-position-invalid",this);else throw new f("merge-operation-source-position-invalid",this);this.howMany=this.sourcePosition.parent.maxOffset}_execute(){let t=this.sourcePosition.parent;Ms(p._createIn(t),this.targetPosition),Ms(p._createOn(t),this.graveyardPosition)}toJSON(){let t=super.toJSON();return t.sourcePosition=t.sourcePosition.toJSON(),t.targetPosition=t.targetPosition.toJSON(),t.graveyardPosition=t.graveyardPosition.toJSON(),t}static get className(){return"MergeOperation"}static fromJSON(t,i){let s=b.fromJSON(t.sourcePosition,i),n=b.fromJSON(t.targetPosition,i),r=b.fromJSON(t.graveyardPosition,i);return new this(s,t.howMany,n,r,t.baseVersion)}};
10var Ue=class Ln extends Ee{name;oldRange;newRange;affectsData;_markers;constructor(t,i,s,n,r,o){super(o),this.name=t,this.oldRange=i?i.clone():null,this.newRange=s?s.clone():null,this.affectsData=r,this._markers=n}get type(){return"marker"}get affectedSelectable(){let t=[];return this.oldRange&&t.push(this.oldRange.clone()),this.newRange&&(this.oldRange?t.push(...this.newRange.getDifference(this.oldRange)):t.push(this.newRange.clone())),t}clone(){return new Ln(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ln(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(){let t=super.toJSON();return this.oldRange&&(t.oldRange=this.oldRange.toJSON()),this.newRange&&(t.newRange=this.newRange.toJSON()),delete t._markers,t}static get className(){return"MarkerOperation"}static fromJSON(t,i){return new Ln(t.name,t.oldRange?p.fromJSON(t.oldRange,i):null,t.newRange?p.fromJSON(t.newRange,i):null,i.model.markers,t.affectsData,t.baseVersion)}};var de=class Vn extends Ee{range;key;oldValue;newValue;constructor(t,i,s,n,r){super(r),this.range=t.clone(),this.key=i,this.oldValue=s===void 0?null:s,this.newValue=n===void 0?null:n}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new Vn(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Vn(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){let t=super.toJSON();return t.range=this.range.toJSON(),t}_validate(){if(!this.range.isFlat)throw new f("attribute-operation-range-not-flat",this);for(let t of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!ss(t.getAttribute(this.key),this.oldValue))throw new f("attribute-operation-wrong-old-value",this,{item:t,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&t.hasAttribute(this.key))throw new f("attribute-operation-attribute-exists",this,{node:t,key:this.key})}}_execute(){ss(this.oldValue,this.newValue)||Sp(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(t,i){return new Vn(p.fromJSON(t.range,i),t.key,t.oldValue,t.newValue,t.baseVersion)}};var ae=class go extends Ee{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new go(this.baseVersion)}getReversed(){return new go(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}};var it=class Mn extends Ee{position;oldName;newName;constructor(t,i,s,n){super(n),this.position=t,this.position.stickiness="toNext",this.oldName=i,this.newName=s}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new Mn(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Mn(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){let t=this.position.nodeAfter;if(t instanceof Z){if(this.oldName!==""&&t.name!==this.oldName)throw new f("rename-operation-wrong-name",this)}else throw new f("rename-operation-wrong-position",this);this.oldName=t.name}_execute(){let t=this.position.nodeAfter;t.name=this.newName}toJSON(){let t=super.toJSON();return t.position=this.position.toJSON(),t}static get className(){return"RenameOperation"}static fromJSON(t,i){return new Mn(b.fromJSON(t.position,i),t.oldName,t.newName,t.baseVersion)}};var Rs=class Bn extends Ee{root;key;oldValue;newValue;constructor(t,i,s,n,r){super(r),this.root=t,this.key=i,this.oldValue=s===void 0?null:s,this.newValue=n===void 0?null:n}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new Bn(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Bn(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new f("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&!ss(this.root.getAttribute(this.key),this.oldValue))throw new f("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 f("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(){let t=super.toJSON();return t.root=this.root.toJSON(),t}static get className(){return"RootAttributeOperation"}static fromJSON(t,i){if(!i.getRoot(t.root))throw new f("rootattribute-operation-fromjson-no-root",this,{rootName:t.root});return new Bn(i.getRoot(t.root),t.key,t.oldValue,t.newValue,t.baseVersion)}};
10var Ri=class On extends Ee{rootName;elementName;isAdd;_document;constructor(t,i,s,n,r){if(super(r),this.rootName=t,this.elementName=i,this.isAdd=s,this._document=n,!this._document.getRoot(this.rootName)){let 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 On(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new On(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){let t=super.toJSON();return delete t._document,t}static get className(){return"RootOperation"}static fromJSON(t,i){return new On(t.rootName,t.elementName,t.isAdd,i,t.baseVersion)}};var Ve={};Ve[de.className]=de;Ve[Ce.className]=Ce;Ve[Ue.className]=Ue;Ve[H.className]=H;Ve[ae.className]=ae;Ve[Ee.className]=Ee;Ve[it.className]=it;Ve[Rs.className]=Rs;Ve[Ri.className]=Ri;Ve[$.className]=$;Ve[ee.className]=ee;var Pp=class{static fromJSON(e,t){return Ve[e.__className].fromJSON(e,t)}};var po=new Map;function R(e,t,i){let s=po.get(e);s||(s=new Map,po.set(e,s)),s.set(t,i)}function Lp(e,t){let i=po.get(e);return i&&i.has(t)?i.get(t):Vp}function Vp(e){return[e]}function wc(e,t,i={}){let s=Lp(e.constructor,t.constructor);try{return e=e.clone(),s(e,t,i)}catch(n){throw n}}function xu(e,t,i){e=e.slice(),t=t.slice();let s=new Mp(i.document,i.useRelations,i.forceWeakRemove);s.setOriginalOperations(e),s.setOriginalOperations(t);let n=s.originalOperations;if(e.length==0||t.length==0)return{operationsA:e,operationsB:t,originalOperations:n};let r=new WeakMap;for(let l of e)r.set(l,0);let o={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length},a=0;for(;a<e.length;){let l=e[a],c=r.get(l);if(c==t.length){a++;continue}let u=t[c],d=wc(l,u,s.getContext(l,u,!0)),h=wc(u,l,s.getContext(u,l,!1));s.updateRelation(l,u),s.setOriginalOperations(d,l),s.setOriginalOperations(h,u);for(let m of d)r.set(m,c+h.length);e.splice(a,1,...d),t.splice(c,1,...h)}if(vc(e),vc(t),i.padWithNoOps){let l=e.length-o.originalOperationsACount,c=t.length-o.originalOperationsBCount;_c(e,c-l),_c(t,l-c)}return bc(e,o.nextBaseVersionB),bc(t,o.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:n}}var Mp=class{originalOperations;_history;_useRelations;_forceWeakRemove;_relations;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){let i=t?this.originalOperations.get(t):null;for(let s of e)this.originalOperations.set(s,i||s)}updateRelation(e,t){if(e instanceof H)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"):e.howMany>1&&e.sourcePosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"firstToMoveMerged"):e.howMany>1&&e.sourcePosition.getShiftedBy(e.howMany-1).isEqual(t.deletionPosition)&&this._setRelation(e,t,"lastToMoveMerged"):t instanceof H&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof $){if(t instanceof ee)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof H)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{let i=p._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){let s=i.end.offset-e.splitPosition.offset,n=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:s,offset:n})}}}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 $?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof H&&t.howMany>0&&(e.sourcePosition.isEqual(t.sourcePosition.getShiftedBy(t.howMany))&&this._setRelation(e,t,"mergeSourceAffected"),e.targetPosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeTargetWasBefore"));else if(e instanceof Ue){let i=e.newRange;if(!i)return;if(t instanceof ee){let s=i.start.isEqual(t.targetPosition),n=i.start.isEqual(t.deletionPosition),r=i.end.isEqual(t.deletionPosition),o=i.end.isEqual(t.sourcePosition);(s||n||r||o)&&this._setRelation(e,t,{wasInLeftElement:s,wasStartBeforeMergedElement:n,wasEndBeforeMergedElement:r,wasInRightElement:o})}}}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){let t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){let i=this.originalOperations.get(t),s=this._history.getUndoneOperation(i);if(!s)return null;let n=this.originalOperations.get(e),r=this._relations.get(n);return r&&r.get(s)||null}_setRelation(e,t,i){let s=this.originalOperations.get(e),n=this.originalOperations.get(t),r=this._relations.get(s);r||(r=new Map,this._relations.set(s,r)),r.set(n,i)}};function bc(e,t){for(let i of e)i.baseVersion=t++}function _c(e,t){for(let i=0;i<t;i++)e.push(new ae(0))}function vc(e){let t=new Map;for(let i=0;i<e.length;i++){let s=e[i];if(s instanceof Ue)if(s.baseVersion!==-1)t.set(s.name,{op:s,ranges:s.newRange?[s.newRange]:[]});else{if(s.newRange){let n=t.get(s.name).ranges;
10n[0].containsRange(s.newRange,!0)||n.push(s.newRange)}e.splice(i,1),i--}}for(let{op:i,ranges:s}of t.values())s.length?i.newRange=p._createFromRanges(s):i.newRange=null}R(de,de,(e,t,i)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){let s=e.range.getDifference(t.range).map(r=>new de(r,e.key,e.oldValue,e.newValue,0)),n=e.range.getIntersection(t.range);return n&&i.aIsStrong&&s.push(new de(n,t.key,t.newValue,e.newValue,0)),s.length==0?[new ae(0)]:s}else return[e]});R(de,Ce,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){let i=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(s=>new de(s,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){let s=Eu(t,e.key,e.oldValue);s&&i.unshift(s)}return i}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]});function Eu(e,t,i){let s=e.nodes.getNode(0).getAttribute(t);return s==i?null:new de(new p(e.position,e.position.getShiftedBy(e.howMany)),t,s,i,0)}R(de,ee,(e,t)=>{let i=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&i.push(p._createFromPositionAndShift(t.graveyardPosition,1));let s=e.range._getTransformedByMergeOperation(t);return s.isCollapsed||i.push(s),i.map(n=>new de(n,e.key,e.oldValue,e.newValue,e.baseVersion))});R(de,H,(e,t)=>Bp(e.range,t).map(i=>new de(i,e.key,e.oldValue,e.newValue,e.baseVersion)));function Bp(e,t){let i=p._createFromPositionAndShift(t.sourcePosition,t.howMany),s=null,n=[];i.containsRange(e,!0)?s=e:e.start.hasSameParentAs(i.start)?(n=e.getDifference(i),s=e.getIntersection(i)):n=[e];let r=[];for(let o of n){o=o._getTransformedByDeletion(t.sourcePosition,t.howMany);let a=t.getMovedRangeStart(),l=o.start.hasSameParentAs(a),c=o._getTransformedByInsertion(a,t.howMany,l);r.push(...c)}return s&&r.push(s._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]),r}R(de,$,(e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){let i=e.clone();return i.range=new p(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,i]}return e.range=e.range._getTransformedBySplitOperation(t),[e]});R(Ce,de,(e,t)=>{let i=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){let s=Eu(e,t.key,t.newValue);s&&i.push(s)}return i});R(Ce,Ce,(e,t,i)=>e.position.isEqual(t.position)&&i.aIsStrong?[e]:(e.position=e.position._getTransformedByInsertOperation(t),[e]));R(Ce,H,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]));R(Ce,$,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e]));R(Ce,ee,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e]));R(Ue,Ce,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e]));R(Ue,Ue,(e,t,i)=>{if(e.name==t.name)if(i.aIsStrong)e.oldRange=t.newRange?t.newRange.clone():null;else return[new ae(0)];return[e]});R(Ue,ee,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e]));R(Ue,H,(e,t)=>{let i=[e];if(e.oldRange&&(e.oldRange=p._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){let s=e.newRange._getTransformedByMoveOperation(t);e.newRange=s[0];for(let n=1;n<s.length;n++){let r=e.clone();r.oldRange=null,r.newRange=s[n],r.baseVersion=-1,i.push(r)}}return i});R(Ue,$,(e,t,i)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(i.abRelation){let s=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)?i.abRelation.wasStartBeforeMergedElement?e.newRange.start=b._createAt(t.insertionPosition):i.abRelation.wasInLeftElement?e.newRange.start=b._createAt(e.newRange.start):e.newRange.start=b._createAt(t.moveTargetPosition):e.newRange.start=s.start,e.newRange.end.isEqual(t.splitPosition)?e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasEndBeforeMergedElement?e.newRange.end=b._createAt(t.insertionPosition):i.abRelation.wasInRightElement?e.newRange.end=b._createAt(t.moveTargetPosition):e.newRange.end=b._createAt(e.newRange.end):e.newRange.end=s.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]});R(ee,Ce,(e,t)=>
10(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e]));R(ee,ee,(e,t,i)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition))if(i.bWasUndone){let s=t.graveyardPosition.path.slice();return s.push(0),e.sourcePosition=new b(t.graveyardPosition.root,s),e.howMany=0,[e]}else return[new ae(0)];if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!i.bWasUndone&&i.abRelation!="splitAtSource"){let s=e.targetPosition.root.rootName=="$graveyard",n=t.targetPosition.root.rootName=="$graveyard";if(n&&!s||!(s&&!n)&&i.aIsStrong){let r=t.targetPosition._getTransformedByMergeOperation(t),o=e.targetPosition._getTransformedByMergeOperation(t);return[new H(r,e.howMany,o,0)]}else return[new ae(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),(!e.graveyardPosition.isEqual(t.graveyardPosition)||!i.aIsStrong)&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]});R(ee,H,(e,t,i)=>{let s=p._createFromPositionAndShift(t.sourcePosition,t.howMany);return t.type=="remove"&&!i.bWasUndone&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&s.containsPosition(e.sourcePosition)?[new ae(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(e.sourcePosition)&&i.abRelation=="mergeSourceAffected"?e.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness="toNone",e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&i.abRelation=="mergeTargetWasBefore"?(e.targetPosition.stickiness="toPrevious",e.howMany+=t.howMany):(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany)),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.sourcePosition.stickiness="toPrevious",e.targetPosition.stickiness="toNext",e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])});R(ee,$,(e,t,i)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)&&(t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition)||i.abRelation=="mergeTargetNotMoved"))return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e];if(e.sourcePosition.isEqual(t.splitPosition)){if(i.abRelation=="mergeSourceNotMoved")return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if(i.abRelation=="mergeSameElement"||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]});R(H,Ce,(e,t)=>{let i=p._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]});R(H,H,(e,t,i)=>{let s=p._createFromPositionAndShift(e.sourcePosition,e.howMany),n=p._createFromPositionAndShift(t.sourcePosition,t.howMany),r=i.aIsStrong,o=!i.aIsStrong;i.abRelation=="insertBefore"||i.baRelation=="insertAfter"?o=!0:(i.abRelation=="insertAfter"||i.baRelation=="insertBefore")&&(o=!1);let a;if(e.targetPosition.isEqual(t.targetPosition)&&o?a=e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):a=e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),yc(e,t)&&yc(t,e))return[t.getReversed()];if(s.containsPosition(t.targetPosition)&&s.containsRange(n,!0))return s.start=s.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),s.end=s.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Mi([s],a);if(n.containsPosition(e.targetPosition)&&n.containsRange(s,!0))return s.start=s.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),s.end=s.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Mi([s],a);let l=ne(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if(l=="prefix"||l=="extension")return s.start=s.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),s.end=s.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Mi([s],a);e.type=="remove"&&t.type!="remove"&&!i.aWasUndone&&!i.forceWeakRemove?r=!0:e.type!="remove"&&t.type=="remove"&&!i.bWasUndone&&!i.forceWeakRemove&&(r=!1);let c=[],u=s.getDifference(n);for(let h of u){h.start=h.start._getTransformedByDeletion(t.sourcePosition,t.howMany),h.end=h.end._getTransformedByDeletion(t.sourcePosition,t.howMany);let m=ne(h.start.getParentPath(),t.getMovedRangeStart().getParentPath())=="same",g=h._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,m);c.push(...g)}let d=s.getIntersection(n);return d!==null&&r&&(d.start=d.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),d.end=d.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),c.length===0?c.push(d):c.length==1?n.start.isBefore(s.start)||n.start.isEqual(s.start)?c.unshift(d):c.push(d):c.splice(1,0,d)),c.length===0?[new ae(e.baseVersion)]:Mi(c,a)});R(H,$,(e,t,i)=>{let s=e.targetPosition.clone();if((!e.targetPosition.isEqual(t.insertionPosition)||!t.graveyardPosition||i.abRelation=="moveTargetAfter")&&(s=e.targetPosition._getTransformedBySplitOperation(t)),e.sourcePosition.isEqual(t.insertionPosition)&&i.abRelation=="firstToMoveMerged")return e.howMany++,e.targetPosition=s,[e];let n=p._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.end.isEqual(t.insertionPosition))return(!t.graveyardPosition||i.abRelation=="lastToMoveMerged")&&e.howMany++,e.targetPosition=s,[e];if(n.start.hasSameParentAs(t.splitPosition)&&n.containsPosition(t.splitPosition)){let o=new p(t.splitPosition,n.end);return o=o._getTransformedBySplitOperation(t),Mi([new p(n.start,t.splitPosition),o],s)}e.targetPosition.isEqual(t.splitPosition)&&i.abRelation=="insertAtSource"&&(s=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&i.abRelation=="insertBetween"&&(s=e.targetPosition);let r=[n._getTransformedBySplitOperation(t)];if(t.graveyardPosition){let o=n.start.isEqual(t.graveyardPosition)||n.containsPosition(t.graveyardPosition);e.howMany>1&&o&&!i.aWasUndone&&r.push(p._createFromPositionAndShift(t.insertionPosition,1))}return Mi(r,s)});R(H,ee,(e,t,i)=>{let s=p._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&s.containsPosition(t.sourcePosition)){if
10(e.type=="remove"&&!i.forceWeakRemove){if(!i.aWasUndone){let r=[],o=t.graveyardPosition.clone(),a=t.targetPosition._getTransformedByMergeOperation(t),l=e.targetPosition.getTransformedByOperation(t);e.howMany>1&&(r.push(new H(e.sourcePosition,e.howMany-1,l,0)),o=o._getTransformedByMove(e.sourcePosition,l,e.howMany-1),a=a._getTransformedByMove(e.sourcePosition,l,e.howMany-1));let c=t.deletionPosition._getCombined(e.sourcePosition,l),u=new H(o,1,c,0),d=u.getMovedRangeStart().path.slice();d.push(0);let h=new b(u.targetPosition.root,d);a=a._getTransformedByMove(o,c,1);let m=new H(a,t.howMany,h,0);return r.push(u),r.push(m),r}}else if(e.howMany==1)return i.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new ae(0)]}let n=p._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]});R(it,Ce,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e]));R(it,ee,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e]));R(it,H,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]));R(it,it,(e,t,i)=>{if(e.position.isEqual(t.position))if(i.aIsStrong)e.oldName=t.newName;else return[new ae(0)];return[e]});R(it,$,(e,t)=>{let i=e.position.path;return ne(i,t.splitPosition.getParentPath())=="same"&&!t.graveyardPosition?[e,new it(e.position.getShiftedBy(1),e.oldName,e.newName,0)]:(e.position=e.position._getTransformedBySplitOperation(t),[e])});R(Rs,Rs,(e,t,i)=>{if(e.root===t.root&&e.key===t.key)if(i.aIsStrong)e.oldValue=t.newValue;else return[new ae(0)];return[e]});R(Ri,Ri,(e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new ae(0)]:[e]);R($,Ce,(e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e]));R($,ee,(e,t,i)=>{if(!e.graveyardPosition&&!i.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){let s=t.graveyardPosition.path.slice();s.push(0);let n=new $(new b(t.graveyardPosition.root,s),0,$.getInsertionPosition(new b(t.graveyardPosition.root,s)),null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=$.getInsertionPosition(e.splitPosition),e.graveyardPosition=n.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[n,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=$.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]});R($,H,(e,t,i)=>{let s=p._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){let r=s.start.isEqual(e.graveyardPosition)||s.containsPosition(e.graveyardPosition);if(!i.bWasUndone&&r){let o=e.splitPosition._getTransformedByMoveOperation(t),a=e.graveyardPosition._getTransformedByMoveOperation(t),l=a.path.slice();l.push(0);let c=new b(a.root,l);return[new H(o,e.howMany,c,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}let n=e.splitPosition.isEqual(t.targetPosition);if(n&&(i.baRelation=="insertAtSource"||i.abRelation=="splitBefore"))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=$.getInsertionPosition(e.splitPosition),[e];if(n&&i.abRelation&&i.abRelation.howMany){let{howMany:r,offset:o}=i.abRelation;return e.howMany+=r,e.splitPosition=e.splitPosition.getShiftedBy(o),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&s.containsPosition(e.splitPosition)){let r=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=r,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.
10insertionPosition=$.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=$.getInsertionPosition(e.splitPosition),[e]});R($,$,(e,t,i)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new ae(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new ae(0)];if(i.abRelation=="splitBefore")return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){let s=e.splitPosition.root.rootName=="$graveyard",n=t.splitPosition.root.rootName=="$graveyard";if(n&&!s||!(s&&!n)&&i.aIsStrong){let r=[];return t.howMany&&r.push(new H(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&r.push(new H(e.splitPosition,e.howMany,e.moveTargetPosition,0)),r}else return[new ae(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&i.abRelation=="splitBefore")return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&i.baRelation=="splitBefore"){let s=t.insertionPosition.path.slice();s.push(0);let n=new b(t.insertionPosition.root,s);return[e,new H(e.insertionPosition,1,n,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=$.getInsertionPosition(e.splitPosition),[e]});function yc(e,t){return e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)===null}function Mi(e,t){let i=[];for(let s=0;s<e.length;s++){let n=e[s],r=new H(n.start,n.end.offset-n.start.offset,t,0);i.push(r);for(let o=s+1;o<e.length;o++)e[o]=e[o]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];t=t._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return i}var Op=F(b),Y=class extends Op{constructor(e,t,i="toNone",s){super(e,t,i);let n=s||(this.root.is("rootElement")?this.root.document.model:null);if(!n)throw new f("model-liveposition-no-model-reference",e);Rp.call(this,n)}detach(){this.stopListening()}toPosition(){return new b(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}static _fromPositionInDocumentFragment(e,t,i){return new this(e.root,e.path.slice(),i||e.stickiness,t)}};Y.prototype.is=function(e){return e==="livePosition"||e==="model:livePosition"||e=="position"||e==="model:position"};function Rp(e){let t=!this.root.is("rootElement");this.listenTo(e,"applyOperation",(i,s)=>{let n=s[0];!t&&!n.isDocumentOperation||Fp.call(this,n)},{priority:"low"})}function Fp(e){let t=this.getTransformedByOperation(e);if(!this.isEqual(t)){let i=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",i)}}var Pi=class{operations;isUndoable;isLocal;isUndo;isTyping;constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},N("batch-constructor-deprecated-string-type"));let{isUndoable:t=!0,isLocal:i=!0,isUndo:s=!1,isTyping:n=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=s,this.isTyping=n}get baseVersion(){for(let e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.isDocumentOperation&&(e.batch=this,this.operations.push(e)),e}};var Dp=class wo{static _statesPriority=[void 0,"refresh","rename","move"];_markerCollection;_changesInElement=new Map;_elementsSnapshots=new Map;_elementChildrenSnapshots=new Map;_elementState=new Map;_changedMarkers=new Map;
10_changedRoots=new Map;_changeCount=0;_cachedChanges=null;_cachedChangesWithGraveyard=null;_refreshedItems=new Set;constructor(t){this._markerCollection=t}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(t){let i=t;switch(i.type){case"insert":if(this._isInInsertedElement(i.position.parent))return;this._markInsert(i.position.parent,i.position.offset,i.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(let s of i.range.getItems({shallow:!0}))this._isInInsertedElement(s.parent)||this._markAttribute(s);break;case"remove":case"move":case"reinsert":{if(i.sourcePosition.isEqual(i.targetPosition)||i.sourcePosition.getShiftedBy(i.howMany).isEqual(i.targetPosition))return;let s=this._isInInsertedElement(i.sourcePosition.parent),n=this._isInInsertedElement(i.targetPosition.parent);s||this._markRemove(i.sourcePosition.parent,i.sourcePosition.offset,i.howMany),n||this._markInsert(i.targetPosition.parent,i.getMovedRangeStart().offset,i.howMany);let r=p._createFromPositionAndShift(i.sourcePosition,i.howMany);for(let o of r.getItems({shallow:!0}))this._setElementState(o,"move");break}case"rename":{if(this._isInInsertedElement(i.position.parent))return;this._markRemove(i.position.parent,i.position.offset,1),this._markInsert(i.position.parent,i.position.offset,1);let s=p._createFromPositionAndShift(i.position,1);for(let n of this._markerCollection.getMarkersIntersectingRange(s)){let r=n.getData();this.bufferMarkerChange(n.name,r,r)}this._setElementState(i.position.nodeAfter,"rename");break}case"split":{let s=i.splitPosition.parent;if(!this._isInInsertedElement(s)){this._markRemove(s,i.splitPosition.offset,i.howMany);let n=p._createFromPositionAndShift(i.splitPosition,i.howMany);for(let r of n.getItems({shallow:!0}))this._setElementState(r,"move")}this._isInInsertedElement(i.insertionPosition.parent)||this._markInsert(i.insertionPosition.parent,i.insertionPosition.offset,1),i.graveyardPosition&&(this._markRemove(i.graveyardPosition.parent,i.graveyardPosition.offset,1),this._setElementState(i.graveyardPosition.nodeAfter,"move"));break}case"merge":{let s=i.sourcePosition.parent;this._isInInsertedElement(s.parent)||this._markRemove(s.parent,s.startOffset,1);let n=i.graveyardPosition.parent;this._markInsert(n,i.graveyardPosition.offset,1),this._setElementState(s,"move");let r=i.targetPosition.parent;if(!this._isInInsertedElement(r)){this._markInsert(r,i.targetPosition.offset,s.maxOffset);let o=p._createFromPositionAndShift(i.sourcePosition,i.howMany);for(let a of o.getItems({shallow:!0}))this._setElementState(a,"move")}break}case"detachRoot":case"addRoot":{let s=i.affectedSelectable;if(!s._isLoaded||s.isAttached()==i.isAdd)return;this._bufferRootStateChange(i.rootName,i.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!i.root._isLoaded)return;let s=i.root.rootName;this._bufferRootAttributeChange(s,i.key,i.oldValue,i.newValue);break}}this._cachedChanges=null}bufferMarkerChange(t,i,s){i.range&&i.range.root.is("rootElement")&&!i.range.root._isLoaded&&(i.range=null),s.range&&s.range.root.is("rootElement")&&!s.range.root._isLoaded&&(s.range=null);let n=this._changedMarkers.get(t);n?n.newMarkerData=s:(n={newMarkerData:s,oldMarkerData:i},this._changedMarkers.set(t,n)),n.oldMarkerData.range==null&&s.range==null&&this._changedMarkers.delete(t)}getMarkersToRemove(){let t=[];for(let[i,s]of this._changedMarkers)s.oldMarkerData.range!=null&&t.push({name:i,range:s.oldMarkerData.range});return t}getMarkersToAdd(){let t=[];for(let[i,s]of this._changedMarkers)s.newMarkerData.range!=null&&t.push({name:i,range:s.newMarkerData.range});return t}getChangedMarkers(){return Array.from(this._changedMarkers).map(([t,i])=>({name:t,data:{oldRange:i.oldMarkerData.range,newRange:i.newMarkerData.range}}))}hasDataChanges(){if(this.getChanges().length||this._changedRoots.size>0)return!0;for(let{newMarkerData:t,oldMarkerData:i}of this._changedMarkers.values()){if(t.affectsData!==i.affectsData)return!0;if(t.affectsData){let s=t.range&&!i.range,n=!t.range&&i.range,r=t.range&&i.range&&!t.range.isEqual(i.range);if(s||n||r)return!0}}return!1}getChanges(t={}){if(this._cachedChanges)return t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let i=[];for(let s of this._changesInElement.keys()){let n=this._changesInElement.get(s).sort((u,d)=>u.offset===d.offset?u.type!=d.type?u.type=="remove"?-1:1:0:u.offset<d.offset?-1:1),r=this._elementChildrenSnapshots.get(s),o=Cc(s.getChildren()),a=Np(r.length,n),l=0,c=0;for(let u of a)if(u==="i"){let d=this._getDiffActionForNode(o[l].node,"insert"),h=this._elementsSnapshots.get(o[l].node),m=this._getInsertDiff(s,l,d,o[l],h);i.push(m),l++}else if(u==="r"){let d=this._getDiffActionForNode(r[c].node,"remove"),h=this._getRemoveDiff(s,l,d,r[c]);i.push(h),c++}else if(u==="a"){let d=r[c].attributes,h=o[l].attributes,m;if(o[l].name=="$text")m=new p(b._createAt(s,l),b._createAt(s,l+1));else{let w=s.offsetToIndex(l);m=new p(b._createAt(s,l),b._createAt(s.getChild(w),0))}let g=this._getAttributesDiff(m,d,h);i.push(...g),l++,c++}else l++,c++}i.sort((s,n)=>s.position.root!=n.position.root?s.position.root.rootName<n.position.root.rootName?-1:1:s.position.isEqual(n.position)?s.changeCount-n.changeCount:s.position.isBefore(n.position)?-1:1);for(let s=1,n=0;s<i.length;s++){let r=i[n],o=i[s],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)),i[s]=null):n=s}i=i.filter(s=>s);for(let s of i)delete s.changeCount,s.type=="attribute"&&(delete s.position,delete s.length);return this._changeCount=0,this._cachedChangesWithGraveyard=i,this._cachedChanges=i.filter(zp),t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}
10getChangedRoots(){return Array.from(this._changedRoots.values()).map(t=>{let i={...t};return i.state!==void 0&&delete i.attributes,i})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementChildrenSnapshots.clear(),this._elementsSnapshots.clear(),this._elementState.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems.clear(),this._cachedChanges=null}_refreshItem(t){if(this._isInInsertedElement(t.parent))return;this._markRemove(t.parent,t.startOffset,t.offsetSize),this._markInsert(t.parent,t.startOffset,t.offsetSize),this._refreshedItems.add(t),this._setElementState(t,"refresh");let i=p._createOn(t);for(let s of this._markerCollection.getMarkersIntersectingRange(i)){let n=s.getData();this.bufferMarkerChange(s.name,n,n)}this._cachedChanges=null}_bufferRootLoad(t){if(t.isAttached()){this._bufferRootStateChange(t.rootName,!0),this._markInsert(t,0,t.maxOffset);for(let i of t.getAttributeKeys())this._bufferRootAttributeChange(t.rootName,i,null,t.getAttribute(i));for(let i of this._markerCollection)if(i.getRange().root==t){let s=i.getData();this.bufferMarkerChange(i.name,{...s,range:null},s)}}}_bufferRootStateChange(t,i){if(!this._changedRoots.has(t)){this._changedRoots.set(t,{name:t,state:i?"attached":"detached"});return}let s=this._changedRoots.get(t);s.state!==void 0?(delete s.state,s.attributes===void 0&&this._changedRoots.delete(t)):s.state=i?"attached":"detached"}_bufferRootAttributeChange(t,i,s,n){let r=this._changedRoots.get(t)||{name:t},o=r.attributes||{};if(o[i]){let a=o[i];n===a.oldValue?delete o[i]:a.newValue=n}else o[i]={oldValue:s,newValue:n};Object.entries(o).length===0?(delete r.attributes,r.state===void 0&&this._changedRoots.delete(t)):(r.attributes=o,this._changedRoots.set(t,r))}_markInsert(t,i,s){if(t.root.is("rootElement")&&!t.root._isLoaded)return;let n={type:"insert",offset:i,howMany:s,count:this._changeCount++};this._markChange(t,n)}_markRemove(t,i,s){if(t.root.is("rootElement")&&!t.root._isLoaded)return;let n={type:"remove",offset:i,howMany:s,count:this._changeCount++};this._markChange(t,n),this._removeAllNestedChanges(t,i,s)}_markAttribute(t){if(t.root.is("rootElement")&&!t.root._isLoaded)return;let i={type:"attribute",offset:t.startOffset,howMany:t.offsetSize,count:this._changeCount++};this._markChange(t.parent,i)}_markChange(t,i){this._makeSnapshots(t);let s=this._getChangesForElement(t);this._handleChange(i,s),s.push(i);for(let n=0;n<s.length;n++)s[n].howMany<1&&(s.splice(n,1),n--)}_setElementState(t,i){if(!t.is("element"))return;let s=wo._statesPriority.indexOf(this._elementState.get(t));wo._statesPriority.indexOf(i)>s&&this._elementState.set(t,i)}_getDiffActionForNode(t,i){if(!t.is("element")||!this._elementsSnapshots.has(t))return i;let s=this._elementState.get(t);return!s||s=="move"?i:s}_getChangesForElement(t){let i;return this._changesInElement.has(t)?i=this._changesInElement.get(t):(i=[],this._changesInElement.set(t,i)),i}_makeSnapshots(t){if(this._elementChildrenSnapshots.has(t))return;let i=Cc(t.getChildren());this._elementChildrenSnapshots.set(t,i);for(let s of i)this._elementsSnapshots.set(s.node,s)}_handleChange(t,i){t.nodesToHandle=t.howMany;for(let s of i){let n=t.offset+t.howMany,r=s.offset+s.howMany;if(t.type=="insert"&&(s.type=="insert"&&(t.offset<=s.offset?s.offset+=t.howMany:t.offset<r&&(s.howMany+=t.nodesToHandle,t.nodesToHandle=0)),s.type=="remove"&&t.offset<s.offset&&(s.offset+=t.howMany),s.type=="attribute")){if(t.offset<=s.offset)s.offset+=t.howMany;else if(t.offset<r){let o=s.howMany;s.howMany=t.offset-s.offset,i.unshift({type:"attribute",offset:n,howMany:o-s.howMany,count:this._changeCount++})}}if(t.type=="remove"){if(s.type=="insert"){if(n<=s.offset)s.offset-=t.howMany;else if(n<=r)if(t.offset<s.offset){let o=n-s.offset;s.offset=t.offset,s.howMany-=o,t.nodesToHandle-=o}else s.howMany-=t.nodesToHandle,t.nodesToHandle=0;else if(t.offset<=s.offset)t.nodesToHandle-=s.howMany,s.howMany=0;else if(t.offset<r){let o=r-t.offset;s.howMany-=o,t.nodesToHandle-=o}}if(s.type=="remove"&&(n<=s.offset?s.offset-=t.howMany:t.offset<s.offset&&(t.nodesToHandle+=s.howMany,s.howMany=0)),s.type=="attribute"){if(n<=s.offset)s.offset-=t.howMany;else if(t.offset<s.offset){let o=n-s.offset;s.offset=t.offset,s.howMany-=o}else if(t.offset<r)if(n<=r){let o=s.howMany;s.howMany=t.offset-s.offset;let a=o-s.howMany-t.nodesToHandle;i.unshift({type:"attribute",offset:t.offset,howMany:a,count:this._changeCount++})}else s.howMany-=r-t.offset}}if(t.type=="attribute"){if(s.type=="insert")if(t.offset<s.offset&&n>s.offset){if(n>r){let o={type:"attribute",offset:r,howMany:n-r,count:this._changeCount++};this._handleChange(o,i),i.push(o)}
10t.nodesToHandle=s.offset-t.offset,t.howMany=t.nodesToHandle}else t.offset>=s.offset&&t.offset<r&&(n>r?(t.nodesToHandle=n-r,t.offset=r):t.nodesToHandle=0);if(s.type=="remove"&&t.offset<s.offset&&n>s.offset){let o={type:"attribute",offset:s.offset,howMany:n-s.offset,count:this._changeCount++};this._handleChange(o,i),i.push(o),t.nodesToHandle=s.offset-t.offset,t.howMany=t.nodesToHandle}s.type=="attribute"&&(t.offset>=s.offset&&n<=r?(t.nodesToHandle=0,t.howMany=0,t.offset=0):t.offset<=s.offset&&n>=r&&(s.howMany=0))}}t.howMany=t.nodesToHandle,delete t.nodesToHandle}_getInsertDiff(t,i,s,n,r){let o={type:"insert",position:b._createAt(t,i),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++,action:s};return s!="insert"&&r&&(o.before={name:r.name,attributes:new Map(r.attributes)}),o}_getRemoveDiff(t,i,s,n){return{type:"remove",action:s,position:b._createAt(t,i),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(t,i,s){let n=[];s=new Map(s);for(let[r,o]of i){let a=s.has(r)?s.get(r):null;a!==o&&n.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:r,attributeOldValue:o,attributeNewValue:a,changeCount:this._changeCount++}),s.delete(r)}for(let[r,o]of s)n.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:r,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return n}_isInInsertedElement(t){let i=t.parent;if(!i)return!1;let s=this._changesInElement.get(i),n=t.startOffset;if(s){for(let r of s)if(r.type=="insert"&&n>=r.offset&&n<r.offset+r.howMany)return!0}return this._isInInsertedElement(i)}_removeAllNestedChanges(t,i,s){let n=new p(b._createAt(t,i),b._createAt(t,i+s));for(let r of n.getItems({shallow:!0}))r.is("element")&&(this._changesInElement.delete(r),this._removeAllNestedChanges(r,0,r.maxOffset))}};function kc(e){return{node:e,name:e.is("$text")?"$text":e.name,attributes:new Map(e.getAttributes())}}function Cc(e){let t=[];for(let i of e)if(i.is("$text"))for(let s=0;s<i.data.length;++s)t.push(kc(i));else t.push(kc(i));return t}function Np(e,t){let i=[],s=0,n=0;for(let r of t){if(r.offset>s){for(let o=0;o<r.offset-s;o++)i.push("e");n+=r.offset-s}if(r.type=="insert"){for(let o=0;o<r.howMany;o++)i.push("i");s=r.offset+r.howMany}else if(r.type=="remove"){for(let o=0;o<r.howMany;o++)i.push("r");s=r.offset,n+=r.howMany}else{if(r.howMany>1500)for(let o=0;o<r.howMany;o++)i.push("a");else i.push(..."a".repeat(r.howMany).split(""));s=r.offset+r.howMany,n+=r.howMany}}if(n<e)for(let r=0;r<e-n-s;r++)i.push("e");return i}function zp(e){let t="position"in e&&e.position.root.rootName=="$graveyard",i="range"in e&&e.range.root.rootName=="$graveyard";return!t&&!i}var Hp=class{_operations=[];_undoPairs=new Map;_undoneOperations=new Set;_baseVersionToOperationIndex=new Map;_version=0;_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 f("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[];let i=this._operations[0];e===void 0&&(e=i.baseVersion);let s=t-1;for(let[o,a]of this._gaps)e>o&&e<a&&(e=a),s>o&&s<a&&(s=o-1);if(s<i.baseVersion||e>this.lastOperation.baseVersion)return[];let n=this._baseVersionToOperationIndex.get(e);n===void 0&&(n=0);let r=this._baseVersionToOperationIndex.get(s);return r===void 0&&(r=this._operations.length-1),this._operations.slice(n,r+1)}getOperation(e){let 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)}
10isUndoneOperation(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}};var Fn=class extends Z{rootName;_document;_isAttached=!0;_isLoaded=!0;constructor(e,t,i="main"){super(t),this._document=e,this.rootName=i}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}};Fn.prototype.is=function(e,t){return t?t===this.name&&(e==="rootElement"||e==="model:rootElement"||e==="element"||e==="model:element"):e==="rootElement"||e==="model:rootElement"||e==="element"||e==="model:element"||e==="node"||e==="model:node"};var Ic="$graveyard",Up=F(),Wp=class extends Up{model;history;selection;roots;differ;isReadOnly;_postFixers;_hasSelectionChangedFromTheLastChangeBlock;constructor(e){super(),this.model=e,this.history=new Hp,this.selection=new le(this),this.roots=new pe({idProperty:"rootName"}),this.differ=new Dp(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Ic),this.listenTo(e,"applyOperation",(t,i)=>{let s=i[0];s.isDocumentOperation&&this.differ.bufferOperation(s)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,i)=>{let 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,n,r)=>{let o={...i.getData(),range:n};this.differ.bufferMarkerChange(i.name,r,o),s===null&&i.on("change",(a,l)=>{let c=i.getData();this.differ.bufferMarkerChange(i.name,{...c,range:l},c)})}),this.registerPostFixer(t=>{let i=!1;for(let s of this.roots)!s.isAttached()&&!s.isEmpty&&(t.remove(t.createRangeIn(s)),i=!0);for(let 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(Ic)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new f("model-document-createroot-name-exists",this,{name:t});let i=new Fn(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 this.getRoots(e).map(t=>t.rootName)}getRoots(e=!1){return this.roots.filter(t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){let e=Ir(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(){let e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){let e=this._getDefaultRoot(),t=this.model,i=t.schema,s=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(s)||t.createRange(s)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&xc(e.start)&&xc(e.end)}_callPostFixers(e){let t=!1;do for(let i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break;while(t)}};function xc(e){let t=e.textNode;if(t){let i=t.data,s=e.offset-t.startOffset;return!ps(i,s)&&!ws(i,s)}return!0}var qp=F(),$p=F(Ot),Kp=class extends qp{_markers=new Map;[Symbol.iterator](){return this._markers.values()}has(e){let t=e instanceof Li?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,s=!1){let n=e instanceof Li?e.name:e;if(n.includes(","))throw new f("markercollection-incorrect-marker-name",this);let r=this._markers.get(n);if(r){let l=r.getData(),c=r.getRange(),u=!1;return c.isEqual(t)||(r._attachLiveRange(xe.fromRange(t)),u=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,u=!0),typeof s=="boolean"&&s!=r.affectsData&&(r._affectsData=s,u=!0),u&&this.fire(`update:${n}`,r,c,t,l),r}let o=xe.fromRange(t),a=new Li(n,o,i,s);return this._markers.set(n,a),this.fire(`update:${n}`,a,null,t,{...a.getData(),range:null}),a}_remove(e){let t=e instanceof Li?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){let t=e instanceof Li?e.name:e,i=this._markers.get(t);if(!i)throw new f("markercollection-refresh-marker-not-exists",this);let s=i.getRange();this.fire(`update:${t}`,i,s,s,i.getData())}*getMarkersAtPosition(e){for(let t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(let t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(let e of this._markers.values())this._destroyMarker(e);this._markers.clear(),this.stopListening()}*getMarkersGroup(e){for(let t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}},Li=class extends $p{name;_managedUsingOperations;_affectsData;_liveRange;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 f("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}
10getStart(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new f("marker-destroyed",this);return this._liveRange.toRange()}toJSON(){return{name:this.name,range:this._liveRange?.toJSON(),usingOperations:this._managedUsingOperations,affectsData:this._affectsData}}_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}};Li.prototype.is=function(e){return e==="marker"||e==="model:marker"};var jp=class extends Ee{sourcePosition;howMany;constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){let e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new f("detach-operation-on-document-node",this)}_execute(){vu(p._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}};var gt=class Tu extends Ot{markers=new Map;_children=new As;constructor(t){super(),t&&this._insertChild(0,t)}[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(t){return this._children.getNode(t)}getChildAtOffset(t){return this._children.getNodeAtOffset(t)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(t){return this._children.getNodeIndex(t)}getChildStartOffset(t){return this._children.getNodeStartOffset(t)}getPath(){return[]}getNodeByPath(t){let i=this;for(let s of t)i=i.getChildAtOffset(s);return i}offsetToIndex(t){return this._children.offsetToIndex(t)}toJSON(){let t=[];for(let i of this._children)t.push(i.toJSON());return t}static fromJSON(t){let i=[];for(let s of t)s.name?i.push(Z.fromJSON(s)):i.push(J.fromJSON(s));return new Tu(i)}_appendChild(t){this._insertChild(this.childCount,t)}_insertChild(t,i){let s=Gp(i);for(let n of s)n.parent!==null&&n._remove(),n.parent=this;this._children._insertNodes(t,s)}_removeChildren(t,i=1){let s=this._children._removeNodes(t,i);for(let n of s)n.parent=null;return s}_removeChildrenArray(t){this._children._removeNodesArray(t);for(let i of t)i.parent=null}};gt.prototype.is=function(e){return e==="documentFragment"||e==="model:documentFragment"};function Gp(e){return typeof e=="string"?[new J(e)]:(ve(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new J(t):t instanceof tt?new J(t.data,t.getAttributes()):t))}var Zp=class{model;batch;constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new J(e,t)}createElement(e,t){return new Z(e,t)}createDocumentFragment(){return new gt}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof J&&e.data=="")return;let s=b._createAt(t,i);if(e.parent)if(Ac(e.root,s.root)){this.move(p._createOn(e),s);return}else{if(e.root.document)throw new f("model-writer-insert-forbidden-move",this);this.remove(e)}let n=s.root.document?s.root.document.version:null,r=new Ce(s,e instanceof gt?e._removeChildren(0,e.childCount):e,n);if(e instanceof J&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof gt)for(let[o,a]of e.markers){let l=b._createAt(a.root,0),c={range:new p(a.start._getCombined(l,s),a.end._getCombined(l,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(o)?this.updateMarker(o,c):this.addMarker(o,c)}}insertText(e,t,i,s){t instanceof gt||t instanceof Z||t instanceof b?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,s)}insertElement(e,t,i,s){t instanceof gt||t instanceof Z||t instanceof b?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 gt||t instanceof Z?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof gt||t instanceof Z?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof p){let s=i.getMinimalFlatRanges();for(let n of s)Ec(this,e,t,n)}else Tc(this,e,t,i)}setAttributes(e,t){for(let[i,s]of De(e))this.setAttribute(i,s,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof p){let i=t.getMinimalFlatRanges();for(let s of i)Ec(this,e,null,s)}else Tc(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();let t=i=>{for(let s of i.getAttributeKeys())this.removeAttribute(s,i)};if(!(e instanceof p))t(e);else for(let i of e.getItems())t(i)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof p))throw new f("writer-move-invalid-range",this);if(!e.isFlat)throw new f("writer-move-range-not-flat",this);let s=b._createAt(t,i);if(s.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!Ac(e.root,s.root))throw new f("writer-move-different-document",this);let n=e.root.document?e.root.document.version:null,r=new H(e.start,e.end.offset-e.start.offset,s,n);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();let t=(e instanceof p?e:p._createOn(e)).getMinimalFlatRanges().reverse();for(let i of t)this._addOperationForAffectedMarkers("move",i),Jp(i.start,i.end.offset-i.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();let t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof Z))throw new f("writer-merge-no-element-before",this);if(!(i instanceof Z))throw new f("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){let t=e.nodeBefore,i=e.nodeAfter;this.move(p._createIn(i),b._createAt(t,"end")),this.remove(i)}_merge(e){let t=b._createAt(e.nodeBefore,"end"),i=b._createAt(e.nodeAfter,0),s=e.root.document.graveyard,n=new b(s,[0]),r=e.root.document.version,o=new ee(i,e.nodeAfter.maxOffset,t,n,r);this.batch.addOperation(o),this.model.applyOperation(o)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof Z))throw new f("writer-rename-not-element-instance",this);let i=e.root.document?e.root.document.version:null,s=new it(b._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 f("writer-split-element-no-parent",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new f("writer-split-invalid-limit-element",this);let s,n;do{let r=i.root.document?i.root.document.version:null,o=i.maxOffset-e.offset,a=$.getInsertionPosition(e),l=new $(e,o,a,null,r);this.batch.addOperation(l),this.model.applyOperation(l),!s&&!n&&(s=i,n=e.parent.nextSibling),e=this.createPositionAfter(e.parent),i=e.parent}while(i!==t);return{position:e,range:new p(b._createAt(s,"end"),b._createAt(n,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new f("writer-wrap-range-not-flat",this);let i=t instanceof Z?t:new Z(t);if(i.childCount>0)throw new f("writer-wrap-element-not-empty",this);if(i.parent!==null)throw new f("writer-wrap-element-attached",this);this.insert(i,e.start);let s=new p(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(s,b._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new f("writer-unwrap-element-no-parent",this);this.move(p._createIn(e),this.createPositionAfter(e)),this.remove(e)}
10addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!="boolean")throw new f("writer-addmarker-no-usingoperation",this);let i=t.usingOperation,s=t.range,n=t.affectsData===void 0?!1:t.affectsData;if(this.model.markers.has(e))throw new f("writer-addmarker-marker-exists",this);if(!s)throw new f("writer-addmarker-no-range",this);return i?(Cs(this,e,null,s,n),this.model.markers.get(e)):this.model.markers._set(e,s,i,n)}updateMarker(e,t){this._assertWriterUsedCorrectly();let i=typeof e=="string"?e:e.name,s=this.model.markers.get(i);if(!s)throw new f("writer-updatemarker-marker-not-exists",this);if(!t){N("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),this.model.markers._refresh(s);return}let n=typeof t.usingOperation=="boolean",r=typeof t.affectsData=="boolean",o=r?t.affectsData:s.affectsData;if(!n&&!t.range&&!r)throw new f("writer-updatemarker-wrong-options",this);let a=s.getRange(),l=t.range?t.range:a;if(n&&t.usingOperation!==s.managedUsingOperations){t.usingOperation?Cs(this,i,null,l,o):(Cs(this,i,a,null,o),this.model.markers._set(i,l,void 0,o));return}s.managedUsingOperations?Cs(this,i,a,l,o):this.model.markers._set(i,l,void 0,o)}removeMarker(e){this._assertWriterUsedCorrectly();let t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new f("writer-removemarker-no-marker",this);let i=this.model.markers.get(t);if(!i.managedUsingOperations){this.model.markers._remove(t);return}let s=i.getRange();Cs(this,t,s,null,i.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();let i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new f("writer-addroot-root-exists",this);let s=this.model.document,n=new Ri(e,t,!0,s,s.version);return this.batch.addOperation(n),this.model.applyOperation(n),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();let t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new f("writer-detachroot-no-root",this);for(let n of this.model.markers)n.getRange().root===t&&this.removeMarker(n);for(let n of t.getAttributeKeys())this.removeAttribute(n,t);this.remove(this.createRangeIn(t));let i=this.model.document,s=new Ri(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(let[i,s]of De(e))this._setSelectionAttribute(i,s)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(let t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){let i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){let s=le._getStoreAttributeKey(e);this.setAttribute(s,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){let t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){let i=le._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new f("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(let i of this.model.markers){if(!i.managedUsingOperations)continue;let s=i.getRange(),n;if(e==="move"){let r=t;n=r.containsPosition(s.start)||r.start.isEqual(s.start)||r.containsPosition(s.end)||r.end.isEqual(s.end)}else{let r=t,o=r.nodeBefore,a=r.nodeAfter,l=s.start.parent==o&&s.start.isAtEnd,c=s.end.parent==a&&s.end.offset==0,u=s.end.nodeAfter==a,d=s.start.nodeAfter==a;n=l||c||u||d}n&&this.updateMarker(i.name,{range:s})}}};function Ec(e,t,i,s){let n=e.model,r=n.document,o=s.start,a,l,c;for(let d of s.getWalker({shallow:!0}))c=d.item.getAttribute(t),a&&l!=c&&(l!=i&&u(),o=a),a=d.nextPosition,l=c;a instanceof b&&a!=o&&l!=i&&u();function u(){let d=new p(o,a),h=d.root.document?r.version:null,m=new de(d,t,l,i,h);e.batch.addOperation(m),n.applyOperation(m)}}function Tc(e,t,i,s){let n=e.model,r=n.document,o=s.getAttribute(t),a,l;if(o!=i){if(s.root===s)l=new Rs(s,t,o,i,s.document?r.version:null);else{a=new p(b._createBefore(s),e.createPositionAfter(s));let c=a.root.document?r.version:null;
10l=new de(a,t,o,i,c)}e.batch.addOperation(l),n.applyOperation(l)}}function Cs(e,t,i,s,n){let r=e.model,o=r.document,a=new Ue(t,i,s,r.markers,!!n,o.version);e.batch.addOperation(a),r.applyOperation(a)}function Jp(e,t,i,s){let n;if(e.root.document){let r=s.document;n=new H(e,t,new b(r.graveyard,[0]),r.version)}else n=new jp(e,t);i.addOperation(n),s.applyOperation(n)}function Ac(e,t){return e===t||e instanceof Fn&&t instanceof Fn}function Yp(e){e.document.registerPostFixer(t=>Qp(t,e))}function Qp(e,t){let i=t.document.selection,s=t.schema,n=[],r=!1;for(let o of i.getRanges()){let a=zn(o,s);a&&!a.isEqual(o)?(n.push(a),r=!0):n.push(o)}return r&&e.setSelection(iw(n),{backward:i.isBackward}),!1}function zn(e,t){return e.isCollapsed?Xp(e,t):ew(e,t)}function Xp(e,t){let i=e.start,s=t.getNearestSelectionRange(i);if(!s){let r=i.getAncestors().reverse().find(o=>t.isObject(o));return r?p._createOn(r):null}if(!s.isCollapsed)return s;let n=s.start;return i.isEqual(n)?null:new p(n)}function ew(e,t){let{start:i,end:s}=e,n=t.checkChild(i,"$text"),r=t.checkChild(s,"$text"),o=t.getLimitElement(i),a=t.getLimitElement(s);if(o===a){if(n&&r)return null;if(tw(i,s,t)){let u=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),d=s.nodeBefore&&t.isSelectable(s.nodeBefore)?null:t.getNearestSelectionRange(s,"backward");return new p(u?u.start:i,d?d.end:s)}}
10let l=o&&!o.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){let u=i.nodeAfter&&s.nodeBefore&&i.nodeAfter.parent===s.nodeBefore.parent,d=l&&(!u||!Pc(i.nodeAfter,t)),h=c&&(!u||!Pc(s.nodeBefore,t)),m=i,g=s;return d&&(m=b._createBefore(Sc(o,t))),h&&(g=b._createAfter(Sc(a,t))),new p(m,g)}return null}function Sc(e,t){let i=e,s=i;for(;t.isLimit(s)&&s.parent;)i=s,s=s.parent;return i}function tw(e,t,i){let s=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),n=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return s||n}function iw(e){let t=[...e],i=new Set,s=1;for(;s<t.length;){let n=t[s],r=t.slice(0,s);for(let[o,a]of r.entries())if(!i.has(o)){if(n.isEqual(a))i.add(o);else if(n.isIntersecting(a)){i.add(o),i.add(s);let l=n.getJoined(a);t.push(l)}}s++}return t.filter((n,r)=>!i.has(r))}function Pc(e,t){return e&&t.isSelectable(e)}function sw(e,t,i={}){if(t.isCollapsed)return;let s=t.getFirstRange();if(s.root.rootName=="$graveyard")return;let n=e.schema,r=e.document.selection,o=mw(t,r,s),a=Array.from(r.getAttributes()),l=!!r.getFirstRange()?.start.parent.isEmpty;e.change(c=>{if(!i.doNotResetEntireContent&&hw(n,t)){dw(c,t);return}let u={};if(!i.doNotAutoparagraph){let m=t.getSelectedElement();m&&Object.assign(u,n.getAttributesWithProperty(m,"copyOnReplace",!0))}let d,h;s.root instanceof gt?(d=Y._fromPositionInDocumentFragment(s.start,e,"toPrevious"),h=Y._fromPositionInDocumentFragment(s.end,e,"toNext")):i.doNotFixSelection?(d=Y.fromPosition(s.start,"toPrevious"),h=Y.fromPosition(s.end,"toNext")):[d,h]=nw(s),d.isTouching(h)||c.remove(c.createRange(d,h)),i.leaveUnmerged||(ow(c,d,h),n.removeDisallowedAttributes(d.parent.getChildren(),c)),Lu(c,t,d),!i.doNotAutoparagraph&&cw(n,d)&&Pu(c,d,t,u),o&&fw(c,a,l),d.detach(),h.detach()})}function nw(e){let t=e.root.document.model,i=e.start,s=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){let n=rw(s);if(n&&s.isTouching(t.createPositionAt(n,0))){let r=t.createSelection(e);t.modifySelection(r,{direction:"backward"});let o=r.getLastPosition(),a=t.createRange(o,s);t.hasContent(a,{ignoreMarkers:!0})||(s=o)}}return[Y.fromPosition(i,"toPrevious"),Y.fromPosition(s,"toNext")]}function rw(e){let t=e.parent,i=t.root.document.model.schema,s=t.getAncestors({parentFirst:!0,includeSelf:!0});for(let n of s){if(i.isLimit(n))return null;if(i.isBlock(n))return n}}function ow(e,t,i){let s=e.model;if(!So(e.model.schema,t,i))return;let[n,r]=lw(t,i);!n||!r||(!s.hasContent(n,{ignoreMarkers:!0})&&s.hasContent(r,{ignoreMarkers:!0})?Su(e,t,i,n.parent):Au(e,t,i,n.parent))}function Au(e,t,i,s){let n=t.parent,r=i.parent;if(!(n==s||r==s)){for(t=e.createPositionAfter(n),i=e.createPositionBefore(r),i.isEqual(t)||e.insert(r,t),e.merge(t);i.parent.isEmpty;){let o=i.parent;i=e.createPositionBefore(o),e.remove(o)}So(e.model.schema,t,i)&&Au(e,t,i,s)}}function Su(e,t,i,s){let n=t.parent,r=i.parent;if(!(n==s||r==s)){for(t=e.createPositionAfter(n),i=e.createPositionBefore(r),i.isEqual(t)||e.insert(n,i);t.parent.isEmpty;){let o=t.parent;t=e.createPositionBefore(o),e.remove(o)}i=e.createPositionBefore(r),aw(e,i),So(e.model.schema,t,i)&&Su(e,t,i,s)}}function aw(e,t){let i=t.nodeBefore,s=t.nodeAfter;i.name!=s.name&&e.rename(i,s.name),e.clearAttributes(i),e.setAttributes(Object.fromEntries(s.getAttributes()),i),e.merge(t)}function So(e,t,i){let s=t.parent,n=i.parent;return s==n||e.isLimit(s)||e.isLimit(n)?!1:uw(t,i,e)}function lw(e,t){let i=e.getAncestors(),s=t.getAncestors(),n=0;for(;i[n]&&i[n]==s[n];)n++;return[i[n],s[n]]}function cw(e,t){let i=e.checkChild(t,"$text"),s=e.checkChild(t,"paragraph");return!i&&s}function uw(e,t,i){let s=new p(e,t);for(let n of s.getWalker())if(i.isLimit(n.item))return!1;return!0}function Pu(e,t,i,s={}){let n=e.createElement("paragraph");e.model.schema.setAllowedAttributes(n,s,e),e.insert(n,t),Lu(e,i,e.createPositionAt(n,0))}function dw(e,t){let i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),Pu(e,e.createPositionAt(i,0),t)}function hw(e,t){let i=e.getLimitElement(t);if(!t.containsEntireContent(i))return!1;let s=t.getFirstRange();return s.start.parent==s.end.parent?!1:e.checkChild(i,"paragraph")}function Lu(e,t,i){t instanceof le?e.setSelection(i):t.setTo(i)}function fw(e,t,i){if(!t.length)return;let s=e.model.document.selection;if(s.anchor.parent.isEmpty&&!i)for(let[n,r]of t)e.model.schema.getAttributeProperties(n).isFormatting&&e.model.schema.checkAttributeInSelection(s,n)&&e.setSelectionAttribute(n,r)}function mw(e,t,i){if(e instanceof le)return!0;
10if(t.isCollapsed){let s=t.getFirstPosition();return s.isEqual(i.start)||s.isEqual(i.end)}return!!t.getFirstRange()?.isIntersecting(i)}function gw(e,t){return e.change(i=>{let s=i.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return s;let r=n.start.root,o=n.start.getCommonPath(n.end),a=r.getNodeByPath(o),l;n.start.parent==n.end.parent?l=n:l=i.createRange(i.createPositionAt(a,n.start.path[o.length]),i.createPositionAt(a,n.end.path[o.length]+1));let c=l.end.offset-l.start.offset;for(let u of l.getItems({shallow:!0}))u.is("$textProxy")?i.appendText(u.data,u.getAttributes(),s):i.append(i.cloneElement(u,!0),s);if(l!=n){let u=n._getTransformedByMove(l.start,i.createPositionAt(s,0),c)[0],d=i.createRange(i.createPositionAt(s,0),u.start);Lc(i.createRange(u.end,i.createPositionAt(s,"end")),i),Lc(d,i)}return s})}function Lc(e,t){let i=[];Array.from(e.getItems({direction:"backward"})).map(s=>t.createRangeOn(s)).filter(s=>(s.start.isAfter(e.start)||s.start.isEqual(e.start))&&(s.end.isBefore(e.end)||s.end.isEqual(e.end))).forEach(s=>{i.push(s.start.parent),t.remove(s)}
10),i.forEach(s=>{let n=s;for(;n.parent&&n.isEmpty;){let r=t.createRangeOn(n);n=n.parent,t.remove(r)}})}function pw(e,t,i){return e.change(s=>{let n=i||e.document.selection;n.isCollapsed||e.deleteContent(n,{doNotAutoparagraph:!0});let r=new ww(e,s,n.anchor),o=[],a;if(t.is("documentFragment")){if(t.markers.size){let u=[];for(let[d,h]of t.markers){let{start:m,end:g}=h,w=m.isEqual(g);u.push({position:m,name:d,isCollapsed:w},{position:g,name:d,isCollapsed:w})}u.sort(({position:d},{position:h})=>d.isBefore(h)?1:-1);for(let{position:d,name:h,isCollapsed:m}of u){let g=null,w=null,T=d.parent===t&&d.isAtStart,E=d.parent===t&&d.isAtEnd;!T&&!E?(g=s.createElement("$marker"),s.insert(g,d)):m&&(w=T?"start":"end"),o.push({name:h,element:g,collapsed:w})}}a=t.getChildren()}else a=[t];r.handleNodes(a);let l=r.getSelectionRange();if(t.is("documentFragment")&&o.length){let u=l?xe.fromRange(l):null,d={};for(let h=o.length-1;h>=0;h--){let{name:m,element:g,collapsed:w}=o[h],T=!d[m];if(T&&(d[m]=[]),g){let E=s.createPositionAt(g,"before");d[m].push(E),s.remove(g)}else{let E=r.getAffectedRange();if(!E){w&&d[m].push(r.position);continue}w?d[m].push(E[w]):d[m].push(T?E.start:E.end)}}for(let[h,[m,g]]of Object.entries(d))m&&g&&m.root===g.root&&m.root.document&&!s.model.markers.has(h)&&s.addMarker(h,{usingOperation:!0,affectsData:!0,range:new p(m,g)});u&&(l=u.toRange(),u.detach())}l&&(n instanceof le?s.setSelection(l):n.setTo(l));let c=r.getAffectedRange()||e.createRange(n.anchor);return r.destroy(),c})}var ww=class{model;writer;position;canMergeWith;schema;_documentFragment;_documentFragmentPosition;_firstNode=null;_lastNode=null;_lastAutoParagraph=null;_filterAttributesAndChildrenOf=[];_affectedStart=null;_affectedEnd=null;_nodeToSelect=null;constructor(e,t,i){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(let t of Array.from(e))t.offsetSize>0&&this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesAndChildrenOf,this.writer),this.model._config?.get("experimentalFlags.modelInsertContentDeepSchemaVerification")!==!1&&this._removeDisallowedChildren(this._filterAttributesAndChildrenOf),this._filterAttributesAndChildrenOf=[]}_removeDisallowedChildren(e){let t=Array.from(e);for(let i of t){if(!i.is("element"))continue;let s=[],n=[],r=this.writer.createRangeIn(i).getWalker({ignoreElementEnd:!0});for(let{item:o}of r){let a=o.parent;this.schema.checkChild(a,o)||(o.is("element")&&!this.schema.isObject(o)?(n.push(o),t.push(a)):s.push(o),r.jumpTo(this.writer.createPositionAfter(o)))}for(let o of n)this.writer.unwrap(o);for(let o of s)this.writer.remove(o)}}_updateLastNodeFromAutoParagraph(e){let t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){this._lastNode=e;if(this.position.parent!=e||!this.position.isAtEnd)throw new f("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?p._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new p(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(!this._checkAndSplitToAllowedPosition(e)){this.schema.isObject(e)||this._handleDisallowedNode(e);return}e=this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;let e=Y.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()}_handleDisallowedNode(e){e.is("element")&&this.handleNodes(e.getChildren())}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new f("insertcontent-wrong-position",this,{node:e,position:this.position});return this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),e.parent||(e=this._documentFragmentPosition.nodeBefore),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesAndChildrenOf.push(e),e}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=Y.fromPosition(e,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Y.fromPosition(e,"toNext"))}_mergeOnLeft(){let e=this._firstNode;if(!(e instanceof Z)||!this._canMergeLeft(e))return;let t=Y._createBefore(e);t.stickiness="toNext";let i=Y.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Y._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=Y._
10createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesAndChildrenOf.push(this.position.parent),t.detach()}_mergeOnRight(){let e=this._lastNode;if(!(e instanceof Z)||!this._canMergeRight(e))return;let t=Y._createAfter(e);t.stickiness="toNext";if(!this.position.isEqual(t))throw new f("insertcontent-invalid-insertion-position",this);this.position=b._createAt(t.nodeBefore,"end");let i=Y.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Y._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=Y._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesAndChildrenOf.push(this.position.parent),t.detach()}_canMergeLeft(e){let t=e.previousSibling;return t instanceof Z&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){let t=e.nextSibling;return t instanceof Z&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_insertAutoParagraph(){this._insertPartialFragment();let e=this.writer.createElement("paragraph");this.writer.insert(e,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=e,this.position=this.writer.createPositionAt(e,0)}_checkAndSplitToAllowedPosition(e){let 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){let 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{let 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 this.schema.checkChild(this.position.parent,e)||this._insertAutoParagraph(),!0}_getAllowedIn(e,t){let i=this.schema.createContext(e);return this.schema.checkChild(i,t)||this.schema.checkChild(i,"paragraph")&&this.schema.checkChild(i.push("paragraph"),t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}};function bw(e,t,i,s={}){if(!e.schema.isObject(t))throw new f("insertobject-element-not-an-object",e,{object:t});let n=i||e.document.selection,r=n;s.findOptimalPosition&&e.schema.isBlock(t)&&(r=e.createSelection(e.schema.findOptimalInsertionRange(n,s.findOptimalPosition)));let o=ye(n.getSelectedBlocks()),a={};return o&&Object.assign(a,e.schema.getAttributesWithProperty(o,"copyOnReplace",!0)),e.change(l=>{r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});let c=t,u=r.anchor.parent,d=e.schema.createContext(u);!e.schema.checkChild(d,t)&&e.schema.checkChild(d,"paragraph")&&e.schema.checkChild(d.push("paragraph"),t)&&(c=l.createElement("paragraph"),l.insert(t,c)),e.schema.setAllowedAttributes(c,a,l);let h=e.insertContent(c,r);return h.isCollapsed||s.setSelection&&_w(l,t,s.setSelection,a),h})}function _w(e,t,i,s){let n=e.model;if(i=="on"){e.setSelection(t,"on");return}if(i!="after")throw new f("insertobject-invalid-place-parameter-value",n);let r=t.nextSibling;if(n.schema.isInline(t)){e.setSelection(t,"after");return}!(r&&n.schema.checkChild(r,"$text"))&&n.schema.checkChild(t.parent,"paragraph")&&(r=e.createElement("paragraph"),n.schema.setAllowedAttributes(r,s,e),n.insertContent(r,e.createPositionAfter(t))),r&&e.setSelection(r,0)}var vw=' ,.?!:;"-()';function yw(e,t,i={}){let s=e.schema,n=i.direction!="backward",r=i.unit?i.unit:"character",o=!!i.treatEmojiAsSingleUnit,a=t.focus,l=new He({boundaries:xw(a,n),singleCharacters:!0,direction:n?"forward":"backward"}),c={walker:l,schema:s,isForward:n,unit:r,treatEmojiAsSingleUnit:o},u;for(;u=l.next();){if(u.done)return;let d=kw(c,u.value);if(d){t instanceof le?e.change(h=>{h.setSelectionFocus(d)}):t.setFocus(d);return}}}function kw(e,t){let{isForward:i,walker:s,unit:n,schema:r,treatEmojiAsSingleUnit:o}=e,{type:a,item:l,nextPosition:c}=t;if(a=="text")return e.unit==="word"?Iw(s,i):Cw(s,n,o);if(a==(i?"elementStart":"elementEnd")){if(r.isSelectable(l))return b._createAt(l,i?"after":"before");if(r.checkChild(c,"$text"))return c}else{if(r.isLimit(l)){s.skip(()=>!0);return}if(r.checkChild(c,"$text"))return c}}function Cw(e,t,i){let s=e.position.textNode;if(s){let n=s.data,r=e.position.offset-s.startOffset;for(;ps(n,r)||t=="character"&&ws(n,r)||i&&kn(n,r);)e.next(),r=e.position.offset-s.startOffset}return e.position}function Iw(e,t){let i=e.position.textNode;for(i||(i=t?e.position.nodeAfter:e.position.nodeBefore);i&&i.is("$text");){let s=e.position.offset-i.startOffset;if(Tw(i,s,t))i=t?e.position.nodeAfter:e.position.nodeBefore;else{if(Ew(i.data,s,t))break;e.next()}}return e.position}function xw(e,t){let i=e.root,s=b._createAt(i,t?"end":0);return t?new p(e,s):new p(s,e)}function Ew(e,t,i){let s=t+(i?0:-1);return vw.includes(e.charAt(s))}function Tw(e,t,i){return t===(i?e.offsetSize:0)}var Aw=z(),Vu=class extends Aw{markers;document;schema;_config;_pendingChanges;_currentWriter;constructor(e){super(),this.markers=new Kp,this.document=new Wp(this),this.schema=new np,this._config=e,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(t=>this.decorate(t)),this.on("applyOperation",(t,i)=>{i[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$inlineRoot",{allowContentOf:"$block",allowAttributesOf:"$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","$inlineRoot"],allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:["$root","$inlineRoot"],allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck(()=>!0,"$marker"),Yp(this),this.document.registerPostFixer(hu),this.on("insertContent",(t,[i,s])=>{t.return=pw(this,i,s)}),this.on("insertObject",(t,[i,s,n])=>{t.return=bw(this,i,s,n)}),this.on("canEditAt",t=>{let i=!this.document.isReadOnly;t.return=i,i||t.stop()})}
10change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new Pi,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){f.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new Pi):e instanceof Pi||(e=new Pi(e)):e=new Pi,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(i){f.rethrowUnexpectedError(i,this)}}applyOperation(e){e._execute()}insertContent(e,t,i,...s){let n=so(t,i);return this.fire("insertContent",[e,n,i,...s])}insertObject(e,t,i,s,...n){let r=so(t,i);return this.fire("insertObject",[e,r,s,s,...n])}deleteContent(e,t){sw(this,e,t)}modifySelection(e,t){yw(this,e,t)}getSelectedContent(e){return gw(this,e)}hasContent(e,t={}){let i;e.is("selection")?i=Array.from(e.getRanges()):e.is("range")?i=[e]:i=[p._createIn(e)];for(let s of i)if(this._rangeHasContent(s,t))return!0;return!1}_rangeHasContent(e,t){if(e.isCollapsed)return!1;let{ignoreWhitespaces:i=!1,ignoreMarkers:s=!1}=t;if(!s){for(let n of this.markers.getMarkersIntersectingRange(e))if(n.affectsData)return!0}for(let n of e.getItems())if(this.schema.isContent(n))if(n.is("$textProxy"))if(i){if(n.data.search(/\S/)!==-1)return!0}else return!0;else return!0;return!1}canEditAt(e){let t=so(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new b(e,t,i)}createPositionAt(e,t){return b._createAt(e,t)}createPositionAfter(e){return b._createAfter(e)}createPositionBefore(e){return b._createBefore(e)}createRange(e,t){return new p(e,t)}createRangeIn(e){return p._createIn(e)}createRangeOn(e){return p._createOn(e)}createSelection(...e){return new ze(...e)}createBatch(e){return new Pi(e)}createOperationFromJSON(e){return Pp.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.markers.destroy(),this.stopListening()}_runPendingChanges(){let e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){let t=this._pendingChanges[0].batch;this._currentWriter=new Zp(this,t);let 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")}
10return e}};function so(e,t){if(e)return e instanceof ze||e instanceof le?e:e instanceof li?t||t===0?new ze(e,t):e.is("rootElement")?new ze(e,"in"):new ze(e,"on"):new ze(e)}var Mu=class extends We{domEventType="click";onDomEvent(e){this.fire(e.type,e)}};var Hn=class extends We{domEventType=["mousedown","mouseup","mouseover","mouseout"];onDomEvent(e){this.fire(e.type,e)}};var Bu=class extends We{domEventType=["touchstart","touchend","touchmove"];onDomEvent(e){this.fire(e.type,e)}};var Un=class extends We{domEventType=["pointerdown","pointerup","pointermove"];onDomEvent(e){this.fire(e.type,e)}};var Du=class{crashes=[];state="initializing";_crashNumberLimit;_now=Date.now;_minimumNonErrorTimePeriod;_boundErrorHandler;_listeners;constructor(e){if(this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{let 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){let i=this._listeners[e]||[];for(let 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()});let 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(){return this.crashes.length<=this._crashNumberLimit?!0:(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}};function Po(e,t=new Set){let i=[e],s=new Set,n=0;for(;i.length>n;){let r=i[n++];if(!(s.has(r)||!Sw(r)||t.has(r)))if(s.add(r),Symbol.iterator in r)try{for(let o of r)i.push(o)}catch{}else for(let o in r)o!=="defaultValue"&&i.push(r[o])}return s}function Sw(e){let t=Object.prototype.toString.call(e),i=typeof e;return!(i==="number"||i==="boolean"||i==="string"||i==="symbol"||i==="function"||t==="[object Date]"||t==="[object RegExp]"||t==="[object Module]"||e===void 0||e===null||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function Nu(e,t,i=new Set){if(e===t&&Pw(e))return!0;let s=Po(e,i),n=Po(t,i);for(let r of s)if(n.has(r))return!0;return!1}function Pw(e){return typeof e=="object"&&e!==null}function Ou(e,t,i){let s=t.root,n=t.roots||Object.create(null);i&&!n[i]&&(n[i]=s||Object.create(null));let r=Lw(e),o=Vw(t,r,i),a=Array.from(new Set([...r?Object.keys(e):[],...Object.keys(n),...Object.keys(o)]));for(let l of a){let c=n[l]||Object.create(null);c.initialData="",c.placeholder??=Ru(t,"placeholder",l),c.label??=Ru(t,"label",l),n[l]=c}t.roots=n}function Lw(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&!Mw(e)}function Vw(e,t,i){return t||!i?e.initialData||Object.create(null):{[i]:e.initialData}}function Ru(e,t,i){let s=e[t];if(s)return typeof s=="string"?s:s[i]}function Mw(e){return he(e)}var Lo=class extends Du{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_editorAttachTo=null;_isSingleRootEditor=!0;_isUsingConfigBasedCreator=!1;_editables={};_config;_excludedProps;constructor(e,t={}){super(t),this._throttledSave=Pt(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=((i,s)=>s===void 0?e.create(i):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(()=>{this._isUsingConfigBasedCreator?Ou(this._isSingleRootEditor?"":{},this._config,this._isSingleRootEditor?"main":!1):Ou(this._isSingleRootEditor?this._editorAttachTo||"":this._editables,this._config,this._isSingleRootEditor?"main":!1);let e={...this._config,extraPlugins:this._config.extraPlugins||[],_watchdogInitialData:this._data};e.extraPlugins.push(Bw);let t={};for(let[s,n]of Object.entries(this._data.roots)){let r=e.roots[s]||Object.create(null);r.initialData="",r.modelElement=n.modelElement,this._isUsingConfigBasedCreator&&(this._editables[s]?.isConnected?r.element=this._editables[s]:n.isLoaded&&!r.element&&Object.assign(r,Ow(n.attributes))),n.isLoaded?r.lazyLoad=!1:delete r.modelAttributes,t[s]=r}if(e.roots=t,delete e.initialData,delete e.root,this._isUsingConfigBasedCreator)return this.create(e,e.context);let i=this._isSingleRootEditor?this._editorAttachTo||"":this._editables;return this.create(i,e,e.context)}).then(()=>{this._fire("restart")})}create(e=this._isUsingConfigBasedCreator?this._config:this._elementOrData,t=this._isUsingConfigBasedCreator?void 0:this._config,i){let s=this._detectConfigBasedCreator(e,t),n=s?void 0:e,r=s?e:t,o=s?t:i;return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>
10{if(super._startErrorHandling(),this._isUsingConfigBasedCreator=s,this._elementOrData=n,this._config=this._cloneEditorConfiguration(r||{}),this._config.context=o,s){this._editorAttachTo=null;let a=this._config.roots?Object.keys(this._config.roots).length:0,l=this._config.initialData,c=l&&typeof l=="object";this._isSingleRootEditor=!c&&a<=1}else this._editorAttachTo=Fs(n)?n:null,this._isSingleRootEditor=Fs(n)||typeof n=="string";return s?this._creator(this._config):this._creator(n,this._config)}).then(a=>{this._editor=a,a.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=a.model.document.version,this._data=this._getData(),this._editorAttachTo||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")}).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.cancel();let e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){let e=this._editor.model.document.version;try{this._data=this._getData(),this._editorAttachTo||(this._editables=this._getEditables()),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(){let e=this._editor,t=e.model.document.roots.filter(o=>o.isAttached()&&o.rootName!="$graveyard"),{plugins:i}=e,s=i.has("CommentsRepository")&&i.get("CommentsRepository"),n=i.has("TrackChanges")&&i.get("TrackChanges"),r={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(o=>{r.roots[o.rootName]={content:JSON.stringify(Array.from(o.getChildren())),attributes:JSON.stringify(Array.from(o.getAttributes())),modelElement:o.name,isLoaded:o._isLoaded}});for(let o of e.model.markers)o._affectsData&&(r.markers[o.name]={rangeJSON:o.getRange().toJSON(),usingOperation:o._managedUsingOperations,affectsData:o._affectsData});return s&&(r.commentThreads=JSON.stringify(s.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),n&&(r.suggestions=JSON.stringify(n.getSuggestions({toJSON:!0,skipNotAttached:!0}))),r}_getEditables(){let e={};for(let t of this.editor.model.document.getRootNames()){let i=this.editor.ui.getEditableElement(t);i&&(e[t]=i)}return e}_isErrorComingFromThisItem(e){return Nu(this._editor,e.context,this._excludedProps)}_detectConfigBasedCreator(e,t){if(typeof e=="string"||Fs(e)||t&&typeof t=="object"&&!("destroy"in t)&&Object.keys(t).length>0)return!1;if(e&&typeof e=="object"){let i=Object.values(e);if(i.length>0&&i.every(s=>typeof s=="string"||Fs(s)))return!1}return!0}_cloneEditorConfiguration(e){return dt(e,(t,i)=>{if(Fs(t)||i==="context")return t})}},Bw=class{editor;_data;constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},t=>{this._restoreCollaborationData(),this._restoreEditorData(t)}),this.editor.data.fire("ready")},{priority:999})}_createNode(e,t){if("name"in t){let i=e.createElement(t.name,t.attributes);if(t.children)for(let s of t.children)i._appendChild(this._createNode(e,s));return i}else return e.createText(t.data,t.attributes)}_restoreEditorData(e){let t=this.editor;Object.entries(this._data.roots).forEach(([i,{content:s,attributes:n}])=>{let r=JSON.parse(s),o=JSON.parse(n),a=t.model.document.getRoot(i);for(let[l,c]of o)e.setAttribute(l,c,a);for(let l of r){let c=this._createNode(e,l);e.insert(c,a,"end")}}),Object.entries(this._data.markers).forEach(([i,s])=>{let{document:n}=t.model,{rangeJSON:{start:r,end:o},...a}=s,l=n.getRoot(r.root),c=e.createPositionFromPath(l,r.path,r.stickiness),u=e.createPositionFromPath(l,o.path,o.stickiness),d=e.createRange(c,u);e.addMarker(i,{range:d,...a}
10)})}_restoreCollaborationData(){let e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);if(this.editor.plugins.has("CommentsRepository")){let i=this.editor.plugins.get("CommentsRepository");for(let s of i.getCommentThreads())i._removeCommentThread({threadId:s.id});e.forEach(s=>{let n=this.editor.config.get("collaboration.channelId");this.editor.plugins.get("CommentsRepository").addCommentThread({channelId:n,...s})})}if(this.editor.plugins.has("TrackChangesEditing")){let i=this.editor.plugins.get("TrackChangesEditing");for(let s of i.getSuggestions())i._removeSuggestion(s);t.forEach(s=>{i.addSuggestionData(s)})}}};function Fs(e){return he(e)}function Ow(e){let{$rootEditableOptions:t}=Object.fromEntries(JSON.parse(e));return!t||typeof t!="object"?{}:{...t.placeholder&&{placeholder:t.placeholder},...t.label&&{label:t.label},...t.element&&{element:t.element}}}var Ds=Symbol("MainQueueId"),zu=class extends Du{_watchdogs=new Map;_watchdogConfig;_context=null;_contextProps=new Set;_actionQueues=new Rw;_contextConfig;_item;constructor(e,t={}){super(t),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(Ds,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){let t=Fu(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 Lo(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",(n,{error:r,causesRestart:o})=>{this._fire("itemError",{itemId:i.id,error:r}),o&&this._actionQueues.enqueue(i.id,()=>new Promise(a=>{let l=()=>{s.off("restart",l),this._fire("itemRestart",{itemId:i.id}),a()};s.on("restart",l)}))}),i.sourceElementOrData!==void 0?s.create(i.sourceElementOrData,i.config,this._context):s.create(i.config,this._context);throw new Error(`Not supported item type: '${i.type}'.`)})))}remove(e){let t=Fu(e);return Promise.all(t.map(i=>this._actionQueues.enqueue(i,()=>{let s=this._getWatchdog(i);return this._watchdogs.delete(i),s.destroy()})))}destroy(){return this._actionQueues.enqueue(Ds,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Ds,()=>(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=Po(this._context),Promise.all(Array.from(this._watchdogs.values()).map(t=>(t._setExcludedProperties(this._contextProps),t._isUsingConfigBasedCreator?t.create(void 0,this._context):t.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();let 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){let t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(let t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return Nu(this._context,e.context)}},Rw=class{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){let i=e===Ds;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());let s=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(Ds),this._queues.get(e)])).then(t),n=s.catch(()=>{});return this._queues.set(e,n),s.finally(()=>{this._activeActions--,this._queues.get(e)===n&&this._activeActions===0&&this._onEmptyCallbacks.forEach(r=>r())})}};function Fu(e){return Array.isArray(e)?e:[e]}var Fw=z(),k=class extends Fw{editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Hu,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Hu),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}};function Hu(e){e.return=!1,e.stop()}var Dw=z(),W=class extends Dw{editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;static get _throwErrorWhenUsedAsAPlugin(){return!0}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=>{if(!this.affectsData)return;let i=e.model.document.selection,s=i.getFirstPosition().root.rootName!="$graveyard"&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!s)&&(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",Uu,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Uu),this.refresh())}execute(...e){}destroy(){this.stopListening()}};function Uu(e){e.return=!1,e.stop()}var Oo=class extends W{_childCommandsDefinitions=[];refresh(){}execute(...e){let t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Rr(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){let e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}};var Nw=class{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){let i=this.get(e);if(!i)throw new f("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(let e of this.commands())e.destroy()}};var zw=F(),ju=class extends zw{_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],i=[]){super(),this._context=e,this._availablePlugins=new Map;for(let s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(let[s,n]of i)this._contextPlugins.set(s,n),this._contextPlugins.set(n,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(let e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){let t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new f("plugincollection-
10plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}async init(e,t=[],i=[]){let s=this,n=this._context;d(e),m(e);let r=[...h(e.filter(y=>!c(y,t)))];ce(r,i);let o=G(r);return await V(o,"init"),await V(o,"afterInit"),o;function a(y){return typeof y=="function"}function l(y){return a(y)&&!!y.isContextPlugin}function c(y,S){return S.some(x=>x===y||u(y)===x||u(x)===y)}function u(y){return a(y)?y.pluginName||y.name:y}function d(y,S=new Set){y.forEach(x=>{a(x)&&(S.has(x)||(S.add(x),x.pluginName&&!s._availablePlugins.has(x.pluginName)&&s._availablePlugins.set(x.pluginName,x),x.requires&&d(x.requires,S)))})}function h(y,S=new Set){return y.map(x=>a(x)?x:s._availablePlugins.get(x)).reduce((x,P)=>S.has(P)?x:(S.add(P),P.requires&&(m(P.requires,P),h(P.requires,S).forEach(Re=>x.add(Re))),x.add(P)),new Set)}function m(y,S=null){y.map(x=>a(x)?x:s._availablePlugins.get(x)||x).forEach(x=>{g(x),w(x,S),T(x,S),E(x,S)})}function g(y){if(typeof y=="function"&&y._throwErrorWhenUsedAsAPlugin)throw new f("plugincollection-plugin-invalid-constructor",n,{name:y.name})}function w(y,S){if(!a(y))throw S?new f("plugincollection-soft-required",n,{missingPlugin:y,requiredBy:u(S)}):new f("plugincollection-plugin-not-found",n,{plugin:y})}function T(y,S){if(l(S)&&!l(y))throw new f("plugincollection-context-required",n,{plugin:u(y),requiredBy:u(S)})}function E(y,S){if(S&&c(y,t))throw new f("plugincollection-required",n,{plugin:u(y),requiredBy:u(S)})}function G(y){return y.map(S=>{let x=s._contextPlugins.get(S);return x=x||new S(n),s._add(S,x),x})}function V(y,S){return y.reduce((x,P)=>!P[S]||s._contextPlugins.has(P)?x:x.then(P[S].bind(P)),Promise.resolve())}function ce(y,S){for(let x of S){if(typeof x!="function")throw new f("plugincollection-replace-plugin-invalid-type",null,{pluginItem:x});let P=x.pluginName;if(!P)throw new f("plugincollection-replace-plugin-missing-name",null,{pluginItem:x});if(x.requires&&x.requires.length)throw new f("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:P});let Re=s._availablePlugins.get(P);if(!Re)throw new f("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:P});let Ht=y.indexOf(Re);if(Ht===-1){if(s._contextPlugins.has(Re))return;throw new f("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:P})}if(Re.requires&&Re.requires.length)throw new f("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:P});y.splice(Ht,1,x),s._availablePlugins.set(P,x)}}}destroy(){let e=[];for(let[,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);let i=e.pluginName;if(i){if(this._plugins.has(i))throw new f("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}};var Wu=class{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){let{translations:t,...i}=e||{};this.config=new Fr(i,this.constructor.defaultConfig);let s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new ju(this,s);let n=this.config.get("language")||{};this.locale=new Hl({uiLanguage:typeof n=="string"?n:n.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new pe}initPlugins(){let e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(let i of e.concat(t)){if(typeof i!="function")throw new f("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new f("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 f("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(){let e={};for(let 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=>{let i=new this(e);t(i.initPlugins().then(()=>i))})}static get _throwErrorWhenUsedAsAPlugin(){return!0}};var Hw=z(),Gu=class extends Hw{context;constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}};var Uw=class extends we{editor;constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){let s=t;t=(n,r)=>{this.editor.execute(s),r()}}super.set(e,t,i)}};var Vo="contentEditing",qu="common",Ww=class{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;let t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:Vo,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});let s=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&s.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:s}]})}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:s}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:qu}
10),s&&s.forEach(n=>{this.addKeystrokeInfoGroup({categoryId:e,...n})})}addKeystrokeInfoGroup({categoryId:e=Vo,id:t,label:i,keystrokes:s}){let n=this.keystrokeInfos.get(e);if(!n)throw new f("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});n.groups.set(t,{id:t,label:i,keystrokes:s||[]})}addKeystrokeInfos({categoryId:e=Vo,groupId:t=qu,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new f("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});let s=this.keystrokeInfos.get(e);if(!s.groups.has(t))throw new f("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});s.groups.get(t).keystrokes.push(...i)}};function qw(e){return{sessionId:Zw(),pageSessionId:Jw(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:$w(e),plugins:Kw(e.plugins),distribution:jw(),env:Gw(),integration:Object.create(null),menuBar:{isVisible:!!e.config.get("menuBar.isVisible")},language:{ui:e.locale.uiLanguage,content:e.locale.contentLanguage},toolbar:{main:Mo(e.config.get("toolbar")),block:Mo(e.config.get("blockToolbar")),balloon:Mo(e.config.get("balloonToolbar"))}}}function $w(e){return Object.getPrototypeOf(e).constructor.editorName}function Kw(e){return Array.from(e).filter(([t])=>!!t.pluginName).map(([t])=>{let{pluginName:i,isContextPlugin:s,isOfficialPlugin:n,isPremiumPlugin:r}=t;return{isContext:!!s,isOfficial:!!n,isPremium:!!r,name:i}})}function Mo(e){if(!e)return;let t=Array.isArray(e)?{items:e}:e,i=n(t.items||[]);return{isMultiline:i.includes("-"),shouldNotGroupWhenFull:!!t.shouldNotGroupWhenFull,items:s(i)};function s(r){return r.filter(o=>o!=="|"&&o!=="-")}function n(r){return r.flatMap(o=>typeof o=="string"?[o]:n(o.items))}}function jw(){return{channel:window[Symbol.for("cke distribution")]||"sh"}}function Gw(){let e="unknown",t="unknown";return I.isMac?e="mac":I.isWindows?e="windows":I.isiOS?e="ios":I.isAndroid&&(e="android"),I.isGecko?t="gecko":I.isBlink?t="blink":I.isSafari&&(t="safari"),{os:e,browser:t}}function Zw(){return localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",X()),localStorage.getItem("__ckeditor-session-id")}function Jw(){return _.window.CKEDITOR_PAGE_SESSION_ID=_.window.CKEDITOR_PAGE_SESSION_ID||X(),_.window.CKEDITOR_PAGE_SESSION_ID}var Yw=z(),Zu=class extends Yw{static get editorName(){return"Editor"}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;_registeredRootsAttributesKeys=new Set;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e={}){if(super(),typeof e!="object"||Array.isArray(e))throw new f("editor-config-invalid-type");if("sanitizeHtml"in e)throw new f("editor-config-sanitizehtml-not-supported");let t=this.constructor,{translations:i,...s}=t.defaultConfig||{},{translations:n=i,...r}=e,o=e.language||s.language;this._context=e.context||new Wu({language:o,translations:n}),this._context._addEditor(this,!e.context);let a=Array.from(t.builtinPlugins||[]);this.config=new Fr(r,s),this.config.define("plugins",a),this.config.define(this._context._getEditorConfig()),c(this.config),this.plugins=new ju(this,a,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new Nw,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new Vu(this.config),this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});let l=new Mc;this.data=new bu(this.model,l),this.editing=new wu(this.model,l),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new _u([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 Uw(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new Ww(this),u(this);function c(d){let h=d.get("licenseKey");if(!h&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(h=window.CKEDITOR_GLOBAL_LICENSE_KEY,d.set("licenseKey",h)),!h)throw new f("license-key-missing")}function u(d){let h=d.config.get("licenseKey"),m=window[Symbol.for("cke distribution")]||"sh";function g(y,S){d.enableReadOnlyMode(Symbol("invalidLicense")),d._showLicenseError(y,S)}function w(y){return["exp","jti","vc"].every(S=>S in y)}function T(y){return Object.getOwnPropertyNames(y).sort().filter(S=>S!="vc"&&y[S]!=null).map(S=>y[S])}function E(y){let{hostname:S}=new URL(window.location.href);if(y.includes(S))return!0;let x=S.split(".");return y.filter(P=>P.includes("*")).map(P=>P.split(".")).filter(P=>P.length<=x.length).map(P=>Array(x.length-P.length).fill(P[0]==="*"?"*":"").concat(P)).some(P=>x.every((Re,Ht)=>P[Ht]===Re||P[Ht]==="*"))}function G(y){let S=y[0].toUpperCase()+y.slice(1),x=y==="evaluation"?"an":"a";console.info(`%cCKEditor 5 ${S} License`,"color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;"),console.warn(`\u26A0\uFE0F You are using ${x} ${y} license of CKEditor 5${y==="trial"?" which is for evaluation purposes only":""}. For production usage, please obtain a production license at https://portal.ckeditor.com/`)}if(h=="GPL"){m=="cloud"&&g("distributionChannel");return}let V=Kr(h);if(!V){g("invalid");return}if(!w(V)){g("invalid");return}if(V.distributionChannel&&!U(V.distributionChannel).includes(m)){g("distributionChannel");return}if(Ul(T(V))!=V.vc.toLowerCase()){g("invalid");return}if(new Date(V.exp*1e3)<Cl){g("expired");return}let ce=V.licensedHosts;if(ce&&ce.length>
100&&!E(ce)){g("domainLimit");return}if(["evaluation","trial"].includes(V.licenseType)&&V.exp*1e3<Date.now()){g("expired");return}if(["development","evaluation","trial"].includes(V.licenseType)){let{licenseType:y}=V;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[y]||(G(y),window.CKEDITOR_WARNING_SUPPRESSIONS[y]=!0)}if(V.licenseType==="evaluation"){let y=setTimeout(()=>{g("evaluationLimit")},6e5);d.on("destroy",()=>{clearTimeout(y)})}V.usageEndpoint&&d.once("ready",()=>{let y={requestId:X(),requestTime:Math.round(Date.now()/1e3),license:h,editor:Qw(d)};d._sendUsageRequest(V.usageEndpoint,y).then(S=>{let{status:x,message:P}=S;P&&console.warn(P),x!="ok"&&g("usageLimit")},()=>{vl("license-key-validation-endpoint-not-reachable",{url:V.usageEndpoint})})},{priority:"high"})}}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new f("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new f("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 f("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))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}async initPlugins(){let e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],n=e.get("substitutePlugins")||[],r=await this.plugins.init(t.concat(s),i,n);return o(this),r;function o(a){let l=a.config.get("licenseKey");if(l==="GPL")return;let c=Kr(l);if(!c)return;let u=[...a.plugins].map(([d])=>d).find(d=>!d.pluginName||!d.licenseFeatureCode?!1:ql(c,d.licenseFeatureCode));u&&(a.enableReadOnlyMode(Symbol("invalidLicense")),a._showLicenseError("pluginNotAllowed",u.pluginName))}}async destroy(){this.state=="initializing"&&await new Promise(e=>this.once("ready",e)),this.fire("destroy"),this.stopListening(),this.commands.destroy(),await this.plugins.destroy(),this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy(),await this._context._removeEditor(this)}execute(e,...t){try{return this.commands.execute(e,...t)}catch(i){f.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}registerRootAttribute(e){this._registeredRootsAttributesKeys.has(e)||(this._registeredRootsAttributesKeys.add(e),this.editing.model.schema.extend("$root",{allowAttributes:e}))}getRootAttributes(e="main"){let t=this.model.document.getRoot(e);if(!t)throw new f("get-root-attributes-missing-root",this,{rootName:e});let i={};for(let s of this._registeredRootsAttributesKeys)i[s]=t.hasAttribute(s)?t.getAttribute(s):null;return i}static create(...e){throw new Error("This is an abstract method.")}static Context=Wu;static EditorWatchdog=Lo;static ContextWatchdog=zu;_showLicenseError(e,t){setTimeout(()=>{if(e=="invalid")throw new f("invalid-license-key");if(e=="expired")throw new f("license-key-expired");if(e=="domainLimit")throw new f("license-key-domain-limit");if(e=="pluginNotAllowed"){let i=t.replace(/(Editing|UI)$/,"");throw new f("license-key-plugin-not-allowed",null,{pluginName:this.plugins.has(i)?i:t})}if(e=="featureNotAllowed")throw new f("license-key-feature-not-allowed",null,{featureName:t});if(e=="evaluationLimit")throw new f("license-key-evaluation-limit");if(e=="trialLimit")throw new f("license-key-trial-limit");if(e=="developmentLimit")throw new f("license-key-development-limit");if(e=="usageLimit")throw new f("license-key-usage-limit");if(e=="distributionChannel")throw new f("license-key-invalid-distribution-channel")},0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){let i=new Headers({"Content-Type":"application/json"}),s=await fetch(new URL(e),{method:"POST",headers:i,body:JSON.stringify(t)});if(!s.ok)throw new Error(`HTTP Response: ${s.status}`);return s.json()}};function Qw(e){let t=qw(e);
10function i(s,n){if(_e(t,s)!==void 0)throw new f("editor-usage-data-path-already-set",{path:s});es(t,s,n)}return e.fire("collectUsageData",{setUsageData:i}),t}function Ju(e){if(!Yt(e.updateSourceElement))throw new f("attachtoform-missing-elementapi-interface",e);let t=e.sourceElement;if(Xw(t)&&t.form){let i,s=t.form,n=()=>e.updateSourceElement();Yt(s.submit)&&(i=s.submit,s.submit=()=>{n(),i.apply(s)}),s.addEventListener("submit",n),e.on("destroy",()=>{s.removeEventListener("submit",n),i&&(s.submit=i)})}}function Xw(e){return!!e&&e.tagName.toLowerCase()==="textarea"}function Yu(e){class t extends e{sourceElement;updateSourceElement(s){if(!this.sourceElement)throw new f("editor-missing-sourceelement",this);let n=this.config.get("updateSourceElementOnDestroy"),r=this.sourceElement instanceof HTMLTextAreaElement;if(!n&&!r){zr(this.sourceElement,"");return}let o=typeof s=="string"?s:this.data.get();zr(this.sourceElement,o)}}return t}var e5=[["description","$description"],["title","$title"]];function Qu(e){let t=e.config.get("roots");for(let[n,r]of Object.entries(t)){let o=null;for(let[a,l]of e5)r[a]==null||r.modelAttributes&&l in r.modelAttributes||(o=o||{...r.modelAttributes},o[l]=r[a]);o&&e.config.set(`roots.${n}.modelAttributes`,o)}let i=e.config.get("roots"),s=!1;for(let n of Object.values(i))for(let r of Object.keys(n.modelAttributes||{}))e.registerRootAttribute(r),s=!0;s&&e.data.once("init",()=>{e.model.enqueueChange({isUndoable:!1},n=>{for(let[r,o]of Object.entries(i)){let a=e.model.document.getRoot(r);if(a)for(let[l,c]of Object.entries(o.modelAttributes||{}))c!==null&&n.setAttribute(l,c,a)}})})}function Xu(e,t,i="main",s=!1){let n=t.get("root"),r=t.get("roots")||Object.create(null);if(!se(r))throw new f("editor-create-roots-not-plain-object",null);if(n)if(i){if(i in r)throw new f("editor-create-roots-with-main",null)}else throw new f("editor-create-multi-root-with-main",null);i&&!r[i]&&(r[i]=n||Object.create(null));let o=t5(e),a=s5(t,o,i),l=Array.from(new Set([...o?Object.keys(e):[],...Object.keys(r),...Object.keys(a)]));for(let c of l){let u=r[c]||Object.create(null),d=o?e[c]:e;if(!s&&st(d)){if(u.element)throw new f("editor-create-root-element-overspecified",null);u.element=d}if(s&&st(u.element)&&(N("editor-create-root-element-not-supported"),u.element=void 0),u.initialData===void 0)if(a[c]===void 0){let h=st(u.element)?u.element:void 0;u.initialData=i5(d||h||s&&t.get("attachTo")||"")}else{if(d&&!st(d))throw new f("editor-create-initial-data-overspecified",null);u.initialData=a[c]}else{if(d&&!st(d))throw new f("editor-create-root-initial-data-overspecified",null);if(a[c]!==void 0)throw new f("editor-create-legacy-initial-data-overspecified",null)}u.placeholder??=$u(t,"placeholder",c),u.label??=$u(t,"label",c),u.modelElement||="$root",u.element=n5(u.element),r[c]=u}if(s&&st(e)){if(t.get("attachTo"))throw new f("editor-create-attachto-overspecified",null);t.set("attachTo",e)}if(!s&&t.get("attachTo"))throw new f("editor-create-attachto-ignored",null);t.set("roots",r)}function ed(e,t){return typeof e=="string"||st(e)||t&&Object.keys(t).length?{sourceElementOrData:e,editorConfig:t}:{sourceElementOrData:"",editorConfig:e}}function t5(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&!st(e)}function i5(e){return st(e)?Al(e):e}function s5(e,t,i){return t||!i?e.get("initialData")||Object.create(null):{[i]:e.get("initialData")}}function $u(e,t,i){let s=e.get(t);if(s)return typeof s=="string"?s:s[i]}function n5(e){if(e==null)return;if(st(e))return Bo(e.tagName),e;if(typeof e=="string")return Bo(e),{name:e};let{name:t,classes:i,styles:s,attributes:n}=e;t!==void 0&&Bo(t);let{class:r,style:o,...a}=n||{},l=!!n&&"class"in n,c=!!s&&Object.keys(s).length>0,u=c&&!!o;u&&N("editor-root-element-styles-overspecified");let d=[...Ku(i),...Ku(r)],h={...a};return l&&(h.class=""),u?h.style="":o&&(h.style=o),{...t!==void 0&&{name:t},...d.length&&{classes:d},...c&&{styles:s},...Object.keys(h).length&&{attributes:h}}}function Ku(e){return e?U(e).flatMap(t=>t.split(/\s+/)).filter(Boolean):[]}function Bo(e){if(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_-]*$/.test(e))throw new f("editor-wrong-element-name",null,{name:e});if(["textarea","input"].includes(e.toLowerCase()))throw new f("editor-wrong-element",null)}function st(e){return he(e)}function td(e){let t=e.model.schema,i=e.model.document;for(let s of i.roots)if(!(s===i.graveyard||!s.isAttached())&&!t.isLimit(s))throw new f("editor-root-element-is-not-limit",null,{rootName:s.rootName,elementName:s.name})}function id(e,t){let i=e.model.document.getRoot(t);return e.model.schema.checkChild(i,"$block")}var Wn=class extends Gu{_actions;static get pluginName(){return"PendingActions"}static get isOfficialPlugin(){return!0}init(){this.set("hasAny",!1),this._actions=new pe({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new f("pendingactions-add-invalid-message",this);let t=new(z());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}};var Ro='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103z"/><path d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17m0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10" clip-rule="evenodd"/></svg>';var sd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75"/></svg>';var qn='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.187 17H5.773q-.956 0-1.364-.415-.41-.416-.409-1.323V4.738q0-.926.419-1.332.418-.405 1.354-.406h4.68q1.035 0 1.793.124.76.124 1.36.478.512.296.906.75a3.26 3.26 0 0 1 .808 2.162q0 2.102-2.167 3.075 2.846.879 2.847 3.421a3.76 3.76 0 0 1-2.296 3.504 6 6 0 0 1-1.517.377q-.857.11-2 .11zm-.217-6.217H7v4.087h3.069q2.965 0 2.965-2.072 0-1.061-.768-1.537-.768-.478-2.296-.478M7 5.13v3.619h2.606q1.093 0 1.69-.2a1.
106 1.6 0 0 0 .91-.765q.247-.4.247-.897 0-1.06-.778-1.409-.778-.348-2.375-.348z"/></svg>';var nd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75m6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75"/></svg>',rd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.414z"/></svg>';var od='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.972 16.615a1 1 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.323a1 1 0 0 1-.745.292"/></svg>';var ad='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m-7 6.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>';var $n='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><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-.136z"/></svg>';var ld='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.822zM14 5V2l3.3 3zm-3.692 12.5q.093.157.213.303L11.52 19H8v-.876a2.24 2.24 0 0 0 1.82-.624zm7.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 0zm-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>';var Fo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5M1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>';var cd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m9.586 14.633.021.004q-.054.502.393.962.123.125.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15q.711-.106 1.005-.334.235-.182.404-.597l2.416-9.55a1.05 1.05 0 0 0-.281-.823 1.1 1.1 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195q-.564.084-.823.296-.323.263-.623.79z"/></svg>';var ud='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 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.294zm5.494-5.335a.8.8 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.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-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-.184"/></svg>';var Kn='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.382z"/></svg>';var dd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M3.5 3v5H2V3.7H1v-1h2.5zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001q-.073.607-.333.988-.263.381-1.244 1.312H4.3v1h-4zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75"/></svg>';var Do='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5m1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>';var No='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5M5 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-1"/></svg>',hd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m7.3 17.37-.061.088a1.52 1.52 0 0 1-.934.535l-4.178.663-.806-4.153a1.5 1.5 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.055zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346zM6.07 16.512l-3.276-2.295.53 2.73zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328M8 18.5 9.375 17H19v1.5z"/></svg>';var fd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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-4"/></svg>';var md='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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-1"/></svg>';var ci='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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"/>
10</svg>';var gd=`<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"/>
10<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> 11`;var zo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.75.75 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.8.8 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-.032z"/></svg>';var pd='<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>';var wd='<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-.75m18.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-.75m-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-.2zm4 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-.2zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.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-.2zm18.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-.2zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.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-.2zm18.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-.2zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.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 0zM18.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.5zM8.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-.2zm4 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-.2z"/></svg>';var Ho=`<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.734 6.375H1.75a.75.75 0 0 1 0-1.5h1.984a2.626 2.626 0 0 1 5.032 0h9.48a.75.75 0 0 1 0 1.5h-9.48a2.626 2.626 0 0 1-5.032 0Zm1.141-.75a1.375 1.375 0 1 1 2.75 0 1.375 1.375 0 0 1-2.75 0ZM16.263 14.625h1.983a.75.75 0 0 1 0 1.5h-1.983a2.626 2.626 0 0 1-5.033 0H1.75a.75.75 0 0 1 0-1.5h9.48a2.626 2.626 0 0 1 5.033 0Zm-1.142.75a1.375 1.375 0 1 1-2.75 0 1.375 1.375 0 0 1 2.75 0Z"/></svg> 12`;var bd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m12.5 0 5 4.5v15.003h-16V0zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058
12-3.5-2.5V9.14zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0"/></svg>';var _d='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53zm8.147 7.829h2.549q.38 0 .58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197a.62.62 0 0 1-.205-.463q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553t.405-.57.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646c.3-.289.454-.349.762-.467a3 3 0 0 1 1.081-.178q.747 0 1.274.228a1.92 1.92 0 0 1 1.004 1.032 1.98 1.98 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.584-1.008.906a3 3 0 0 0-.24.309z"/></svg>',vd='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="m7.184 10.353 3.818-3.819a.8.8 0 0 1 1.132 1.132l-3.82 3.818 3.82 3.818a.802.8
1202 0 0 1-.873 1.306.8.8 0 0 1-.26-.174l-3.817-3.82-3.818 3.82a.8.8 0 0 1-1.305-.26.8.8 0 0 1 .173-.872l3.82-3.818-3.82-3.818a.8.8 0 0 1 1.132-1.132l3.818 3.82M15.68 6.88h2.549q.38 0 .58.153a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197A.62.62 0 0 1 14 7.34q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553.266-.277.405-.57.14-.291.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646t.762-.467A3 3 0 0 1 16.466 1q.747 0 1.274.228c.456.2.816.57 1.004 1.032a1.99 1.99 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.583-1.008.906-.131.146-.24.309z"/></svg>';var yd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254z"/></svg>';var jn='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><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>';var Uo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.75.75 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.8.8 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-.032z"/></svg>',kd='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 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.294zm5.494-5.335a.8.8 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.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-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-.184m4.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.06z"/></svg>';var Wo={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],ol
vendor: 6,420 bytes, line 12
12ive:[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]};for(let e in Wo)Object.freeze(Wo[e]);var ui=Object.freeze(Wo);var Cd={};for(let e of Object.keys(ui))Cd[ui[e]]=e;var C={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"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},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"]}},vt=C,_t=(6/29)**3;function Fi(e){let t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Di(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(C)){if(!("channels"in C[e]))throw new Error("missing channels property: "+e);if(!("labels"in C[e]))throw new Error("missing channel labels property: "+e);if(C[e].labels.length!==C[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:i}=C[e];delete C[e].channels,delete C[e].labels,Object.defineProperty(C[e],"channels",{value:t}),Object.defineProperty(C[e],"labels",{value:i})}C.rgb.hsl=function(e){let t=e[0]/255,i=e[1]/255,s=e[2]/255,n=Math.min(t,i,s),r=Math.max(t,i,s),o=r-n,a,l;switch(r){case n:{a=0;break}case t:{a=(i-s)/o;break}case i:{a=2+(s-t)/o;break}case s:{a=4+(t-i)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);let c=(n+r)/2;return r===n?l=0:c<=.5?l=o/(r+n):l=o/(2-r-n),[a,l*100,c*100]};C.rgb.hsv=function(e){let t,i,s,n,r,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),d=function(h){return(c-h)/6/u+1/2};if(u===0)n=0,r=0;else{switch(r=u/c,t=d(o),i=d(a),s=d(l),c){case o:{n=s-i;break}case a:{n=1/3+t-s;break}case l:{n=2/3+i-t;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,r*100,c*100]};C.rgb.hwb=function(e){let t=e[0],i=e[1],s=e[2],n=C.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(i,s));return s=1-1/255*Math.max(t,Math.max(i,s)),[n,r*100,s*100]};C.rgb.oklab=function(e){let t=Di(e[0]/255),i=Di(e[1]/255),s=Di(e[2]/255),n=Math.cbrt(.4122214708*t+.5363325363*i+.0514459929*s),r=Math.cbrt(.2119034982*t+.6806995451*i+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*i+.6299787005*s),a=.2104542553*n+.793617785*r-.0040720468*o,l=1.9779984951*n-2.428592205*r+.4505937099*o,c=.0259040371*n+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};C.rgb.cmyk=function(e){let t=e[0]/255,i=e[1]/255,s=e[2]/255,n=Math.min(1-t,1-i,1-s),r=(1-t-n)/(1-n)||0,o=(1-i-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[r*100,o*100,a*100,n*100]};function r5(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}C.rgb.keyword=function(e){let t=Cd[e];if(t)return t;let i=Number.POSITIVE_INFINITY,s;for(let n of Object.keys(ui)){let r=ui[n],o=r5(e,r);o<i&&(i=o,s=n)}return s};C.keyword.rgb=function(e){return ui[e]};C.rgb.xyz=function(e){let t=Di(e[0]/255),i=Di(e[1]/255),s=Di(e[2]/255),n=t*.4124564+i*.3575761+s*.1804375,r=t*.2126729+i*.7151522+s*.072175,o=t*.0193339+i*.119192+s*.9503041;return[n*100,r*100,o*100]};C.rgb.lab=function(e){let t=C.rgb.xyz(e),i=t[0],s=t[1],n=t[2];i/=95.047,s/=100,n/=108.883,i=i>_t?i**(1/3):7.787*i+16/116,s=s>_t?s**(1/3):7.787*s+16/116,n=n>_t?n**(1/3):7.787*n+16/116;let r=116*s-16,o=500*(i-s),a=200*(s-n);return[r,o,a]};C.hsl.rgb=function(e){let t=e[0]/360,i=e[1]/100,s=e[2]/100,n,r;if(i===0)return r=s*255,[r,r,r];let o=s<.5?s*(1+i):s+i-s*i,a=2*s-o,l=[0,0,0];for(let c=0;c<3;c++)n=t+1/3*-(c-1),n<0&&n++,n>1&&n--,6*n<1?r=a+(o-a)*6*n:2*n<1?r=o:3*n<2?r=a+(o-a)*(2/3-n)*6:r=a,l[c]=r*255;return l};C.hsl.hsv=function(e){let t=e[0],i=e[1]/100,s=e[2]/100,n=i,r=Math.max(s,.01);s*=2,i*=s<=1?s:2-s,n*=r<=1?r:2-r;let o=(s+i)/2,a=s===0?2*n/(r+n):2*i/(s+i);return[t,a*100,o*100]};C.hsv.rgb=function(e){let t=e[0]/60,i=e[1]/100,s=e[2]/100,n=Math.floor(t)%6,r=t-Math.floor(t),o=255*s*(1-i),a=255*s*(1-i*r),l=255*s*(1-i*(1-r));switch(s*=255,n){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};C.hsv.hsl=function(e){let t=e[0],i=e[1]/100,s=e[2]/100,n=Math.max(s,.01),r,o;o=(2-i)*s;let a=(2-i)*n;return r=i*n,r/=a<=1?a:2-a,r=r||0,o/=2,[t,r*100,o*100]};C.hwb.rgb=function(e){let t=e[0]/360,i=e[1]/100,s=e[2]/100,n=i+s,r;n>1&&(i/=n,s/=n);let o=Math.floor(6*t),a=1-s;r=6*t-o,(o&1)!==0&&(r=1-r);let l=i+r*(a-i),c,u,d;switch(o){default:case 6:case 0:{c=a,u=l,d=i;break}case 1:{c=l,u=a,d=i;break}case 2:{c=i,u=a,d=l;break}case 3:{c=i,u=l,d=a;break}case 4:{c=l,u=i,d=a;break}case 5:{c=a,u=i,d=l;break}}return[c*255,u*255,d*255]};C.cmyk.rgb=function(e){let t=e[0]/100,i=e[1]/100,s=e[2]/100,n=e[3]/100,r=1-Math.min(1,t*(1-n)+n),o=1-Math.min(1,i*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[r*255,o*255,a*255]};C.xyz.rgb=function(e){let t=e[0]/100,i=e[1]/100,s=e[2]/100,n,r,o;return n=t*3.2404542+i*-1.5371385+s*-.4985314,r=t*-.969266+i*1.8760108+s*.041556,o=t*.0556434+i*-.2040259+s*1.0572252,n=Fi(n),r=Fi(r),o=Fi(o),[n*255,r*255,o*255]};C.xyz.lab=function(e){let t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>_t?t**(1/3):7.787*t+16/116,i=i>_t?i**(1/3):7.787*i+16/116,s=s>_t?s**(1/3):7.787*s+16/116;let n=116*i-16,r=500*(t-i),o=200*(i-s);return[n,r,o]};C.xyz.oklab=function(e){let t=e[0]/100,i=e[1]/100,s=e[2]/100,n=Math.cbrt(.8189330101*t+.3618667424*i-.1288597137*s),r=M
12ath.cbrt(.0329845436*t+.9293118715*i+.0361456387*s),o=Math.cbrt(.0482003018*t+.2643662691*i+.633851707*s),a=.2104542553*n+.793617785*r-.0040720468*o,l=1.9779984951*n-2.428592205*r+.4505937099*o,c=.0259040371*n+.7827717662*r-.808675766*o;return[a*100,l*100,c*100]};C.oklab.oklch=function(e){return C.lab.lch(e)};C.oklab.xyz=function(e){let t=e[0]/100,i=e[1]/100,s=e[2]/100,n=(.999999998*t+.396337792*i+.215803758*s)**3,r=(1.000000008*t-.105561342*i-.063854175*s)**3,o=(1.000000055*t-.089484182*i-1.291485538*s)**3,a=1.227013851*n-.55779998*r+.281256149*o,l=-.040580178*n+1.11225687*r-.071676679*o,c=-.076381285*n-.421481978*r+1.58616322*o;return[a*100,l*100,c*100]};C.oklab.rgb=function(e){let t=e[0]/100,i=e[1]/100,s=e[2]/100,n=(t+.3963377774*i+.2158037573*s)**3,r=(t-.1055613458*i-.0638541728*s)**3,o=(t-.0894841775*i-1.291485548*s)**3,a=Fi(4.0767416621*n-3.3077115913*r+.2309699292*o),l=Fi(-1.2684380046*n+2.6097574011*r-.3413193965*o),c=Fi(-.0041960863*n-.7034186147*r+1.707614701*o);return[a*255,l*255,c*255]};C.oklch.oklab=function(e){return C.lch.lab(e)};C.lab.xyz=function(e){let t=e[0],i=e[1],s=e[2],n,r,o;r=(t+16)/116,n=i/500+r,o=r-s/200;let a=r**3,l=n**3,c=o**3;return r=a>_t?a:(r-16/116)/7.787,n=l>_t?l:(n-16/116)/7.787,o=c>_t?c:(o-16/116)/7.787,n*=95.047,r*=100,o*=108.883,[n,r,o]};C.lab.lch=function(e){let t=e[0],i=e[1],s=e[2],n;n=Math.atan2(s,i)*360/2/Math.PI,n<0&&(n+=360);let o=Math.sqrt(i*i+s*s);return[t,o,n]};C.lch.lab=function(e){let t=e[0],i=e[1],n=e[2]/360*2*Math.PI,r=i*Math.cos(n),o=i*Math.sin(n);return[t,r,o]};C.rgb.ansi16=function(e,t=null){let[i,s,n]=e,r=t===null?C.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(i/255));return r===2&&(o+=60),o};C.hsv.ansi16=function(e){return C.rgb.ansi16(C.hsv.rgb(e),e[2])};C.rgb.ansi256=function(e){let t=e[0],i=e[1],s=e[2];return t>>4===i>>4&&i>>4===s>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(s/255*5)};C.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let i=(Math.trunc(e>50)+1)*.5,s=(t&1)*i*255,n=(t>>1&1)*i*255,r=(t>>2&1)*i*255;return[s,n,r]};C.ansi256.rgb=function(e){if(e=e[0],e>=232){let r=(e-232)*10+8;return[r,r,r]}e-=16;let t,i=Math.floor(e/36)/5*255,s=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[i,s,n]};C.rgb.hex=function(e){let i=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(i.length)+i};C.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let i=t[0];t[0].length===3&&(i=[...i].map(a=>a+a).join(""));let s=Number.parseInt(i,16),n=s>>16&255,r=s>>8&255,o=s&255;return[n,r,o]};C.rgb.hcg=function(e){let t=e[0]/255,i=e[1]/255,s=e[2]/255,n=Math.max(Math.max(t,i),s),r=Math.min(Math.min(t,i),s),o=n-r,a,l=o<1?r/(1-o):0;return o<=0?a=0:n===t?a=(i-s)/o%6:n===i?a=2+(s-t)/o:a=4+(t-i)/o,a/=6,a%=1,[a*360,o*100,l*100]};C.hsl.hcg=function(e){let t=e[1]/100,i=e[2]/100,s=i<.5?2*t*i:2*t*(1-i),n=0;return s<1&&(n=(i-.5*s)/(1-s)),[e[0],s*100,n*100]};C.hsv.hcg=function(e){let t=e[1]/100,i=e[2]/100,s=t*i,n=0;return s<1&&(n=(i-s)/(1-s)),[e[0],s*100,n*100]};C.hcg.rgb=function(e){let t=e[0]/360,i=e[1]/100,s=e[2]/100;if(i===0)return[s*255,s*255,s*255];let n=[0,0,0],r=t%1*6,o=r%1,a=1-o,l=0;switch(Math.floor(r)){case 0:{n[0]=1,n[1]=o,n[2]=0;break}case 1:{n[0]=a,n[1]=1,n[2]=0;break}case 2:{n[0]=0,n[1]=1,n[2]=o;break}case 3:{n[0]=0,n[1]=a,n[2]=1;break}case 4:{n[0]=o,n[1]=0,n[2]=1;break}default:n[0]=1,n[1]=0,n[2]=a}return l=(1-i)*s,[(i*n[0]+l)*255,(i*n[1]+l)*255,(i*n[2]+l)*255]};C.hcg.hsv=function(e){let t=e[1]/100,i=e[2]/100,s=t+i*(1-t),n=0;return s>0&&(n=t/s),[e[0],n*100,s*100]};C.hcg.hsl=function(e){let t=e[1]/100,s=e[2]/100*(1-t)+.5*t,n=0;return s>0&&s<.5?n=t/(2*s):s>=.5&&s<1&&(n=t/(2*(1-s))),[e[0],n*100,s*100]};C.hcg.hwb=function(e){let t=e[1]/100,i=e[2]/100,s=t+i*(1-t);return[e[0],(s-t)*100,(1-s)*100]};C.hwb.hcg=function(e){let t=e[1]/100,s=1-e[2]/100,n=s-t,r=0;return n<1&&(r=(s-n)/(1-n)),[e[0],n*100,r*100]};C.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};C.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};C.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};C.gray.hsl=function(e){return[0,0,e[0]]};C.gray.hsv=C.gray.hsl;C.gray.hwb=function(e){return[0,100,e[0]]};C.gray.cmyk=function(e){return[0,0,0,e[0]]};C.gray.lab=function(e){return[e[0],0,0]};C.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(s.length)+s};C.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function o5(){let e={},t=Object.keys(vt);for(let{length:i}=t,s=0;s<i;s++)e[t[s]]={distance:-1,parent:null};return e}function a5(e){let t=o5(),i=[e];for(t[e].distance=0;i.length>0;){let s=i.pop(),n=Object.keys(vt[s]);for(let{length:r}=n,o=0;o<r;o++){let a=n[o],l=t[a];l.distance===-1&&(l.distance=t[s].distance+1,l.parent=s,i.unshift(a))}}return t}function l5(e,t){return function(i){return t(e(i))}}function c5(e,t){let i=[t[e].parent,e],s=vt[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)i.unshift(t[n].parent),s=l5(vt[t[n].parent][n],s),n=t[n].parent;return s.conversion=i,s}function u5(e){let t=a5(e),i={},s=Object.keys(t);for(let{length:n}=s,r=0;r<n;r++){let o=s[r];t[o].parent!==null&&(i[o]=c5(o,t))}return i}var Id=u5;var Ns={},d5=Object.keys(vt);function h5(e){let t=function(...i){let s=i[0];return s==null?s:(s.length>1&&(i=s),e(i))};return"conversion"in e&&(t.conversion=e.conversion),t}function f5(e){let t=function(...i){let s=i[0];if(s==null)return s;s.length>1&&(i=s);let n=e(i);if(typeof n=="object")for(let{length:r}=n,o=0;o<r;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}for(let e of d5){Ns[e]={},Object.defineProperty(Ns[e],"channels",{value:vt[e].channels}),Object.defineProperty(Ns[e],"labels",{value:vt[e].labels});let t=Id(e),i=Object.keys(t);for(let s of i){let n=t[s];Ns[e][s]=f5(n),Ns[e][s].raw=h5(n)}}var Me=class extends pe{_parentElement;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(let t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!g5(e))throw new f("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(let i of this)for(let s of e)i.delegate(s).to(t);this.on("add",(i,s)=>{for(let n of e)s.delegate(n).to(t)}),this.on("remove",(i,s)=>{for(let n of e)s.stopDelegating(n,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 g5(e){return e.every(t=>typeof t=="string")}var p5="http://www.w3.org/1999/xhtml",w5=F(),$e=class extends w5{ns;tag;text;attributes;children;eventListeners;_isRendered;_revertData;constructor(e){super(),Object.assign(this,Ed(xd(e))),this._isRendered=!1,this._revertData=null}render(){let e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=Sd(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new f("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(let i of t.children)Xn(i)?yield i:Qo(i)&&(yield*e(i))}yield*e(this)}static bind(e,t){return{to(i,s){return new b5({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:s})},if(i,s,n){return new jd({observable:e,emitter:t,attribute:i,valueIfTrue:s,callback:n})}}}static extend(e,t){if(e._isRendered)throw new f("template-extend-render",[this,e]);Yd(e,Ed(xd(t)))}_renderNode(e){let t;if(e.node?t=this.tag&&this.text:t=this.tag?this.text:!this.text,t)throw new f("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||p5,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(""),Jn(this.text)?this._bindToObservable({schema:this.text,updater:v5(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;let t=e.node,i=e.revertData;for(let s in this.attributes){let n=t.getAttribute(s),r=this.attributes[s];i&&(i.attributes[s]=n);let o=Ad(r)?r[0].ns:null;if(Jn(r)){let a=Ad(r)?r[0].value:r;i&&Pd(s)&&a.unshift(n),this._bindToObservable({schema:a,updater:y5(t,s,o),data:e})}
12else if(s=="style"&&typeof r[0]!="string")this._renderStyleAttribute(r[0],e);else{i&&n&&Pd(s)&&r.unshift(n);let a=r.map(l=>l&&(l.value||l)).reduce((l,c)=>l.concat(c),[]).reduce(Jd,"");Hi(a)||t.setAttributeNS(o,s,a)}}}_renderStyleAttribute(e,t){let i=t.node;for(let s in e){let n=e[s];Jn(n)?this._bindToObservable({schema:[n],updater:k5(i,s),data:t}):Jo(s)?i.style.setProperty(s,n):i.style[s]=n}}_renderElementChildren(e){let t=e.node,i=e.intoFragment?document.createDocumentFragment():t,s=e.isApplying,n=0;for(let r of this.children)if(Xo(r)){if(!s){r.setParent(t);for(let o of r)i.appendChild(o.element)}}else if(Xn(r))s||(r.isRendered||r.render(),i.appendChild(r.element));else if(Qe(r))i.appendChild(r);else if(s){let o=e.revertData,a=Sd();o.children.push(a),r._renderNode({intoFragment:!1,node:i.childNodes[n++],isApplying:!0,revertData:a})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(let t in this.eventListeners){let i=this.eventListeners[t].map(s=>{let[n,r]=t.split("@");return s.activateDomEventListener(n,r,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){let s=i.revertData;Gd(e,t,i);let n=e.filter(r=>!Hi(r)).filter(r=>r.observable).map(r=>r.activateAttributeListener(e,t,i));s&&s.bindings.push(n)}_revertTemplateFromNode(e,t){for(let s of t.bindings)for(let n of s)n();if(t.text){e.textContent=t.text;return}let i=e;for(let s in t.attributes){let n=t.attributes[s];n===null?i.removeAttribute(s):i.setAttribute(s,n)}for(let s=0;s<t.children.length;++s)this._revertTemplateFromNode(i.childNodes[s],t.children[s])}},Hs=class{attribute;observable;emitter;callback;constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){let t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){let s=()=>Gd(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}},b5=class extends Hs{eventNameOrFunction;constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,i){let s=(n,r)=>{(!t||r.target.matches(t))&&(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(r):this.observable.fire(this.eventNameOrFunction,r))};return this.emitter.listenTo(i.node,e,s),()=>{this.emitter.stopListening(i.node,e,s)}}},jd=class extends Hs{valueIfTrue;constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return Hi(super.getValue(e))?!1:this.valueIfTrue||!0}};function Jn(e){return e?(e.value&&(e=e.value),Array.isArray(e)?e.some(Jn):e instanceof Hs):!1}function Jo(e){return/^--[a-zA-Z_-][\w-]*$/.test(e)}function _5(e,t){return e.map(i=>i instanceof Hs?i.getValue(t):i)}function Gd(e,t,{node:i}){let s=_5(e,i),n;e.length==1&&e[0]instanceof jd?n=s[0]:n=s.reduce(Jd,""),Hi(n)?t.remove():t.set(n)}function v5(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function y5(e,t,i){return{set(s){e.setAttributeNS(i,t,s)},remove(){e.removeAttributeNS(i,t)}}}function k5(e,t){return{set(i){Jo(t)?e.style.setProperty(t,i):e.style[t]=i},remove(){Jo(t)?e.style.removeProperty(t):e.style[t]=null}}}function xd(e){return dt(e,t=>{if(t&&(t instanceof Hs||Qo(t)||Xn(t)||Xo(t)))return t})}function Ed(e){if(typeof e=="string"?e=x5(e):e.text&&E5(e),e.on&&(e.eventListeners=I5(e.on),delete e.on),!e.text){e.attributes&&C5(e.attributes);let t=[];if(e.children)if(Xo(e.children))t.push(e.children);else for(let i of e.children)Qo(i)||Xn(i)||Qe(i)?t.push(i):t.push(new $e(i));e.children=t}return e}function C5(e){for(let t in e)e[t].value&&(e[t].value=U(e[t].value)),Zd(e,t)}function I5(e){for(let t in e)Zd(e,t);return e}function x5(e){return{text:[e]}}function E5(e){e.text=U(e.text)}function Zd(e,t){e[t]=U(e[t])}function Jd(e,t){return Hi(t)?e:Hi(e)?t:`${e} ${t}`}function Td(e,t){for(let i in t)e[i]?e[i].push(...t[i]):e[i]=t[i]}function Yd(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),Td(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),Td(e.eventListeners,t.eventListeners)),t.text&&e.text.push(...t.text),t.children&&t.children.length){if(e.children.length!=t.children.length)throw new f("ui-template-extend-children-mismatch",e);let i=0;for(let s of t.children)Yd(e.children[i++],s)}}function Hi(e){return!e&&e!==0}function Xn(e){return e instanceof A}function Qo(e){return e instanceof $e}function Xo(e){return e instanceof Me}function Ad(e){return re(e[0])&&e[0].ns}function Sd(){return{children:[],bindings:[],attributes:{}}}function Pd(e){return e=="class"||e=="style"}var T5=ge(z()),A=class extends T5{element;isRendered;locale;t;template;_viewCollections;_unboundChildren;_bindTemplate;constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new pe,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=$e.bind(this,this)}createCollection(e){let t=new Me(e);return this._viewCollections.add(t),t}registerChild(e){ve(e)||(e=[e]);for(let t of e)this._unboundChildren.add(t)}deregisterChild(e){ve(e)||(e=[e]);for(let t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new $e(e)}extendTemplate(e){$e.extend(this.template,e)}
12render(){if(this.isRendered)throw new f("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)}};var Ld={POLITE:"polite",ASSERTIVE:"assertive"},A5=class{editor;view;constructor(e){this.editor=e,e.once("ready",()=>{for(let t of Object.values(Ld))this.announce("",t)})}announce(e,t=Ld.POLITE){let i=this.editor;if(!i.ui.view)return;this.view||(this.view=new S5(i.locale),i.ui.view.body.add(this.view));let{politeness:s,isUnsafeHTML:n}=typeof t=="string"?{politeness:t}:t,r=this.view.regionViews.find(o=>o.politeness===s);r||(r=new P5(i,s),this.view.regionViews.add(r)),r.announce({announcement:e,isUnsafeHTML:n})}},S5=class extends A{regionViews;constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}},P5=class extends A{politeness;_domConverter;_pruneAnnouncementsInterval;constructor(e,t){super(e.locale),this.setTemplate({tag:"div",attributes:{"aria-live":t,"aria-relevant":"additions"},children:[{tag:"ul",attributes:{class:["ck","ck-aria-live-region-list"]}}]}),e.on("destroy",()=>{this._pruneAnnouncementsInterval!==null&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)}),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval(()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()},5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;let i=document.createElement("li");t?this._domConverter.setContentOf(i,e):i.innerText=e,this._listElement.appendChild(i)}get _listElement(){return this.element.querySelector("ul")}};function er({emitter:e,activator:t,callback:i,contextElements:s,listenerOptions:n}){e.listenTo(document,"mousedown",(r,o)=>{if(!t())return;let a=typeof o.composedPath=="function"?o.composedPath():[],l=typeof s=="function"?s():s;for(let c of l)if(c.contains(o.target)||a.includes(c))return;i()},n)}function ea(e){class t extends e{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...s){super(...s),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.template&&this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}return t}function L5(e){class t extends e{_onDragBound=this._onDrag.bind(this);_onDragEndBound=this._onDragEnd.bind(this);_lastDraggingCoordinates={x:0,y:0};constructor(...s){super(...s),this.on("render",()=>{this._attachListeners()}),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(_.document,"mouseup",this._onDragEndBound),this.listenTo(_.document,"touchend",this._onDragEndBound),this.listenTo(_.document,"mousemove",this._onDragBound),this.listenTo(_.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(_.document,"mouseup",this._onDragEndBound),this.stopListening(_.document,"touchend",this._onDragEndBound),this.stopListening(_.document,"mousemove",this._onDragBound),this.stopListening(_.document,"touchmove",this._onDragBound)}_onDragStart(s,n){if(!this._isHandleElementPressed(n))return;this._attachDragListeners();let r,o;n instanceof MouseEvent?(r=n.clientX,o=n.clientY):(r=n.touches[0].clientX,o=n.touches[0].clientY),this._lastDraggingCoordinates={x:r,y:o},this.isDragging=!0}_onDrag(s,n){if(!this.isDragging){this._detachDragListeners();return}let r,o;n instanceof MouseEvent?(r=n.clientX,o=n.clientY):(r=n.touches[0].clientX,o=n.touches[0].clientY),n.preventDefault(),this.fire("drag",{deltaX:Math.round(r-this._lastDraggingCoordinates.x),deltaY:Math.round(o-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:r,y:o}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(s){return this.dragHandleElement?this.dragHandleElement===s.target||s.target instanceof HTMLElement&&this.dragHandleElement.contains(s.target):!1}}return t}function Qd({view:e}){e.listenTo(e.element,"submit",(t,i)=>{i.preventDefault(),e.fire("submit")},{useCapture:!0})}var tr=class extends A{id;constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${X()}`;let t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}};var V5=class extends A{constructor(e,t){super(e);let i=e.t,s=new tr;s.text=i("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":s.id,role:"document",tabindex:-1},children:[ue(document,"p",{},i("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())
12),s]})}focus(){this.element.focus()}_createCategories(e){return e.map(t=>{let i=[ue(document,"h3",{},t.label),...Array.from(t.groups.values()).map(s=>this._createGroup(s)).flat()];return t.description&&i.splice(1,0,ue(document,"p",{},t.description)),ue(document,"section",{},i)})}_createGroup(e){let t=e.keystrokes.sort((s,n)=>s.label.localeCompare(n.label)).map(s=>this._createGroupRow(s)).flat(),i=[ue(document,"dl",{},t)];return e.label&&i.unshift(ue(document,"h4",{},e.label)),i}_createGroupRow(e){let t=this.locale.t,i=ue(document,"dt"),s=ue(document,"dd"),n=B5(e.keystroke),r=[];for(let o of n)r.push(o.map(M5).join(""));return i.innerHTML=e.label,s.innerHTML=r.join(", ")+(e.mayRequireFn&&I.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[i,s]}};function M5(e){return ms(e).split("+").map(t=>`<kbd>${t}</kbd>`).join("+")}function B5(e){return typeof e=="string"?[[e]]:typeof e[0]=="string"?[e]:e}var Ct=class Xd extends A{static 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"];constructor(){super();let t=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",t.if("isVisible","ck-hidden",i=>!i),"ck-reset_all-excluded",t.if("isColorInherited","ck-icon_inherit-color")],viewBox:t.to("viewBox"),"aria-hidden":!0}})}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){let t=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg");if(!t)throw new f("ui-iconview-invalid-svg",this);let i=t.getAttribute("viewBox");i&&(this.viewBox=i);for(let{name:s,value:n}of Array.from(t.attributes))Xd.presentationalAttributeNames.includes(s)&&this.element.setAttribute(s,n);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(t=>{t.style.fill=this.fillColor})}};var eh=class extends A{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});let e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}};var B=class extends A{children;labelView;iconView;keystrokeView;_focusDelayed=null;constructor(e,t=new eh){super(e);let i=this.bindTemplate,s=X();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${s}`),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._setupLabelView(t),this.iconView=new Ct,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.iconView.bind("content").to(this,"icon"),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));let n={tag:"button",attributes:{class:["ck","ck-button",i.to("class"),i.if("isEnabled","ck-disabled",r=>!r),i.if("isVisible","ck-hidden",r=>!r),i.to("isOn",r=>r?"ck-on":"ck-off"),i.if("withText","ck-button_with-text"),i.if("withKeystroke","ck-button_with-keystroke")],role:i.to("role"),type:i.to("type",r=>r||"button"),tabindex:i.to("tabindex"),"aria-checked":i.to("_ariaChecked"),"aria-pressed":i.to("_ariaPressed"),"aria-label":i.to("ariaLabel"),"aria-labelledby":i.to("ariaLabelledBy"),"aria-disabled":i.if("isEnabled",!0,r=>!r),"data-cke-tooltip-text":i.to("_tooltipString"),"data-cke-tooltip-position":i.to("tooltipPosition")},children:this.children,on:{click:i.to(r=>{this.isEnabled?this.fire("execute"):r.preventDefault()})}};if(this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",(r,o,a)=>!o||Vd(a)?!1:String(!!r)),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",(r,o,a)=>!o||!Vd(a)?!1:String(!!r)),I.isSafari){this._focusDelayed||(this._focusDelayed=gs(()=>
12this.focus(),0)),n.on.mousedown=i.to(()=>{this._focusDelayed()}),n.on.mouseup=i.to(()=>{this._focusDelayed.cancel()})}this.setTemplate(n)}render(){super.render(),this.icon&&this.children.add(this.iconView),this.on("change:icon",(e,t,i,s)=>{i&&!s?this.children.add(this.iconView,0):!i&&s&&this.children.remove(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()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){let e=new A;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>ms(t))}]}),e}_getTooltipString(e,t,i){return e?typeof e=="string"?e:(i&&(i=ms(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}};function Vd(e){switch(e){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}var Us=class extends A{children;iconView;constructor(e,t={}){super(e);let i=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",i.to("class")]},children:this.children}),t.icon&&(this.iconView=new Ct,this.iconView.content=t.icon,this.children.add(this.iconView));let s=new A(e);s.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:i.to("label")}]}),this.children.add(s)}};var O5=F(),rt=class extends O5{focusables;focusTracker;keystrokeHandler;actions;constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(let t in e.actions){let i=e.actions[t];typeof i=="string"&&(i=[i]);for(let s of i)e.keystrokeHandler.set(s,(n,r)=>{this[t](),r()},e.keystrokeHandlerOptions)}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"})}get first(){return this.focusables.find(qo)||null}get last(){return this.focusables.filter(qo).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return this.focusTracker.focusedElement===null?null:(this.focusables.find((t,i)=>{let s=t.element===this.focusTracker.focusedElement;return s&&(e=i),s}),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){let e=this.next;if(e&&this.focusables.getIndex(e)===this.current){this.fire("forwardCycle");return}e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){let e=this.previous;if(e&&this.focusables.getIndex(e)===this.current){this.fire("backwardCycle");return}e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}chain(e){let t=()=>this.current===null?null:this.focusables.get(this.current);this.listenTo(e,"forwardCycle",i=>{let s=t();this.focusNext(),s!==t()&&i.stop()},{priority:"low"}),this.listenTo(e,"backwardCycle",i=>{let s=t();this.focusPrevious(),s!==t()&&i.stop()},{priority:"low"})}unchain(e){this.stopListening(e)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){let t=this.focusables.length;if(!t)return null;let i=this.current;if(i===null)return this[e===1?"first":"last"];let s=this.focusables.get(i),n=(i+t+e)%t;do{let r=this.focusables.get(n);if(qo(r)){s=r;break}n=(n+t+e)%t}while(n!==i);return s}};function qo(e){return Ws(e)&&Xe(e.element)}function Ws(e){return"focus"in e&&typeof e.focus=="function"}function R5(e){return Ws(e)&&"focusCycler"in e&&e.focusCycler instanceof rt}var F5=class extends A{children;keystrokes;focusCycler;_focusTracker;_focusables;constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new we,this._focusTracker=new oe,this._focusables=new Me,this.focusCycler=new rt({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(e){for(let t of e){let i=new B(this.locale),s;i.on("execute",()=>t.onExecute()),t.onCreate&&t.onCreate(i);for(s in t)s!="onExecute"&&s!="onCreate"&&i.set(s,t[s]);this.children.add(i)}this._updateFocusCyclableItems()}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}
12_updateFocusCyclableItems(){Array.from(this.children).forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}};var D5=class extends A{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}};var qe={SCREEN_CENTER:"screen-center",EDITOR_CENTER:"editor-center",EDITOR_TOP_SIDE:"editor-top-side",EDITOR_TOP_CENTER:"editor-top-center",EDITOR_BOTTOM_CENTER:"editor-bottom-center",EDITOR_ABOVE_CENTER:"editor-above-center",EDITOR_BELOW_CENTER:"editor-below-center"},Md=ei("px"),N5=L5(A),ir=class th extends N5{parts;headerView;closeButtonView;actionsView;static defaultOffset=15;contentView;keystrokes;focusTracker;wasMoved=!1;_getDomRootElement;_getViewportOffset;_focusables;_focusCycler;constructor(t,{getDomRootElement:i,getViewportOffset:s,keystrokeHandlerOptions:n}){super(t);let r=this.bindTemplate,o=t.t;this.set("className",""),this.set("ariaLabel",o("Editor dialog")),this.set("isModal",!1),this.set("position",qe.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getDomRootElement=i,this._getViewportOffset=s,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new we,this.focusTracker=new oe,this._focusables=new Me,this._focusCycler=new rt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"},keystrokeHandlerOptions:n}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",r.if("isModal","ck-dialog-overlay__transparent",a=>!a),r.if("_isVisible","ck-hidden",a=>!a)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",r.if("isModal","ck-dialog_modal"),r.to("className")],role:"dialog","aria-label":r.to("ariaLabel"),style:{top:r.to("_top",a=>Md(a)),left:r.to("_left",a=>Md(a)),visibility:r.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",(t,i)=>{t.defaultPrevented||(this.fire("close",{source:"escKeyPress"}),i())}),this.on("drag",(t,{deltaX:i,deltaY:s})=>{this.wasMoved=!0,this.moveBy(i,s)}),this.listenTo(_.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(_.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on("change:_isVisible",(t,i,s)=>{s&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView&&!this.isModal?this.headerView.element:null}setupParts({icon:t,title:i,hasCloseButton:s=!0,content:n,actionButtons:r}){i&&(this.headerView=new Us(this.locale,{icon:t}),s&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=i,this.ariaLabel=i,this.parts.add(this.headerView,0)),n&&(n instanceof A&&(n=[n]),this.contentView=new D5(this.locale),this.contentView.children.addMany(n),this.parts.add(this.contentView)),r&&(this.actionsView=new F5(this.locale),this.actionsView.setButtons(r),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(t,i){let s=this._getViewportRect(),n=this._getDialogRect();t+n.width>s.right&&(t=s.right-n.width),t<s.left&&(t=s.left),i<s.top&&(i=s.top),this._moveTo(t,i)}_moveTo(t,i){this._left=t,this._top=i}moveBy(t,i){this.moveTo(this._left+t,this._top+i)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;let t=this._getViewportRect(),i=this.position,s=null,n=null;this._getDomRootElement()?{domRootRect:s,visibleDomRootRect:n}=this._getDomRootRects(t):i=qe.SCREEN_CENTER;let r=th.defaultOffset,o=this._getDialogRect();if(this.position!=null){if(typeof this.position=="function"){let a=this.position(o,n,s);if(a==null){this._moveOffScreen();return}this._moveTo(a.left,a.top);return}
12switch(i){case qe.EDITOR_TOP_SIDE:if(n){let a=this.locale.contentLanguageDirection==="ltr"?n.right-o.width-r:n.left+r;this.moveTo(a,n.top+r)}else this._moveOffScreen();break;case qe.EDITOR_CENTER:n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),Math.round(n.top+n.height/2-o.height/2)):this._moveOffScreen();break;case qe.SCREEN_CENTER:this.moveTo(Math.round((t.width-o.width)/2),Math.round((t.height-o.height)/2));break;case qe.EDITOR_TOP_CENTER:n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.top+r):this._moveOffScreen();break;case qe.EDITOR_BOTTOM_CENTER:n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.bottom-o.height-r):this._moveOffScreen();break;case qe.EDITOR_ABOVE_CENTER:n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.top-o.height-r):this._moveOffScreen();break;case qe.EDITOR_BELOW_CENTER:n?this.moveTo(Math.round(n.left+n.width/2-o.width/2),n.bottom+r):this._moveOffScreen();break}}}_getDomRootRects(t){let i=new O(this._getDomRootElement()),s=i.getVisible();return s&&(s=t.getIntersection(s)),{visibleDomRootRect:s,domRootRect:i}}_getDialogRect(){return new O(this.element.firstElementChild)}_getViewportRect(){let t=new O(_.window);return this.isModal?t:Ur(this._getViewportOffset())}_updateFocusCyclableItems(){let t=[];if(this.contentView)for(let i of this.contentView.children)Ws(i)&&t.push(i);
12this.actionsView&&t.push(this.actionsView),this.closeButtonView&&t.push(this.closeButtonView),t.forEach(i=>{this._focusables.add(i),this.focusTracker.add(i.element),R5(i)&&this._focusCycler.chain(i.focusCycler)})}_createCloseButton(){let t=new B(this.locale),i=this.locale.t;return t.set({label:i("Close"),tooltip:!0,icon:rd}),t.on("execute",()=>this.fire("close",{source:"closeButton"})),t}};var z5=class yt extends k{view;static _visibleDialogPlugin;_onHide;static get pluginName(){return"Dialog"}static get isOfficialPlugin(){return!0}constructor(t){super(t);let i=t.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),t.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:i("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}destroy(){super.destroy(),yt._visibleDialogPlugin===this&&this._unlockBodyScroll()}_initShowHideListeners(){this.on("show",(t,i)=>{this._show(i)}),this.on("show",(t,i)=>{i.onShow&&i.onShow(this)},{priority:"low"}),this.on("hide",()=>{yt._visibleDialogPlugin&&yt._visibleDialogPlugin._hide()}),this.on("hide",()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)},{priority:"low"})}_initFocusToggler(){let t=this.editor;t.keystrokes.set("Ctrl+F6",(i,s)=>{!this.isOpen||this.view.isModal||(this.view.focusTracker.isFocused?t.editing.view.focus():this.view.focus(),s())})}_initMultiRootIntegration(){let t=this.editor.model;t.document.on("change:data",()=>{if(!this.view)return;let i=t.document.differ.getChangedRoots();for(let s of i)s.state&&this.view.updatePosition()})}show(t){this.hide(),this.fire(`show:${t.id}`,t)}_show({id:t,icon:i,title:s,hasCloseButton:n=!0,content:r,actionButtons:o,className:a,isModal:l,position:c,onHide:u,getRootName:d,keystrokeHandlerOptions:h}){let m=this.editor;this.view=new ir(m.locale,{getDomRootElement:()=>{let w=d?.()??this.editor.model.document.selection.anchor.root.rootName;return!w||!m.editing.view.domRoots.has(w)?null:m.editing.view.getDomRoot(w)??null},getViewportOffset:()=>m.ui.viewportOffset,keystrokeHandlerOptions:h});let g=this.view;g.on("close",()=>{this.hide()}),m.ui.view.body.add(g),m.keystrokes.listenTo(g.element),c||(c=l?qe.SCREEN_CENTER:qe.EDITOR_CENTER),l&&this._lockBodyScroll(),g.set({position:c,_isVisible:!0,className:a,isModal:l}),g.setupParts({icon:i,title:s,hasCloseButton:n,content:r,actionButtons:o}),this.id=t,u&&(this._onHide=u),this.isOpen=!0,yt._visibleDialogPlugin=this}hide(){yt._visibleDialogPlugin&&yt._visibleDialogPlugin.fire(`hide:${yt._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;let t=this.editor,i=this.view;i.isModal&&this._unlockBodyScroll(),i.contentView&&i.contentView.reset(),t.ui.view.body.remove(i),t.ui.focusTracker.remove(i.element),t.keystrokes.stopListening(i.element),i.destroy(),t.editing.view.focus(),this.id=null,this.isOpen=!1,yt._visibleDialogPlugin=null}_lockBodyScroll(){document.documentElement.classList.add("ck-dialog-scroll-locked")}_unlockBodyScroll(){document.documentElement.classList.remove("ck-dialog-scroll-locked")}};var sr=class extends B{_checkIconHolderView=new H5;constructor(e,t=new eh){super(e,t),this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});let i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",i.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",(s,n)=>s||n)}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind("isOn").to(this,"isOn",e=>this.isToggleable&&e),this.on("change:_hasCheck",(e,t,i)=>{let{children:s,_checkIconHolderView:n}=this;i?s.add(n,0):s.remove(n)})}},H5=class extends A{children;_checkIconView=this._createCheckIconView();constructor(){super();let e=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",!1),this.setTemplate({tag:"span",children:this.children,attributes:{class:["ck","ck-list-item-button__check-holder",e.to("isOn",t=>t?"ck-on":"ck-off")]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",(e,t,i)=>{let{children:s,_checkIconView:n}=this;i&&!s.has(n)?s.add(n):!i&&s.has(n)&&s.remove(n)})}_createCheckIconView(){let e=new Ct;return e.content=od,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}};var te=class extends sr{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}};var ih=class extends k{contentView=null;static get requires(){return[z5]}static get pluginName(){return"AccessibilityHelp"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",()=>{let i=this._createButton(B);return i.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),i}),e.ui.componentFactory.add("menuBar:accessibilityHelp",()=>{let i=this._createButton(te);return i.label=t("Accessibility"),i}),e.keystrokes.set("Alt+0",(i,s)=>{this._toggleDialog(),s()}),this._setupRootLabels()}_createButton(e){let t=this.editor,i=t.plugins.get("Dialog"),s=t.locale,n=new e(s);return n.set({keystroke:"Alt+0",icon:Ro,isToggleable:!0}),n.on("execute",()=>this._toggleDialog()),n.bind("isOn").to(i,"id",r=>r==="accessibilityHelp"),n}_setupRootLabels(){let e=this.editor,t=e.editing.view,i=e.t;e.ui.on("ready",()=>{t.change(n=>{for(let r of t.document.roots)s(n,r)}),e.on("addRoot",(n,r)=>{let o=e.editing.view.document.getRoot(r.rootName);t.change(a=>s(a,o))},{priority:"low"})});function s(n,r){let o=[r.getAttribute("aria-label"),i("Press %0 for help.",[ms("Alt+0")])].filter(a=>a).join(". ");n.setAttribute("aria-label",o,r)}}_toggleDialog(){let e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.contentView||(this.contentView=new V5(e.locale,e.accessibility.keystrokeInfos)),t.id==="accessibilityHelp"?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:i("Accessibility help"),icon:Ro,hasCloseButton:!0,content:this.contentView})}};var U5=class nt extends Me{locale;_bodyCollectionContainer;static _bodyWrapper;constructor(t,i=[]){super(i),this.locale=t}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new $e({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render(),(!nt._bodyWrapper||!nt._bodyWrapper.isConnected)&&(nt._bodyWrapper=ue(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(nt._bodyWrapper)),nt._bodyWrapper.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove(),nt._bodyWrapper&&!nt._bodyWrapper.childElementCount&&(nt._bodyWrapper.remove(),delete nt._bodyWrapper)}};var Bd=ei("px"),W5={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}
12},zs=class di extends A{content;_pinWhenIsVisibleCallback;_resizeObserver;constructor(t){super(t);let i=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._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",i.to("position",s=>`ck-balloon-panel_${s}`),i.if("isVisible","ck-balloon-panel_visible"),i.if("withArrow","ck-balloon-panel_with-arrow"),i.to("class")],style:{top:i.to("top",Bd),left:i.to("left",Bd)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(t){let i=Yn(t.target);if(i&&!Xe(i))return!1;this.show();let s=di.defaultPositions,n=Object.assign({},{element:this.element,positions:[s.southArrowNorth,s.southArrowNorthMiddleWest,s.southArrowNorthMiddleEast,s.southArrowNorthWest,s.southArrowNorthEast,s.northArrowSouth,s.northArrowSouthMiddleWest,s.northArrowSouthMiddleEast,s.northArrowSouthWest,s.northArrowSouthEast,s.viewportStickyNorth],limiter:_.document.body,fitInViewport:!0},t),r=di._getOptimalPosition(n)||W5,o=parseInt(r.left),a=parseInt(r.top),l=r.name,{withArrow:c=!0}=r.config||{};return this.top=a,this.left=o,this.position=l,this.withArrow=c,!0}pin(t){this.unpin(),this._startPinning(t)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(t):this._stopPinning()},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(t){if(!this.attachTo(t))return!1;let i=Yn(t.target),s=t.limiter?Yn(t.limiter):_.document.body;if(this.listenTo(_.document,"scroll",(n,r)=>{let o=r.target,a=i&&o.contains(i),l=s&&o.contains(s);(a||l||!i||!s)&&this.attachTo(t)},{useCapture:!0}),this.listenTo(_.window,"resize",()=>{this.attachTo(t)}),!this._resizeObserver&&(i&&q(i)&&(i=i.parentElement),i)){let n=()=>{Xe(i)||this.unpin()};this._resizeObserver=new ds(i,n)}return!0}_stopPinning(){this.stopListening(_.document,"scroll"),this.stopListening(_.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(t={}){let{sideOffset:i=di.arrowSideOffset,heightOffset:s=di.arrowHeightOffset,stickyVerticalOffset:n=di.stickyVerticalOffset,config:r}=t;return{northWestArrowSouthWest:(l,c)=>({top:o(l,c),left:l.left-i,name:"arrow_sw",...r&&{config:r}}),northWestArrowSouthMiddleWest:(l,c)=>({top:o(l,c),left:l.left-c.width*.25-i,name:"arrow_smw",...r&&{config:r}}),northWestArrowSouth:(l,c)=>({top:o(l,c),left:l.left-c.width/2,name:"arrow_s",...r&&{config:r}}),northWestArrowSouthMiddleEast:(l,c)=>({top:o(l,c),left:l.left-c.width*.75+i,name:"arrow_sme",...r&&{config:r}}),northWestArrowSouthEast:(l,c)=>({top:o(l,c),left:l.left-c.width+i,name:"arrow_se",...r&&{config:r}}),northArrowSouthWest:(l,c)=>({top:o(l,c),left:l.left+l.width/2-i,name:"arrow_sw",...r&&{config:r}}),northArrowSouthMiddleWest:(l,c)=>({top:o(l,c),left:l.left+l.width/2-c.width*.25-i,name:"arrow_smw",...r&&{config:r}}),northArrowSouth:(l,c)=>({top:o(l,c),left:l.left+l.width/2-c.width/2,name:"arrow_s",...r&&{config:r}}),northArrowSouthMiddleEast:(l,c)=>({top:o(l,c),left:l.left+l.width/2-c.width*.75+i,name:"arrow_sme",...r&&{config:r}}),northArrowSouthEast:(l,c)=>({top:o(l,c),left:l.left+l.width/2-c.width+i,name:"arrow_se",...r&&{config:r}}),northEastArrowSouthWest:(l,c)=>({top:o(l,c),left:l.right-i,name:"arrow_sw",...r&&{config:r}}),northEastArrowSouthMiddleWest:(l,c)=>({top:o(l,c),left:l.right-c.width*.25-i,name:"arrow_smw",...r&&{config:r}}),northEastArrowSouth:(l,c)=>({top:o(l,c),left:l.right-c.width/2,name:"arrow_s",...r&&{config:r}}),northEastArrowSouthMiddleEast:(l,c)=>({top:o(l,c),left:l.right-c.width*.75+i,name:"arrow_sme",...r&&{config:r}}),northEastArrowSouthEast:(l,c)=>({top:o(l,c),left:l.right-c.width+i,name:"arrow_se",...r&&{config:r}}),southWestArrowNorthWest:l=>({top:a(l),left:l.left-i,name:"arrow_nw",...r&&{config:r}}),southWestArrowNorthMiddleWest:(l,c)=>({top:a(l),left:l.left-c.width*.25-i,name:"arrow_nmw",...r&&{config:r}}),southWestArrowNorth:(l,c)=>({top:a(l),left:l.left-c.width/2,name:"arrow_n",...r&&{config:r}}),southWestArrowNorthMiddleEast:(l,c)=>({top:a(l),left:l.left-c.width*.75+i,name:"arrow_nme",...r&&{config:r}}),southWestArrowNorthEast:(l,c)=>({top:a(l),left:l.left-c.width+i,name:"arrow_ne",...r&&{config:r}}),southArrowNorthWest:l=>({top:a(l),left:l.left+l.width/2-i,name:"arrow_nw",...r&&{config:r}}),southArrowNorthMiddleWest:(l,c)=>({top:a(l),left:l.left+l.width/2-c.width*.25-i,name:"arrow_nmw",...r&&{config:r}}),southArrowNorth:(l,c)=>({top:a(l),left:l.left+l.width/2-c.width/2,name:"arrow_n",...r&&{config:r}}),southArrowNorthMiddleEast:(l,c)=>({top:a(l),left:l.left+l.width/2-c.width*.75+i,name:"arrow_nme",...r&&{config:r}}),southArrowNorthEast:(l,c)=>({top:a(l),left:l.left+l.width/2-c.width+i,name:"arrow_ne",...r&&{config:r}}),southEastArrowNorthWest:l=>({top:a(l),left:l.right-i,name:"arrow_nw",...r&&{config:r}}),southEastArrowNorthMiddleWest:(l,c)=>({top:a(l),left:l.right-c.width*.25-i,name:"arrow_nmw",...r&&{config:r}}),southEastArrowNorth:(l,c)=>({top:a(l),left:l.right-c.width/2,name:"arrow_n",...r&&{config:r}}),southEastArrowNorthMiddleEast:(l,c)=>({top:a(l),left:l.right-c.width*.75+i,name:"arrow_nme",...r&&{config:r}}),southEastArrowNorthEast:(l,c)=>({top:a(l),left:l.right-c.width+i,name:"arrow_ne",...r&&{config:r}}),westArrowEast:(l,c)=>({top:l.top+l.height/2-c.height/2,left:l.left-c.width-s,name:"arrow_e",...r&&{config:r}}),eastArrowWest:(l,c)=>({top:l.top+l.height/2-c.height/2,left:l.right+s,name:"arrow_w",...r&&{config:r}}),viewportStickyNorth:(l,c,u)=>{let d=new O(_.document.body).getIntersection(u.getVisible());if(!d)return null;let h=d.getVisible();return!l.getIntersection(h)||!(h.top-l.top-n<c.height&&h.bottom-l.bottom<c.height)?null:{top:h.top+n,left:l.left+l.width/2-c.width/2,name:"arrowless",config:{withArrow:!1,...r}}}};function o(l,c){return l.top-c.height-s}function a(l){return l.bottom+s}}static arrowSideOffset=25;static arrowHeightOffset=10;static stickyVerticalOffset=20;static _getOptimalPosition=_n;static defaultPositions=di.generatePositions()};function Yn(e){return he(e)?e:us(e)?e.commonAncestorContainer:typeof e=="function"?Yn(e()):null}var q5=50,$5=350,K5=ge(),sh=class extends K5{editor;_balloonView=null;_showBalloonThrottled=Pt(()=>this._showBalloon(),50,{leading:!0});_lastFocusedEditableElement=null;_balloonClass;constructor(e,t={}){super(),this.editor=e,this._balloonClass=t.balloonClass,e.on("ready",()=>this._handleEditorReady())}destroy(){let e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){let e=this.editor;this._isEnabled()&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(t,i,s)=>{this._updateLastFocusedEditableElement(),s?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(t,i,s)=>{this._updateLastFocusedEditableElement(),s&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_getNormalizedConfig(){return{side:this.editor.locale.contentLanguageDirection==="ltr"?"right":"left",position:"border",verticalOffset:0,horizontalOffset:5}}_showBalloon(){let e=this._getBalloonAttachOptions();e&&(this._balloonView||(this._balloonView=this._createBalloonView()),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_createBalloonView(){let e=this.editor,t=new zs,i=this._createBadgeContent();return t.content.add(i),this._balloonClass&&(t.class=this._balloonClass),e.ui.view.body.add(t),t}_getBalloonAttachOptions(){if(!this._lastFocusedEditableElement)return null;let e=this._getNormalizedConfig(),t=e.side==="right"?j5(this._lastFocusedEditableElement,e):G5(this._lastFocusedEditableElement,e);return{target:this._lastFocusedEditableElement,positions:[t]}}_updateLastFocusedEditableElement(){let e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i){this._lastFocusedEditableElement=null;return}let s=Array.from(e.ui.getEditableElementsNames()).map(n=>e.ui.getEditableElement(n));s.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=s[0]}};function j5(e,t){return nh(e,t,(i,s)=>i.left+i.width-s.width-t.horizontalOffset)}function G5(e,t){return nh(e,t,i=>i.left+t.horizontalOffset)}function nh(e,t,i){return(s,n)=>{let r=new O(e);if(r.width<$5||r.height<q5)return null;let o;t.position==="inside"?o=r.bottom-n.height:o=r.bottom-n.height/2,o-=t.verticalOffset;
12let a=i(r,n),l=s.clone().moveTo(a,o).getIntersection(n.clone().moveTo(a,o)).getVisible();return!l||l.getArea()<n.getArea()?null:{top:o,left:a,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}var Z5="Powered by",J5=class extends sh{constructor(e){super(e,{balloonClass:"ck-powered-by-balloon"})}_isEnabled(){let e=this.editor;if(e.config.get("ui.poweredBy.forceVisible"))return!0;let t=e.config.get("licenseKey");if(t=="GPL")return!0;let i=yn(t.split(".")[1]);return i?!i.whiteLabel:!0}_createBadgeContent(){return new Y5(this.editor.locale,this._getNormalizedConfig().label)}_getNormalizedConfig(){let e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{},i=t.position||e.position,s=i==="inside"?5:e.verticalOffset;return{position:i,side:t.side||e.side,label:t.label===void 0?Z5:t.label,verticalOffset:t.verticalOffset!==void 0?t.verticalOffset:s,horizontalOffset:t.horizontalOffset!==void 0?t.horizontalOffset:e.horizontalOffset,forceVisible:!!t.forceVisible}}},Y5=class extends A{constructor(e,t){super(e);let i=new Ct,s=this.bindTemplate;i.set({content:gd,isColorInherited:!1}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/powered-by-ckeditor/?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(n=>n.preventDefault())}}]})}};var nr=class extends B{toggleSwitchView;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(){let e=new A;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}};var Q5=e2(sr);var X5=class extends Q5{};function e2(e){class t extends e{_fileInputView;constructor(...s){super(...s),this._fileInputView=new t2(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",()=>{this._fileInputView.open()}),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}return t}var t2=class extends A{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);let t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element?.files?.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}};var rr=class extends A{fieldView;labelView;statusView;fieldWrapperChildren;constructor(e,t){super(e);let i=`ck-labeled-field-view-${X()}`,s=`ck-labeled-field-view-status-${X()}`;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",(r,o)=>r||o);let n=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",n.to("class"),n.if("isEnabled","ck-disabled",r=>!r),n.if("isEmpty","ck-labeled-field-view_empty"),n.if("isFocused","ck-labeled-field-view_focused"),n.if("placeholder","ck-labeled-field-view_placeholder"),n.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){let t=new tr(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){let t=new A(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(e){this.fieldView.focus(e)}};var i2=class extends A{focusTracker;constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new oe,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);let t=this.bindTemplate;
12this.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"),tabindex:t.to("tabIndex"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById"),"aria-label":t.to("ariaLabel")},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()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=s2(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?"":e}};function s2(e){return!e.value}var n2=class extends i2{constructor(e){super(e),this.set("inputMode","text");let t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}};var r2=class extends n2{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}};var o2=class extends A{children;constructor(e){super(e);let 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")],tabindex:"-1"},children:this.children,on:{selectstart:t.to(i=>{let s=i.target;s instanceof Element&&s.tagName.toLocaleLowerCase()==="input"||i.preventDefault()})}})}focus(){if(this.children.length){let e=this.children.first;typeof e.focus=="function"?e.focus():N("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){let e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}};var a2=class Yo extends A{buttonView;panelView;focusTracker;keystrokes;listView;toolbarView;menuView;constructor(t,i,s){super(t);let n=this.bindTemplate;this.buttonView=i,this.panelView=s,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new we,this.focusTracker=new oe,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",r=>!r)],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[i,s]}),i.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":n.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.on("change:isOpen",(i,s,n)=>{if(n)if(this.panelPosition==="auto"){let r=Yo._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=r?r.name:this._defaultPanelPositionName}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);let t=(i,s)=>{this.isOpen&&(this.isOpen=!1,s())};this.keystrokes.set("arrowdown",(i,s)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,s())}),this.keystrokes.set("arrowright",(i,s)=>{this.isOpen&&s()}),this.keystrokes.set("arrowleft",t),this.keystrokes.set("esc",t)}focus(){this.buttonView.focus()}get _panelPositions(){let{south:t,north:i,southEast:s,southWest:n,northEast:r,northWest:o,southMiddleEast:a,southMiddleWest:l,northMiddleEast:c,northMiddleWest:u}=Yo.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[s,n,a,l,t,r,o,c,u,i]:[n,s,l,a,t,o,r,u,c,i]}get _defaultPanelPositionName(){return this.locale.uiLanguageDirection==="rtl"?"sw":"se"}static defaultPanelPositions={south:(t,i)=>({top:t.bottom,left:t.left-(i.width-t.width)/2,name:"s"}),southEast:t=>({top:t.bottom,left:t.left,name:"se"}),southWest:(t,i)=>({top:t.bottom,left:t.left-i.width+t.width,name:"sw"}),southMiddleEast:(t,i)=>({top:t.bottom,left:t.left-(i.width-t.width)/4,name:"sme"}),southMiddleWest:(t,i)=>({top:t.bottom,left:t.left-(i.width-t.width)*3/4,name:"smw"}),north:(t,i)=>({top:t.top-i.height,left:t.left-(i.width-t.width)/2,name:"n"}),northEast:(t,i)=>({top:t.top-i.height,left:t.left,name:"ne"}),northWest:(t,i)=>({top:t.top-i.height,left:t.left-i.width+t.width,name:"nw"}),northMiddleEast:(t,i)=>({top:t.top-i.height,left:t.left-(i.width-t.width)/4,name:"nme"}),northMiddleWest:(t,i)=>({top:t.top-i.height,left:t.left-(i.width-t.width)*3/4,name:"nmw"})};static _getOptimalPosition=_n};var l2=class extends B{arrowView;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(){let e=new Ct;return e.content=$n,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}};var kt=class extends A{children;constructor(e){super(e);let 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&&this.children.first.focus()}};var rh=class extends A{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}};var $o=class extends A{labelView;items;children;constructor(e,t=new tr){super(e);let i=this.bindTemplate,s=new Ui(e);this.set({label:"",isVisible:!0}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,s]),s.set({role:"group",ariaLabelledBy:t.id}),s.focusTracker.destroy(),s.keystrokes.destroy(),this.items=s.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",i.if("isVisible","ck-hidden",n=>!n)]},children:this.children})}focus(){if(this.items){let e=this.items.find(t=>!(t instanceof rh));e&&e.focus()}}};var Ui=class extends A{focusables;items;focusTracker;keystrokes;_focusCycler;_listItemGroupToChangeListeners=new WeakMap;constructor(e){super(e);let t=this.bindTemplate;this.focusables=new Me,this.items=this.createCollection(),this.focusTracker=new oe,this.keystrokes=new we,this._focusCycler=new rt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",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"),"aria-labelledby":t.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(let e of this.items)e instanceof $o?this._registerFocusableItemsGroup(e):e instanceof kt&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(let i of t.removed)i instanceof $o?this._deregisterFocusableItemsGroup(i):i instanceof kt&&this._deregisterFocusableListItem(i);for(let i of Array.from(t.added).reverse())i instanceof $o?this._registerFocusableItemsGroup(i,t.index):this._registerFocusableListItem(i,t.index)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,i)=>{for(let s of i.removed)this._deregisterFocusableListItem(s);for(let s of Array.from(i.added).reverse())this._registerFocusableListItem(s,this.items.getIndex(e)+i.index)}}
12_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((s,n)=>{let r=typeof t<"u"?t+n:void 0;this._registerFocusableListItem(s,r)});let i=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,i),e.items.on("change",i)}_deregisterFocusableItemsGroup(e){for(let t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}};var oh=class extends A{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}};var c2=class extends A{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}};function u2(e){return e.bindTemplate.to(t=>{t.target===e.element&&t.preventDefault()})}function ta(e){if(Array.isArray(e))return{items:e,removeItems:[]};let t={items:[],removeItems:[]};return e?{...t,...e}:t}var d2={alignLeft:sd,bold:qn,importExport:ld,paragraph:No,plus:md,text:yd,threeVerticalDots:jn,pilcrow:fd,dragIndicator:ad},Wi=class extends A{options;items;focusTracker;keystrokes;itemsView;children;focusables;_focusCycler;_behavior;constructor(e,t){super(e);let i=this.bindTemplate,s=this.t;this.options=t||{},this.set("ariaLabel",s("Editor toolbar")),this.set("maxWidth","auto"),this.set("role","toolbar"),this.set("isGrouping",!!this.options.shouldGroupWhenFull),this.items=this.createCollection(),this.focusTracker=new oe,this.keystrokes=new we,this.set("class",void 0),this.set("isCompact",!1),this.set("isVertical",!1),this.itemsView=new h2(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();let n=e.uiLanguageDirection==="rtl";this._focusCycler=new rt({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[n?"arrowright":"arrowleft","arrowup"],focusNext:[n?"arrowleft":"arrowright","arrowdown"]}});let r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact"),i.if("isGrouping","ck-toolbar_grouping"),i.if("isVertical","ck-toolbar_vertical")];this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:i.to("role"),"aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:u2(this)}}),this._behavior=this.options.shouldGroupWhenFull?new Rd(this):new Od(this)}render(){super.render(),this.focusTracker.add(this.element);for(let e of this.items)this.focusTracker.add(e);this.items.on("add",(e,t)=>{this.focusTracker.add(t)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t)}),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))}switchBehavior(e){this._behavior.type!==e&&(this._behavior.destroy(),this.itemsView.children.clear(),this.focusables.clear(),e==="dynamic"?(this._behavior=new Rd(this),this._behavior.render(this),this._behavior.refreshItems()):(this._behavior=new Od(this),this._behavior.render(this)))}_buildItemsFromConfig(e,t,i){let s=ta(e),n=i||s.removeItems;return this._cleanItemsConfiguration(s.items,t,n).map(r=>re(r)?this._createNestedToolbarDropdown(r,t,n):r==="|"?new oh:r==="-"?new c2:t.create(r)).filter(r=>!!r)}_cleanItemsConfiguration(e,t,i){let s=e.filter((n,r,o)=>n==="|"?!0:i.indexOf(n)!==-1?!1:n==="-"?this.options.shouldGroupWhenFull?(N("toolbarview-line-break-ignored-when-grouping-items",o),!1):!0:!re(n)&&!t.has(n)?(N("toolbarview-item-unavailable",{item:n}),!1):!0);return this._cleanSeparatorsAndLineBreaks(s)}_cleanSeparatorsAndLineBreaks(e){let t=r=>r!=="-"&&r!=="|",i=e.length,s=e.findIndex(t);if(s===-1)return[];let n=i-e.slice().reverse().findIndex(t);return e.slice(s,n).filter((r,o,a)=>t(r)?!0:!(o>0&&a[o-1]===r))}_createNestedToolbarDropdown(e,t,i){let{label:s,icon:n,items:r,tooltip:o=!0,withText:a=!1}=e;if(r=this._cleanItemsConfiguration(r,t,i),!r.length)return null;let l=this.locale,c=ia(l);return s||N("toolbarview-nested-toolbar-dropdown-missing-label",e),c.class="ck-toolbar__nested-toolbar-dropdown",c.buttonView.set({label:s,tooltip:o,withText:!!a}),n!==!1?c.buttonView.icon=d2[n]||n||jn:c.buttonView.withText=!0,lh(c,()=>c.toolbarView._buildItemsFromConfig(r,t,i)),c}},h2=class extends A{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}},Od=class{type="static";constructor(e){e.isGrouping=!1,e.itemsView.children.bindTo(e.items).using(t=>t),e.focusables.bindTo(e.items).using(t=>Ws(t)?t:null)}render(){}destroy(){}},Rd=class{type="dynamic";view;viewChildren;viewFocusables;viewItemsView;viewFocusTracker;viewLocale;ungroupedItems;groupedItems;groupedItemsDropdown;resizeObserver=null;cachedPadding=null;shouldUpdateGroupingOnNextResize=!1;viewElement;constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.view.isGrouping=!0,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._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",(t,i)=>{let s=i.index,n=Array.from(i.added);for(let r of i.removed)s>=this.ungroupedItems.length?this.groupedItems.remove(r):this.ungroupedItems.remove(r);for(let r=s;r<s+n.length;r++){let o=n[r-s];r>this.ungroupedItems.length?this.groupedItems.add(o,r-this.ungroupedItems.length):this.ungroupedItems.add(o,r)}this._updateGrouping()})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.viewChildren.length>1&&(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last)),this.resizeObserver.destroy()}refreshItems(){let e=this.view;if(e.items.length){for(let t=0;t<e.items.length;t++){let i=[...e.items][t];this.ungroupedItems.add(i,t)}this._updateGrouping()}}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Xe(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}let e=this.groupedItems.length,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;let e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new O(e.lastChild),s=new O(e);if(!this.cachedPadding){let n=_.window.getComputedStyle(e),r=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[r])}return t==="ltr"?i.right>s.right-this.cachedPadding:i.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new ds(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 oh),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(){let e=this.viewLocale,t=e.t,i=ia(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",lh(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:jn}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{Ws(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}};var ah=class extends A{children;actionView;arrowView;keystrokes;focusTracker;constructor(e,t){super(e);let i=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(t),this.arrowView=this._createArrowView(),this.keystrokes=new we,this.focusTracker=new oe,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",i.to("class"),i.if("isVisible","ck-hidden",s=>!s),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(e){let t=e||new B;return e||t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){let e=new B,t=e.bindTemplate;return e.icon=$n,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}};function ia(e,t=l2){let i=typeof t=="function"?new t(e):t,s=new a2(e,i,new o2(e));return i.bind("isEnabled").to(s),i instanceof ah?i.arrowView.bind("isOn").to(s,"isOpen"):i.bind("isOn").to(s,"isOpen"),f2(s),s}function lh(e,t,i={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?Fd(e,t,i):e.once("change:isOpen",()=>Fd(e,t,i),{priority:"highest"}),i.enableActiveItemFocusOnDropdownOpen&&ch(e,()=>e.toolbarView.items.find(s=>s.isOn))}function Fd(e,t,i){let s=e.locale,n=s.t,r=e.toolbarView=new Wi(s),o=typeof t=="function"?t():t;r.ariaLabel=i.ariaLabel||n("Dropdown toolbar"),i.maxWidth&&(r.maxWidth=i.maxWidth),i.class&&(r.class=i.class),i.isCompact&&(r.isCompact=i.isCompact),i.isVertical&&(r.isVertical=!0),o
12instanceof Me?r.items.bindTo(o).using(a=>a):r.items.addMany(o),e.panelView.children.add(r),e.focusTracker.add(r),r.items.delegate("execute").to(e)}function ch(e,t){e.on("change:isOpen",()=>{if(!e.isOpen)return;let i=t();i&&(typeof i.focus=="function"?i.focus():N("ui-dropdown-focus-child-on-open-child-missing-focus",{view:i}))},{priority:me.low-10})}function f2(e){m2(e),g2(e),p2(e),w2(e),b2(e),_2(e)}function m2(e){er({emitter:e,activator:()=>e.isRendered&&e.isOpen,callback:()=>{e.isOpen=!1},contextElements:()=>[e.element,...uh(e.focusTracker).filter(t=>!e.element.contains(t))]})}function uh(e){return[...e.elements,...e.externalViews.flatMap(t=>uh(t.focusTracker))]}function g2(e){e.on("execute",t=>{t.source instanceof nr||(e.isOpen=!1)})}function p2(e){e.focusTracker.on("change:isFocused",(t,i,s)=>{s||!e.isOpen||(e.isOpen=!1)})}function w2(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isOpen&&(e.panelView.focus(),i())}),e.keystrokes.set("arrowup",(t,i)=>{e.isOpen&&(e.panelView.focusLast(),i())})}function b2(e){e.on("change:isOpen",(t,i,s)=>{s||e.focusTracker.elements.some(n=>n.contains(_.document.activeElement))&&e.buttonView.focus()})}function _2(e){e.on("change:isOpen",(t,i,s)=>{s&&e.panelView.focus()},{priority:"low"})}var sa=(e,t,i)=>{let s=new r2(e.locale);return s.set({id:t,ariaDescribedById:i}),s.bind("isReadOnly").to(e,"isEnabled",n=>!n),s.bind("hasError").to(e,"errorText",n=>!!n),s.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused","placeholder").to(s),s};var v2=class{editor;_components=new Map;constructor(e){this.editor=e}*names(){for(let e of this._components.values())yield e.originalName}add(e,t){this._components.set(Ko(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new f("componentfactory-item-missing",this,{name:e});return this._components.get(Ko(e)).callback(this.editor.locale)}has(e){return this._components.has(Ko(e))}};function Ko(e){return String(e).toLowerCase()}var Dd="ck-tooltip",y2=ge(),k2=class Ie extends y2{tooltipTextView;balloonPanelView;static defaultBalloonPositions=zs.generatePositions({heightOffset:5,sideOffset:13});_currentElementWithTooltip=null;_currentTooltipPosition=null;_mutationObserver=null;_pinTooltipDebounced;_unpinTooltipDebounced;_watchdogExcluded;static _editors=new Set;static _instance=null;constructor(t){if(super(),Ie._editors.add(t),Ie._instance)return Ie._instance;Ie._instance=this,this.tooltipTextView=new A(t.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 zs(t.locale),this.balloonPanelView.class=Dd,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=C2(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=Pe(this._pinTooltip,600),this._unpinTooltipDebounced=Pe(this._unpinTooltip,400),this.listenTo(_.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(_.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(_.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(_.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(_.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(_.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(t){let i=t.ui.view&&t.ui.view.body;Ie._editors.delete(t),this.stopListening(t.ui),i&&i.has(this.balloonPanelView)&&i.remove(this.balloonPanelView),Ie._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),Ie._instance=null)}static getPositioningFunctions(t){let i=Ie.defaultBalloonPositions;return{s:[i.southArrowNorth,i.southArrowNorthEast,i.southArrowNorthWest],n:[i.northArrowSouth],e:[i.eastArrowWest],w:[i.westArrowEast],sw:[i.southArrowNorthEast],se:[i.southArrowNorthWest]}[t]}_onKeyDown(t,i){i.key==="Escape"&&this._currentElementWithTooltip&&(this._unpinTooltip(),i.stopPropagation())}_onEnterOrFocus(t,{target:i}){let s=jo(i);if(!s){t.name==="focus"&&this._unpinTooltip();return}if(s===this._currentElementWithTooltip){this._unpinTooltipDebounced.cancel();return}this._unpinTooltip(),t.name==="focus"&&!s.matches(":hover")||s.matches("[data-cke-tooltip-instant]")?this._pinTooltip(s,Go(s)):this._pinTooltipDebounced(s,Go(s))}_onLeaveOrBlur(t,{target:i,relatedTarget:s}){if(t.name==="mouseleave"){if(!he(i))return;let n=this.balloonPanelView.element,r=n&&(n===s||n.contains(s)),o=!r&&i===n;if(r){this._unpinTooltipDebounced.cancel();return}if(!o&&this._currentElementWithTooltip&&i!==this._currentElementWithTooltip)return;let a=jo(i),l=jo(s);(o||a&&a!==l)&&(this._pinTooltipDebounced.cancel(),this._currentElementWithTooltip&&this._currentElementWithTooltip.matches("[data-cke-tooltip-instant]")||a&&a.matches("[data-cke-tooltip-instant]")?this._unpinTooltip():this._unpinTooltipDebounced())}else{if(this._currentElementWithTooltip&&i!==this._currentElementWithTooltip)return;this._pinTooltipDebounced.cancel(),this._unpinTooltipDebounced()}}_onScroll(t,{target:i}){this._currentElementWithTooltip&&(i.contains(this.balloonPanelView.element)&&i.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(t,{text:i,position:s,cssClass:n}){this._unpinTooltip();let r=ye(Ie._editors.values()).ui.view.body;r.has(this.balloonPanelView)||r.add(this.balloonPanelView),this.tooltipTextView.text=i,this.balloonPanelView.class=[Dd,n].filter(o=>o).join(" "),this.balloonPanelView.pin({target:t,positions:Ie.getPositioningFunctions(s)}),this._mutationObserver.attach(t);for(let o of Ie._editors)this.listenTo(o.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=t,this._currentTooltipPosition=s}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(let t of Ie._editors)this.stopListening(t.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;let t=Go(this._currentElementWithTooltip);if(!Xe(this._currentElementWithTooltip)||!t.text){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:Ie.getPositioningFunctions(t.position)})}};function jo(e){return he(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function Go(e){return{text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||"s",cssClass:e.dataset.ckeTooltipClass||""}}function C2(e){let t=new MutationObserver(()=>{e()});return{attach(i){t.observe(i,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){t.disconnect()}}}var I2=class extends sh{licenseTypeMessage={evaluation:"For evaluation purposes only",trial:"For evaluation purposes only",development:"For development purposes only"};constructor(e){super(e,{balloonClass:"ck-evaluation-badge-balloon"})}_isEnabled(){let e=Nd(this.editor.config.get("licenseKey"));return!!(e&&this.licenseTypeMessage[e])}_createBadgeContent(){let e=Nd(this.editor.config.get("licenseKey"));return new x2(this.editor.locale,this.licenseTypeMessage[e])}_getNormalizedConfig(){let e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{};return{position:t.position||e.position,side:(t.side||e.side)==="left"?"right":"left",verticalOffset:e.verticalOffset,horizontalOffset:e.horizontalOffset}}},x2=class extends A{constructor(e,t){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-evaluation-badge"],"aria-hidden":!0},children:[{tag:"span",attributes:{class:["ck","ck-evaluation-badge__label"]},children:[t]}]})}};function Nd(e){if(e=="GPL")return"GPL";let t=yn(e.split(".")[1]);return t?t.licenseType||"production":null}var dh=class extends kt{constructor(e,t){super(e);let i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:i.to("mouseenter")}}),this.delegate("mouseenter").to(t)}};var Gn=5,Ni={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",t=>{if(!(!e.isFocusBorderEnabled&&!e.isOpen)){if(e.isOpen)for(let i of e.menus){let s=t.path[0],n=s instanceof dh&&s.children.first===i;i.isOpen=(t.path.includes(i)||n)&&i.isEnabled}
12t.source.focus()}})},focusCycleMenusOnArrows(e){let t=e.locale.uiLanguageDirection==="rtl";e.on("menu:arrowright",s=>{i(s.source,t?-1:1)}),e.on("menu:arrowleft",s=>{i(s.source,t?1:-1)});function i(s,n){let r=e.children.getIndex(s),o=s.isOpen,a=e.children.length,l=e.children.get((r+a+n)%a);s.isOpen=!1,o&&(l.isOpen=!0),l.buttonView.focus()}},closeMenusWhenTheBarCloses(e){e.on("change:isOpen",()=>{e.isOpen||e.menus.forEach(t=>{t.isOpen=!1})})},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",(t,i,s)=>{s&&e.menus.filter(n=>t.source.parentMenuView===n.parentMenuView&&t.source!==n&&n.isOpen).forEach(n=>{n.isOpen=!1})})},closeOnClickOutside(e){er({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map(t=>t.element)})},enableFocusHighlightOnInteraction(e){let t=!1;e.on("change:isOpen",(i,s,n)=>{n||(t||(e.isFocusBorderEnabled=!1),t=!1)}),e.listenTo(e.element,"keydown",()=>{t=!0},{useCapture:!0}),e.listenTo(e.element,"keyup",()=>{t=!1},{useCapture:!0}),e.listenTo(e.element,"focus",()=>{t&&(e.isFocusBorderEnabled=!0)},{useCapture:!0})}},Rt={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isEnabled&&e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),i())})},openOnArrowRightKey(e){let t=e.locale.uiLanguageDirection==="rtl"?"arrowleft":"arrowright";e.keystrokes.set(t,(i,s)=>{e.focusTracker.focusedElement!==e.buttonView.element||!e.isEnabled||(e.isOpen||(e.isOpen=!0),e.panelView.focus(),s())})},openOnButtonClick(e){e.buttonView.on("execute",()=>{e.isOpen=!0})},toggleOnButtonClick(e){e.buttonView.on("execute",()=>{e.isOpen=!e.isOpen})},openAndFocusOnEnterKeyPress(e){e.keystrokes.set("enter",(t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=!0,e.panelView.focus(),i())})},closeOnArrowLeftKey(e){let t=e.locale.uiLanguageDirection==="rtl"?"arrowright":"arrowleft";e.keystrokes.set(t,(i,s)=>{e.isOpen&&(e.isOpen=!1,e.focus(),s())})},closeOnEscKey(e){e.keystrokes.set("esc",(t,i)=>{e.isOpen&&(e.isOpen=!1,e.focus(),i())})},closeOnParentClose(e){e.parentMenuView.on("change:isOpen",(t,i,s)=>{!s&&t.source===e.parentMenuView&&(e.isOpen=!1)})}},E2={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),eastSouth:e=>({top:e.top,left:e.right-Gn,name:"es"}),eastNorth:(e,t)=>({top:e.top-t.height,left:e.right-Gn,name:"en"}),westSouth:(e,t)=>({top:e.top,left:e.left-t.width+Gn,name:"ws"}),westNorth:(e,t)=>({top:e.top-t.height,left:e.left-t.width+Gn,name:"wn"})},T2=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditingEnhanced",items:["menuBar:sourceEditingEnhanced"]},{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"fullscreen",items:["menuBar:fullscreen"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable","menuBar:insertTableLayout"]},{groupId:"insertInline",items:["menuBar:link","menuBar:insertFootnote","menuBar:bookmark","menuBar:comment","menuBar:insertMergeField","menuBar:emoji"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]}
12,{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException:inline","menuBar:restrictedEditingException:block"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:lineHeight","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands","menuBar:toggleAi","menuBar:aiQuickActions"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function A2(e){let t;return!("items"in e)||!e.items?t={items:ie(T2),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...e}:t={items:e.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...e},t}function S2({normalizedConfig:e,locale:t,componentFactory:i,extraItems:s}){let n=ie(e);return zd(e,n,s),P2(e,n),zd(e,n,n.addItems),L2(e,n,i),hh(e,n),V2(n,t),n}function P2(e,t){let i=t.removeItems,s=[];t.items=t.items.filter(({menuId:n})=>i.includes(n)?(s.push(n),!1):!0),qi(t.items,n=>{n.groups=n.groups.filter(({groupId:r})=>i.includes(r)?(s.push(r),!1):!0);for(let r of n.groups)r.items=r.items.filter(o=>{let a=fh(o);return i.includes(a)?(s.push(a),!1):!0})});for(let n of i)s.includes(n)||N("menu-bar-item-could-not-be-removed",{menuBarConfig:e,itemName:n})}function zd(e,t,i){let s=[];if(i.length!=0){for(let n of i){let r=O2(n.position),o=R2(n.position);if(M2(n))if(!o)r==="start"?(t.items.unshift(n.menu),s.push(n)):r==="end"&&(t.items.push(n.menu),s.push(n));else{let a=t.items.findIndex(l=>l.menuId===o);a!=-1?r==="before"?(t.items.splice(a,0,n.menu),s.push(n)):r==="after"&&(t.items.splice(a+1,0,n.menu),s.push(n)):Hd(t,n.menu,o,r)&&s.push(n)}else B2(n)?qi(t.items,a=>{if(a.menuId===o)r==="start"?(a.groups.unshift(n.group),s.push(n)):r==="end"&&(a.groups.push(n.group),s.push(n));else{let l=a.groups.findIndex(c=>c.groupId===o);l!==-1&&(r==="before"?(a.groups.splice(l,0,n.group),s.push(n)):r==="after"&&(a.groups.splice(l+1,0,n.group),s.push(n)))}}):Hd(t,n.item,o,r)&&s.push(n)}for(let n of i)s.includes(n)||N("menu-bar-item-could-not-be-added",{menuBarConfig:e,addedItemConfig:n})}}function Hd(e,t,i,s){let n=!1;return qi(e.items,r=>{for(let{groupId:o,items:a}of r.groups){if(n)return;if(o===i)s==="start"?(a.unshift(t),n=!0):s==="end"&&(a.push(t),n=!0);else{let l=a.findIndex(c=>fh(c)===i);l!==-1&&(s==="before"?(a.splice(l,0,t),n=!0):s==="after"&&(a.splice(l+1,0,t),n=!0))}}}),n}function L2(e,t,i){qi(t.items,s=>{for(let n of s.groups)n.items=n.items.filter(r=>{let o=typeof r=="string"&&!i.has(r);return o&&!t.isUsingDefaultConfig&&N("menu-bar-item-unavailable",{menuBarConfig:e,parentMenuConfig:ie(s),componentName:r}),!o})})}function hh(e,t){let i=t.isUsingDefaultConfig,s=!1;if(t.items=t.items.filter(n=>n.groups.length?!0:(Zo(e,n,i),!1)),!t.items.length){Zo(e,e,i);return}qi(t.items,n=>{n.groups=n.groups.filter(r=>r.items.length?!0:(s=!0,!1));for(let r of n.groups)r.items=r.items.filter(o=>mh(o)&&!o.groups.length?(Zo(e,o,i),s=!0,!1):!0)}),s&&hh(e,t)}function Zo(e,t,i){i||N("menu-bar-menu-empty",{menuBarConfig:e,emptyMenuConfig:t})}function V2(e,t){let i=t.t,s={File:i({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:i({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:i({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:i({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:i({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:i({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:i({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:i({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:i({string:"Font",id:"MENU_BAR_MENU_FONT"})};qi(e.items,n=>
12{n.label in s&&(n.label=s[n.label])})}function qi(e,t){if(Array.isArray(e))for(let s of e)i(s);function i(s){t(s);for(let n of s.groups)for(let r of n.items)mh(r)&&i(r)}}function M2(e){return typeof e=="object"&&"menu"in e}function B2(e){return typeof e=="object"&&"group"in e}function O2(e){return e.startsWith("start")?"start":e.startsWith("end")?"end":e.startsWith("after")?"after":"before"}function R2(e){let t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function fh(e){return typeof e=="string"?e:e.menuId}function mh(e){return typeof e=="object"&&"menuId"in e}var F2=z(),gh=class extends F2{editor;componentFactory;focusTracker;tooltipManager;poweredBy;evaluationBadge;ariaLiveAnnouncer;isReady=!1;_editableElementsMap=new Map;_focusableToolbarDefinitions=[];_extraMenuBarElements=[];_lastFocusedForeignElement=null;_domEmitter;constructor(e){super();let t=e.editing.view;this.editor=e,this.componentFactory=new v2(e),this.focusTracker=new oe,this.tooltipManager=new k2(e),this.poweredBy=new J5(e),this.evaluationBadge=new I2(e),this.ariaLiveAnnouncer=new A5(e),this._initViewportOffset(this._readViewportOffsetFromConfig()),this.once("ready",()=>{this._bindBodyCollectionWithFocusTracker(),this.isReady=!0}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking(),this._initVisualViewportSupport()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy(),this.evaluationBadge.destroy();for(let e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this._domEmitter&&this._domEmitter.stopListening()}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);let i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?i():this.once("ready",i)}removeEditableElement(e){let 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),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}extendMenuBar(e){this._extraMenuBarElements.push(e)}initMenuBar(e){let t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);let i=A2(this.editor.config.get("menuBar")||{});e.fillFromConfig(i,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",(s,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),n())}),this.editor.keystrokes.set("Alt+F9",(s,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),n())})}_readViewportOffsetFromConfig(){let e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;let 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(){let e=this.editor,t;e.keystrokes.set("Alt+F10",(i,s)=>{this._saveLastFocusedForeignElement();let n=this._getCurrentFocusedToolbarDefinition();(!n||!t)&&(t=this._getFocusableCandidateToolbarDefinitions());for(let r=0;r<t.length;r++){let o=t.shift();if(t.push(o),o!==n&&this._focusFocusableCandidateToolbar(o)){n&&n.options.afterBlur&&n.options.afterBlur();break}}s()}),e.keystrokes.set("Esc",(i,s)=>{let n=this._getCurrentFocusedToolbarDefinition();n&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),n.options.afterBlur&&n.options.afterBlur(),s())})}_saveLastFocusedForeignElement(){let e=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(e)&&!Array.from(this.editor.editing.view.domRoots.values()).includes(e)&&(this._lastFocusedForeignElement=e)}_getFocusableCandidateToolbarDefinitions(){let e=[];for(let t of this._focusableToolbarDefinitions){let{toolbarView:i,options:s}=t;(Xe(i.element)||s.beforeFocus)&&e.push(t)}return e.sort((t,i)=>Ud(t)-Ud(i)),e}_getCurrentFocusedToolbarDefinition(){for(let e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){let{toolbarView:t,options:{beforeFocus:i}}=e;return i&&i(),Xe(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){let 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}_bindBodyCollectionWithFocusTracker(){let e=this.view.body;for(let t of e)this.focusTracker.add(t.element);e.on("add",(t,i)=>{this.focusTracker.add(i.element)}),e.on("remove",(t,i)=>{this.focusTracker.remove(i.element)})}_initViewportOffset(e){this.on("set:viewportOffset",(t,i,s)=>{let n=this._getVisualViewportTopOffset(s);s.visualTop!==n&&(t.return={...s,visualTop:n})}),this.set("viewportOffset",e)}
12_initVisualViewportSupport(){if(!_.window.visualViewport)return;let e=()=>{let t=this._getVisualViewportTopOffset(this.viewportOffset);this.viewportOffset.visualTop!==t&&(this.viewportOffset={...this.viewportOffset,visualTop:t})};this._domEmitter=new(ge()),this._domEmitter.listenTo(_.window.visualViewport,"scroll",e),this._domEmitter.listenTo(_.window.visualViewport,"resize",e)}_getVisualViewportTopOffset(e){let t=hs().top,i=e.top||0;return t>i?0:i-t}};function Ud(e){let{toolbarView:t,options:i}=e,s=10;return Xe(t.element)&&s--,i.isContextual&&(s-=2),s}var D2=class extends A{body;menuBarView;toolbar;constructor(e){super(e),this.body=new U5(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}};var ph=class extends D2{top;main;_voiceLabelView;constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){let e=this.t,t=new tr;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}};var N2=class extends A{name=null;_editingView;_editableElement;_hasExternalElement;constructor(e,t,i){super(e);let{name:s,classes:n,styles:r,attributes:o}=(Wd(i)?void 0:i)||{};this.set("isFocused",!1),this.set("isInlineRoot",!1),this.setTemplate({tag:s||"div",attributes:{...o,class:["ck","ck-content","ck-editor__editable","ck-rounded-corners",this.bindTemplate.if("isInlineRoot","ck-editor__editable_inline-root"),...n?U(n):[]],...r&&{style:r},lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this._editableElement=Wd(i)?i:void 0,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(){let e=this._editingView;e.isRenderingInProgress?i(this):t(this);function t(s){e.change(n=>{let r=e.document.getRoot(s.name);n.addClass(s.isFocused?"ck-focused":"ck-blurred",r),n.removeClass(s.isFocused?"ck-blurred":"ck-focused",r)})}function i(s){e.once("change:isRenderingInProgress",(n,r,o)=>{o?i(s):t(s)})}}};function Wd(e){return he(e)}var wh=class extends N2{_options;constructor(e,t,i,s={}){super(e,t,i),this._options=s,this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();let e=this._editingView;e.change(t=>{let i=e.document.getRoot(this.name);t.setAttribute("aria-label",this.getEditableAriaLabel(),i)})}getEditableAriaLabel(){let e=this.locale.t,t=this._options.label,i=this._editableElement,s=this.name;if(typeof t=="string")return t;if(typeof t=="object")return t[s];if(typeof t=="function")return t(this);if(i){let n=i.getAttribute("aria-label");if(n)return n}return e("Rich Text Editor. Editing area: %0",s)}};var na=class extends A{children;constructor(e,t={}){super(e);let i=this.bindTemplate;this.set("class",["ck","ck-form__row",...U(t.class||[])]),this.children=this.createCollection(),t.children&&t.children.forEach(s=>this.children.add(s)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:i.to("class",s=>s.join(" ")),role:i.to("_role"),"aria-labelledby":i.to("_ariaLabelledBy")},children:this.children})}};var Zn=ei("px"),or=class extends k{positionLimiter;visibleStack;_viewToStack=new Map;_idToStack=new Map;_view=null;_rotatorView=null;_fakePanelsView=null;static get pluginName(){return"ContextualBalloon"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.positionLimiter=()=>{let t=this.editor.editing.view,i=t.document.selection.editableElement;return i?t.domConverter.mapViewToDom(i.root):null},this.decorate("getPositionOptions"),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 f("contextualballoon-add-view-exist",[this,e]);let 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}let 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 f("contextualballoon-remove-view-not-exist",[this,e]);let 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.getPositionOptions()),this._fakePanelsView.updatePosition()}getPositionOptions(){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,top:this.editor.ui.viewportOffset.visualTop}})),e}showStack(e){this.visibleStack=e;let t=this._idToStack.get(e);if(!t)throw new f("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new zs(this.editor.locale),this.editor.ui.view.body.add(this._view),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(t=>t[1]===e)[0]}_showNextStack(){let e=Array.from(this._idToStack.values()),t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){let e=Array.from(this._idToStack.values()),t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){let e=new z2(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"";let n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,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(){let e=new H2(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.getPositionOptions()),this._fakePanelsView.updatePosition(),s&&(this._singleViewMode=!0)}},z2=class extends A{focusTracker;buttonPrevView;buttonNextView;content;constructor(e){super(e);let t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new oe,this.buttonPrevView=this._createButtonView(t("Previous"),ci),this.buttonNextView=this._createButtonView(t("Next"),Kn),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){let i=new B(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({on:{mousedown:i.bindTemplate.to(s=>s.preventDefault())}}),i}},H2=class extends A{content;_balloonPanelView;constructor(e,t){super(e);let 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=>
12s?"":"ck-hidden")],style:{top:i.to("top",Zn),left:i.to("left",Zn),width:i.to("width",Zn),height:i.to("height",Zn)}},children:this.content}),this.on("change:numberOfPanels",(s,n,r,o)=>{r>o?this._addPanels(r-o):this._removePanels(o-r),this.updatePosition()})}_addPanels(e){for(;e--;){let t=new A;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){let t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){let{top:e,left:t}=this._balloonPanelView,{width:i,height:s}=new O(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:s})}}};var zi=ei("px"),bh=class extends A{content;contentPanelElement;_contentPanelPlaceholder;constructor(e){super(e);let t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new $e({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",i=>i?"block":"none"),height:t.to("isSticky",i=>i?zi(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new $e({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",i=>i?zi(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",i=>i&&zi(i)),bottom:t.to("_stickyBottomOffset",i=>i&&zi(i)),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this.contentPanelElement]})}render(){super.render(),this.checkIfShouldBeSticky(),this.listenTo(_.document,"scroll",()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky()}),_.window.visualViewport&&(this.listenTo(_.window.visualViewport,"scroll",()=>{this.checkIfShouldBeSticky()}),this.listenTo(_.window.visualViewport,"resize",()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive){this._unstick();return}let e=new O(this.limiterElement),t=e.getVisible();if(t){let n=new O(_.window);n.top+=this.viewportTopOffset,n.height-=this.viewportTopOffset,t=t.getIntersection(n)}let{left:i,top:s}=hs();if(e.moveBy(i,s),t&&t.moveBy(i,s),t&&e.top<t.top)if(this._contentPanelRect.height+this.limiterBottomOffset>t.height){let n=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;this._contentPanelRect.height+n+1<e.height?this._stickToBottomOfLimiter(n):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(t.top):this._unstick();else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=zi(-_.window.scrollX+hs().left)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=zi(-_.window.scrollX+hs().left)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new O(this.contentPanelElement)}};var U2=class extends sr{arrowView;constructor(e){super(e);let t=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",i=>String(i)),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new Ct;return e.content=$n,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}};var W2=class extends A{children;constructor(e){super(e);let 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-menu-bar__menu__panel",t.to("position",i=>`ck-menu-bar__menu__panel_position_${i}`),t.if("isVisible","ck-hidden",i=>!i)],tabindex:"-1"},children:this.children,on:{selectstart:t.to(i=>{i.target.tagName.toLocaleLowerCase()!=="input"&&i.preventDefault()})}})}focus(e=1){this.children.length&&(e===1?this.children.first.focus():this.children.last.focus())}};var Qn=class _h extends A{buttonView;panelView;focusTracker;keystrokes;constructor(t){super(t);let i=this.bindTemplate;this.buttonView=new U2(t),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new W2(t),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new we,this.focusTracker=new oe,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("panelPosition","w"),this.set("class",void 0),this.set("parentMenuView",null),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar__menu",i.to("class"),i.if("isEnabled","ck-disabled",s=>!s),i.if("parentMenuView","ck-menu-bar__menu_top-level",s=>!s)]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),Rt.closeOnEscKey(this),this._closeOnDisabled(),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(Rt.openOnButtonClick(this),Rt.o
12penOnArrowRightKey(this),Rt.closeOnArrowLeftKey(this),Rt.openAndFocusOnEnterKeyPress(this),Rt.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),Rt.openAndFocusPanelOnArrowDownKey(this),Rt.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",(t,i)=>{this.fire("arrowright"),i()}),this.keystrokes.set("arrowleft",(t,i)=>{this.fire("arrowleft"),i()})}_closeOnDisabled(){this.on("change:isEnabled",(t,i,s)=>{s||(this.isOpen=!1)})}_repositionPanelOnOpen(){this.on("change:isOpen",(t,i,s)=>{if(!s)return;let n=_h._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=n?n.name:this._defaultMenuPositionName})}focus(){this.buttonView.focus()}get _panelPositions(){let{southEast:t,southWest:i,northEast:s,northWest:n,westSouth:r,eastSouth:o,westNorth:a,eastNorth:l}=E2;return this.locale.uiLanguageDirection==="ltr"?this.parentMenuView?[o,l,r,a]:[t,i,s,n]:this.parentMenuView?[r,a,o,l]:[i,t,n,s]}get _defaultMenuPositionName(){return this.locale.uiLanguageDirection==="ltr"?this.parentMenuView?"es":"se":this.parentMenuView?"ws":"sw"}static _getOptimalPosition=_n};var qd=class extends Ui{constructor(e){super(e),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){let e=Array.from(this.items).some(t=>{let i=$d(t);return i&&i.isToggleable});this.items.forEach(t=>{let i=$d(t);i&&(i.hasCheckSpace=e)})}};function $d(e){return e instanceof kt?e.children.map(t=>q2(t)?t.buttonView:t).find(t=>t instanceof sr):null}function q2(e){return typeof e=="object"&&"buttonView"in e&&e.buttonView instanceof B}var $2=class extends X5{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}};var Kd=["mouseenter","arrowleft","arrowright","change:isOpen"],vh=class extends A{children;menus=[];constructor(e){super(e);let t=e.t,i=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",i.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t,i=[]){let s=this.locale,n=S2({normalizedConfig:e,locale:s,componentFactory:t,extraItems:i}).items.map(r=>this._createMenu({componentFactory:t,menuDefinition:r}));this.children.addMany(n)}render(){super.render(),Ni.toggleMenusAndFocusItemsOnHover(this),Ni.closeMenusWhenTheBarCloses(this),Ni.closeMenuWhenAnotherOnTheSameLevelOpens(this),Ni.focusCycleMenusOnArrows(this),Ni.closeOnClickOutside(this),Ni.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(let e of this.children)e.isOpen=!1;this.isOpen=!1}disable(){for(let e of this.children)e.isEnabled=!1}enable(){for(let e of this.children)e.isEnabled=!0}registerMenu(e,t=null){t?(e.delegate(...Kd).to(t),e.parentMenuView=t):e.delegate(...Kd).to(this,i=>"menu:"+i),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:i}){let s=this.locale,n=new Qn(s);return this.registerMenu(n,i),n.buttonView.set({label:t.label}),n.once("change:isOpen",()=>{let r=new qd(s);r.ariaLabel=t.label,n.panelView.children.add(r),r.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:n,componentFactory:e}))}),n}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:i}){let s=this.locale,n=[];for(let r of e.groups){for(let o of r.items){let a=new dh(s,t);if(re(o))a.children.add(this._createMenu({componentFactory:i,menuDefinition:o,parentMenuView:t}));else{let l=this._createMenuItemContentFromFactory({componentName:o,componentFactory:i,parentMenuView:t});if(!l)continue;a.children.add(l)}n.push(a)}r!==e.groups[e.groups.length-1]&&n.push(new rh(s))}return n}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:i}){let s=i.create(e);return s instanceof Qn||s instanceof te||s instanceof $2?(this._registerMenuTree(s,t),s.on("execute",()=>{this.close()}),s):(N("menu-bar-component-unsupported",{componentName:e,componentView:s}),null)}_registerMenuTree(e,t){if(!(e instanceof Qn)){e.delegate("mouseenter").to(t);return}this.registerMenu(e,t);let i=e.panelView.children.filter(n=>n instanceof qd)[0];if(!i){e.delegate("mouseenter").to(t);return}let s=i.items.filter(n=>n instanceof kt);for(let n of s)this._registerMenuTree(n.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",(t,i,s)=>{clearTimeout(e),s?this.isOpen=!0:e=setTimeout(()=>{this.isOpen=Array.from(this.children).some(n=>n.isOpen)},0)})}};var K2=class extends gh{view;_toolbarConfig;_elementReplacer;constructor(e,t){super(e),this.view=t,this._toolbarConfig=ta(e.config.get("toolbar")),this._elementReplacer=new wn,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}
12get element(){return this.view.element}init(e){let t=this.editor,i=this.view,s=t.editing.view,n=i.editable,r=s.document.getRoot();n.name=r.rootName,n.isInlineRoot=!id(t,r.rootName),i.render();let o=n.element;this.setEditableElement(n.name,o),i.editable.bind("isFocused").to(this.focusTracker),s.attachDomRoot(o),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&this.initMenuBar(i.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){let e=this.editor,t=e.editing.view,i=t.document.getRoot(),s=e.sourceElement,n,r=e.config.get("roots")[this.view.editable.name].placeholder;r&&(n=r),!n&&s&&s.tagName.toLowerCase()==="textarea"&&(n=s.getAttribute("placeholder")),n&&(i.placeholder=n),bo({view:t,element:i,isDirectHost:this.view.editable.isInlineRoot,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;let{stickyPanel:e}=this.view,t=this.editor.plugins.get("ContextualBalloon");t.on("getPositionOptions",s=>{let n=s.return;if(!n||!e.isSticky||!e.element)return;let r=new O(e.element).height,o=typeof n.target=="function"?n.target():n.target,a=typeof n.limiter=="function"?n.limiter():n.limiter;if(o&&a&&new O(o).height>=new O(a).height-r)return;let l={...n.viewportOffsetConfig},c=(l.top||0)+r;s.return={...n,viewportOffsetConfig:{...l,top:c}}},{priority:"low"});let i=()=>{t.visibleView&&t.updatePosition()};this.listenTo(e,"change:isSticky",i),this.listenTo(this.editor.ui,"change:viewportOffset",i)}_handleScrollToTheSelectionWithStickyPanel(e,t,i){let s=this.view.stickyPanel;if(s.isSticky){let n=new O(s.element).height;t.viewportOffset.top+=n}else{let n=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(s,"change:isSticky",n),setTimeout(()=>{this.stopListening(s,"change:isSticky",n)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;let e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",()=>{let i=t.view;i.on("moveTo",(s,n)=>{if(!e.isSticky||i.wasMoved||i.isModal)return;let r=new O(e.contentPanelElement);n[1]<r.bottom+ir.defaultOffset&&(n[1]=r.bottom+ir.defaultOffset)},{priority:"high"})},{priority:"low"})}};var j2=class extends ph{stickyPanel;toolbar;editable;constructor(e,t,i={}){super(e),this.stickyPanel=new bh(e),this.toolbar=new Wi(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new vh(e)),this.editable=new wh(e,t,i.editableElement,{label:i.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}};var G2=Yu(Zu),yh=class extends G2{static get editorName(){return"ClassicEditor"}ui;constructor(e,t={}){let{sourceElementOrData:i,editorConfig:s}=ed(e,t);super(s),Xu(i,this.config,"main",!0);let n=this.config.get("attachTo");if(this.config.define("menuBar.isVisible",!1),Z2(n)){if(!n.isConnected)throw new f("editor-source-element-not-attached",null);this.sourceElement=n}this.model.document.createRoot(this.config.get("roots").main.modelElement),Qu(this);let r=!this.config.get("toolbar.shouldNotGroupWhenFull"),o=this.config.get("menuBar"),a=this.config.get("roots").main.element,l=new j2(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:r,useMenuBar:o.isVisible,label:this.config.get("roots").main.label,editableElement:a});this.ui=new K2(this,l),Ju(this)}async destroy(){this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),await super.destroy()}static async create(e,t={}){let i=new this(e,t);return await i.initPlugins(),td(i),await i.ui.init(i.config.get("attachTo")||null),await i.data.init(i.config.get("roots").main.initialData),i.fire("ready"),i}};function Z2(e){return he(e)}var Th=class{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;
12constructor(e,t=20){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)}};var J2=class extends W{_buffer;constructor(e,t){super(e),this._buffer=new Th(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){let t=this.editor.model,i=t.document,s=e.text||"",n=s.length,r=i.selection;if(e.selection?r=e.selection:e.range&&(r=t.createSelection(e.range)),!t.canEditAt(r))return;let o=e.resultRange;t.enqueueChange(this._buffer.batch,a=>{this._buffer.lock();let l=Array.from(i.selection.getAttributes());t.deleteContent(r),s&&t.insertContent(a.createText(s,l),r),o?a.setSelection(o):r.is("documentSelection")||a.setSelection(r),this._buffer.unlock(),this._buffer.input(n)})}};var Ah=["insertText","insertReplacementText"],Y2=[...Ah,"insertCompositionText"],Q2=class extends Te{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(Ls);let t=I.isAndroid?Y2:Ah,i=e.document;i.on("beforeinput",(s,n)=>{if(!this.isEnabled)return;let{data:r,targetRanges:o,inputType:a,domEvent:l,isComposing:c}=n;if(!t.includes(a))return;this.focusObserver.flush();let u=new Le(i,"insertText");i.fire(u,new bt(e,l,{text:r,selection:e.createSelection(o),isComposing:c})),u.stop.called&&s.stop()}),I.isAndroid||i.on("compositionend",(s,{data:n,domEvent:r})=>{this.isEnabled&&n&&i.fire("insertText",new bt(e,r,{text:n,isComposing:!0}))},{priority:"low"})}observe(){}stopObserving(){}};var ra=class extends k{_typingQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model,i=e.editing.view,s=e.editing.mapper,n=t.document.selection;this._typingQueue=new X2(e),i.addObserver(Q2);let r=new J2(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",r),e.commands.add("input",r),this.listenTo(i.document,"beforeinput",()=>{this._typingQueue.flush("next beforeinput")},{priority:"high"}),this.listenTo(i.document,"insertText",(o,a)=>{let{text:l,selection:c}=a;if(i.document.selection.isFake&&c&&i.document.selection.isSimilar(c)&&a.preventDefault(),c&&Array.from(c.getRanges()).some(m=>!m.isCollapsed)&&a.preventDefault(),!r.isEnabled){a.preventDefault();return}let u;c&&(u=Array.from(c.getRanges()).filter(m=>m.root.is("rootElement")).map(m=>s.toModelRange(m)).map(m=>zn(m,t.schema)||m)),(!u||!u.length)&&(u=Array.from(n.getRanges()));let d=l;if(I.isAndroid){let m=Array.from(u[0].getItems()).reduce((g,w)=>g+(w.is("$textProxy")?w.data:""),"");if(m&&(m.length<=d.length?d.startsWith(m)&&(d=d.substring(m.length),u[0].start=u[0].start.getShiftedBy(m.length)):m.startsWith(d)&&(u[0].start=u[0].start.getShiftedBy(d.length),d="")),d.length==0&&u[0].isCollapsed)return}let h={text:d,selection:t.createSelection(u)};this._typingQueue.push(h,!!a.isComposing),a.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented")}),I.isAndroid?this.listenTo(i.document,"keydown",(o,a)=>{n.isCollapsed||a.keyCode!=229||!i.document.isComposing||kh(t,r)}):this.listenTo(i.document,"compositionstart",()=>{n.isCollapsed||kh(t,r)},{priority:"high"}),this.listenTo(i.document,"mutations",(o,{mutations:a})=>{if(this._typingQueue.hasAffectedElements())for(let{node:l}of a){let c=tb(l,s),u=s.toModelElement(c);if(this._typingQueue.isElementAffected(u)){this._typingQueue.flush("mutations");return}}}),this.listenTo(i.document,"compositionend",()=>{this._typingQueue.flush("before composition end")},{priority:"high"}),this.listenTo(i.document,"compositionend",()=>{this._typingQueue.flush("after composition end");let o=[];if(this._typingQueue.hasAffectedElements())for(let a of this._typingQueue.flushAffectedElements()){let l=s.toViewElement(a);l&&o.push({type:"children",node:l})}(o.length||!I.isAndroid)&&i.document.fire("mutations",{mutations:o})},{priority:"lowest"})}destroy(){super.destroy(),this._typingQueue.destroy()}},X2=class{editor;flushDebounced=Pe(()=>this.flush("timeout"),50);_queue=[];_isComposing=!1;_affectedElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e,t){let i={text:e.text};
12if(e.selection){i.selectionRanges=[];for(let s of e.selection.getRanges())i.selectionRanges.push(xe.fromRange(s)),this._affectedElements.add(s.start.parent)}this._queue.push(i),this._isComposing||=t,this.flushDebounced()}shift(){let e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){let i=e.selectionRanges.map(s=>eb(s)).filter(s=>!!s);i.length&&(t.selection=this.editor.model.createSelection(i))}return t}flush(e){let t=this.editor,i=t.model,s=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;let n=t.commands.get("insertText").buffer;i.enqueueChange(n.batch,()=>{for(n.lock();this._queue.length;){let r=this.shift();t.execute("insertText",r)}n.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1}),s.scrollToTheSelection()}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){let e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}};function kh(e,t){if(!t.isEnabled)return;let i=t.buffer;i.lock(),e.enqueueChange(i.batch,()=>{e.deleteContent(e.document.selection)}),i.unlock()}function eb(e){let t=e.toRange();return e.detach(),t.root.rootName=="$graveyard"?null:t}function tb(e,t){let i=e.is("$text")?e.parent:e;for(;!t.toModelElement(i);)i=i.parent;return i}var Ch=class extends W{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new Th(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){let t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();let n=s.createSelection(e.selection||i.selection);if(!t.canEditAt(n))return;let r=e.sequence||1,o=n.isCollapsed;if(n.isCollapsed&&t.modifySelection(n,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(n,r)){this.editor.execute("paragraph",{selection:n});return}if(n.isCollapsed)return;let a=0;
12n.getFirstRange().getMinimalFlatRanges().forEach(l=>{a+=cs(l.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(n,{doNotResetEntireContent:o,direction:this.direction}),this._buffer.input(a),s.setSelection(n),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;let t=this.editor.model,i=t.document.selection,s=t.schema.getLimitElement(i);if(!(i.isCollapsed&&i.containsEntireContent(s))||!t.schema.checkChild(s,"paragraph"))return!1;let n=s.getChild(0);return!(n&&n.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){let t=this.editor.model,i=t.document.selection,s=t.schema.getLimitElement(i),n=e.createElement("paragraph");e.remove(e.createRangeIn(s)),e.insert(n,s),e.setSelection(n,0)}_shouldReplaceFirstBlockWithParagraph(e,t){let i=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;let s=e.getFirstPosition(),n=i.schema.getLimitElement(s),r=n.getChild(0);return!(s.parent!=r||!e.containsEntireContent(r)||!i.schema.checkChild(n,"paragraph")||r.name=="paragraph")}};var ib="character",Ih="word",sb="codePoint",Ft="selection",Ki="backward",Ks="forward",Sh={deleteContent:{unit:Ft,direction:Ki},deleteContentBackward:{unit:sb,direction:Ki},deleteWordBackward:{unit:Ih,direction:Ki},deleteHardLineBackward:{unit:Ft,direction:Ki},deleteSoftLineBackward:{unit:Ft,direction:Ki},deleteContentForward:{unit:ib,direction:Ks},deleteWordForward:{unit:Ih,direction:Ks},deleteHardLineForward:{unit:Ft,direction:Ks},deleteSoftLineForward:{unit:Ft,direction:Ks}},nb=class extends Te{constructor(e){super(e);let t=e.document,i=0;t.on("keydown",()=>{i++}),t.on("keyup",()=>{i=0}),t.on("beforeinput",(s,n)=>{if(!this.isEnabled)return;let{targetRanges:r,domEvent:o,inputType:a}=n,l=Sh[a];if(!l)return;let c={direction:l.direction,unit:l.unit,sequence:i};c.unit==Ft&&(c.selectionToRemove=e.createSelection(r[0])),a==="deleteContentBackward"&&(I.isAndroid&&(c.sequence=1),ob(r)&&(c.unit=Ft,c.selectionToRemove=e.createSelection(r)));let u=new wt(t,"delete",r[0]);t.fire(u,new bt(e,o,c)),u.stop.called&&s.stop()}),I.isBlink&&rb(this)}observe(){}stopObserving(){}};function rb(e){let t=e.view,i=t.document,s=null,n=!1;i.on("keydown",(a,{keyCode:l})=>{s=l,n=!1}),i.on("keyup",(a,{keyCode:l,domEvent:c})=>{let u=i.selection,d=e.isEnabled&&l==s&&r(l)&&!u.isCollapsed&&!n;if(s=null,d){let h=u.getFirstRange(),m=new wt(i,"delete",h),g={unit:Ft,direction:o(l),selectionToRemove:u};i.fire(m,new bt(t,c,g))}}),i.on("beforeinput",(a,{inputType:l})=>{let c=Sh[l];r(s)&&c&&c.direction==o(s)&&(n=!0)},{priority:"high"}),i.on("beforeinput",(a,{inputType:l,data:c})=>{s==L.delete&&l=="insertText"&&c=="\x7F"&&a.stop()},{priority:"high"});function r(a){return a==L.backspace||a==L.delete}function o(a){return a==L.backspace?Ki:Ks}}function ob(e){if(e.length!=1||e[0].isCollapsed)return!1;let t=e[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0}),i=0;for(let{nextPosition:s,item:n}of t){if(s.parent.is("$text")){let r=s.parent.data,o=s.offset;if(ps(r,o)||ws(r,o)||kn(r,o))continue;i++}else(n.is("containerElement")||n.is("emptyElement"))&&i++;if(i>1)return!0}return!1}var xt=class extends k{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,i=t.document,s=e.model.document;t.addObserver(nb),this._undoOnBackspace=!1;let n=new Ch(e,"forward");e.commands.add("deleteForward",n),e.commands.add("forwardDelete",n),e.commands.add("delete",new Ch(e,"backward")),this.listenTo(i,"delete",(r,o)=>{i.isComposing||o.preventDefault();let{direction:a,sequence:l,selectionToRemove:c,unit:u}=o,d=a==="forward"?"deleteForward":"delete",h={sequence:l};if(u=="selection"){let m=Array.from(c.getRanges()).map(g=>e.editing.mapper.toModelRange(g)).map(g=>zn(g,e.model.schema)||g);h.selection=e.model.createSelection(m)}else h.unit=u;e.execute(d,h),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(i,"keydown",(r,o)=>{if(i.isComposing||o.keyCode!=L.backspace||!s.selection.isCollapsed)return;let a=e.model.schema.getLimitElement(s.selection),l=e.model.createPositionAt(a,0);if(l.isTouching(s.selection.getFirstPosition())){o.preventDefault();let c=e.model.schema.getNearestSelectionRange(l,"forward");if(!c)return;let u=t.createSelection(e.editing.mapper.toViewRange(c)),d=u.getFirstRange(),h=new wt(document,"delete",d),m={unit:"selection",direction:"backward",selectionToRemove:u};i.fire(h,new bt(t,o.domEvent,m))}}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(r,o)=>
12{this._undoOnBackspace&&o.direction=="backward"&&o.sequence==1&&o.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),o.preventDefault(),r.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}};var Ph=class extends k{static get requires(){return[ra,xt]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}};function oa(e,t){let i=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce((s,{item:n})=>n.is("$text")||n.is("$textProxy")?s+n.data:(i=t.createPositionAfter(n),""),""),range:t.createRange(i,e.end)}}var ab=z(),Lh=class extends ab{model;testCallback;_hasMatch;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(){let e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{if(i){if(!e.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(e,"change:data",(t,i)=>{i.isUndo||!i.isLocal||this._evaluateTextBeforeSelection("data",{batch:i})})}_evaluateTextBeforeSelection(e,t={}){let i=this.model,s=i.document.selection,{text:n,range:r}=oa(i.createRange(i.createPositionAt(s.focus.parent,0),s.focus),i),o=this.testCallback(n);if(!o&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!o,o){let a=Object.assign(t,{text:n,range:r});typeof o=="object"&&Object.assign(a,o),this.fire(`matched:${e}`,a)}}};var lr=class extends k{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){let e=this.editor,t=e.model,i=e.editing.view,s=e.locale,n=t.document.selection;this.listenTo(i.document,"arrowKey",(r,o)=>{if(!n.isCollapsed||o.shiftKey||o.altKey||o.ctrlKey)return;let a=o.keyCode==L.arrowright,l=o.keyCode==L.arrowleft;if(!a&&!l)return;let c=s.contentLanguageDirection,u;c==="ltr"&&a||c==="rtl"&&l?u=this._handleForwardMovement(o):u=this._handleBackwardMovement(o),u===!0&&r.stop()},{context:"$text",priority:"highest"}),this.listenTo(n,"change:range",(r,o)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!o.directChange&&Be(n.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){let t=this.attributes,i=this.editor.model,s=i.document.selection,n=s.getFirstPosition();return this._isGravityOverridden||n.isAtStart&&It(s,t)?!1:Be(n,t)?(e&&$s(e),It(s,t)&&Be(n,t,!0)?qs(i,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){let t=this.attributes,i=this.editor.model,s=i.document.selection,n=s.getFirstPosition();return this._isGravityOverridden?(e&&$s(e),this._restoreGravity(),Be(n,t,!0)?qs(i,t):ar(i,t,n),!0):n.isAtStart?It(s,t)?(e&&$s(e),ar(i,t,n),!0):!1:!It(s,t)&&Be(n,t,!0)?(e&&$s(e),ar(i,t,n),!0):xh(n,t)?n.isAtEnd&&!It(s,t)&&Be(n,t)?(e&&$s(e),ar(i,t,n),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){let e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(Hn),e.editing.view.addObserver(Bu);let n=!1,r=!1;this.listenTo(s,"touchstart",()=>{r=!1,n=!0}),this.listenTo(s,"mousedown",()=>{r=!0}),this.listenTo(s,"selectionChange",()=>{let o=this.attributes;if(!r&&!n||(r=!1,n=!1,!i.isCollapsed)||!It(i,o))return;let a=i.getFirstPosition();Be(a,o)&&(a.isAtStart||Be(a,o,!0)?qs(t,o):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){let e=this.editor.model,t=e.document.selection,i=this.attributes;this.listenTo(e,"insertContent",()=>{let s=t.getFirstPosition();It(t,i)&&Be(s,i)&&qs(e,i)},{priority:"low"})}_handleDeleteContentAfterNode(){let e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view,n=!1,r=!1;this.listenTo(s.document,"delete",(o,a)=>{n=a.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!n)return;let o=i.getFirstPosition();r=It(i,this.attributes)&&!xh(o,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{n&&(n=!1,!r&&e.model.enqueueChange(()=>{let o=i.getFirstPosition();It(i,this.attributes)&&Be(o,this.attributes)&&(o.isAtStart||Be(o,this.attributes,!0)?qs(t,this.attributes):this._isGravityOverridden||this._overrideGravity())}))},{priority:"low"})}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 It(e,t){for(let i of t)if(e.hasAttribute(i))return!0;return!1}function ar(e,t,i){let s=i.nodeBefore;e.change(n=>{if(s){let r=[],o=e.schema.isObject(s)&&e.schema.isInline(s);for(let[a,l]of s.getAttributes())e.schema.checkAttribute("$text",a)&&(!o||e.schema.getAttributeProperties(a).copyFromObject!==!1)&&r.push([a,l]);n.setSelectionAttribute(r)}else n.removeSelectionAttribute(t)})}function qs(e,t){e.change(i=>{i.removeSelectionAttribute(t)})}function $s(e){e.preventDefault()}function xh(e,t){return Be(e.getShiftedBy(-1),t)}function Be(e,t,i=!1){let{nodeBefore:s,nodeAfter:n}=e;for(let r of t){let o=s?s.getAttribute(r):void 0,a=n?n.getAttribute(r):void 0;if(!(i&&(o===void 0||a===void 0))&&a!==o)return!0}return!1}var w9={copyright:{from:"(c)",to:"\xA9"},registeredTrademark:{from:"(r)",to:"\xAE"},trademark:{from:"(tm)",to:"\u2122"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"\xBD",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"\u2153",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"\u2154",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"\xBC",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"\xBE",null]},lessThanOrEqual:{from:"<=",to:"\u2264"},greaterThanOrEqual:{from:">=",to:"\u2265"},notEqual:{from:"!=",to:"\u2260"},arrowLeft:{from:"<-",to:"\u2190"},arrowRight:{from:"->",to:"\u2192"},horizontalEllipsis:{from:"...",to:"\u2026"},enDash:{from:/(^| )(--)( )$/,to:[null,"\u2013",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"\u2014",null]},quotesPrimary:{from:$i('"'),to:[null,"\u201C",null,"\u201D"]},quotesSecondary:{from:$i("'"),to:[null,"\u2018",null,"\u2019"]},quotesPrimaryEnGb:{from:$i("'"),to:[null,"\u2018",null,"\u2019"]},quotesSecondaryEnGb:{from:$i('"'),to:[null,"\u201C",null,"\u201D"]},quotesPrimaryPl:{from:$i('"'),to:[null,"\u201E",null,"\u201D"]},quotesSecondaryPl:{from:$i("'"),to:[null,"\u201A",null,"\u2019"]}};function $i(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function js(e,t,i,s){return s.createRange(Eh(e,t,i,!0,s),Eh(e,t,i,!1,s))}function Eh(e,t,i,s,n){let r=e.textNode||(s?e.nodeBefore:e.nodeAfter),o=null;for(;r&&r.getAttribute(t)==i;)o=r,r=s?r.previousSibling:r.nextSibling;return o?n.createPositionAt(o,s?"before":"after"):e}function aa(e,t,i,s){let n=e.editing.view,r=new Set;n.document.registerPostFixer(o=>{let a=e.model.document.selection,l=!1;if(a.hasAttribute(t)){let c=js(a.getFirstPosition(),t,a.getAttribute(t),e.model),u=e.editing.mapper.toViewRange(c);for(let d of u.getItems())d.is("element",i)&&!d.hasClass(s)&&(o.addClass(s,d),r.add(d),l=!0)}return l}),e.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(){n.change(l=>{for(let c of r.values())l.removeClass(s,c),r.delete(c)})}})}function*Gs(e,t){for(let i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i)}var lb=class extends W{execute(){this.editor.model.change(e=>
12{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){let t=this.editor.model,i=t.document.selection,s=t.schema,n=i.isCollapsed,r=i.getFirstRange(),o=r.start.parent,a=r.end.parent;if(s.isLimit(o)||s.isLimit(a))return!n&&o==a&&t.deleteContent(i),!1;if(n){let l=Gs(e.model.schema,i.getAttributes());return Vh(e,r.start),e.setSelectionAttribute(l),!0}else{let l=!(r.start.isAtStart&&r.end.isAtEnd),c=o==a;if(t.deleteContent(i,{leaveUnmerged:l}),l){if(c)return Vh(e,i.focus),!0;e.setSelection(a,0)}}return!1}};function Vh(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}var cb={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}},Bh=class extends Te{constructor(e){super(e);let t=this.document,i=!1;t.on("keydown",(s,n)=>{i=n.shiftKey}),t.on("beforeinput",(s,n)=>{if(!this.isEnabled)return;let r=n.inputType;I.isSafari&&i&&r=="insertParagraph"&&(r="insertLineBreak");let o=n.domEvent,a=cb[r];if(!a)return;let l=new wt(t,"enter",n.targetRanges[0]);t.fire(l,new bt(e,o,{isSoft:a.isSoft})),l.stop.called&&s.stop()})}observe(){}stopObserving(){}};var ji=class extends k{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,i=t.document,s=this.editor.t;t.addObserver(Bh),e.commands.add("enter",new lb(e)),this.listenTo(i,"enter",(n,r)=>{i.isComposing||r.preventDefault(),!r.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}};var ub=class extends W{execute(){let e=this.editor.model,t=e.document;e.change(i=>{hb(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){let e=this.editor.model,t=e.document;this.isEnabled=db(e.schema,t.selection)}};function db(e,t){if(t.rangeCount>1)return!1;let i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return!1;let s=t.getFirstRange(),n=s.start.parent,r=s.end.parent;return!((la(n,e)||la(r,e))&&n!==r)}function hb(e,t,i){let s=i.isCollapsed,n=i.getFirstRange(),r=n.start.parent,o=n.end.parent,a=r==o;if(s)Mh(e,t,n.end,i.getAttributes());else{let l=!(n.start.isAtStart&&n.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:l}),a?Mh(e,t,i.focus,i.getAttributes()):l&&t.setSelection(o,0)}}function Mh(e,t,i,s){let n=Array.from(Gs(e.schema,s)),r=t.createElement("softBreak",n);e.insertContent(r,i),t.setSelection(r,"after")}function la(e,t){return e.is("rootElement")?!1:t.isLimit(e)||la(e.parent,t)}var Oh=class extends k{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,i=e.conversion,s=e.editing.view,n=s.document,r=this.editor.t;t.register("softBreak",{allowWhere:"$text",allowAttributesOf:"$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(Bh),e.commands.add("shiftEnter",new ub(e)),e.model.document.registerPostFixer(o=>fb(o)),this.listenTo(n,"enter",(o,a)=>{n.isComposing||a.preventDefault(),a.isSoft&&(e.execute("shiftEnter"),s.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Insert a soft break (a <code><br></code> element)"),keystroke:"Shift+Enter"}]})}};function fb(e){let t=new Set;for(let s of e.model.document.differ.getChanges())if(s.type=="insert"||s.type=="remove"){s.position.parent.is("element")&&t.add(s.position.parent)}else if(s.type=="attribute"){s.range.start.parent.is("element")&&t.add(s.range.start.parent)}let i=!1;for(let s of t)for(let n of s.getChildren()){if(!n.is("element","softBreak"))continue;let r=n.nextSibling;if(!r||r.is("element"))continue;let o=Array.from(n.getAttributes()).filter(([a,l])=>!mb(r,a,l));for(let[a]of o)e.removeAttribute(a,n),i=!0}return i}function mb(e,t,i){return e?.getAttribute(t)===i}var Rh="ck-widget_selected";function j(e){return e.is("element")?!!e.getCustomProperty("widget"):!1}function gb(e){return e.getCustomProperty("widgetLabel").reduce((t,i)=>typeof i=="function"?t?t+". "+i():i():t?t+". "+i:i,"")}var Et="widget-type-around";function hi(e,t,i){return!!e&&j(e)&&!i.isInline(t)}function zh(e){return e.closest(".ck-widget__type-around__button")}function pb(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function wb(e,t){let i=e.closest(".ck-widget");return t.mapDomToView(i)}function Dt(e){return e.getAttribute(Et)}function bb(e,t){let i=t;for(;i&&i.is("element")&&e.isObject(i);)i=i.previousSibling;if(!i?.is("element"))return[];if(i.isEmpty){let n=_b(i.getAttributes());return Array.from(Gs(e,n))}let s=i.getChild(i.childCount-1);return e.isInline(s)?Array.from(Gs(e,s.getAttributes())):[]}function*_b(e){for(let[t,i]of e)le._isStoreAttributeKey(t)&&(yield[le._dropStoreAttributeKeyPrefix(t),i])}var Hh=["before","after"],vb=new DOMParser().parseFromString(pd,"image/svg+xml").firstChild,F
12h="ck-widget__type-around_disabled",yb=class extends k{_currentFakeCaretModelElement=null;static get pluginName(){return"WidgetTypeAround"}static get isOfficialPlugin(){return!0}static get requires(){return[ji,xt]}init(){let e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,s,n)=>{t.change(r=>{for(let o of t.document.roots)n?r.removeClass(Fh,o):r.addClass(Fh,o)}),n||e.model.change(r=>{r.removeSelectionAttribute(Et)})}),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){let i=this.editor,{model:s}=i,{schema:n}=s,r=i.editing.view,o=n.getAttributesWithProperty(e,"copyOnReplace",!0),a=bb(n,e);s.change(l=>{i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:o})&&l.setSelectionAttribute(a)}),r.focus(),r.scrollToTheSelection()}_listenToIfEnabled(e,t,i,s){this.listenTo(e,t,(...n)=>{this.isEnabled&&i(...n)},s)}_insertParagraphAccordingToFakeCaretPosition(){let e=this.editor.model.document.selection,t=Dt(e);if(!t)return!1;let i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){let 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",(n,r,o)=>{let a=o.mapper.toViewElement(r.item);a&&hi(a,r.item,t)&&(kb(o.writer,s,a),a.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){let e=this.editor,t=e.model,i=t.document.selection,s=t.schema,n=e.editing.view;this._listenToIfEnabled(n.document,"arrowKey",(o,a)=>{this._handleArrowKeyPress(o,a)},{context:[j,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(o,a)=>{a.directChange&&e.model.change(l=>{l.removeSelectionAttribute(Et)})}),this._listenToIfEnabled(t.document,"change:data",()=>{let o=i.getSelectedElement();o&&hi(e.editing.mapper.toViewElement(o),o,s)||e.model.change(a=>{a.removeSelectionAttribute(Et)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(o,a,l)=>{let c=l.writer;if(this._currentFakeCaretModelElement){let m=l.mapper.toViewElement(this._currentFakeCaretModelElement);m&&(c.removeClass(Hh.map(r),m),this._currentFakeCaretModelElement=null)}let u=a.selection.getSelectedElement();if(!u)return;let d=l.mapper.toViewElement(u);if(!hi(d,u,s))return;let h=Dt(a.selection);h&&(c.addClass(r(h),d),this._currentFakeCaretModelElement=u)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(o,a,l)=>{l||e.model.change(c=>{c.removeSelectionAttribute(Et)})});function r(o){return`ck-widget_type-around_show-fake-caret_${o}`}}_handleArrowKeyPress(e,t){let i=this.editor,s=i.model,n=s.document.selection,r=s.schema,o=i.editing.view;if(t.shiftKey)return;let a=t.keyCode,l=zl(a,i.locale.contentLanguageDirection),c=o.document.selection.getSelectedElement(),u=i.editing.mapper.toModelElement(c),d;hi(c,u,r)?d=this._handleArrowKeyPressOnSelectedWidget(l):n.isCollapsed?d=this._handleArrowKeyPressWhenSelectionNextToAWidget(l):t.shiftKey||(d=this._handleArrowKeyPressWhenNonCollapsedSelection(l)),d&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){let t=this.editor.model,i=t.document.selection,s=Dt(i);return t.change(n=>{if(s){if(s!==(e?"after":"before"))return n.removeSelectionAttribute(Et),!0}else return n.setSelectionAttribute(Et,e?"after":"before"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){let t=this.editor,i=t.model,s=i.schema,n=t.plugins.get("Widget"),r=n._getObjectElementNextToSelection(e);return hi(t.editing.mapper.toViewElement(r),r,s)?(i.change(o=>{n._setSelectionOverElement(r),o.setSelectionAttribute(Et,e?"before":"after")}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){let t=this.editor,i=t.model,s=i.schema,n=t.editing.mapper,r=i.document.selection,o=e?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return hi(n.toViewElement(o),o,s)?(i.change(a=>{a.setSelection(o,"on"),a.setSelectionAttribute(Et,e?"after":"before")}),!0):!1}_enableInsertingParagraphsOnButtonClick(){let e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,s)=>{let n=zh(s.domTarget);if(!n)return;let r=pb(n),o=wb(n,t.domConverter),a=e.editing.mapper.toModelElement(o);this._insertParagraph(a,r),s.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){let e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(s,n)=>{if(s.eventPhase!="atTarget")return;let r=t.getSelectedElement(),o=e.editing.mapper.toViewElement(r),a=e.model.schema,l;this._insertParagraphAccordingToFakeCaretPosition()?l=!0:hi(o,r,a)&&(this._insertParagraph(r,n.isSoft?"before":"after"),l=!0),l&&(n.preventDefault(),s.stop())},{context:j})}_enableInsertingParagraphsOnTypingKeystroke(){let e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,i)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(i.selection=e.selection)},{priority:"high"}),I.isAndroid?this._listenToIfEnabled(e,"keydown",(t,i)=>{i.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"highest"})}_enableDeleteIntegration(){let e=this.editor,t=e.editing.view,i=e.model,s=i.schema;this._listenToIfEnabled(t.document,"delete",(n,r)=>{if(n.eventPhase!="atTarget")return;let o=Dt(i.document.selection);if(!o)return;let a=r.direction,l=i.document.selection.getSelectedElement(),c=o==="before",u=a=="forward";if(c===u)e.execute("delete",{selection:i.createSelection(l,"on")});else{let d=s.getNearestSelectionRange(i.createPositionAt(l,o),a);if(d)if(!d.isCollapsed)i.change(h=>{h.setSelection(d),e.execute(u?"deleteForward":"delete")});else{let h=i.createSelection(d.start);if(i.modifySelection(h,{direction:a}),!h.focus.isEqual(d.start))i.change(m=>{m.setSelection(d),e.execute(u?"deleteForward":"delete")});else{let m=xb(s,d.start.parent);i.deleteContent(i.createSelection(m,"on"),{doNotAutoparagraph:!0})}}}r.preventDefault(),n.stop()},{context:j})}_enableInsertContentIntegration(){let e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(s,[n,r])=>
12{if(r&&!r.is("documentSelection"))return;let o=Dt(i);if(o)return s.stop(),t.change(a=>{let l=i.getSelectedElement(),c=t.createPositionAt(l,o),u=a.createSelection(c),d=t.insertContent(n,u);return a.setSelection(u),d})},{priority:"high"})}_enableInsertObjectIntegration(){let e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(i,s)=>{let[,n,r={}]=s;if(n&&!n.is("documentSelection"))return;let o=Dt(t);o&&(r.findOptimalPosition=o,s[3]=r)},{priority:"high"})}_enableDeleteContentIntegration(){let e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(i,[s])=>{s&&!s.is("documentSelection")||Dt(t)&&i.stop()},{priority:"high"})}};function kb(e,t,i){let s=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(n){let r=this.toDomElement(n);return Cb(r,t),Ib(r),r});e.insert(e.createPositionAt(i,"end"),s)}function Cb(e,t){for(let i of Hh){let s=new $e({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${i}`],title:t[i],"aria-hidden":"true"},children:[e.ownerDocument.importNode(vb,!0)]});e.appendChild(s.render())}}function Ib(e){let t=new $e({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}function xb(e,t){let i=t;for(let s of t.getAncestors({parentFirst:!0})){if(s.childCount>1||e.isLimit(s))break;i=s}return i}function Eb(e){let t=e.model;return(i,s)=>{let n=s.keyCode==L.arrowup,r=s.keyCode==L.arrowdown,o=s.shiftKey,a=t.document.selection;if(!n&&!r)return;let l=r,c=Tb(e,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(o)return}(c.isCollapsed||Ab(e,c,l))&&(t.change(u=>{let d=l?c.end:c.start;if(o){let h=t.createSelection(a.anchor);h.setFocus(d),u.setSelection(h)}else u.setSelection(d)}),i.stop(),s.preventDefault(),s.stopPropagation())}}}function Tb(e,t,i){let s=e.model;if(i){let n=t.focus,r=Dh(s,n,"forward");if(!r)return;let o=s.createRange(n,r),a=Nh(s.schema,o,"backward");if(a)return s.createRange(n,a)}else{let n=t.focus,r=Dh(s,n,"backward");if(!r)return;let o=s.createRange(r,n),a=Nh(s.schema,o,"forward");if(a)return s.createRange(a,n)}}function Dh(e,t,i){let s=e.schema,n=e.createRangeIn(t.root),r=i=="forward"?"elementStart":"elementEnd";for(let{previousPosition:o,item:a,type:l}of n.getWalker({startPosition:t,direction:i})){if(s.isLimit(a)&&!s.isInline(a))return o;if(l==r&&s.isBlock(a))return null}return null}function Nh(e,t,i){let s=i=="backward"?t.end:t.start;if(e.checkChild(s,"$text"))return s;for(let{nextPosition:n}of t.getWalker({direction:i}))if(e.checkChild(n,"$text"))return n}function Ab(e,t,i){let s=e.model,n=e.view.domConverter;if(i){let c=s.createSelection(t.start);s.modifySelection(c),!c.focus.isAtEnd&&!t.start.isEqual(c.focus)&&(t=s.createRange(c.focus,t.end))}let r=e.mapper.toViewRange(t),o=n.viewRangeToDom(r),a=O.getDomRangeRects(o),l;for(let 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}var ca=class extends k{_previouslySelected=new Set;static get pluginName(){return"Widget"}static get isOfficialPlugin(){return!0}static get requires(){return[yb,xt]}init(){let e=this.editor,t=e.editing.view,i=t.document,s=e.t;this.editor.editing.downcastDispatcher.on("selection",(n,r,o)=>{let a=o.writer,l=r.selection;if(l.isCollapsed)return;let c=l.getSelectedElement();if(!c)return;let u=e.editing.mapper.toViewElement(c);j(u)&&o.consumable.consume(l,"selection")&&a.setSelection(a.createRangeOn(u),{fake:!0,label:gb(u)})}),this.editor.editing.downcastDispatcher.on("selection",(n,r,o)=>{this._clearPreviouslySelectedWidgets(o.writer);let a=o.writer,l=a.document.selection,c=null;for(let u of l.getRanges())for(let d of u){let h=d.item;j(h)&&!Mb(h,c)&&(a.addClass(Rh,h),this._previouslySelected.add(h),c=h)}},{priority:"low"}),t.addObserver(Hn),t.addObserver(Un),this.listenTo(i,"mousedown",(...n)=>this._onMousedown(...n)),this.listenTo(i,"pointerdown",(...n)=>this._onPointerdown(...n)),this.listenTo(i,"arrowKey",(...n)=>
12{this._handleSelectionChangeOnArrowKeyPress(...n)},{context:[j,"$text"]}),this.listenTo(i,"arrowKey",(...n)=>{this._preventDefaultOnArrowKeyPress(...n)},{context:"$root"}),this.listenTo(i,"arrowKey",Eb(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(n,r)=>{this._handleDelete(r.direction=="forward")&&(r.preventDefault(),n.stop())},{context:"$root"}),this.listenTo(i,"tab",(n,r)=>{this._selectNextEditable(r.shiftKey?"backward":"forward")&&(t.scrollToTheSelection(),r.preventDefault(),n.stop())},{context:n=>j(n)||n.is("editableElement"),priority:"low"}),this.listenTo(i,"keydown",(n,r)=>{r.keystroke==L.esc&&this._selectAncestorWidget()&&(r.preventDefault(),n.stop())},{context:n=>n.is("editableElement"),priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:s("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:s("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:s("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:s("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:s("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:s("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){let i=t.target;i&&t.domEvent.detail>=3&&this._selectBlockContent(i)&&t.preventDefault()}_onPointerdown(e,t){if(!t.domEvent.isPrimary||zh(t.domTarget))return;let i=this.editor,s=i.editing.view,n=s.document,r=t.target;if(!r)return;if(!j(r)){let a=Lb(r);if(!a)return;if(j(a))r=a;else{let l=Vb(s,t);if(l&&j(l))r=l;else return}}(I.isAndroid||I.isiOS)&&t.preventDefault(),n.isFocused||s.focus();let o=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(o)}_selectBlockContent(e){let t=this.editor,i=t.model,s=t.editing.mapper,n=i.schema,r=s.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),o=Bb(s.toModelElement(r),i.schema);return o?(i.change(a=>{let l=n.isLimit(o)?null:Ob(a.createPositionAfter(o),n),c=a.createPositionAt(o,0),u=l?a.createPositionAt(l,0):a.createPositionAt(o,"end");a.setSelection(a.createRange(c,u))}),!0):!1}_handleSelectionChangeOnArrowKeyPress(e,t){let i=t.keyCode,s=this.editor.model,n=s.schema,r=s.document.selection,o=r.getSelectedElement(),a=vn(i,this.editor.locale.contentLanguageDirection),l=a=="down"||a=="right",c=a=="up"||a=="down";if(!t.shiftKey&&!r.isCollapsed){if(Sb(r,n)){let T=l?r.getLastPosition():r.getFirstPosition(),E=n.getNearestSelectionRange(T,l?"forward":"backward");E&&(s.change(G=>{G.setSelection(E)}),t.preventDefault(),e.stop())}return}let u=Pb(s,l),d=s.createSelection(u);if(s.modifySelection(d,{direction:l?"forward":"backward"}),d.isEqual(u))return;d.focus.isTouching(u.focus)&&n.checkChild(d.focus.parent,"$text")&&(l?!d.focus.isAtEnd:!d.focus.isAtStart)&&s.modifySelection(d,{direction:l?"forward":"backward"});let h=l?u.focus.nodeBefore:u.focus.nodeAfter,m=d.focus.nodeBefore,g=d.focus.nodeAfter,w=l?m:g;if(t.shiftKey)(o&&n.isObject(o)||w&&n.isObject(w)||h&&n.isObject(h))&&(s.change(T=>{T.setSelection(d)}),t.preventDefault(),e.stop());else if(w&&n.isObject(w)){if(n.isInline(w)&&c)return;s.change(T=>{T.setSelection(w,"on")}),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){let i=this.editor.model,s=i.schema,n=i.document.selection.getSelectedElement();n&&s.isObject(n)&&(t.preventDefault(),e.stop())}_handleDelete(e){let t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t)||!t.isCollapsed)return;let i=this._getObjectElementNextToSelection(e);if(i)return this.editor.model.change(s=>{let n=t.anchor.parent;for(;n.isEmpty;){let r=n;n=r.parent,s.remove(r)}this._setSelectionOverElement(i)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){let t=this.editor.model,i=t.schema,s=t.document.selection,n=t.createSelection(s);if(t.modifySelection(n,{direction:e?"forward":"backward"}),n.isEqual(s))return null;let r=e?n.focus.nodeBefore:n.focus.nodeAfter;return r&&i.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(let t of this._previouslySelected)e.removeClass(Rh,t);this._previouslySelected.clear()}_selectNextEditable(e){let t=this.editor.editing,i=t.view,s=this.editor.model,n=i.document.selection,r=s.document.selection,o;if(r.rangeCount>
121){let l=r.isBackward?r.getFirstRange():r.getLastRange();o=t.mapper.toViewPosition(e=="forward"?l.end:l.start)}else o=e=="forward"?n.getFirstPosition():n.getLastPosition();let a=this._findNextFocusRange(o,e);return a?(s.change(l=>{l.setSelection(a)}),!0):!1}_findNextFocusRange(e,t){let i=this.editor.editing,s=i.view,n=this.editor.model,r=s.document.selection,o=r.editableElement,a=o.getPath(),l=r.getSelectedElement();l&&!j(l)&&(l=null);let c=t=="forward"?s.createRange(e,s.createPositionAt(e.root,"end")):s.createRange(s.createPositionAt(e.root,0),e);for(let{nextPosition:u}of c.getWalker({direction:t})){let d=u.parent;if(j(d)&&d!=l){let h=i.mapper.toModelElement(d);if(!n.schema.isBlock(h))continue;if(ne(a,d.getPath())!="extension")return n.createRangeOn(h)}else if(d.is("editableElement")){if(d==o&&!l)continue;let h=i.mapper.toModelPosition(u),m=n.schema.getNearestSelectionRange(h,t);if(!m)continue;return d==o&&l?m:ne(a,d.getPath())!="extension"?n.createRangeIn(n.schema.getLimitElement(m)):m}}return null}_selectAncestorWidget(){let e=this.editor,t=e.editing.mapper,i=e.editing.view.document.selection.getFirstPosition().parent,s=(i.is("$text")?i.parent:i).findAncestor(j);if(!s)return!1;let n=t.toModelElement(s);return n?(e.model.change(r=>{r.setSelection(n,"on")}),!0):!1}};function Sb(e,t){let i=e.getFirstPosition(),s=e.getLastPosition(),n=i.nodeAfter,r=s.nodeBefore;return!!n&&t.isObject(n)||!!r&&t.isObject(r)}function Pb(e,t){let i=e.document.selection,s=i.getSelectedElement(),n=Dt(i);return s&&n=="before"?e.createSelection(s,"before"):s&&n=="after"?e.createSelection(s,"after"):e.createSelection(i.getRanges(),{backward:s&&e.schema.isObject(s)?!t:i.isBackward})}function Lb(e){let t=e;for(;t;){if(t.is("editableElement")||j(t))return t;t=t.parent}return null}function Vb(e,t){let i=bn(t.domEvent),s;if(i?s=e.domConverter.domRangeToView(i):s=e.createRange(e.createPositionAt(t.target,0)),!s)return null;let n=s.start;if(!n.parent)return null;let r=n.parent;if(n.parent.is("editableElement")){n.isAtEnd&&n.nodeBefore?r=n.nodeBefore:n.isAtStart&&n.nodeAfter&&(r=n.nodeAfter)}return r.is("$text")?r.parent:r}function Mb(e,t){return t?Array.from(e.getAncestors()).includes(t):!1}function Bb(e,t){for(let i of e.getAncestors({includeSelf:!0,parentFirst:!0})){if(t.checkChild(i,"$text"))return i;if(t.isLimit(i)&&!t.isObject(i))break}return null}function Ob(e,t){let i=new He({startPosition:e});for(let{item:s}of i){if(t.isLimit(s)||!s.is("element"))return null;if(t.checkChild(s,"$text"))return s}return null}function Rb(e){return e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," "),(e.includes("</p><p>")||e.includes("<br>"))&&(e=`<p>${e}</p>`),e}var Zs=class extends We{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);let 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(n,r)=>{r.preventDefault();let o=r.dropRange?[r.dropRange]:null,a=r.dataTransfer,l=new Le(t,s),c="";a.getData("text/html")?c=a.getData("text/html"):a.getData("text/plain")&&(c=Rb(a.getData("text/plain"))),t.fire(l,{dataTransfer:a,content:c,method:n.name,targetRanges:o,target:r.target,domEvent:r.domEvent}),l.stop.called&&r.stopPropagation()}}}onDomEvent(e){let t={dataTransfer:new Co("clipboardData"in e?e.clipboardData:e.dataTransfer,{cacheFiles:e.type=="drop"||e.type=="paste"})};if(e.type=="drop"||e.type=="dragover"){let i=bn(e);t.dropRange=i&&this.view.domConverter.domRangeToView(i)}this.fire(e.type,e,t)}};function Fb(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(t,i)=>i.length==1?" ":i).replace(/<!--[\s\S]*?-->/g,"")}var Uh=["figcaption","li"],Wh=["ol","ul"];function Gh(e,t){if(t.is("$text")||t.is("$textProxy"))return t.data;if(t.is("element","img")&&t.hasAttribute("alt"))return t.getAttribute("alt");if(t.is("element","br"))return` 13`;let i="",s=null;for(let n of t.getChildren())i+=Db(n,s)+Gh(e,n),s=n;
13if(t.is("rawElement")){let n=document.implementation.createHTMLDocument("").createElement("div");t.render(n,e),i+=Zh(n)}return i}function Zh(e){let t="";if(e.nodeType===Node.TEXT_NODE)return e.textContent;if(e.tagName==="BR")return` 14`;for(let i of e.childNodes)t+=Zh(i);return t}function Db(e,t){return t?e.is("element","li")&&!e.isEmpty&&e.getChild(0).is("containerElement")||Wh.includes(e.name)&&Wh.includes(t.name)?` 15 16`:!e.is("containerElement")&&!t.is("containerElement")?"":Uh.includes(e.name)||Uh.includes(t.name)?` 17`:e.is("element")&&e.getCustomProperty("dataPipeline:transparentRendering")||t.is("element")&&t.getCustomProperty("dataPipeline:transparentRendering")?"":` 18 19`:""}var Jh=class extends k{_markersToCopy=new Map;static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,i=s=>s.model.getSelectedContent(s.model.document.selection)){return this.editor.model.change(s=>{let n=s.model.document.selection;s.setSelection(t);let r=this._insertFakeMarkersIntoSelection(s,s.model.document.selection,e),o=i(s),a=this._removeFakeMarkersInsideElement(s,o);for(let[l,c]of Object.entries(r)){a[l]||=s.createRangeIn(o);for(let u of c)s.remove(u)}o.markers.clear();for(let[l,c]of Object.entries(a))o.markers.set(l,c);return s.setSelection(n),o})}_pasteMarkersIntoTransformedElement(e,t){let i=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(s=>{let n=this._insertFakeMarkersElements(s,i),r=t(s),o=this._removeFakeMarkersInsideElement(s,r);for(let a of Object.values(n).flat())s.remove(a);for(let[a,l]of Object.entries(o))s.model.markers.has(a)||s.addMarker(a,{usingOperation:!0,affectsData:!0,range:l});return r})}_pasteFragmentWithMarkers(e){let t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(let i of t)e.markers.set(i.name,i.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,i={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){let s=this._markersToCopy.get(e);this._markersToCopy.set(e,i),t(),s?this._markersToCopy.set(e,s):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){let i=this._getMarkerClipboardConfig(e);if(!i)return!1;if(!t)return!0;let{allowedActions:s}=i;return s==="all"||s.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){let[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,i){let s=this._getCopyableMarkersFromSelection(e,t,i);return this._insertFakeMarkersElements(e,s)}_getCopyableMarkersFromSelection(e,t,i){let s=Array.from(t.getRanges()),n=new Set(s.flatMap(o=>Array.from(e.model.markers.getMarkersIntersectingRange(o)))),r=o=>{if(!this._isMarkerCopyable(o.name,i))return!1;let{copyPartiallySelected:a}=this._getMarkerClipboardConfig(o.name);if(!a){let l=o.getRange();return s.some(c=>c.containsRange(l,!0))}return!0};return Array.from(n).filter(r).map(o=>({name:i==="dragstart"?this._getUniqueMarkerName(o.name):o.name,range:o.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){let{model:i}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([s,n])=>{if(!this._hasMarkerConfiguration(s))return[{name:s,range:n}];if(this._isMarkerCopyable(s,t)){let r=this._getMarkerClipboardConfig(s),o=i.markers.has(s)&&i.markers.get(s).getRange().root.rootName==="$graveyard";return(r.duplicateOnPaste||o)&&(s=this._getUniqueMarkerName(s)),[{name:s,range:n}]}return[]})}_insertFakeMarkersElements(e,t){let i={},s=t.flatMap(n=>{let{start:r,end:o}=n.range;return[{position:r,marker:n,type:"start"},{position:o,marker:n,type:"end"}]}).sort(({position:n},{position:r})=>n.isBefore(r)?1:-1);for(let{position:n,marker:r,type:o}of s){let a=e.createElement("$marker",{"data-name":r.name,"data-type":o});
19i[r.name]||(i[r.name]=[]),i[r.name].push(a),e.insert(a,n)}return i}_removeFakeMarkersInsideElement(e,t){return xr(this._getAllFakeMarkersFromElement(e,t).reduce((i,s)=>{let n=s.markerElement&&e.createPositionBefore(s.markerElement),r=i[s.name],o=!1;return r?.start&&r?.end&&(this._getMarkerClipboardConfig(s.name).duplicateOnPaste?i[this._getUniqueMarkerName(s.name)]=i[s.name]:o=!0,r=null),o||(i[s.name]={...r,[s.type]:n}),s.markerElement&&e.remove(s.markerElement),i},{}),i=>new p(i.start||e.createPositionFromPath(t,[0]),i.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){let i=Array.from(e.createRangeIn(t)).flatMap(({item:r})=>r.is("element","$marker")?[{markerElement:r,name:r.getAttribute("data-name"),type:r.getAttribute("data-type")}]:[]),s=[],n=[];for(let r of i)r.type==="end"&&(i.some(o=>o.name===r.name&&o.type==="start")||s.push({markerElement:null,name:r.name,type:"start"})),r.type==="start"&&(i.some(o=>o.name===r.name&&o.type==="end")||n.unshift({markerElement:null,name:r.name,type:"end"}));return[...s,...i,...n]}_getUniqueMarkerName(e){let t=e.split(":"),i=X().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${i}`:`${t.join(":")}:${i}`}};var ot=class extends k{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[Jh]}init(){this.editor.editing.view.addObserver(Zs),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,i){let s=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:i==="cut"},()=>{let n=s._copySelectedFragmentWithMarkers(i,t);this.fire("outputTransformation",{dataTransfer:e,content:n,method:i})})}_setupPasteDrop(){let e=this.editor,t=e.model,i=e.editing.view,s=i.document,n=this.editor.plugins.get("ClipboardMarkersUtils");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)=>{let a=o.dataTransfer,l=new Le(this,"inputTransformation"),c=a.getData("application/ckeditor5-editor-id")||null,u=typeof o.content=="string"?this.editor.data.htmlProcessor.toView(Fb(o.content)):o.content;this.fire(l,{content:u,dataTransfer:a,sourceEditorId:c,extraContent:o.extraContent,targetRanges:o.targetRanges,method:o.method}),l.stop.called&&r.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(r,o)=>{if(o.content.isEmpty)return;let a=this.editor.data.toModel(o.content,"$clipboardHolder");a.childCount!=0&&(r.stop(),t.change(()=>{this.fire("contentInsertion",{content:a,method:o.method,sourceEditorId:o.sourceEditorId,dataTransfer:o.dataTransfer,targetRanges:o.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(r,o)=>{o.resultRange=n._pasteFragmentWithMarkers(o.content)},{priority:"low"})}_setupCopyCut(){let e=this.editor,t=e.model.document,i=e.editing.view.document,s=(n,r)=>{let o=r.dataTransfer;r.preventDefault(),this._fireOutputTransformationEvent(o,t.selection,n.name)};this.listenTo(i,"copy",s,{priority:"low"}),this.listenTo(i,"cut",(n,r)=>{e.model.canEditAt(e.model.document.selection)?s(n,r):r.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(n,r)=>{let o=e.data.toView(r.content,{isClipboardPipeline:!0});i.fire("clipboardOutput",{dataTransfer:r.dataTransfer,content:o,method:r.method})},{priority:"low"}),this.listenTo(i,"clipboardOutput",(n,r)=>{r.content.isEmpty||(r.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(r.content)),r.dataTransfer.setData("text/plain",Gh(e.data.htmlProcessor.domConverter,r.content)),r.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),r.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}};var ua=ei("px"),Nb=class extends A{constructor(){super();let e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>ua(t)),top:e.to("top",t=>ua(t)),width:e.to("width",t=>ua(t))}}})}};var cr=class extends k{removeDropMarkerDelayed=gs(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=Pt(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=Pt(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0);_dropTargetLineView=new Nb;_domEmitter=new(ge());_scrollables=new Map;static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(let{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,s,n,r){this.removeDropMarkerDelayed.cancel();let o=qh(this.editor,e,t,i,s,n,r);return o?r&&r.containsRange(o)?(this.removeDropMarker(),null):o&&!this.editor.model.canEditAt(o)?(this.removeDropMarker(),null):(this._updateDropMarkerThrottled(o),o):null}getFinalDropRange(e,t,i,s,n,r){let o=qh(this.editor,e,t,i,s,n,r);return this.removeDropMarker(),o}removeDropMarker(){let e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){let e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer
19:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){let 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})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){let i=this.toDomElement(t);return i.append("\u2060",t.createElement("span"),"\u2060"),i})}_updateDropTargetLine(e){let t=this.editor.editing,i=e.start.nodeBefore,s=e.start.nodeAfter,n=e.start.parent,r=i?t.mapper.toViewElement(i):null,o=r?t.view.domConverter.mapViewToDom(r):null,a=s?t.mapper.toViewElement(s):null,l=a?t.view.domConverter.mapViewToDom(a):null,c=t.mapper.toViewElement(n);if(!c)return;let u=t.view.domConverter.mapViewToDom(c),d=this._getScrollableRect(c),{scrollX:h,scrollY:m}=_.window,g=o?new O(o):null,w=l?new O(l):null,T=new O(u).excludeScrollbarsAndBorders(),E=g?g.bottom:T.top,G=w?w.top:T.bottom,V=_.window.getComputedStyle(u),ce=E<=G?(E+G)/2:G;if(d.top<ce&&ce<d.bottom){let y=T.left+parseFloat(V.paddingLeft),S=T.right-parseFloat(V.paddingRight),x=Math.max(y+h,d.left),P=Math.min(S+h,d.right);this._dropTargetLineView.set({isVisible:!0,left:x,top:ce+m,width:P-x})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){let t=e.root.rootName,i;if(this._scrollables.has(t))i=this._scrollables.get(t).domElement;else{i=Hb(this.editor.editing.view.domConverter.mapViewToDom(e)),this._domEmitter.listenTo(i,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});let s=new ds(i,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:i,resizeObserver:s})}return new O(i).excludeScrollbarsAndBorders()}};function qh(e,t,i,s,n,r,o){let a=e.model,l=e.editing.mapper,c=$h(e,t);for(;c;){if(!r){if(a.schema.checkChild(c,"$text")){if(i){let u=i[0].start,d=l.toModelPosition(u);if(!o||Array.from(o.getItems({shallow:!0})).some(h=>a.schema.checkChild(d,h))){if(a.schema.checkChild(d,"$text"))return a.createRange(d);if(u)return ur(e,$h(e,u.parent),s,n)}}}else if(a.schema.isInline(c))return ur(e,c,s,n)}if(a.schema.isBlock(c))return ur(e,c,s,n);if(a.schema.checkChild(c,"$block")){let u=Array.from(c.getChildren()).filter(m=>m.is("element")&&!zb(e,m)),d=0,h=u.length;if(h==0)return a.createRange(a.createPositionAt(c,"end"));for(;d<h-1;){let m=Math.floor((d+h)/2);Yh(e,u[m],s,n)=="before"?h=m:d=m}return ur(e,u[d],s,n)}c=c.parent}return null}function zb(e,t){let i=e.editing.mapper,s=e.editing.view.domConverter,n=i.toViewElement(t);if(!n)return!0;let r=s.mapViewToDom(n);return _.window.getComputedStyle(r).float!="none"}function ur(e,t,i,s){let n=e.model;return n.createRange(n.createPositionAt(t,Yh(e,t,i,s)))}function Yh(e,t,i,s){let n=e.editing.mapper,r=e.editing.view.domConverter,o=n.toViewElement(t),a=new O(r.mapViewToDom(o));return e.model.schema.isInline(t)?i<(a.left+a.right)/2?"before":"after":s<(a.top+a.bottom)/2?"before":"after"}function $h(e,t){let i=e.editing.mapper,s=e.editing.view,n=i.toModelElement(t);if(n)return n;let r=s.createPositionBefore(t),o=i.findMappedViewAncestor(r);return i.toModelElement(o)}function Hb(e){let t=e;do{t=t.parentElement;let i=_.window.getComputedStyle(t).overflowY;if(i=="auto"||i=="scroll")break}while(t.tagName!="BODY");return t}var Ub=class extends k{_isBlockDragging=!1;_domEmitter=new(ge());static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,i,s)=>{s?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),I.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){let t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",(i,s)=>this._handleBlockDragStart(s)),this._domEmitter.listenTo(_.document,"dragover",(i,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(_.document,"drop",(i,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(_.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",(i,s,n)=>{t.setAttribute("draggable",n?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;let t=this.editor.model,i=t.document.selection,s=this.editor.editing.view,n=Array.from(i.getSelectedBlocks()),r=t.createRange(t.createPositionBefore(n[0]),t.createPositionAfter(n[n.length-1]));t.change(o=>o.setSelection(r)),this._isBlockDragging=!0,s.focus(),s.getObserver(Zs).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;let t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),i=e.clientY,s=document.elementFromPoint(t,i),n=this.editor.editing.view;!s||!s.closest(".ck-editor__editable")||n.getObserver(Zs).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:s,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}};var Wb=class extends k{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=gs(()=>this._clearDraggableAttributes(),40);_blockMode=!1;_domEmitter=new(ge());_previewContainer;static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[ot,ca,cr,Ub]}init(){let e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(Zs),t.addObserver(Un),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(i,s,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(i,s,n)=>{n||this._finalizeDragging(!1)}),I.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){let e=this.editor,t=e.model,i=e.editing.view,s=i.document,n=e.plugins.get(cr);this.listenTo(s,"dragstart",(r,o)=>{if(o.target?.is("editableElement")){o.preventDefault();return}if(this._prepareDraggedRange(o.target),!this._draggedRange){o.preventDefault();return}this._draggingUid=X();let a=this.isEnabled&&e.model.canEditAt(this._draggedRange);o.dataTransfer.effectAllowed=a?"copyMove":"copy",o.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);let l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(o.dataTransfer,l,"dragstart");let{dataTransfer:c,domTarget:u,domEvent:d}=o,{clientX:h}=d;this._updatePreview({dataTransfer:c,domTarget:u,clientX:h}),o.stopPropagation(),a||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(s,"dragend",(r,o)=>{this._finalizeDragging(!o.dataTransfer.isCanceled&&o.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(_.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(s,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(s,"dragleave",()=>{n.removeDropMarkerDelayed()}),this.listenTo(s,"dragging",(r,o)=>{if(!this.isEnabled){o.dataTransfer.dropEffect="none";return}let{clientX:a,clientY:l}=o.domEvent;if(!n.updateDropMarker(o.target,o.targetRanges,a,l,this._blockMode,this._draggedRange)){o.dataTransfer.dropEffect="none";return}this._draggedRange||(o.dataTransfer.dropEffect="copy"),I.isGecko||(o.dataTransfer.effectAllowed=="copy"?o.dataTransfer.dropEffect="copy":["all","copyMove"].includes(o.dataTransfer.effectAllowed)&&(o.dataTransfer.dropEffect="move")),r.stop()},{priority:"low"})}_setupClipboardInputIntegration(){let e=this.editor,t=e.editing.view.document,i=e.plugins.get(cr);this.listenTo(t,"clipboardInput",(s,n)=>{if(n.method!="drop")return;let{clientX:r,clientY:o}=n.domEvent,a=i.getFinalDropRange(n.target,n.targetRanges,r,o,this._blockMode,this._draggedRange);
19if(!a){this._finalizeDragging(!1),s.stop();return}if(this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),Kh(n.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(a,!0)){this._finalizeDragging(!1),s.stop();return}n.targetRanges=[e.editing.mapper.toViewRange(a)]},{priority:"high"})}_setupContentInsertionIntegration(){let e=this.editor.plugins.get(ot);e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;let s=i.targetRanges.map(n=>this.editor.editing.mapper.toModelRange(n));this.editor.model.change(n=>n.setSelection(s))},{priority:"high"}),e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;let s=Kh(i.dataTransfer)=="move",n=!i.resultRange||!i.resultRange.isCollapsed;this._finalizeDragging(n&&s)},{priority:"lowest"})}_setupDraggableAttributeHandling(){let e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"pointerdown",(s,n)=>{if(I.isAndroid||!n)return;this._clearDraggableAttributesDelayed.cancel();let r=jh(n.target);if(I.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){let o=i.selection.getSelectedElement();(!o||!j(o))&&(r=i.selection.editableElement)}r&&(t.change(o=>{o.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(i,"pointerup",()=>{I.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){let 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})}_finalizeDragging(e){let t=this.editor,i=t.model;t.plugins.get(cr).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change(s=>{let n=i.createSelection(this._draggedRange);i.deleteContent(n,{doNotAutoparagraph:!0});let r=n.getFirstPosition().parent;r.isEmpty&&!i.schema.checkChild(r,"$text")&&i.schema.checkChild(r,"paragraph")&&s.insertElement("paragraph",r,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){let t=this.editor,i=t.model,s=i.document.selection,n=e?jh(e):null;if(n){let l=t.editing.mapper.toModelElement(n);this._draggedRange=xe.fromRange(i.createRangeOn(l)),this._blockMode=i.schema.isBlock(l),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(s.isCollapsed&&!s.getFirstPosition().parent.isEmpty)return;let r=Array.from(s.getSelectedBlocks()),o=s.getFirstRange();if(r.length==0){this._draggedRange=xe.fromRange(o);return}let a=Qh(i,r);if(r.length>1)this._draggedRange=xe.fromRange(a),this._blockMode=!0;else if(r.length==1){let l=o.start.isTouching(a.start)&&o.end.isTouching(a.end);this._draggedRange=xe.fromRange(l?a:o),this._blockMode=l}i.change(l=>l.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){let s=this.editor.editing.view,n=s.document.selection.editableElement,r=s.domConverter.mapViewToDom(n),o=_.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=ue(_.document,"div",{style:"position: fixed; left: -999999px;"}),_.document.body.appendChild(this._previewContainer));let a=ue(_.document,"div");a.className="ck ck-content ck-clipboard-preview";let l=new O(r),c=parseFloat(o.paddingLeft),u=parseFloat(o.paddingRight),d=parseFloat(o.width)-c-u;if(r.contains(t))if(I.isiOS)a.style.maxWidth=`${d}px`,a.style.padding="10px",a.style.minWidth="200px",a.style.minHeight="20px",a.style.boxSizing="border-box",a.style.backgroundColor="var(--ck-color-base-background)";else return;else if(I.isiOS)a.style.width=`${d}px`,a.style.backgroundColor="var(--ck-color-base-background)";else{let h=l.left-i+c;a.style.width=`${d+h}px`,a.style.paddingLeft=`${h}px`}s.domConverter.setContentOf(a,e.getData("text/html")),e.setDragImage(a,0,0),this._previewContainer.appendChild(a)}};function Kh(e){return I.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function jh(e){if(e.is("editableElement"))return null;
19if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(j);if(j(e))return e;let t=e.findAncestor(i=>j(i)||i.is("editableElement"));return j(t)?t:null}function Qh(e,t){let i=t[0],s=t[t.length-1],n=i.getCommonAncestor(s),r=e.createPositionBefore(i),o=e.createPositionAfter(s);if(n&&n.is("element")&&!e.schema.isLimit(n)){let a=e.createRangeOn(n),l=r.isTouching(a.start),c=o.isTouching(a.end);if(l&&c)return Qh(e,[n])}return e.createRange(r,o)}var qb=class extends k{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[ot]}init(){let e=this.editor,t=e.model,i=e.editing.view,s=t.document.selection;i.addObserver(Zs),e.plugins.get(ot).on("contentInsertion",(n,r)=>{$b(r.content,t)&&t.change(o=>{let a=Array.from(s.getAttributes()).filter(([c])=>t.schema.getAttributeProperties(c).isFormatting);s.isCollapsed||t.deleteContent(s,{doNotAutoparagraph:!0}),a.push(...s.getAttributes());let l=o.createRangeIn(r.content);for(let c of l.getItems())for(let u of a)t.schema.checkAttribute(c,u[0])&&o.setAttribute(u[0],u[1],c)})})}};function $b(e,t){let i=t.createRangeIn(e);if(e.childCount==1){let s=e.getChild(0);s.is("element")&&t.schema.isBlock(s)&&!t.schema.isObject(s)&&!t.schema.isLimit(s)&&(i=t.createRangeIn(s))}for(let s of i.getItems())if(!t.schema.isInline(s)||Array.from(s.getAttributeKeys()).find(n=>t.schema.getAttributeProperties(n).isFormatting))return!1;return!0}var da=class extends k{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Jh,ot,Wb,qb]}init(){let e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}};var Kb=class extends W{constructor(e){super(e),this.affectsData=!1}execute(){let e=this.editor.model,t=e.document.selection,i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!Xh(e.schema,i))do if(i=i.parent,!i)return;while(!Xh(e.schema,i));e.change(s=>{s.setSelection(i,"in")})}};function Xh(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}var jb=fs("Ctrl+A"),Gb=class extends k{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,i=e.editing.view.document;e.commands.add("selectAll",new Kb(e)),this.listenTo(i,"keydown",(s,n)=>{ft(n)===jb&&(e.execute("selectAll"),n.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}};var Zb=class extends k{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("selectAll",()=>{let t=this._createButton(B);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(te))}_createButton(e){let t=this.editor,i=t.locale,s=t.commands.get("selectAll"),n=new e(t.locale),r=i.t;return n.set({label:r("Select all"),icon:wd,keystroke:"Ctrl+A"}),n.bind("isEnabled").to(s,"isEnabled"),this.listenTo(n,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),n}};var ef=class extends k{static get requires(){return[Gb,Zb]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}};var tf=class extends W{_stack=[];_createdBatches=new WeakSet;constructor(e){super(e),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,i)=>{i[1]={...i[1]};let 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){let 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){let s=this.editor.model,n=s.document,r=[],o=e.map(l=>l.getTransformedByOperations(i)),a=o.flat();
19for(let l of o){let c=l.filter(u=>u.root!=n.graveyard).filter(u=>!Yb(u,a));c.length&&(Jb(c),r.push(c[0]))}r.length&&s.change(l=>{l.setSelection(r,{backward:t})})}_undo(e,t){let i=this.editor.model,s=i.document;this._createdBatches.add(t);let n=e.operations.slice().filter(r=>r.isDocumentOperation);n.reverse();for(let r of n){let o=r.baseVersion+1,a=Array.from(s.history.getOperations(o)),l=xu([r.getReversed()],a,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let c of l){let u=c.affectedSelectable;u&&!i.canEditAt(u)&&(c=new ae(c.baseVersion)),t.addOperation(c),i.applyOperation(c),s.history.setOperationAsUndone(r,c)}}}};function Jb(e){e.sort((t,i)=>t.start.isBefore(i.start)?-1:1);for(let t=1;t<e.length;t++){let i=e[t-1].getJoined(e[t],!0);i&&(t--,e.splice(t,2,i))}}function Yb(e,t){return t.some(i=>i!==e&&i.containsRange(e,!0))}var Qb=class extends tf{execute(e=null){let t=e?this._stack.findIndex(n=>n.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);let n=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,n)}),this.fire("revert",i.batch,s),this.refresh()}};var Xb=class extends tf{execute(){let e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{let i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,s=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,s),this._undo(e.batch,t)}),this.fire("revert",e.batch,t),this.refresh()}};var e_=class extends k{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;this._undoCommand=new Qb(e),this._redoCommand=new Xb(e),e.commands.add("undo",this._und
19oCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(i,s)=>{let n=s[0];if(!n.isDocumentOperation)return;let r=n.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",(i,s,n)=>{this._redoCommand.addBatch(n)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Undo"),keystroke:"CTRL+Z"},{label:t("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}};var t_=class extends k{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?Uo:zo,n=t.uiLanguageDirection=="ltr"?zo:Uo;this._addButtonsToFactory("undo",i("Undo"),"CTRL+Z",s),this._addButtonsToFactory("redo",i("Redo"),"CTRL+Y",n)}_addButtonsToFactory(e,t,i,s){let n=this.editor;n.ui.componentFactory.add(e,()=>{let r=this._createButton(B,e,t,i,s);return r.set({tooltip:!0}),r}),n.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(te,e,t,i,s))}_createButton(e,t,i,s,n){let r=this.editor,o=r.locale,a=r.commands.get(t),l=new e(o);return l.set({label:i,icon:n,keystroke:s}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{r.execute(t),r.editing.view.focus()}),l}};var ha=class extends k{static get requires(){return[e_,t_]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}};var sf=class extends k{static get requires(){return[ih,da,ji,ef,Oh,Ph,ha]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}};var dr=class extends W{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){let t=this.editor.model,i=t.document.selection,s=e.forceValue===void 0?!this.value:e.forceValue;t.change(n=>{if(i.isCollapsed)s?n.setSelectionAttribute(this.attributeKey,!0):n.removeSelectionAttribute(this.attributeKey);else{let r=t.schema.getValidRanges(i.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(let o of r){let a=o,l=this.attributeKey;o.isCollapsed&&(a=o.start.parent,l=le._getStoreAttributeKey(this.attributeKey)),s?n.setAttribute(l,s,a):n.removeAttribute(l,a)}}})}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(let s of i.getRanges())for(let n of s.getItems())if(t.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}};var Gi="bold",i_=class extends k{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Gi}),e.model.schema.setAttributeProperties(Gi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Gi,view:"strong",upcastAlso:["b",i=>{let s=i.getStyle("font-weight");return s&&(s=="bold"||Number(s)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Gi,new dr(e,Gi)),e.keystrokes.set("CTRL+B",Gi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}};function hr({editor:e,commandName:t,plugin:i,icon:s,label:n,keystroke:r}){return o=>{let a=e.commands.get(t),l=new o(e.locale);return l.set({label:n,icon:s,keystroke:r,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),l.bind("isOn").to(a,"value"),l instanceof te?l.set({role:"menuitemcheckbox"}):l.set({tooltip:!0}),i.listenTo(l,"execute",()=>{e.execute(t),e.editing.view.focus()}),l}}var nf="bold",s_=class extends k{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=hr({editor:e,commandName:nf,plugin:this,icon:qn,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(nf,()=>i(B)),e.ui.componentFactory.add("menuBar:bold",()=>i(te))}};var lf=class extends k{static get requires(){return[i_,s_]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}};var Zi="italic",n_=class extends k{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Zi}),e.model.schema.setAttributeProperties(Zi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Zi,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}
19),e.commands.add(Zi,new dr(e,Zi)),e.keystrokes.set("CTRL+I",Zi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}};var rf="italic",r_=class extends k{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=hr({editor:e,commandName:rf,plugin:this,icon:cd,keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(rf,()=>i(B)),e.ui.componentFactory.add("menuBar:italic",()=>i(te))}};var cf=class extends k{static get requires(){return[n_,r_]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}};var Js="subscript",o_=class extends k{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:Js}),e.model.schema.setAttributeProperties(Js,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Js,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(Js,new dr(e,Js))}};var of="subscript",a_=class extends k{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=hr({editor:e,commandName:of,plugin:this,icon:_d,label:t("Subscript")});e.ui.componentFactory.add(of,()=>i(B)),e.ui.componentFactory.add("menuBar:subscript",()=>i(te))}};var uf=class extends k{static get requires(){return[o_,a_]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}};var Ys="superscript",l_=class extends k{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ys}),e.model.schema.setAttributeProperties(Ys,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Ys,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(Ys,new dr(e,Ys))}};var af="superscript",c_=class extends k{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=hr({editor:e,commandName:af,plugin:this,icon:vd,label:t("Superscript")});e.ui.componentFactory.add(af,()=>i(B)),e.ui.componentFactory.add("menuBar:superscript",()=>i(te))}};var df=class extends k{static get requires(){return[l_,c_]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}};var GI=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));var u_=class{_definitions=new Set;_conflictChecker;get length(){return this._definitions.size}setConflictChecker(e){this._conflictChecker=e}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{let t=(s,n)=>{let r=n.createAttributeElement("a",s.attributes,{priority:5});s.classes&&n.addClass(s.classes,r);for(let o in s.styles)n.setStyle(o,s.styles[o],r);return n.setCustomProperty("link",!0,r),r},i=s=>(n,r,o)=>{if(r.attributeKey.startsWith("link")&&!(r.attributeKey=="linkHref"&&!o.consumable.test(r.item,"attribute:linkHref"))&&!(!r.item.is("selection")&&!o.schema.isInline(r.item)))for(let a of this._definitions)a.callback(r.item.getAttribute("linkHref"))&&!this._conflictChecker?.(a,r.item)&&s?r.item.is("selection")?o.writer.wrap(o.writer.document.selection.getFirstRange(),t(a,o.writer)):o.writer.wrap(o.mapper.toViewRange(r.range),t(a,o.writer)):o.writer.unwrap(o.mapper.toViewRange(r.range),t(a,o.writer))};e.on("attribute",i(!1),{priority:me.high-1}),e.on("attribute",i(!0),{priority:me.high-2})}}getDispatcherForLinkedImage(){return e=>{let t=i=>(s,n,{writer:r,mapper:o})=>{if(!n.item.is("element","imageBlock")||!n.attributeKey.startsWith("link"))return;let a=o.toViewElement(n.item),l=Array.from(a.getChildren()).find(c=>c.is("element","a"));if(l)for(let c of this._definitions){let u=De(c.attributes);if(c.callback(n.item.getAttribute("linkHref"))&&!this._conflictChecker?.(c,n.item)&&i){for(let[d,h]of u)d==="class"?r.addClass(h,l):r.setAttribute(d,h,!1,l);c.classes&&r.addClass(c.classes,l);for(let d in c.styles)r.setStyle(d,c.styles[d],l)}else{for(let[d,h]of u)d==="class"?r.removeClass(h,l):r.removeAttribute(d,h,l);c.classes&&r.removeClass(c.classes,l);for(let d in c.styles)r.removeStyle(d,l)}}};e.on("attribute",t(!1),{priority:me.high-1}),e.on("attribute",t(!0),{priority:me.high-2})}}};var d_=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,h_="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",f_=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,m_=/^((\w+:(\/{2,})?)|(\W))/i,g_=["https?","ftps?","mailto"],fr="Ctrl+K";function p_(e){return e.is("attributeElement")&&!!e.getCustomProperty("link")}
19function hf(e,{writer:t}){let i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function gf(e,t=g_){let i=String(e),s=t.join("|");return w_(i,new RegExp(`${h_.replace("<protocols>",s)}`,"i"))?i:"#"}function w_(e,t){return!!e.replace(d_,"").match(t)}function b_(e,t){let i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(s=>("label"in s&&i[s.label]&&(s.label=i[s.label]),s)),t}function __(e){let t=[];if(e)for(let[i,s]of Object.entries(e)){let n=Object.assign({},s,{id:`link${Tr(i)}`});t.push(n)}return t}function ma(e,t){return e?t.checkAttribute(e.name,"linkHref"):!1}function v_(e){return f_.test(e)}function wa(e,t){let i=v_(e)?"mailto:":t,s=!!i&&!pf(e);return e&&s?i+e:e}function pf(e){return m_.test(e)}function y_(e){window.open(e,"_blank","noopener")}function ga(e){let t="";for(let i of e.getItems()){if(!i.is("$text")&&!i.is("$textProxy"))return;t+=i.data}return t}function pa(e,t){if(e.attributes&&t.attributes&&Object.keys(e.attributes).some(s=>!i(s)&&s in t.attributes)||e.styles&&t.styles&&Object.keys(e.styles).some(s=>s in t.styles))return!0;return!1;function i(s){return s==="class"||s==="style"||s==="rel"}}function wf({decoratorStates:e,allDecorators:t}){let i={...e};for(let n in e)if(e[n]&&s(n)){let r=k_(n,t);for(let o of r)i[o]=!1}function s(n){return t.some(r=>r.id===n&&!r.value)}return i}function k_(e,t){let i=t.find(s=>s.id===e);return i?t.filter(s=>s.id!==e&&pa(i,s)).map(s=>s.id):[]}var C_=class extends W{manualDecorators=new pe;automaticDecorators=new u_;restoreManualDecoratorStates(){for(let e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){let e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||ye(t.getSelectedBlocks());ma(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(let s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={},i){let s=this.editor.model,n=s.document.selection,r=wf({allDecorators:Array.from(this.manualDecorators),decoratorStates:t}),o=[],a=[];for(let l in r)r[l]?o.push(l):a.push(l);s.change(l=>{let c=h=>{l.setAttribute("linkHref",e,h),o.forEach(m=>l.setAttribute(m,!0,h)),a.forEach(m=>l.removeAttribute(m,h))},u=(h,m)=>{let g=ga(h);if(!g)return h;let w=i;if(w||(w=m&&m==g?e:g),w!=g){let T=l.createDocumentFragment();for(let ce of h.getItems()){let y=ce;l.append(l.createText(y.data,y.getAttributes()),T)}let E=l.createRangeIn(T),G=I_(g,w),V=0;for(let{offset:ce,actual:y,expected:S}of G){let x=ce+V,P=l.createRange(E.start.getShiftedBy(x),E.start.getShiftedBy(x+y.length)),Re=x_(P,E).getAttributes(),Ht=Array.from(Re).filter(([jf])=>s.schema.getAttributeProperties(jf).isFormatting),xa=l.createText(S,Ht);c(xa),l.remove(P),l.insert(xa,P.start),V+=S.length}return s.insertContent(T,h),l.createRange(h.start,h.start.getShiftedBy(w.length))}},d=h=>{let{plugins:m}=this.editor;if(l.setSelection(h.end),m.has("TwoStepCaretMovement"))m.get("TwoStepCaretMovement")._handleForwardMovement();else for(let g of["linkHref",...o,...a])l.removeSelectionAttribute(g)};if(n.isCollapsed){let h=n.getFirstPosition();if(n.hasAttribute("linkHref")){let m=n.getAttribute("linkHref"),g=js(h,"linkHref",m,s),w=u(g,m);c(w||g),w&&d(w)}else if(e!==""){let m=De(n.getAttributes());m.set("linkHref",e),o.forEach(g=>{m.set(g,!0)}),d(s.insertContent(l.createText(i||e,m),h))}}else{let h=Array.from(n.getRanges()),m=s.schema.getValidRanges(h,"linkHref"),g=[];for(let E of n.getSelectedBlocks())s.schema.checkAttribute(E,"linkHref")&&g.push(l.createRangeOn(E));let w=g.slice();for(let E of m)this._isRangeToUpdate(E,g)&&w.push(E);let T=h.map(E=>({start:Y.fromPosition(E.start,"toPrevious"),end:Y.fromPosition(E.end,"toNext")}));for(let E of w){let G=(E.start.textNode||E.start.nodeAfter).getAttribute("linkHref");E=u(E,G)||E,c(E)}l.setSelection(T.map(E=>{let G=E.start.toPosition(),V=E.end.toPosition();return E.start.detach(),E.end.detach(),s.createRange(G,V)}))}}),this.restoreManualDecoratorStates()}_getDecoratorStateFromModel(e){let t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return ma(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(let i of t)if(i.containsRange(e))return!1;return!0}};function I_(e,t){let i=Vt(e,t),s={equal:0,insert:0,delete:0},n=[],r="",o="";for(let a of[...i,null])a=="insert"?o+=t[s.equal+s.insert]:a=="delete"?r+=e[s.equal+s.delete]:(r.length||o.length)&&(n.push({offset:s.equal,actual:r,expected:o}),r="",o=""),a&&s[a]++;return n}function x_(e,t){if(!e.isCollapsed)return ye(e.getItems());let i=e.start;return i.textNode?i.textNode:!i.nodeBefore||i.isEqual(t.start)?i.nodeAfter:i.nodeBefore}var E_=class extends W{refresh(){let e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();ma(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){let e=this.editor,t=this.editor.model,i=t.document.selection,s=e.commands.get("link");t.change(n=>{let r=i.isCollapsed?[js(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(let o of r)if(n.removeAttribute("linkHref",o),s)for(let a of s.manualDecorators)n.removeAttribute(a.id,o)})}};var T_=z(),A_=class extends T_{id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:s,styles:n,defaultValue:r}){super(),this.id=e,this.set("value",void 0),this.defaultValue=r,this.label=t,this.attributes=i,this.classes=s,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}};var S_="ck-link_selected",ff="automatic",P_="manual",L_=/^(https?:)?\/\//,mr=class extends k{_linkOpeners=[];static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[lr,ra,ot]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}init(){let e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:hf}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(s,n)=>hf(gf(s,t),n)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:s=>s.getAttribute("href")}}),e.commands.add("link",new C_(e)),e.commands.add("unlink",new E_(e));let i=b_(e.t,__(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(s=>s.mode===ff)),this._enableManualDecorators(i.filter(s=>s.mode===P_)),e.plugins.get(lr).registerAttribute("linkHref"),aa(e,"linkHref","a",S_),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration(),this._enableDecoratorConflictPostfixer()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){let t=this.editor,i=t.commands.get("link"),s=i.automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:ff,callback:n=>!!n&&L_.test(n),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.setConflictChecker((n,r)=>{for(let o of i.manualDecorators)if(r.hasAttribute(o.id)&&pa(n,o))return!0}),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;let t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(s=>{t.model.schema.extend("$text",{allowAttributes:s.id});let n=new A_(s);i.add(n),t.conversion.for("downcast").add(r=>{let o=l=>{let c=l.createAttributeElement("a",n.attributes,{priority:5});n.classes&&l.addClass(n.classes,c);for(let u in n.styles)l.setStyle(u,n.styles[u],c);return l.setCustomProperty("link",!0,c),c},a=l=>(c,u,d)=>{if(!(!u.item.is("selection")&&!d.schema.isInline(u.item))){if(!l&&u.attributeOldValue){if(!d.consumable.test(u.item,c.name))return;d.writer.unwrap(d.mapper.toViewRange(u.range),o(d.writer))}if(l&&u.attributeNewValue){if(!d.consumable.consume(u.item,c.name))return;u.item.is("selection")?d.writer.wrap(d.writer.document.selection.getFirstRange(),o(d.writer)):d.writer.wrap(d.mapper.toViewRange(u.range),o(d.writer))}}};r.on(`attribute:${n.id}`,a(!1),{priority:me.high-1}),r.on(`attribute:${n.id}`,a(!0),{priority:me.high-2})}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...n._createPattern()},model:{key:n.id}})})}_enableLinkOpen(){let e=this.editor,t=e.editing.view.document,i=s=>{this._linkOpeners.some(n=>n(s))||y_(s)};this.listenTo(t,"click",(s,n)=>{if(!(I.isMac?n.domEvent.metaKey:n.domEvent.ctrlKey))return;let r=n.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;let o=r.getAttribute("href");o&&(s.stop(),n.preventDefault(),i(o))},{context:"$capture"}),this.listenTo(t,"keydown",(s,n)=>{let r=e.commands.get("link").value;
19r&&n.keyCode===L.enter&&n.altKey&&(s.stop(),i(r))})}_enableSelectionAttributesFixer(){let e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",(i,{attributeKeys:s})=>{!s.includes("linkHref")||t.hasAttribute("linkHref")||e.change(n=>{V_(n,M_(e.schema))})})}_enableClipboardIntegration(){let e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,n)=>{t.change(r=>{let o=r.createRangeIn(n.content);for(let a of o.getItems())if(a.hasAttribute("linkHref")){let l=wa(a.getAttribute("linkHref"),i);r.setAttribute("linkHref",l,a)}})})}_enableDecoratorConflictPostfixer(){let e=this.editor,t=e.model,i=e.commands.get("link");t.document.registerPostFixer(s=>{let n=!1,r=t.document.differ.getChanges(),o=new Set,a=new Set(i.manualDecorators.map(l=>l.id));for(let l of r){if(l.type==="attribute"){if(l.attributeKey!=="linkHref"&&!a.has(l.attributeKey))continue;for(let c of l.range.getItems())c.hasAttribute("linkHref")&&o.add(c)}l.type==="insert"&&l.attributes.has("linkHref")&&l.position.nodeAfter&&o.add(l.position.nodeAfter)}for(let l of o){let c=[];for(let u of i.manualDecorators)if(l.hasAttribute(u.id)){for(let d=c.length-1;d>=0;d--){let h=c[d];pa(h,u)&&(s.removeAttribute(h.id,l),c.splice(d,1),n=!0)}c.push(u)}}return n})}};function V_(e,t){e.removeSelectionAttribute("linkHref");for(let i of t)e.removeSelectionAttribute(i)}function M_(e){return e.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}var B_=class extends B{constructor(e){super(e);let t=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:t.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to(i=>{if(this.href){let s=()=>i.preventDefault();this.fire("navigate",this.href,s)}})}}),this.template.tag="a"}};var O_=class extends A{focusTracker=new oe;keystrokes=new we;backButtonView;saveButtonView;manualDecoratorsButtonView;
19displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new Me;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.manualDecoratorsButtonView=this._createManualDecoratorsButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView())}),this._focusCycler=new rt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Qd({view:this}),[this.urlInputView,this.manualDecoratorsButtonView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(let e of this._validators){let t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){let e=this.locale.t,t=new B(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ci,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){let e=this.locale.t,t=new B(this.locale);return t.set({label:e("Insert"),tooltip:!1,withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createManualDecoratorsButton(){let e=this.locale.t,t=new B(this.locale);return t.set({label:e("Link properties"),icon:Ho,tooltip:!0,isVisible:!1}),t.delegate("execute").to(this,"showDecorators"),t}_createHeaderView(){let e=this.locale.t,t=new Us(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){let e=new Ui(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{let i=new kt(this.locale);return i.children.add(t),i}),e}_createDisplayedTextInput(){let e=this.locale.t,t=new rr(this.locale,sa);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){let e=this.locale.t,t=new rr(this.locale,sa);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new na(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new na(this.locale,{children:[this.urlInputView,this.manualDecoratorsButtonView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}))}get url(){let{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}};var R_=class extends A{focusTracker=new oe;keystrokes=new we;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new Me;_focusCycler;constructor(e){super(e),this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",!1),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0}),this.on("change:hasItems",(t,i,s)=>{s?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation))}),this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new rt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children})}render(){super.render(),[this.listView,this.backButtonView].forEac
19h(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createListView(){let e=new Ui(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{let i=new kt(this.locale);return i.children.add(t),i}),e}_createBackButton(){let e=this.locale.t,t=new B(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ci,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){let e=new Us(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){let e=new A(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}};var F_=class extends A{focusTracker=new oe;keystrokes=new we;backButtonView;children;listChildren;_focusables=new Me;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new rt({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(t,i)=>{this.fire("back"),i()})}render(){super.render(),[...this.listChildren,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBackButton(){let e=this.locale.t,t=new B(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:ci,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){let e=this.locale.t,t=new Us(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){let e=new Ui(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{let i=new kt(this.locale);return i.children.add(t),i}),e}};var D_=class extends B{arrowView;constructor(e){super(e),this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new Ct;return e.content=Kn,e}};var at="link-ui",N_=class extends k{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new pe;static get requires(){return[or,mr]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(Mu),this._balloon=e.plugins.get(or),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:at,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:at,view:(i,{writer:s})=>{if(!i.markerRange.isCollapsed)return null;let n=s.createUIElement("span");return s.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:fr},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy()}registerLinksListProvider(e){let t=this._linksProviders.filter(i=>(i.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){let e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){let e=this.editor,t=new Wi(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let s=e.config.get("link.toolbar");return i.manualDecorators.length||(s=s.filter(n=>n!=="linkProperties")),t.fillFromConfig(s,e.ui.componentFactory),t.keystrokes.set("Esc",(n,r)=>{this._hideUI(),r()}),t.keystrokes.set(fr,(n,r)=>{this._addFormView(),r()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){let e=this.editor,t=e.locale.t,i=e.commands.get("link"),s=e.config.get("link.defaultProtocol"),n=new(ea(O_))(e.locale,z_(e));return n.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",r=>r!==void 0),n.urlInputView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("isEnabled").to(i,"isEnabled"),n.saveButtonView.bind("label").to(i,"value",r=>t(r?"Update":"Insert")),this.listenTo(n,"submit",()=>{if(n.isValid()){let r=n.urlInputView.fieldView.element.value,o=wa(r,s),a=n.displayedTextInputView.fieldView.element.value;e.execute("link",o,this._getDecoratorSwitchesState(),a!==this.selectedLinkableText?a:void 0),this._closeFormView()}}),this.listenTo(n.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(r,o)=>{this._closeFormView(),o()}),n.providersListChildren.bindTo(this._linksProviders).using(r=>this._createLinksListProviderButton(r)),n.manualDecoratorsButtonView.isVisible=i.manualDecorators.length>0,this.listenTo(n,"showDecorators",()=>{this._addPropertiesView()}),n}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:s})=>{let n=new B;return n.set({label:i,icon:s,tooltip:!1,withText:!0}),n.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),n})}_createLinkProviderItemsView(e){let t=this.editor,i=t.locale.t,s=new R_(t.locale),{emptyListPlaceholder:n,label:r}=e;return s.emptyListPlaceholder=n||i("No links available"),s.title=r,this.listenTo(s,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),s}_createPropertiesView(){let e=this.editor,t=this.editor.commands.get("link"),i=new(ea(F_))(e.locale);return this.listenTo(i,"back",()=>{this._isFormInPanel?(this._removePropertiesView(),this.formView.focus()):(e.editing.view.focus(),this._removePropertiesView())}),i.listChildren.bindTo(t.manualDecorators).using(s=>{let n=new nr(e.locale);return n.set({label:s.label,withText:!0}),n.bind("isOn").toMany([s,t],"value",(r,o)=>o===void 0&&r===void 0?!!s.defaultValue:!!r),n.on("execute",()=>{let r=!n.isOn;t.value!==void 0?e.execute("link",t.value,{...this._getDecoratorSwitchesState(),[s.id]:r}):this._togglePendingManualDecorator(s,r)}),n}),i}_getDecoratorSwitchesState(){let e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{let s=e.value===void 0&&i.value===void 0?i.defaultValue:i.value;return{...t,[i.id]:!!s}},{})}_togglePendingManualDecorator(e,t){let i=this.editor.commands.get("link"),s=Array.from(i.manualDecorators),n=this._getDecoratorSwitchesState(),r=s.map(a=>({id:a.id,attributes:a.attributes,styles:a.styles,value:n[a.id]}));n[e.id]=t;let o=wf({decoratorStates:n,allDecorators:r});for(let a of s)a.value=o[a.id]}_resetPendingManualDecoratorsState(){let e=this.editor.commands.get("link");for(let t of e.manualDecorators)t.value=void 0}
19_registerEditingOpeners(){this.editor.plugins.get(mr)._registerLinkOpener(e=>{let t=this._getLinkProviderLinkByHref(e);if(!t)return!1;let{item:i,provider:s}=t;return s.navigate?s.navigate(i):!1})}_registerComponents(){let e=this.editor;e.ui.componentFactory.add("link",()=>{let t=this._createButton(B);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{let t=this._createButton(te);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{let i=new B_(t),s=e.config.get("link.allowedProtocols"),n=e.commands.get("link"),r=t.t;i.bind("isEnabled").to(n,"value",a=>!!a),i.bind("href").to(n,"value",a=>a&&gf(a,s));let o=a=>{if(a===""){i.label=r("This link has no URL"),i.icon=void 0,i.tooltip=!1;return}if(!a){i.label=void 0,i.icon=void 0,i.tooltip=r("Open link in new tab");return}let l=this._getLinkProviderLinkByHref(a);if(l){let{label:c,tooltip:u,icon:d}=l.item;i.label=c,i.tooltip=u||!1,i.icon=d}else i.label=a,i.icon=void 0,i.tooltip=r("Open link in new tab")};return o(n.value),this.listenTo(n,"change:value",(a,l,c)=>{o(c)}),this.listenTo(i,"navigate",(a,l,c)=>{let u=this._getLinkProviderLinkByHref(l);if(!u)return;let{provider:d,item:h}=u,{navigate:m}=d;m&&m(h)&&(a.stop(),c())}),i}),e.ui.componentFactory.add("unlink",t=>{let i=e.commands.get("unlink"),s=new B(t),n=t.t;return s.set({label:n("Unlink"),icon:kd,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{e.execute("unlink"),this._hideUI()}),s}),e.ui.componentFactory.add("editLink",t=>{let i=e.commands.get("link"),s=new B(t),n=t.t;return s.set({label:n("Edit link"),icon:hd,tooltip:!0}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{this._addFormView()}),s}),e.ui.componentFactory.add("linkProperties",t=>{let i=e.commands.get("link"),s=new B(t),n=t.t;return s.set({label:n("Link properties"),icon:Ho,tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(r,o,a)=>r&&o!==void 0&&a.length>0),this.listenTo(s,"execute",()=>{this._addPropertiesView()}),s})}_createLinksListProviderButton(e){let t=this.editor.locale,i=new D_(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e)}),i}_createButton(e){let t=this.editor,i=t.locale,s=t.commands.get("link"),n=new e(t.locale),r=i.t;return n.set({label:r("Link"),icon:ud,keystroke:fr,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",o=>!!o),this.listenTo(n,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),n}_enableBalloonActivators(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(fr,(i,s)=>{s(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),er({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&e.value!==void 0,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){let e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){if(this._isFormInPanel){let t=this.editor.commands.get("link");this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),t.value===void 0&&this._resetPendingManualDecoratorsState(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection()}}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpd
19atingUI()}_hideUI(e=!0){let t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){let e=this.editor,t=e.editing.view.document,i=this._getSelectedLinkElement(),s=r(),n=()=>{let o=this._getSelectedLinkElement(),a=r();i&&!o||!i&&a!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=o,s=a};function r(){return t.selection.focus.getAncestors().reverse().find(o=>o.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}get _arePropertiesInPanel(){return!!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return!!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return!!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return!!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return!!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){let e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(at)){let i=this.editor.editing.mapper.markerNameToElements(at);if(i){let s=Array.from(i),n=e.createRange(e.createPositionBefore(s[0]),e.createPositionAfter(s[s.length-1]));return{target:e.domConverter.viewRangeToDom(n)}}}return{target:()=>{let i=this._getSelectedLinkElement();return i?e.domConverter.mapViewToDom(i):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){let e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&j(i))return fa(t.getFirstPosition());{let s=t.getFirstRange().getTrimmed(),n=fa(s.start),r=fa(s.end);return!n||n!=r?null:e.createRangeIn(n).getTrimmed().isEqual(s)?n:null}}_getSelectedLinkableText(){let e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return ga(e.document.selection.getFirstRange());let s=t.view.createRangeOn(i);return ga(t.mapper.toModelRange(s))}_getLinkProviderLinkByHref(e){if(!e)return null;for(let t of this._linksProviders){let i=t.getItem?t.getItem(e):t.getListItems().find(s=>s.href===e);if(i)return{provider:t,item:i}}return null}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let i=e.document.selection.getFirstRange();if(e.markers.has(at))t.updateMarker(at,{range:i});else if(i.start.isAtEnd){let s=i.start.getLastMatchingPosition(({item:n})=>!e.schema.isContent(n),{boundaries:i});t.addMarker(at,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(at,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(at)&&e.change(t=>{t.removeMarker(at)})}};function fa(e){return e.getAncestors().find(t=>p_(t))||null}function z_(e){let t=e.t,i=e.config.get("link.allowCreatingEmptyLinks");return[s=>{if(!i&&!s.url.length)return t("Link URL must not be empty.")}]}var H_=4,bf=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}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),U_=2,W_=class extends k{static get requires(){return[xt,mr]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?js(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){let i=this.editor.model,s=i.document.selection,n=s.getFirstPosition(),r=s.getLastPosition(),o=t.getJoined(this._expandLinkRange(i,n)||t);o&&(o=o.getJoined(this._expandLinkRange(i,r)||t)),o&&(o.start.isBefore(n)||o.end.isAfter(r))&&e.setSelection(o)}_enablePasteLinking(){let e=this.editor,t=e.model,i=t.document.selection,s=e.plugins.get("ClipboardPipeline"),n=e.commands.get("link");s.on("inputTransformation",(r,o)=>{if(!this.isEnabled||!n.isEnabled||i.isCollapsed||o.method!=="paste"||i.rangeCount>1)return;let a=i.getFirstRange(),l=o.dataTransfer.getData("text/plain");if(!l)return;let c=l.match(bf);c&&c[2]===l&&(t.change(u=>{this._selectEntireLinks(u,a),n.execute(l)}),r.stop())},{priority:"high"})}_enableTypingHandling(){let e=this.editor,t=new Lh(e.model,i=>{let s=i;if(!q_(s))return;s=s.slice(0,-1),"!.:,;?".includes(s[s.length-1])&&(s=s.slice(0,-1));let n=mf(s);if(n)return{url:n,removedTrailingCharacters:i.length-s.length}});t.on("matched:data",(i,s)=>{let{batch:n,range:r,url:o,removedTrailingCharacters:a}=s;if(!n.isTyping)return;let l=r.end.getShiftedBy(-a),c=l.getShiftedBy(-o.length),u=e.model.createRange(c,l);this._applyAutoLink(o,u)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){let e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{let s=t.document.selection.getFirstPosition(),n;s.parent.previousSibling?.is("element")?n=t.createRangeIn(s.parent.previousSibling):n=t.createRange(t.createPositionAt(s.parent,0),s),this._checkAndApplyAutoLinkOnRange(n)})}_enableShiftEnterHandling(){let e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{let s=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)})}_checkAndApplyAutoLinkOnRange(e){let t=this.editor.model,{text:i,range:s}=oa(e,t),n=mf(i);if(n){let r=t.createRange(s.end.getShiftedBy(-n.length),s.end);this._applyAutoLink(n,r)}}_applyAutoLink(e,t){let i=this.editor.model,s=wa(e,this.editor.config.get("link.defaultProtocol"));!this.isEnabled||!$_(t,i)||!pf(s)||K_(t)||this._persistAutoLink(s,t)}_persistAutoLink(e,t){let i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(n=>{n.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}};function q_(e){return e.length>H_&&e[e.length-1]===" "&&e[e.length-2]!==" "}function mf(e){let t=bf.exec(e);return t?t[U_]:null}function $_(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}function K_(e){let t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}
19var _f=class extends k{static get requires(){return[mr,N_,W_]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}};function _a(e){return e.map(t=>j_(t)).filter(t=>t!==void 0)}var vf={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function j_(e){if(typeof e=="number"&&(e=String(e)),typeof e=="object"&&J_(e))return ba(e);let t=Z_(e);if(t)return ba(t);if(e==="default")return{model:void 0,title:"Default"};if(!Y_(e))return G_(e)}function G_(e){return typeof e=="string"&&(e={title:e,model:`${parseFloat(e)}px`}),e.view={name:"span",styles:{"font-size":e.model}},ba(e)}function ba(e){return e.view&&typeof e.view!="string"&&!e.view.priority&&(e.view.priority=7),e}function Z_(e){return typeof e=="string"?vf[e]:vf[e.model]}function J_(e){return e.title&&e.model&&e.view}function Y_(e){let t;if(typeof e=="object")if(e.model)t=parseFloat(e.model);else throw new f("font-size-invalid-definition",null,e);else t=parseFloat(e);return isNaN(t)}var Oe=class{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward=t.direction=="forward",this._includeSelf=!!t.includeSelf,this._sameAttributes=U(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){return ye(new this(e,t)[Symbol.iterator]())}*[Symbol.iterator](){let e=[];for(let{node:t}of new en(this._getStartNode(),this._isForward?"forward":"backward")){let i=t.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some(s=>t.getAttribute(s)!==this._startElement.getAttribute(s)))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}},en=class{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(e,t="forward"){this._node=e,this._isForward=t==="forward"}[Symbol.iterator](){return this}next(){if(!D(this._node))return{done:!0,value:void 0};let e=this._node.getAttribute("listIndent"),t=null;if(this._previous){let s=this._previousNodeIndent;e>s?this._previousNodesByIndent[s]=this._previous:e<s?(t=this._previousNodesByIndent[e]||null,this._previousNodesByIndent.length=e):t=this._previous}let i={node:this._node,previous:this._previous,previousNodeInList:t};return this._previous=this._node,this._previousNodeIndent=e,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:i,done:!1}}},Q_=class{_listHead;constructor(e){this._listHead=e}[Symbol.iterator](){return new en(this._listHead)}};var Ji=class{static next(){return X()}};function D(e){return!!e&&e.is("element")&&e.hasAttribute("listItemId")}function Yi(e,t={}){return[...Nt(e,{...t,direction:"backward"}),...Nt(e,{...t,direction:"forward"})]}function Nt(e,t={}){let i=t.direction=="forward",s=Array.from(new Oe(e,{...t,includeSelf:i,sameIndent:!0,sameAttributes:"listItemId"}));return i?s:s.reverse()}function X_(e){return Array.from(new Oe(e,{direction:"forward",higherIndent:!0}))}function Bf(e,t){let i=new Oe(e,{sameIndent:!0,sameAttributes:"listType",...t}),s=new Oe(e,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(i).reverse(),...s]}function zt(e){return!Oe.first(e,{sameIndent:!0,sameAttributes:"listItemId"})}function yf(e){return!Oe.first(e,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function tn(e,t={}){e=U(e);let i=t.withNested!==!1,s=new Set;for(let n of e)for(let r of Yi(n,{higherIndent:i}))s.add(r);return fi(s)}function ev(e){e=U(e);let t=new Set;for(let i of e)for(let s of Bf(i))t.add(s);return fi(t)}function Ia(e,t){let i=Nt(e,{direction:"forward"}),s=Ji.next();for(let n of i)t.setAttribute("listItemId",s,n);return i}function ya(e,t,i){let s={};for(let[r,o]of t.getAttributes())r.startsWith("list")&&(s[r]=o);let n=Nt(e,{direction:"forward"});for(let r of n)i.setAttributes(s,r);return n}function ka(e,t,{expand:i,indentBy:s=1,attributeNames:n}){e=U(e);let r=i?tn(e):e;for(let o of r){let a=o.getAttribute("listIndent")+s;a<0?wr(o,t,n):t.setAttribute("listIndent",a,o)}return r}function tv(e,t,{attributeNames:i}){e=U(e);let s=tn(e),n=new Set,r=Math.min(...s.map(a=>a.getAttribute("listIndent"))),o=new Map;for(let a of s)o.set(a,Oe.first(a,{lowerIndent:!0}));for(let a of s){if(n.has(a))continue;n.add(a);let l=a.getAttribute("listIndent")-1;if(l<0){wr(a,t,i);continue}if(a.getAttribute("listIndent")==r&&o.get(a)){let c=rv(a,o.get(a),t);for(let u of c)n.add(u);if(c.length)continue}t.setAttribute("listIndent",l,a)}return fi(n)}function wr(e,t,i){e=U(e);for(let s of e)s.is("element","listItem")&&t.rename(s,"paragraph");for(let s of e)for(let n of s.getAttributeKeys())i.includes(n)&&t.removeAttribute(n,s);return e}function Qs(e){if(!e.length)return!1;let t=e[0].getAttribute("listItemId");return t?!e.some(i=>i.getAttribute("listItemId")!=t):!1}function iv(e,t){let i=[],s=Number.POSITIVE_INFINITY;for(let{node:n}of new en(e.nextSibling)){let r=n.getAttribute("listIndent");if(r==0)break;r<s&&(s=r);let o=r-s;t.setAttribute("listIndent",o,n),i.push(n)}return i}function fi(e){return Array.from(e).filter(t=>t.root.rootName!=="$graveyard").sort((t,i)=>t.index-i.index)}function Xs(e){let t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function va(e,t){return t.checkChild(e.parent,"listItem")&&t.checkChild(e,"$text")&&!t.isObject(e)}function sv(e){return e=="numbered"||e=="customNumbered"}function nv(e){let t=e.getAttribute("listIndent"),i=e.getAttribute("listType"),s=e.getAttribute("listItemId"),n=e.previousSibling,r=!1;for(;D(n);){let o=n.getAttribute("listIndent");if(o<t)return!0;
19if(o===t)return n.getAttribute("listItemId")===s?!1:n.getAttribute("listType")!==i;r=!0,n=n.previousSibling}return!r}function rv(e,t,i){return Nt(t,{direction:"forward"}).pop().index>e.index?ya(e,t,i):[]}var kf=class extends W{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor,t=e.model,i=Cf(t.document.selection),s=e.plugins.get("ListEditing").getListAttributeNames();t.change(n=>{let r=[];Qs(i)&&!zt(i[0])?(this._direction=="forward"&&r.push(...ka(i,n,{attributeNames:s})),r.push(...Ia(i[0],n))):this._direction=="forward"?r.push(...ka(i,n,{expand:!0,attributeNames:s})):r.push(...tv(i,n,{attributeNames:s}));for(let o of r){if(!o.hasAttribute("listType"))continue;let a=Oe.first(o,{sameIndent:!0});a&&n.setAttribute("listType",a.getAttribute("listType"),o)}this._fireAfterExecute(r)})}_fireAfterExecute(e){this.fire("afterExecute",fi(new Set(e)))}_checkEnabled(){let e=Cf(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction=="backward"||Qs(e)&&!zt(e[0])||this.editor.config.get("list.enableSkipLevelLists"))return!0;e=tn(e),t=e[0];let i=Oe.first(t,{sameIndent:!0});return i?i.getAttribute("listType")==t.getAttribute("listType"):!1}
19};function Cf(e){let t=Array.from(e.getSelectedBlocks()),i=t.findIndex(s=>!D(s));return i!=-1&&(t.length=i),t}var gr=class extends W{type;_listWalkerOptions;constructor(e,t,i={}){super(e),this.type=t,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,i=t.document,s=Xs(t),n=Array.from(i.selection.getSelectedBlocks()).filter(o=>t.schema.checkAttribute(o,"listType")||va(o,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(o=>{if(r){let a=n[n.length-1],l=this.editor.plugins.get("ListEditing").getListAttributeNames(),c=Nt(a,{direction:"forward"}),u=[];c.length>1&&u.push(...Ia(c[1],o)),u.push(...wr(n,o,l)),u.push(...iv(a,o)),this._fireAfterExecute(u)}else if((s||i.selection.isCollapsed)&&D(n[0])){let a=Bf(s||n[0],this._listWalkerOptions);for(let l of a)o.setAttributes({...e.additionalAttributes,listType:this.type},l);this._fireAfterExecute(a)}else{let a=[];for(let l of n)if(!l.hasAttribute("listType"))!l.is("element","listItem")&&va(l,t.schema)&&o.rename(l,"listItem"),o.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:Ji.next(),listType:this.type},l),a.push(l);else for(let c of tn(l,{withNested:!1}))c.getAttribute("listType")!=this.type&&(o.setAttributes({...e.additionalAttributes,listType:this.type},c),a.push(c));this._fireAfterExecute(a)}})}_fireAfterExecute(e){this.fire("afterExecute",fi(new Set(e)))}_getValue(){let e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(let i of t)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){let e=this.editor.model,t=e.schema,i=e.document.selection,s=Array.from(i.getSelectedBlocks());if(!s.length)return!1;if(this.value)return!0;for(let n of s)if(t.checkAttribute(n,"listType")||va(n,t))return!0;return!1}};var If=class extends W{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){let t=this.editor,i=t.model,s=i.document.selection,n=[],r=t.plugins.get("ListEditing").getListAttributeNames();i.change(o=>{let{firstElement:a,lastElement:l}=this._getMergeSubjectElements(s,e);if(!a||!l)return;let c=a.getAttribute("listIndent")||0,u=l.getAttribute("listIndent"),d=l.getAttribute("listItemId");if(c!=u){let h=X_(l);n.push(...ka([l,...h],o,{indentBy:c-u,expand:c<u,attributeNames:r}))}if(e){let h=s;s.isCollapsed&&(h=o.createSelection(o.createRange(o.createPositionAt(a,"end"),o.createPositionAt(l,0)))),i.deleteContent(h,{doNotResetEntireContent:s.isCollapsed});let m=h.getLastPosition().parent,g=m.nextSibling;n.push(m),g&&g!==l&&g.getAttribute("listItemId")==d&&n.push(...ya(g,m,o))}else n.push(...ya(l,a,o));this._fireAfterExecute(n)})}_fireAfterExecute(e){this.fire("afterExecute",fi(new Set(e)))}_checkEnabled(){let e=this.editor.model,t=e.document.selection,i=Xs(e);if(t.isCollapsed||i){let s=i||t.getFirstPosition().parent;if(!D(s))return!1;let n=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!n||Qs([s,n]))return!1}else{let s=t.getLastPosition(),n=t.getFirstPosition();if(s.parent===n.parent||!D(s.parent))return!1}return!0}_getMergeSubjectElements(e,t){let i=this.editor.model,s=Xs(i),n,r;if(e.isCollapsed||s){let o=s||e.getFirstPosition().parent,a=zt(o);this._direction=="backward"?(r=o,a&&!t?(n=Oe.first(o,{sameIndent:!0,lowerIndent:!0}),!n&&D(o.previousSibling)&&(n=o.previousSibling)):n=o.previousSibling):(n=o,r=o.nextSibling)}else n=e.getFirstPosition().parent,r=e.getLastPosition().parent;return{firstElement:n,lastElement:r}}};var xf=class extends W{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(e=>{let t=Ia(this._getStartBlock(),e);this._fireAfterExecute(t)})}_fireAfterExecute(e){this.fire("afterExecute",fi(new Set(e)))}_checkEnabled(){let e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&D(t)&&!zt(t)}_getStartBlock(){let e=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?e:e.nextSibling}};var ov=class extends k{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[je]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(je);!e.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("bold","listItemBold"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(s,n,r,o){n&&(s.addClass("ck-list-marker-bold",r),I.isSafari&&!(o&&o.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-bold","0",r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemBold"}),t.schema.setAttributeProperties("listItemBold",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemBold"),e.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}))}};var av=class extends k{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[je]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(je);!e.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("italic","listItemItalic"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(s,n,r,o){n&&(s.addClass("ck-list-marker-italic",r),I.isSafari&&!(o&&o.dataPipeline)&&s.setStyle("--ck-content-list-marker-dummy-italic","0",r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),t.schema.setAttributeProperties("listItemItalic",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemItalic"),e.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}))}};var lv=class extends k{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[je]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(je);if(!e.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;let s=_a(e.config.get("fontSize.options"));t.registerFormatAttribute("fontSize","listItemFontSize"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(n,r,o,a){if(r){let l=s.find(c=>c.model==r);l&&l.view&&typeof l.view!="string"?l.view.styles?(n.addClass("ck-list-marker-font-size",o),n.setStyle("--ck-content-list-marker-font-size",l.view.styles["font-size"],o)):l.view.classes&&(n.addClass(`ck-list-marker-font-size-${r}`,o),I.isSafari&&!(a&&a.dataPipeline)&&n.setStyle("--ck-content-list-marker-dummy-font-size","0",o)):(n.addClass("ck-list-marker-font-size",o),n.setStyle("--ck-content-list-marker-font-size",r,o))}}})}afterInit(){let e=this.editor,t=e.model;if(!e.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;t.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),t.schema.setAttributeProperties("listItemFontSize",{isFormatting:!0}),t.schema.addAttributeCheck(s=>{if(!s.last.getAttribute("listItemId"))return!1},"listItemFontSize"),e.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s=>s.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});let i=_a(e.config.get("fontSize.options"));for(let s of i)s.model&&s.view&&e.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:s.model},view:{name:"li",classes:`ck-list-marker-font-size-${s.model}`}})}};var cv=class extends k{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[je]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(je);!e.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("fontColor","listItemFontColor"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(s,n,r){n&&(s.addClass("ck-list-marker-color",r),s.setStyle("--ck-content-list-marker-color",n,r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),t.schema.setAttributeProperties("listItemFontColor",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontColor"),e.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:i=>i.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}))}};var uv=class extends k{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[je]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(je);!e.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("fontFamily","listItemFontFamily"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(s,n,r){n&&(s.addClass("ck-list-marker-font-family",r),s.setStyle("--ck-content-list-marker-font-family",n,r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),t.schema.setAttributeProperties("listItemFontFamily",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontFamily"),e.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:i=>i.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}))}};var dv=class extends k{_loadedFormatting={};static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[ov,av,lv,cv,uv]}constructor(e){super(e),e.config.define("list.enableListItemMarkerFormatting",!0)}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){let e=this.editor.model;e.document.registerPostFixer(t=>{let i=e.document.differ.getChanges(),s=new Set,n=!1;for(let r of i)if(r.type==="attribute")(r.attributeKey=="listItemId"||r.attributeKey=="listType"||this._isInlineOrSelectionFormatting(r.attributeKey)||Object.values(this._loadedFormatting).includes(r.attributeKey))&&(D(r.range.start.nodeAfter)?s.add(r.range.start.nodeAfter):D(r.range.start.parent)&&s.add(r.range.start.parent));else if(D(r.position.nodeAfter)&&s.add(r.position.nodeAfter),D(r.position.nodeBefore)&&s.add(r.position.nodeBefore),D(r.position.parent)&&s.add(r.position.parent),r.type=="insert"&&r.name!="$text"){let o=t.createRangeIn(r.position.nodeAfter);for(let a of o.getItems())D(a)&&s.add(a)}for(let r of s){let o=hv(e,r,Object.keys(this._loadedFormatting));for(let[a,l]of Object.entries(o)){let c=this._loadedFormatting[a
19];(l&&fv(t,r,c,l)||!l&&mv(t,r,c))&&(n=!0)}}return n})}registerFormatAttribute(e,t){this._loadedFormatting[e]=t}_isInlineOrSelectionFormatting(e){return e.replace(/^selection:/,"")in this._loadedFormatting}};function hv(e,t,i){return zt(t)?Ef(e,t,i):Ef(e,Yi(t)[0],i)}function Ef(e,t,i){if(!gv(t)||e.schema.isLimit(t))return Object.fromEntries(i.map(o=>[o]));if(t.isEmpty)return Object.fromEntries(i.map(o=>[o,t.getAttribute(`selection:${o}`)]));let s=new Set(i),n={},r=e.createRangeIn(t).getWalker({ignoreElementEnd:!0});for(let{item:o}of r){for(let a of s)if(e.schema.checkAttribute(o,a)){let l=o.getAttribute(a);l===void 0?(s.delete(a),n[a]=void 0):n[a]===void 0?n[a]=l:n[a]!==l&&(s.delete(a),n[a]=void 0)}else a in n||(n[a]=void 0);if(!s.size)break;e.schema.isLimit(o)&&r.jumpTo(e.createPositionAfter(o))}return n}function fv(e,t,i,s){let n=Yi(t),r=!1;for(let o of n)(!o.hasAttribute(i)||o.getAttribute(i)!==s)&&(e.setAttribute(i,s,o),r=!0);return r}function mv(e,t,i){let s=Yi(t),n=!1;for(let r of s)r.hasAttribute(i)&&(e.removeAttribute(i,r),n=!0);return n}function gv(e){return["numbered","bulleted","customNumbered","customBulleted"].includes(e.getAttribute("listType"))}var pv=class extends k{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(e){return ev(e)}isFirstBlockOfListItem(e){return zt(e)}isListItemBlock(e){return D(e)}expandListBlocksToCompleteItems(e,t={}){return tn(e,t)}isNumberedListType(e){return sv(e)}isFirstListItemInList(e){return nv(e)}};function wv(e){return e.is("element","ol")||e.is("element","ul")}function Ca(e){return e.is("element","li")}function bv(e){let t=0,i=e.parent;for(;i;){if(Ca(i))t++;else{let s=i.previousSibling;s&&Ca(s)&&t++}i=i.parent}return t}function Tf(e,t,i,s=Rf(i,t)){return e.createAttributeElement(Of(i),null,{priority:2*t/100-100,id:s})}function Af(e,t,i){return e.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:i})}function Of(e){return e=="numbered"||e=="customNumbered"?"ol":"ul"}function Rf(e,t){return`list-${e}-${t}`}function Ke(e,t,i){let s=e.nodeBefore;if(D(s)){let n=s;for(let{node:r}of new en(n,"backward"))if(n=r,i.has(n)||(i.add(n),t.has(s)))return;t.add(n)}else{let n=e.nodeAfter;D(n)&&t.add(n)}}function _v(e,t){let i=0,s=-1,n=null,r=!1;for(let{node:o}of e){let a=o.getAttribute("listIndent");if(a>i){let l;n===null?(n=a-i,l=i):(n>a&&(n=a),l=a-n),l>s+1&&(l=s+1),t.setAttribute("listIndent",l,o),r=!0,s=l}else n=null,i=a+1,s=a}return r}function vv(e,t,i){let s=new Set,n=!1;for(let{node:r}of e){if(s.has(r))continue;let o=r.getAttribute("listType"),a=r.getAttribute("listItemId");if(t.has(a)&&(a=Ji.next()),t.add(a),r.is("element","listItem")){r.getAttribute("listItemId")!=a&&(i.setAttribute("listItemId",a,r),n=!0);continue}for(let l of Nt(r,{direction:"forward"}))s.add(l),l.getAttribute("listType")!=o&&(a=Ji.next(),o=l.getAttribute("listType")),l.getAttribute("listItemId")!=a&&(i.setAttribute("listItemId",a,l),n=!0)}return n}function yv(){return(e,t,i)=>{let s=t.viewItem;if(s.getStyle("list-style-type")!=="none"||!kv(s)||!i.consumable.consume(s,{name:!0}))return;let{modelRange:n,modelCursor:r}=i.convertChildren(s,t.modelCursor);t.modelRange=n,t.modelCursor=r}}function kv(e){let t=!1;for(let i of e.getChildren()){if(i.is("element","ul")||i.is("element","ol")){t=!0;continue}return!1}return t}function Cv(){return(e,t,i)=>{let{writer:s,schema:n}=i;if(!t.modelRange)return;let r=Array.from(t.modelRange.getItems({shallow:!0})).filter(d=>n.checkAttribute(d,"listItemId"));if(!r.length||r.every(d=>d.hasAttribute("listItemId")))return;let o=t.viewItem.getAttribute("data-list-item-id")||Ji.next();i.consumable.consume(t.viewItem,{attributes:"data-list-item-id"});let a=bv(t.viewItem),l=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted",c=r[0].getAttribute("listType");c&&(l=c);let u={listItemId:o,listIndent:a,listType:l};for(let d of r)d.hasAttribute("listItemId")||s.setAttributes(u,d);r.length>1&&r[1].getAttribute("listItemId")!=u.listItemId&&i.keepEmptyElement(r[0])}}function Iv(e,t,i,s){return()=>{let u=e.document.differ.getChanges(),d=[],h=new Set,m=new Set,g=new Set;for(let w of u)if(w.type=="insert"&&w.name!="$text")Ke(w.position,h,g),w.attributes.has("listItemId")?m.add(w.position.nodeAfter):Ke(w.position.getShiftedBy(w.length),h,g);else if(w.type=="remove"&&w.attributes.has("listItemId"))Ke(w.position,h,g);else if(w.type=="attribute"){let T=w.range.start.nodeAfter;i.includes(w.attributeKey)?(Ke(w.range.start,h,g),w.attributeNewValue===null?(Ke(w.range.start.getShiftedBy(1),h,g),a(T)&&d.push(T)):m.add(T)):D(T)&&a(T)&&d.push(T)}for(let w of h.values())d.push(...n(w,m));for(let w of new Set(d))t.reconvertItem(w)};function n(u,d){let h=[],m=new Set,g=[];for(let{node:w,previous:T}of new en(u)){if(m.has(w))continue;let E=w.getAttribute("listIndent");T&&E<T.getAttribute("listIndent")&&(g.length=E+1),g[E]={modelAttributes:r(w),modelElement:w},o(w,E,g);let G=Nt(w,{direction:"forward"});for(let V of G)m.add(V),(a(V,G)||c(V,g,d))&&h.push(V)}return h}function r(u){return Object.fromEntries(Array.from(u.getAttributes()).filter(([d])=>i.includes(d)))}function o(u,d,h){for(let m=d-1;m>=0&&!h[m];m--){let g=Df(u,m),w=null;if(!g){for(let E=m-1;E>=0;E--)if(h[E]){w=h[E].modelElement;break}}let T=g||w||u;h[m]={modelAttributes:{...r(T),listItemId:`list-item-skip-${m}`,listIndent:m},modelElement:T}}}function a(u,d){let h=t.mapper.toViewElement(u);if(!h)return!1;if(l(h)||s.fire("checkElement",{modelElement:u,viewElement:h}))return!0;
19if(!u.is("element","paragraph")&&!u.is("element","listItem"))return!1;let m=Nf(u,i,d);return m&&h.is("element","p")?!0:!!(!m&&h.is("element","span"))}function l(u){for(u=u.parent;u.is("attributeElement")&&["ol","ul","li"].includes(u.name);)u=u.parent;return!!(u.getCustomProperty("$structureSlotParent")&&!t.mapper.toModelElement(u))}function c(u,d,h){if(h.has(u))return!1;let m=t.mapper.toViewElement(u),g=d.length-1;for(let w=m.parent;!w.is("editableElement");w=w.parent){let T=Ca(w),E=wv(w);if(!(!E&&!T)){if(d[g]){let G=`checkAttributes:${T?"item":"list"}`;if(s.fire(G,{viewElement:w,modelAttributes:d[g].modelAttributes,modelReferenceElement:d[g].modelElement}))break}if(E&&(g--,g<0))return!1}}return!0}}function Sf(e,t,i,{dataPipeline:s,enableSkipLevelLists:n}){let r=Lv(e,t);return(o,a,l)=>{let{writer:c,mapper:u,consumable:d}=l,h=a.item;if(!e.includes(a.attributeKey)||!r(h,d))return;let m={...l.options,dataPipeline:s,enableSkipLevelLists:n},g=Ev(h,u,i,c);Ff(g,c,u),Sv(g,c),Pv(h,Av(h,g,t,c,m),t,c,m)}}function xv(e){return(t,i,s)=>{let{writer:n,mapper:r}=s,o=t.name.split(":")[1];if(!e.checkAttribute(o,"listItemId"))return;let a=r.toViewPosition(i.position),l=i.position.getShiftedBy(i.length),c=r.toViewPosition(l,{isPhantom:!0}),u=n.createRange(a,c).getTrimmed().end.nodeBefore;u&&Ff(u,n,r)}}function Pf(e,{dataPipeline:t}={}){return(i,{writer:s})=>{if(!Nf(i,e))return null;if(!t)return s.createContainerElement("span",{class:"ck-list-bogus-paragraph"});let n=s.createContainerElement("p");return s.setCustomProperty("dataPipeline:transparentRendering",!0,n),n}}function Ev(e,t,i,s){let n=i.createRangeOn(e),r=t.toViewRange(n).getTrimmed().getWalker();for(let{item:o}of r)if(o.is("element")&&o.getCustomProperty("listItemMarker"))r.jumpTo(s.createPositionAfter(o));else if(o.is("element")&&!o.getCustomProperty("listItemWrapper"))return o}function Tv(e,t){return(i,s)=>{if(s.modelPosition.offset>0)return;let n=s.modelPosition.parent;if(!D(n)||!e.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(n)))return;let r=s.mapper.toViewElement(n),o=t.createRangeIn(r),a=o.getWalker(),l=o.start;for(let{item:c}of a){if(c.is("element")&&s.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(l=t.createPositionAfter(c),a.skip(({previousPosition:u})=>!u.isEqual(l)))}s.viewPosition=l}}function Ff(e,t,i){for(;e.parent.is("attributeElement")&&e.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(e),e.parent);let s=[];n(t.createPositionBefore(e).getWalker({direction:"backward"})),n(t.createRangeIn(e).getWalker());for(let r of s)t.remove(r);function n(r){for(let{item:o}of r){if(o.is("element")&&i.toModelElement(o))break;o.is("element")&&o.getCustomProperty("listItemMarker")&&s.push(o)}}}function Av(e,t,i,s,{dataPipeline:n}){let r=s.createRangeOn(t);if(!zt(e))return r;for(let o of i){if(o.scope!="itemMarker")continue;let a=o.createElement(s,e,{dataPipeline:n});if(!a||(s.setCustomProperty("listItemMarker",!0,a),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(e)?s.insert(s.createPositionAt(t,0),a):(s.insert(r.start,a),r=s.createRange(s.createPositionBefore(a),s.createPositionAfter(t))),!o.createWrapperElement||!o.canWrapElement))continue;let l=o.createWrapperElement(s,e,{dataPipeline:n});s.setCustomProperty("listItemWrapper",!0,l),o.canWrapElement(e)?r=s.wrap(r,l):(r=s.wrap(s.createRangeOn(a),l),r=s.createRange(r.start,s.createPositionAfter(t)))}return r}function Sv(e,t){let i=e.parent;for(;i.is("attributeElement")&&["ul","ol","li"].includes(i.name);){let s=i.parent;t.unwrap(t.createRangeOn(e),i),i=s}}function Pv(e,t,i,s,n){if(!e.hasAttribute("listIndent"))return;let r=e.getAttribute("listIndent"),o=n.enableSkipLevelLists,a=e;for(let l=r;l>=0;l--){let c=a.getAttribute("listIndent")!==l;if(c){let u=Df(e,l)||a,d=u.getAttribute("listType"),h=Af(s,l,`list-item-skip-${l}`),m=Tf(s,l,d);s.setStyle("list-style-type","none",h);for(let g of i)g.scope=="list"&&u.hasAttribute(g.attributeName)&&g.setAttributeOnDowncast(s,u.getAttribute(g.attributeName),m,n,u);t=s.wrap(t,h),t=s.wrap(t,m)}else{let u=Af(s,l,a.getAttribute("listItemId")),d=Tf(s,l,a.getAttribute("listType"));for(let h of i)(h.scope=="list"||h.scope=="item")&&a.hasAttribute(h.attributeName)&&h.setAttributeOnDowncast(s,a.getAttribute(h.attributeName),h.scope=="list"?d:u,n,a);t=s.wrap(t,u),t=s.wrap(t,d)}if(l==0)break;if(!c){let u=Oe.first(a,{lowerIndent:!0});if(u)a=u;else if(!o)break}}}function Df(e,t){let i=e.nextSibling;for(;i&&D(i);){let s=i.getAttribute("listIndent");if(s<t)return null;if(s===t)return i;i=i.nextSibling}return null}function Lv(e,t){let i=t.filter(s=>s.consume===!1).map(s=>s.attributeName);return(s,n)=>{let r=[];for(let o of e)s.hasAttribute(o)&&!i.includes(o)&&r.push(`attribute:${o}`);return r.every(o=>n.test(s,o)!==!1)?(r.forEach(o=>n.consume(s,o)),!0):!1}}function Nf(e,t,i=Yi(e)){if(!D(e))return!1;for(let s of e.getAttributeKeys())if(!(s.startsWith("selection:")||s=="htmlEmptyBlock")&&!t.includes(s))return!1;return i.length<2}var pr=["listType","listIndent","listItemId"],je=class extends k{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ji,xt,pv,ot,dv]}constructor(e){super(e),e.config.define("list.multiBlock",!0)}init(){let e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new f("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:pr}),i?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"}
19)):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(let s of pr)t.schema.setAttributeProperties(s,{copyOnReplace:!0});e.commands.add("numberedList",new gr(e,"numbered")),e.commands.add("bulletedList",new gr(e,"bulleted")),e.commands.add("customNumberedList",new gr(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new gr(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new kf(e,"forward")),e.commands.add("outdentList",new kf(e,"backward")),e.commands.add("splitListItemBefore",new xf(e,"before")),e.commands.add("splitListItemAfter",new xf(e,"after")),i&&(e.commands.add("mergeListItemBackward",new If(e,"backward")),e.commands.add("mergeListItemForward",new If(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){let e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList"),{priority:"high"}),i&&i.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...pr,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){let e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(s,n)=>{let r=e.model.document.selection;Xs(e.model)||e.model.change(()=>{let o=r.getFirstPosition();if(r.isCollapsed&&n.direction=="backward"){if(!o.isAtStart)return;let a=o.parent;if(!D(a))return;let l=Oe.first(a,{sameAttributes:"listType",sameIndent:!0}),c=a.getAttribute("listIndent")===0||!D(a.previousSibling);if(!l&&c)yf(a)||e.execute("splitListItemAfter"),e.execute("outdentList");else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:Lf(e.model,"backward")})}n.preventDefault(),s.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:Lf(e.model,"forward")}),n.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){let e=this.editor,t=e.model,i=e.commands,s=i.get("enter");this.listenTo(e.editing.view.document,"enter",(n,r)=>{let o=t.document,a=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&D(a)&&a.isEmpty&&!r.isSoft){let l=zt(a),c=yf(a);l&&c?(e.execute("outdentList"),r.preventDefault(),n.stop()):l&&!c?(e.execute("splitListItemAfter"),r.preventDefault(),n.stop()):c&&(e.execute("splitListItemBefore"),r.preventDefault(),n.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{let n=i.get("splitListItemBefore");if(n.refresh(),!n.isEnabled)return;let r=e.model.document.selection.getLastPosition().parent;Yi(r).length===2&&n.execute()})}_setupTabIntegration(){let e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,i)=>{let s=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(e.execute(s),i.stopPropagation(),i.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){let e=this.editor,t=e.model,i=this.getListAttributeNames(),s=e.config.get("list.multiBlock"),n=s?"paragraph":"listItem",r=!!e.config.get("list.enableSkipLevelLists");e.conversion.for("upcast").elementToElement({view:"li",model:(a,{writer:l})=>l.createElement(n,{listType:""})}).elementToElement({view:"p",model:(a,{writer:l})=>a.parent&&a.parent.is("element","li")?l.createElement(n,{listType:""}):null,converterPriority:"high"}).add(a=>{a.on("element:p",(l,c,u)=>{let d=c.viewItem;if(!d.parent||!d.parent.is("element","li")||d.isEmpty||!d.getAttributeKeys().next().done)return;for(let g of d.parent.getChildren())if(g!==d&&!(g.is("element","ol")||g.is("element","ul")))return;u.consumable.consume(d,{name:!0});let{modelRange:h,modelCursor:m}=u.convertChildren(d,c.modelCursor);c.modelRange=h,c.modelCursor=m},{priority:"highest"}),r&&a.on("element:li",yv(),{priority:"high"}),a.on("element:li",Cv())}),s||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:n,view:Pf(i),converterPriority:"high"}).add(a=>{a.on("attribute",Sf(i,this._downcastStrategies,t,{enableSkipLevelLists:r})),a.on("remove",xv(t.schema))}),e.conversion.for("dataDowncast").elementToElement({model:n,view:Pf(i,{dataPipeline:!0}),converterPriority:"high"}).add(a=>{a.on("attribute",Sf(i,this._downcastStrategies,t,{dataPipeline:!0,enableSkipLevelLists:r}))});let o=Tv(this._downcastStrategies,e.editing.view);e.editing.mapper.on("modelToViewPosition",o),e.data.mapper.on("modelToViewPosition",o),this.listenTo(t.document,"change:data",Iv(t,e.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(a,{viewElement:l,modelAttributes:c})=>{l.id!=c.listItemId&&(a.return=!0,a.stop())}),this.on("checkAttributes:list",(a,{viewElement:l,modelAttributes:c})=>{(l.name!=Of(c.listType)||l.id!=Rf(c.listType,c.listIndent))&&(a.return=!0,a.stop())})}_setupModelPostFixing(){let e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(i=>Vv(e,i,t,this)),this.editor.config.get("list.enableSkipLevelLists")||this.on("postFixer",(i,{listNodes:s,writer:n})=>{i.return=_v(s,n)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:n,seenIds:r})=>{i.return=vv(s,r,n)||i.return},{priority:"high"})}_setupClipboardIntegration(){let e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",Mv(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(i,s)=>{e.change(n=>{let r=Array.from(s.content.getChildren()),o=r[r.length-1];if(r.length>1&&o.is("element")&&o.isEmpty&&r.slice(0,-1).every(D)&&n.remove(o),s.method=="copy"||s.method=="cut"){let a=Array.from(s.content.getChildren());Qs(a)&&wr(a,n,this.getListAttributeNames())}})})}_setupAccessibilityIntegration(){let e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(e,t,i,s){s&&(s.skipListItemIds||s.isClipboardPipeline)||e.setAttribute("data-list-item-id",t,i)}})}};function Vv(e,t,i,s){let n=e.document.differ.getChanges(),r=new Set,o=new Set,a=s.editor.config.get("list.multiBlock"),l=!1;for(let u of n){if(u.type=="insert"&&u.name!="$text"){let d=u.position.nodeAfter;if(!e.schema.checkAttribute(d,"listItemId"))for(let h of Array.from(d.getAttributeKeys()))i.includes(h)&&
19(t.removeAttribute(h,d),l=!0);Ke(u.position,o,r),u.attributes.has("listItemId")||Ke(u.position.getShiftedBy(u.length),o,r);for(let{item:h,previousPosition:m}of e.createRangeIn(d))D(h)&&Ke(m,o,r)}else u.type=="remove"?Ke(u.position,o,r):u.type=="attribute"&&i.includes(u.attributeKey)&&(Ke(u.range.start,o,r),u.attributeNewValue===null&&Ke(u.range.start.getShiftedBy(1),o,r));if(!a&&u.type=="attribute"&&pr.includes(u.attributeKey)){let d=u.range.start.nodeAfter;u.attributeNewValue===null&&d&&d.is("element","listItem")?(t.rename(d,"paragraph"),l=!0):u.attributeOldValue===null&&d&&d.is("element")&&d.name!="listItem"&&(t.rename(d,"listItem"),l=!0)}}let c=new Set;for(let u of o.values())l=s.fire("postFixer",{listNodes:new Q_(u),listHead:u,writer:t,seenIds:c})||l;return l}function Mv(e){return(t,[i,s])=>{let n=(i.is("documentFragment")?Array.from(i.getChildren()):[i]).filter(a=>!e.schema.isInline(a));if(!n.length)return;let r=(s?e.createSelection(s):e.document.selection).getFirstPosition(),o;if(D(r.parent))o=r.parent;else if(D(r.nodeBefore)&&D(r.nodeAfter))o=r.nodeBefore;else return;e.change(a=>{let l=o.getAttribute("listType"),c=o.getAttribute("listIndent"),u=n[0].getAttribute("listIndent")||0,d=Math.max(c-u,0);for(let h of n){let m=D(h);o.is("element","listItem")&&h.is("element","paragraph")&&a.rename(h,"listItem"),a.setAttributes({listIndent:(m?h.getAttribute("listIndent"):0)+d,listItemId:m?h.getAttribute("listItemId"):Ji.next(),listType:l},h)}})}}function Lf(e,t){let i=e.document.selection;if(!i.isCollapsed)return!Xs(e);if(t==="forward")return!0;let s=i.getFirstPosition().parent,n=s.previousSibling;return e.schema.isObject(n)?!1:n.isEmpty?!0:Qs([s,n])}function Vf(e,t,i,s){e.ui.componentFactory.add(t,()=>{let n=Mf(B,e,t,i,s);return n.set({tooltip:!0,isToggleable:!0}),n}),e.ui.componentFactory.add(`menuBar:${t}`,()=>{let n=Mf(te,e,t,i,s);return n.set({role:"menuitemcheckbox",isToggleable:!0}),n})}function Mf(e,t,i,s,n){let r=t.commands.get(i),o=new e(t.locale);return o.set({label:s,icon:n}),o.bind("isOn","isEnabled").to(r,"value","isEnabled"),o.on("execute",()=>{t.execute(i),t.editing.view.focus()}),o}var Bv=class extends k{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||Vf(this.editor,"numberedList",e("Numbered List"),dd),this.editor.ui.componentFactory.has("bulletedList")||Vf(this.editor,"bulletedList",e("Bulleted List"),nd)}};var zf=class extends k{static get requires(){return[je,Bv]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}};var Ov={},Rv={},Fv={},Dv=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"},{listStyle:"arabic-indic",typeAttribute:null,listType:"numbered"}];for(let{listStyle:e,typeAttribute:t,listType:i}of Dv)Ov[e]=i,Rv[e]=t,t&&(Fv[t]=e);var Nv=class extends W{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){let e=this.editor.model,t=e.document,i=ye(t.selection.getSelectedBlocks());this.value=!!i&&i.is("element","paragraph"),this.isEnabled=!!i&&Hf(i,e.schema)}execute(e={}){let t=this.editor.model,i=t.document,s=e.selection||i.selection;t.canEditAt(s)&&t.change(n=>{let r=s.getSelectedBlocks();for(let o of r)!o.is("element","paragraph")&&Hf(o,t.schema)&&n.rename(o,"paragraph")})}};function Hf(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}var zv=class extends W{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){let t=this.editor.model,i=e.attributes,s=e.position;return t.canEditAt(s)?t.change(n=>{if(s=this._findPositionToInsertParagraph(s,n),!s)return null;let r=n.createElement("paragraph");return i&&t.schema.setAllowedAttributes(r,i,n),t.insertContent(r,s),n.setSelection(r,"in"),n.createPositionAt(r,0)}):null}_findPositionToInsertParagraph(e,t){let i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;let s=i.schema.findAllowedParent(e,"paragraph");if(!s)return null;let n=e.parent,r=i.schema.checkChild(n,"$text");return n.isEmpty||r&&e.isAtEnd?i.createPositionAfter(n):!n.isEmpty&&r&&e.isAtStart?i.createPositionBefore(n):t.split(e,s).position}};var Uf=class Wf extends k{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){let t=this.editor,i=t.model;t.commands.add("paragraph",new Nv(t)),t.commands.add("insertParagraph",new zv(t)),i.schema.register("paragraph",{inheritAllFrom
19:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(s,{writer:n})=>!Wf.paragraphLikeElements.has(s.name)||s.isEmpty?null:n.createElement("paragraph"),view:/.+/,converterPriority:"low"})}static paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"])};var Hv=class extends k{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.commands.add("indent",new Oo(e)),e.commands.add("outdent",new Oo(e))}};var Uv=class extends k{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?Fo:Do,n=t.uiLanguageDirection=="ltr"?Do:Fo;this._defineButton("indent",i("Increase indent"),s),this._defineButton("outdent",i("Decrease indent"),n)}_defineButton(e,t,i){let s=this.editor;s.ui.componentFactory.add(e,()=>{let n=this._createButton(B,e,t,i);return n.set({tooltip:!0}),n}),s.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(te,e,t,i))}_createButton(e,t,i,s){let n=this.editor,r=n.commands.get(t),o=new e(n.locale);return o.set({label:i,icon:s}),o.bind("isEnabled").to(r,"isEnabled"),this.listenTo(o,"execute",()=>{n.execute(t),n.editing.view.focus()}),o}};var qf=class extends k{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[Hv,Uv]}};var br="SourceEditingMode",$f=class extends k{static get pluginName(){return"SourceEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Wn]}_elementReplacer;_replacedRoots;_dataFromRoots;constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new wn,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();let e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",()=>{let i=this._createButton(B);return i.set({label:t("Source"),icon:bd,tooltip:!0,class:"ck-source-editing-button"}),i}),e.ui.componentFactory.add("menuBar:sourceEditing",()=>{let i=this._createButton(te);return i.set({label:t("Show source"),role:"menuitemcheckbox"}),i}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(i,s,n)=>{n?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(i,s,n)=>this._handleReadOnlyMode(!n)),this.listenTo(e,"change:isReadOnly",(i,s,n)=>this._handleReadOnlyMode(n))),e.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}updateEditorData(){let e=this.editor,t={};for(let[i,s]of this._replacedRoots){let n=this._dataFromRoots.get(i),r=s.dataset.value;n!==r&&(t[i]=r,this._dataFromRoots.set(i,r))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){let e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new f("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some(i=>e.plugins.has(i))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){let e=this.editor,t=e.editing.view,i=e.model;i.change(s=>{s.setSelection(null),s.removeSelectionAttribute(i.document.selection.getAttributeKeys())});for(let[s,n]of t.domRoots){let r=Wv(e.data.get({rootName:s})),o=ue(n.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),a=ue(n.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[o]);o.value=r,o.setSelectionRange(0,0),o.addEventListener("input",()=>{a.dataset.value=o.value,e.ui.update()}),o.addEventListener("keydown",l=>{let c=l.key.toLowerCase();
19(l.ctrlKey||l.metaKey)&&!l.altKey&&(c==="z"||c==="y")&&(l.stopImmediatePropagation(),I.isMac&&c==="y"&&(l.preventDefault(),n.ownerDocument.execCommand("redo")))}),t.change(l=>{let c=t.document.getRoot(s);l.addClass("ck-hidden",c)}),e.ui.setEditableElement("sourceEditing:"+s,o),this._replacedRoots.set(s,a),this._elementReplacer.replace(n,a),this._dataFromRoots.set(s,r)}this._hideDocumentOutline(),this._refreshAnnotationsVisibility(),this._focusSourceEditing()}_hideSourceEditing(){let e=this.editor.editing.view;this.updateEditorData(),e.change(t=>{for(let[i]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(i))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),this._showDocumentOutline(),this._refreshAnnotationsVisibility(),e.focus()}_hideDocumentOutline(){this.editor.plugins.has("DocumentOutlineUI")&&(this.editor.plugins.get("DocumentOutlineUI").view.element.style.display="none")}_showDocumentOutline(){this.editor.plugins.has("DocumentOutlineUI")&&(this.editor.plugins.get("DocumentOutlineUI").view.element.style.display="")}_refreshAnnotationsVisibility(){this.editor.plugins.has("Annotations")&&this.editor.plugins.get("Annotations").refreshVisibility()}_focusSourceEditing(){let e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=!1,i.focus()}_disableCommands(){let e=this.editor;for(let t of e.commands.commands())t.forceDisabled(br);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(br)}_enableCommands(){let e=this.editor;for(let t of e.commands.commands())t.clearForceDisabled(br);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(br)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(let[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){let e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){let e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){let t=this.editor,i=new e(t.locale);return i.set({withText:!0,isToggleable:!0}),i.bind("isOn").to(this,"isSourceEditingMode"),i.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(Wn),"hasAny",(s,n,r)=>!(!s||n||r)),this.listenTo(i,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),i}};function Wv(e){return qv(e)?Wl(e):e}function qv(e){return e.startsWith("<")}var Kf={de:{dictionary:{"Words: %0":"W\xF6rter: %0 ","Characters: %0":"Zeichen: %0 ","Widget toolbar":"Widget Werkzeugleiste","Insert paragraph before block":"Absatz vor Block einf\xFCgen","Insert paragraph after block":"Absatz nach Block einf\xFCgen","Press Enter to type after or press Shift + Enter to type before the widget":"Dr\xFCcken Sie die Eingabetaste, um nach dem Widget zu tippen oder Shift + Eingabetaste, um vor dem Widget zu tippen.","Keystrokes that can be used when a widget is selected (for example: image, table, etc.)":"Tastatureingaben, die verwendet werden k\xF6nnen, wenn ein Widget ausgew\xE4hlt wurde (zum Beispiel: Bilder, Tabellen etc.)","Insert a new paragraph directly after a widget":"Einen neuen Abschnitt direkt nach einem Widget einf\xFCgen","Insert a new paragraph directly before a widget":"Einen neuen Abschnitt direkt vor einem Widget einf\xFCgen","Move the caret to allow typing directly before a widget":"Verschieben Sie den Textcursor, um die Eingabe direkt nach dem Widget zu erlauben","Move the caret to allow typing directly after a widget":"Verschieben Sie den Textcursor, um die direkte Eingabe nach dem Widget zu erlauben","Move focus from an editable area back to the parent widget":"Bewegen Sie den Fokus von einem bearbeitbaren Bereich zur\xFCck zum \xFCbergeordneten Widget","Upload in progress":"Upload l\xE4uft",Undo:"R\xFCckg\xE4ngig",Redo:"Wiederherstellen","Rich Text Editor":"Rich Text Editor","Edit block":"Absatz bearbeiten","Click to edit block":"Zum Bearbeiten des Blocks klicken","Drag to move":"Zum Verschieben ziehen",Next:"N\xE4chste",Previous:"vorherige","Editor toolbar":"Editor Werkzeugleiste","Dropdown toolbar":"Dropdown-Liste Werkzeugleiste","Dropdown menu":"Dropdown-Men\xFC",Black:"Schwarz","Dim grey":"Dunkelgrau",Grey:"Grau","Light grey":"Hellgrau",White:"Wei\xDF",Red:"Rot",Orange:"Orange",Yellow:"Gelb","Light green":"Hellgr\xFCn",Green:"Gr\xFCn",Aquamarine:"Aquamarinblau",Turquoise:"T\xFCrkis","Light blue":"Hellblau",Blue:"Blau",Purple:"Violett","Editor block content toolbar":"Editor Blockinhalt-Toolbar","Editor contextual toolbar":"Editor kontextuelle Toolbar",HEX:"HEX","No results found":"Keine Ergebnisse gefunden","No searchable items":"Keine durchsuchbaren Elemente","Editor dialog":"Editor-Dialog",Close:"Schlie\xDFen","Help Contents. To close this dialog press ESC.":"Hilfe zum Inhalt. Dr\xFCcken Sie die Esc-Taste, um dieses Dialogfenster zu schlie\xDFen.","Below, you can find a list of keyboard shortcuts that can be used in the editor.":"Unten finden Sie eine Liste mit Tastenkombinationen, die im Editor benutzt werden k\x
19F6nnen.","(may require <kbd>Fn</kbd>)":"(erfordert gegebenenfalls <kbd>Fn</kbd>)",Accessibility:"Bedienungshilfen","Accessibility help":"Hilfe zur Eingabe","Press %0 for help.":"Dr\xFCcken Sie %0 f\xFCr Hilfe.","Move focus in and out of an active dialog window":"Fokus auf ein aktives Dialogfenster richten oder aufheben",MENU_BAR_MENU_FILE:"Datei",MENU_BAR_MENU_EDIT:"Bearbeiten",MENU_BAR_MENU_VIEW:"Anzeigen",MENU_BAR_MENU_INSERT:"Einf\xFCgen",MENU_BAR_MENU_FORMAT:"Format",MENU_BAR_MENU_TOOLS:"Werkzeuge",MENU_BAR_MENU_HELP:"Hilfe",MENU_BAR_MENU_TEXT:"Text",MENU_BAR_MENU_FONT:"Schriftart","Editor menu bar":"Men\xFCleiste des Editors",'Please enter a valid color (e.g. "ff0000").':"Bitte geben Sie eine g\xFCltige Farbe ein (z. B. \u201Eff0000\u201C).","Insert table":"Tabelle einf\xFCgen","Header column":"Kopfspalte","Insert column left":"Spalte links einf\xFCgen","Insert column right":"Spalte rechts einf\xFCgen","Delete column":"Spalte l\xF6schen","Select column":"Spalte ausw\xE4hlen",Column:"Spalte","Header row":"Kopfzeile","Insert row below":"Zeile unten einf\xFCgen","Insert row above":"Zeile oben einf\xFCgen","Delete row":"Zeile l\xF6schen","Select row":"Zeile ausw\xE4hlen",Row:"Zeile","Merge cell up":"Zelle oben verbinden","Merge cell right":"Zelle rechts verbinden","Merge cell down":"Zelle unten verbinden","Merge cell left":"Zelle links verbinden","Split cell vertically":"Zelle vertikal teilen","Split cell horizontally":"Zelle horizontal teilen","Merge cells":"Zellen verbinden","Table toolbar":"Tabelle Werkzeugleiste","Table properties":"Tabelleneigenschaften","Cell properties":"Zelleneigenschaften",Border:"Rahmen",Style:"Rahmenart",Width:"Breite",Height:"H\xF6he",Color:"Farbe",Background:"Hintergrund",Padding:"Innenabstand",Dimensions:"Gr\xF6\xDFe","Table cell text alignment":"Ausrichtung des Zellentextes","Horizontal text alignment toolbar":"Werkzeugleiste f\xFCr die horizontale Zellentext-Ausrichtung","Vertical text alignment toolbar":"Werkzeugleiste f\xFCr die vertikale Zellentext-Ausrichtung","Table alignment toolbar":"Werkzeugleiste f\xFCr die Tabellen-Ausrichtung",None:"Kein Rahmen",Solid:"Durchgezogen",Dotted:"Gepunktet",Dashed:"Gestrichelt",Double:"Doppelt",Groove:"Eingeritzt",Ridge:"Hervorgehoben",Inset:"Eingelassen",Outset:"Gepr\xE4gt","Align cell text to the left":"Zellentext linksb\xFCndig ausrichten","Align cell text to the center"
19:"Zellentext zentriert ausrichten","Align cell text to the right":"Zellentext rechtsb\xFCndig ausrichten","Justify cell text":"Zellentext als Blocksatz ausrichten","Align cell text to the top":"Zellentext oben ausrichten","Align cell text to the middle":"Zellentext mittig ausrichten","Align cell text to the bottom":"Zellentext unten ausrichten",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"Die Farbe ist ung\xFCltig. Probieren Sie \u201E#FF0000\u201C oder \u201Ergb(255,0,0)\u201C oder \u201Ered\u201C.",'The value is invalid. Try "10px" or "2em" or simply "2".':"Der Wert ist ung\xFCltig. Probieren Sie \u201E10px\u201C oder \u201E2em\u201C oder \u201E2\u201C.","Enter table caption":"Tabellen\xFCberschrift eingeben","Keystrokes that can be used in a table cell":"Tastatureingaben, die in einer Tabelle benutz werden k\xF6nnen.","Move the selection to the next cell":"Auswahl in die n\xE4chste Zelle verschieben","Move the selection to the previous cell":"Auswahl in die vorherige Zelle verschieben","Insert a new table row (when in the last cell of a table)":"Eine neue Tabellenspalte einf\xFCgen (wenn in der letzten Tabellenzelle)","Navigate through the table":"Tabellennavigation",Table:"Tabelle","Insert table layout":"Tabellenlayout einf\xFCgen","Table layout":"Tabellenlayout","Layout table":"Layouttabelle","Content table":"Inhaltstabelle","Choose table type":"Tabellentyp ausw\xE4hlen","Table type":"Tabellentyp","Table type options":"Tabellentyp-Optionen","Table Alignment":"Tabellenausrichtung","Align table to the left with text wrapping":"Tabelle mit Textumbruch linksb\xFCndig ausrichten","Center table with no text wrapping":"Tabelle ohne Textumbruch zentrieren","Align table to the right with text wrapping":"Tabelle mit Textumbruch rechtsb\xFCndig ausrichten","Align table to the left with no text wrapping":"Tabelle ohne Textumbruch linksb\xFCndig ausrichten","Align table to the right with no text wrapping":"Tabelle ohne Textumbruch rechtsb\xFCndig ausrichten","Cell type":"Zelltyp","Data cell":"Datenzelle","Header cell":"Kopfzelle","Footer row":"Fu\xDFzeile","Column header":"Spaltentitel","Row header":"Zeilentitel",Styles:"Stile","Multiple styles":"Mehrere Stile","Block styles":"Block-Stile","Text styles":"Text-Stile","Special characters":"Sonderzeichen",Category:"Kategorie",All:"Alle",Arrows:"Pfeile",Currency:"W\xE4hrung",Latin:"Lateinisch",Mathematical:"Mathematisch",Text:"Text","leftwards simple arrow":"einfacher Linkspfeil","rightwards simple arrow":"einfacher Rechtspfeil","upwards simple arrow":"einfacher Aufw\xE4rtspfeil","downwards simple arrow":"einfacher Abw\xE4rtspfeil","leftwards double arrow":"Doppelpfeil nach links","rightwards double arrow":"Doppelpfeil nach rechts","upwards double arrow":"Doppelpfeil nach oben","downwards double arrow":"Doppelpfeil nach unten","leftwards dashed arrow":"Gestrichelter Pfeil nach links","rightwards dashed arrow":"Gestrichelter Pfeil nach rechts","upwards dashed arrow":"Gestrichelter Pfeil nach oben","downwards dashed arrow":"Gestrichelter Pfeil nach unten","leftwards arrow to bar":"Pfeil nach links zum Querstrich","rightwards arrow to bar":"Pfeil nach rechts zum Querstrich","upwards arrow to bar":"Pfeil nach oben zum Querstrich","downwards arrow to bar":"Pfeil nach unten zum Querstrich","up down arrow with base":"Unterstrichener Pfeil nach oben und unten","back with leftwards arrow above":"\u201EBack\u201C dar\xFCber Pfeil nach links","end with leftwards arrow above":"\u201EEnd\u201C dar\xFCber Pfeil nach links","on with exclamation mark with left right arrow above":"\u201EOn\u201C mit Ausrufezeichen dar\xFCber Pfeil nach links und rechts","soon with rightwards arrow above":"\u201ESoon\u201C dar\xFCber Pfeil nach rechts","top with upwards arrow above":"\u201ETop\u201C dar\xFCber Pfeil nach oben","Dollar sign":"Dollar-Zeichen","Euro sign":"Euro-Zeichen","Yen sign":"Yen-Zeichen","Pound sign":"Pfund-Zeichen","Cent sign":"Cent-Zeichen","Euro-currency sign":"Euro-W\xE4hrungszeichen","Colon sign":"Col\xF3n-Zeichen","Cruzeiro sign":"Cruzeiro-Zeichen","French franc sign":"Franz\xF6sischer Franc-Zeichen","Lira sign":"Lira-Zeic
19hen","Currency sign":"W\xE4hrungssymbol","Bitcoin sign":"Bitcoin-Zeichen","Mill sign":"Mill-Zeichen","Naira sign":"Naira-Zeichen","Peseta sign":"Peseta-Zeichen","Rupee sign":"Rupie-Zeichen","Won sign":"Won-Zeichen","New sheqel sign":"Schekel-Zeichen","Dong sign":"\u0110\u1ED3ng-Zeichen","Kip sign":"Kip-Zeichen","Tugrik sign":"Tugrik-Zeichen","Drachma sign":"Drachme-Zeichen","German penny sign":"Pfennig-Zeichen","Peso sign":"Philippinischer Peso-Zeichen","Guarani sign":"Guaran\xED-Zeichen","Austral sign":"Austral-Zeichen","Hryvnia sign":"Hrywnja-Zeichen","Cedi sign":"Cedi-Zeichen","Livre tournois sign":"Livre tournois-Zeichen","Spesmilo sign":"Spesmilo-Zeichen","Tenge sign":"Tenge-Zeichen","Indian rupee sign":"Indische Rupie-Zeichen","Turkish lira sign":"T\xFCrkische Lira-Zeichen","Nordic mark sign":"Nordische Mark-Zeichen","Manat sign":"Manat-Zeichen","Ruble sign":"Rubel-Zeichen","Latin capital letter a with macron":"Lateinischer Gro\xDFbuchstabe a mit Makron","Latin small letter a with macron":"Lateinischer Kleinbuchstabe a mit Makron","Latin capital letter a with breve":"Lateinischer Gro\xDFbuchstabe a mit Breve","Latin small letter a with breve":"Lateinischer Kleinbuchstabe a mit Breve","Latin capital letter a with ogonek":"Lateinischer Gro\xDFbuchstabe a mit Ogonek","Latin small letter a with ogonek":"Lateinischer Kleinbuchstabe a mit Ogonek","Latin capital letter c with acute":"Lateinischer Gro\xDFbuchstabe c mit Akut","Latin small letter c with acute":"Lateinischer Kleinbuchstabe c mit Akut","Latin capital letter c with circumflex":"Lateinischer Gro\xDFbuchstabe c mit Zirkumflex","Latin small letter c with circumflex":"Lateinischer Kleinbuchstabe c mit Zirkumflex","Latin capital letter c with dot above":"Lateinischer Gro\xDFbuchstabe c mit Punkt dar\xFCber","Latin small letter c with dot above":"Lateinischer Kleinbuchstabe c mit Punkt dar\xFCber","Latin capital letter c with caron":"Lateinischer Gro\xDFbuchstabe c mit Hatschek","Latin small letter c with caron":"Lateinischer Kleinbuchstabe c mit Hatschek","Latin capital letter d with caron":"Lateinischer Gro\xDFbuchstabe d mit Hatschek","Latin small letter d with caron":"Lateinischer Kleinbuchstabe d mit Hatschek","Latin capital letter d with stroke":"Lateinischer Gro\xDFbuchstabe d mit Querstrich","Latin small letter d with stroke":"Lateinischer Kleinbuchstabe d mit Querstrich","Latin capital letter e with macron":"Lateinischer Gro\xDFbuchstabe e mit Makron","Latin small letter e with macron":"Lateinischer Kleinbuchstabe e mit Makron","Latin capital letter e with breve":"Lateinischer Gro\xDFbuchstabe e mit Breve","Latin small letter e with breve":"Lateinischer Kleinbuchstabe e mit Breve","Latin capital letter e with dot above":"Lateinischer Gro\xDFbuchstabe e mit Punkt dar\xFCber","Latin small letter e with dot above":"Lateinischer Kleinbuchstabe e mit Punkt dar\xFCber","Latin capital letter e with ogonek":"Lateinischer Gro\xDFbuchstabe e mit Ogonek","Latin small letter e with ogonek":"Lateinischer Kleinbuchstabe e mit Ogonek","Latin capital letter e with caron":"Lateinischer Gro\xDFbuchstabe e mit Hatschek","Latin small letter e with caron":"Lateinischer Kleinbuchstabe e mit Hatschek","Latin capital letter g with circumflex":"Lateinischer Gro\xDFbuchstabe g mit Zirkumflex","Latin small letter g with circumflex":"Lateinischer Kleinbuchstabe g mit Zirkumflex","Latin capital letter g with breve":"Lateinischer Gro\xDFbuchstabe g mit Breve","Latin small letter g with breve":"Lateinischer Kleinbuchstabe g mit Breve","Latin capital letter g with dot above":"Lateinischer Gro\xDFbuchstabe g mit Punkt dar\xFCber","Latin small letter g with dot above":"Lateinischer Kleinbuchstabe g mit Punkt dar\xFCber","Latin capital letter g with cedilla":"Lateinischer Gro\xDFbuchstabe g mit Cedille","Latin small letter g with cedilla":"Lateinischer Kleinbuchstabe g mit Cedille","Latin capital letter h with circumflex":"Lateinischer Gro\xDFbuchstabe h mit Zirkumflex","Latin small letter h with circumflex":"Lateinischer Kleinbuchstabe h mit Zirkumflex","Latin capital letter h with stroke":"Lateinischer Gro\xDFbuchstabe h mit Querstrich","Latin small letter h with stroke":"Lateinischer Kleinbuchstabe h mit Querstrich","Latin capital letter i with tilde":"Lateinischer Gro\xDFbuchstabe i mit Tilde","Latin small letter i with tilde":"Lateinischer Kleinbuchstabe i mit Tilde","Latin capital letter i with macron":"Lateinischer Gro\xDFbuchstabe i mit Makron","Latin small letter i with macron":"Lateinischer Kleinbuchstabe i mit Makron","Latin capital letter i with breve":"Lateinischer Gro\xDFbuchstabe i mit Breve","Latin small letter i with breve":"Lateinischer Kleinbuchstabe i mit Breve","Latin capital letter i with ogonek":"Lateinischer Gro\xDFbuchstabe i mit Ogonek","Latin small letter i with ogonek":"Lateinischer Kleinbuchstabe i mit Ogonek","Latin capital letter i with dot above":"Lateinischer Gro\xDFbuchstabe i mit Punkt dar\xFCber","Latin small letter dotless i":"Lateinischer Kleinbuchstabe i ohne Punkt","Latin capital ligature ij":"Gro\xDFe lateinische Ligatur ij","Latin small ligature ij":"Kleine lateinische Ligatur ij","Latin capital letter j with circumflex":"Lateinischer Gro\xDFbuchstabe j mit Zirkumflex","
19Latin small letter j with circumflex":"Lateinischer Kleinbuchstabe j mit Zirkumflex","Latin capital letter k with cedilla":"Lateinischer Gro\xDFbuchstabe k mit Cedille","Latin small letter k with cedilla":"Lateinischer Kleinbuchstabe k mit Cedille","Latin small letter kra":"Lateinischer Kleinbuchstabe Kra","Latin capital letter l with acute":"Lateinischer Gro\xDFbuchstabe l mit Akut","Latin small letter l with acute":"Lateinischer Kleinbuchstabe l mit Akut","Latin capital letter l with cedilla":"Lateinischer Gro\xDFbuchstabe l mit Cedille","Latin small letter l with cedilla":"Lateinischer Kleinbuchstabe l mit Cedille","Latin capital letter l with caron":"Lateinischer Gro\xDFbuchstabe l mit Hatschek","Latin small letter l with caron":"Lateinischer Kleinbuchstabe l mit Hatschek","Latin capital letter l with middle dot":"Lateinischer Gro\xDFbuchstabe l mit Mittelpunkt","Latin small letter l with middle dot":"Lateinischer Kleinbuchstabe l mit Mittelpunkt","Latin capital letter l with stroke":"Lateinischer Gro\xDFbuchstabe l mit Querstrich","Latin small letter l with stroke":"Lateinischer Kleinbuchstabe l mit Querstrich","Latin capital letter n with acute":"Lateinischer Gro\xDFbuchstabe n mit Akut","Latin small letter n with acute":"Lateinischer Kleinbuchstabe n mit Akut","Latin capital letter n with cedilla":"Lateinischer Gro\xDFbuchstabe n mit Cedille","Latin small letter n with cedilla":"Lateinischer Kleinbuchstabe n mit Cedille","Latin capital letter n with caron":"Lateinischer Gro\xDFbuchstabe n mit Hatschek","Latin small letter n with caron":"Lateinischer Kleinbuchstabe n mit Hatschek","Latin small letter n preceded by apostrophe":"Lateinischer Kleinbuchstabe n mit vorangestelltem Apostroph","Latin capital letter eng":"Lateinischer Gro\xDFbuchstabe Eng","Latin small letter eng":"Lateinischer Kleinbuchstabe Eng","Latin capital letter o with macron":"Lateinischer Gro\xDFbuchstabe o mit Makron","Latin small letter o with macron":"Lateinischer Kleinbuchstabe o mit Makron","Latin capital letter o with breve":"Lateinischer Gro\xDFbuchstabe o mit Breve","Latin small letter o with breve":"Lateinischer Kleinbuchstabe o mit Breve","Latin capital letter o with double acute":"Lateinischer Gro\xDFbuchstabe o mit doppeltem Akut","Latin small letter o with double acute":"Lateinischer Kleinbuchstabe o mit doppeltem Akut","Latin capital ligature oe":"Gro\xDFe lateinische Ligatur oe","Latin small ligature oe":"Kleine lateinische Ligatur oe","Latin capital letter r with acute":"Lateinischer Gro\xDFbuchstabe r mit Akut","Latin small letter r with acute":"Lateinischer Kleinbuchstabe r mit Akut","Latin capital letter r with cedilla":"Lateinischer Gro\xDFbuchstabe r mit Cedille","Latin small letter r with cedilla":"Lateinischer Kleinbuchstabe r mit Cedille","Latin capital letter r with caron":"Lateinischer Gro\xDFbuchstabe r mit Hatschek","Latin small letter r with caron":"Lateinischer Kleinbuchstabe r mit Hatschek","Latin capital letter s with acute":"Lateinischer Gro\xDFbuchstabe s mit Akut","Latin small letter s with acute":"Lateinischer Kleinbuchstabe s mit Akut","Latin capital letter s with circumflex":"Lateinischer Gro\xDFbuchstabe s mit Zirkumflex","Latin small letter s with circumflex":"Lateinischer Kleinbuchstabe s mit Zirkumflex","Latin capital letter s with cedilla":"Lateinischer Gro\xDFbuchstabe s mit Cedille","Latin small letter s with cedilla":"Lateinischer Kleinbuchstabe s mit Cedille","Latin capital letter s with caron":"Lateinischer Gro\xDFbuchstabe s mit Hatschek","Latin small letter s with caron":"Lateinischer Kleinbuchstabe s mit Hatschek","Latin capital letter t with cedilla":"Lateinischer Gro\xDFbuchstabe t mit Cedille","Latin small letter t with cedilla":"Lateinischer Kleinbuchstabe t mit Cedille","Latin capital letter t with caron":"Lateinischer Gro\xDFbuchstabe t mit Hatschek","Latin small letter t with caron":"Lateinischer Kleinbuchstabe t mit Hatschek","Latin capital letter t with stroke":"Lateinischer Gro\xDFbuchstabe t mit Querstrich","Latin small letter t with stroke":"Lateinischer Kleinbuchstabe t mit Querstrich","Latin capital letter u with tilde":"Lateinischer Gro\xDFbuchstabe u mit Tilde","Latin small letter u with tilde":"Lateinischer Kleinbuchstabe u mit Tilde","Latin capital letter u with macron":"Lateinischer Gro\xDFbuchstabe u mit Makron","Latin small letter u with macron":"Lateinischer Kleinbuchstabe u mit Makron","Latin capital letter u with breve":"Lateinischer Gro\xDFbuchstabe u mit Breve","Latin small letter u with breve":"Lateinischer Kleinbuchstabe u mit Breve","Latin capital letter u with ring above":"Lateinischer Gro\xDFbuchstabe u mit Krou\u017Eek dar\xFCber","Latin small letter u with ring above":"Lateinischer Kleinbuchstabe u mit Krou\u017Eek dar\xFCber","Latin capital letter u with double acute":"Lateinischer Gro\xDFbuchstabe u mit doppeltem Akut","Latin small letter u with double acute":"Lateinischer Kleinbuchstabe u mit doppeltem Akut","Latin capital letter u with ogonek":"Lateinischer Gro\xDFbuchstabe u mit Ogonek","Latin small letter u with ogonek":"Lateinischer Kleinbuchstabe u mit Ogonek","Latin capital letter w with circumflex":"Lateinischer Gro\xDFbuchstabe w mit Zirkumflex","
19Latin small letter w with circumflex":"Lateinischer Kleinbuchstabe w mit Zirkumflex","Latin capital letter y with circumflex":"Lateinischer Gro\xDFbuchstabe y mit Zirkumflex","Latin small letter y with circumflex":"Lateinischer Kleinbuchstabe y mit Zirkumflex","Latin capital letter y with diaeresis":"Lateinischer Gro\xDFbuchstabe y mit Trema","Latin capital letter z with acute":"Lateinischer Gro\xDFbuchstabe z mit Akut","Latin small letter z with acute":"Lateinischer Kleinbuchstabe z mit Akut","Latin capital letter z with dot above":"Lateinischer Gro\xDFbuchstabe z mit Punkt dar\xFCber","Latin small letter z with dot above":"Lateinischer Kleinbuchstabe z mit Punkt dar\xFCber","Latin capital letter z with caron":"Lateinischer Gro\xDFbuchstabe z mit Hatschek","Latin small letter z with caron":"Lateinischer Kleinbuchstabe z mit Hatschek","Latin small letter long s":"Lateinischer Kleinbuchstabe langes s","Less-than sign":"Kleiner-als-Zeichen","Greater-than sign":"Gr\xF6\xDFer-als-Zeichen","Less-than or equal to":"Kleiner als oder gleich","Greater-than or equal to":"Gr\xF6\xDFer als oder gleich","En dash":"Halbgeviertstrich","Em dash":"Geviertstrich",Macron:"Makron",Overline:"\xDCberstrich","Degree sign":"Grad-Zeichen","Minus sign":"Minus-Zeichen","Plus-minus sign":"Plus-Minus-Zeichen","Division sign":"Geteilt-Zeichen","Fraction slash":"Schr\xE4gstrich","Multiplication sign":"Mal-Zeichen","Latin small letter f with hook":"Lateinischer Kleinbuchstabe f mit Haken",Integral:"Integral-Zeichen","N-ary summation":"Summen-Zeichen",Infinity:"Unendlich-Zeichen","Square root":"Wurzel-Zeichen","Tilde operator":"Tilde-Operator","Approximately equal to":"Ungef\xE4hr gleich","Almost equal to":"Gerundet","Not equal to":"Ungleich","Identical to":"Identisch mit","Element of":"Element von","Not an element of":"Kein Element von","Contains as member":"Enth\xE4lt als Element","N-ary product":"Produkt-Zeichen","Logical and":"Logisches und","Logical or":"Logisches oder","Not sign":"Negations-Zeichen",Intersection:"Schnitt",Union:"Vereinigung","Partial differential":"Partielle Ableitung","For all":"Allquantor","There exists":"Existenzquantor","Empty set":"Leere Menge",Nabla:"Nabla","Asterisk operator":"Hodge-Stern-Operator","Proportional to":"Proportional zu",Angle:"Winkel-Zeichen","Vulgar fraction one quarter":"Gemeiner Bruch ein Viertel","Vulgar fraction one half":"Gemeiner Bruch ein Halb","Vulgar fraction three quarters":"Gemeiner Bruch drei Viertel","Single left-pointing angle quotation mark":"Einfache Guillemets nach links","Single right-pointing angle quotation mark":"Einfache Guillemets nach rechts","Left-pointing double angle quotation mark":"Doppelte Guillemets nach links","Right-pointing double angle quotation mark":"Doppelte Guillemets nach rechts","Left single quotation mark":"Einfache Anf\xFChrungszeichen links","Right single quotation mark":"Einfache Anf\xFChrungszeichen rechts","Left double quotation mark":"Doppelte Anf\xFChrungszeichen links","Right double quotation mark":"Doppelte Anf\xFChrungszeichen rechts","Single low-9 quotation mark":"Einfache Anf\xFChrungszeichen links unten","Double low-9 quotation mark":"Doppelte Anf\xFChrungszeichen links unten","Inverted exclamation mark":"Umgekehrtes Ausrufezeichen","Inverted question mark":"Umgekehrtes Fragezeichen","Two dot leader":"Doppel-Punktlinie","Horizontal ellipsis":"Auslassungspunkte","Double dagger":"Zweibalkenkreuz","Per mille sign":"Promille-Zeichen","Per ten thousand sign":"Pro-Zehntausend-Zeichen","Double exclamation mark":"Doppeltes Ausrufezeichen","Question exclamation mark":"Frage-Ruf-Zeichen","Exclamation question mark":"Ruf-Frage-Zeichen","Double question mark":"Doppeltes Fragezeichen","Copyright sign":"Copyright-Zeichen","Registered sign":"Registered-Trade-Mark-Zeichen","Trade mark sign":"Unregistered-Trade-Mark-Zeichen","Section sign":"Paragraphen-Zeichen","Paragraph sign":"Absatz-Zeichen","Reversed paragraph sign":"Umgedrehtes Absatz-Zeichen","Show source":"Quelle anzeigen","Show blocks":"Bl\xF6cke anzeigen","Select all":"Alles ausw\xE4hlen","Enable editing":"Bearbeitung zulassen","Previous editable region":"Vorheriger bearbeitbarer Bereich","Next editable region":"N\xE4chster bearbeitbarer Bereich","Navigate editable regions":"Durch bearbeitbare Bereiche navigieren","Disable inline editing":"Inline-Bearbeitung deaktivieren","Enable inline editing":"Inline-Bearbeitung aktivieren","Disable block editing":"Blockbearbeitung deaktivieren","Enable block editing":"Blockbearbeitung aktivieren","Disable editing":"Bearbeitung deaktivieren","Remove Format":"Formatierung entfernen","Page break":"Seitenumbruch","media widget":"Medien-Widget","Media URL":"Medien-URL","Paste the media URL in the input.":"Medien-URL in das Eingabefeld einf\xFCgen.","Tip: Paste the URL into the content to embed faster.":"Tipp: Zum schnelleren Einbetten k\xF6nnen Sie die Medien-URL in den Inhalt einf\xFCgen.","The URL must not be empty.":"Die URL darf nicht leer sein.","This media URL is not supported.":"Diese Medien-URL wird nicht unterst\xFCtzt.","Insert media":"Medium einf\xFCgen",Media:"Medien","Media toolbar":"Medien Werkzeugleiste","Open media in new tab":"Medien in neuem Tab \xF6ffnen","Media embed":"Medieneinbettung","Left aligned media":"Links ausgerichtete Medien","Centered media":"Zentrierte Medien","Right aligned media":"Rechts ausgerichtete Medien","Resize media":"Mediengr\xF6\xDFe \xE4ndern","Resize media to %0":"Mediengr\xF6\xDFe auf %0 \xE4ndern","Resize media to the original size":"Mediengr\xF6\xDFe auf Originalgr\xF6\xDFe zur\xFCcksetzen","Re
19size media (in %0)":"Mediengr\xF6\xDFe \xE4ndern (auf %0)","Custom media size":"Benutzerdefinierte Mediengr\xF6\xDFe","Media resize list":"Liste zur \xC4nderung der Mediengr\xF6\xDFe","Media Resize":"Mediengr\xF6\xDFe \xE4ndern","Numbered List":"Nummerierte Liste","Bulleted List":"Aufz\xE4hlungsliste","To-do List":"Aufgabenliste","Bulleted list styles toolbar":"Darstellung der ungeordneten Liste","Numbered list styles toolbar":"Darstellung der geordneten Liste","Toggle the disc list style":"Gef\xFCllten Kreis einstellen","Toggle the circle list style":"Leeren Kreis einstellen","Toggle the square list style":"Quadrat einstellen","Toggle the decimal list style":"Dezimalzahlen einstellen","Toggle the decimal with leading zero list style":"Dezimalzahlen mit vorangestellten Nullen einstellen","Toggle the lower\u2013roman list style":"Kleingeschriebene r\xF6mische Zahlen einstellen","Toggle the upper\u2013roman list style":"Gro\xDFgeschriebene r\xF6mische Zahlen einstellen","Toggle the lower\u2013latin list style":"Kleingeschriebene lateinische Buchstaben einstellen","Toggle the upper\u2013latin list style":"Gro\xDFgeschriebene lateinische Buchstaben einstellen",Disc:"Gef\xFCllter Kreis",Circle:"Leerer Kreis",Square:"Quadrat",Decimal:"Dezimalzahlen","Decimal with leading zero":"Dezimalzahlen mit vorangestellten Nullen","Lower\u2013roman":"Kleingeschriebene r\xF6mische Zahlen","Upper-roman":"Gro\xDFgeschriebene r\xF6mische Zahlen","Lower-latin":"Kleingeschriebene lateinische Buchstaben","Upper-latin":"Gro\xDFgeschriebene lateinische Buchstaben","List properties":"Listeneigenschaften","Start at":"Beginnen mit","Invalid start index value.":"Ung\xFCltiger Anfangsindexwert.","Start index must be greater than 0.":"Der Startwert muss gr\xF6\xDFer als 0 sein.","Reversed order":"Umgekehrte Reihenfolge","Keystrokes that can be used in a list":"Tastatureingaben, die in einer Liste verwendet werden k\xF6nnen.","Increase list item indent":"Listeneinzug vergr\xF6\xDFern","Decrease list item indent":"Listeneinzug verkleinern","Entering a to-do list":"Eingabe einer Aufgabenliste","Leaving a to-do list":"Verlassen einer Aufgabenliste","Toggle the arabic-indic list style":"Ostarabisch-indische Listenform umschalten","Arabic-indic":"Ostarabisch-indisch",Unlink:"Link entfernen",Link:"Link","Link URL":"Linkadresse","Link URL must not be empty.":"Die Link-URL darf nicht leer sein.","Link image":"Bild verlinken","Edit link":"Link bearbeiten","Open link in new tab":"Link im neuen Tab \xF6ffnen","Open in a new tab":"In neuem Tab \xF6ffnen",Downloadable:"Herunterladbar","Create link":"Link erstellen","Move out of a link":"Linkauswahl aufheben","Link properties":"Linkeigenschaften","Displayed text":"Angezeigter Text","No links available":"Keine Links verf\xFCgbar","This link has no URL":"Diesem Link fehlt die URL",Language:"Sprache","Choose language":"Sprache ausw\xE4hlen","Remove language":"Sprache entfernen","Increase indent":"Einzug vergr\xF6\xDFern","Decrease indent":"Einzug verkleinern","image widget":"Bild-Steuerelement","In line":"Text in Zeile","Side image":"Seitenbild","Full size image":"Bild in voller Gr\xF6\xDFe","Left aligned image":"Linksb\xFCndiges Bild","Centered image":"Zentriertes Bild","Right aligned image":"Rechtsb\xFCndiges Bild","Change image text alternative":"Alternativtext \xE4ndern","Text alternative":"Alternativtext","Enter image caption":"Bildunterschrift eingeben","Insert image":"Bild einf\xFCgen","Replace image":"Bild ersetzen","Upload from computer":"Vom Computer hochladen","Replace from computer":"Vom Computer ersetzen","Upload image from computer":"Bild vom Computer hochladen","Image from computer":"Bild vom Computer","From computer":"Vom Computer","Replace image from computer":"Bild vom Computer ersetzen","Upload failed":"Hochladen fehlgeschlagen","You have no image upload permissions.":"Sie haben keine Berechtigung zum Hochladen von Bildern.","Image toolbar":"Bild Werkzeugleiste","Resize image":"Bildgr\xF6\xDFe \xE4ndern","Resize image to %0":"Bildgr\xF6\xDFe \xE4ndern in %0","Resize image to the original size":"Bild in Originalgr\xF6\xDFe \xE4ndern","Resize image (in %0)":"Bildgr\xF6\xDFe \xE4ndern (in %0)","Custom image size":"Benutzerdefinierte Bildgr\xF6\xDFe","Image resize list":"Bildgr\xF6\xDFen-Liste","Insert image via URL":"Bild von URL einf\xFCgen","Insert via URL":"Per URL einf\xFCgen","Image via URL":"Bild per URL","Via URL":"Per URL","Update image URL":"Bild-URL aktualisieren","Caption for the image":"Bildunterschrift","Caption for image: %0":"Bildunterschrift: %0","Uploading image":"Bild hochladen","Image upload complete":"Bild erfolgreich hochgeladen","Error during image upload":"Fehler beim Hochladen des Bildes",Image:"Bild","Image Resize":"Bildgr\xF6\xDFen\xE4nderung","Text Alternative":"Textalternative","HTML object":"HTML-Objekt","Insert HTML":"HTML einf\xFCgen","HTML snippet":"HTML-Snippet","Paste raw HTML here...":"Rohes HTML hier einf\xFCgen \u2026","Edit source":"Quelle bearbeiten","Save changes":"\xC4nderungen speichern","N
19o preview available":"Keine Vorschau verf\xFCgbar","Empty snippet content":"Leerer Snippet-Inhalt","Horizontal line":"Horizontale Linie","Yellow marker":"Gelber Marker","Green marker":"Gr\xFCner Marker","Pink marker":"Pinker Marker","Blue marker":"Blauer Marker","Red pen":"Rote Schriftfarbe","Green pen":"Gr\xFCne Schriftfarbe","Remove highlight":"Texthervorhebung entfernen",Highlight:"Texthervorhebung","Text highlight toolbar":"Text hervorheben Werkzeugleiste",Heading:"\xDCberschrift","Choose heading":"\xDCberschrift ausw\xE4hlen","Heading 1":"\xDCberschrift 1","Heading 2":"\xDCberschrift 2","Heading 3":"\xDCberschrift 3","Heading 4":"\xDCberschrift 4","Heading 5":"\xDCberschrift 5","Heading 6":"\xDCberschrift 6","Type your title":"Titel eingeben","Type or paste your content here.":"Hier Inhalt einf\xFCgen.","Enter fullscreen mode":"Vollbildmodus aktivieren","Leave fullscreen mode":"Vollbildmodus deaktivieren","Fullscreen mode":"Vollbildmodus","Toggle fullscreen mode":"Vollbildmodus umschalten","Document outline":"Dokumentgliederung","Connected users":"Verbundene Nutzer","Show left sidebar":"Linke Seitenleiste anzeigen","Hide left sidebar":"Linke Seitenleiste ausblenden","Toggle sidebar":"Seitenleiste umschalten","Font Size":"Schriftgr\xF6\xDFe",Tiny:"Sehr klein",Small:"Klein",Big:"Gro\xDF",Huge:"Sehr gro\xDF","Font Family":"Schriftart",Default:"Standard","Font Color":"Schriftfarbe","Font Background Color":"Hintergrundfarbe","Document colors":"Dokumentfarben","Find and replace":"Suchen und ersetzen","Find in text\u2026":"In Text suchen\u2026",Find:"Suchen","Previous result":"Vorheriges Ergebnis","Next result":"N\xE4chstes Ergebnis",Replace:"Ersetzen","Replace all":"Alle ersetzen","Match case":"Gro\xDF-/Kleinschreibung beachten","Whole words only":"Nur ganze W\xF6rter","Replace with\u2026":"Ersetzen durch\u2026","Text to find must not be empty.":"Der Suchtext darf nicht leer sein.","Tip: Find some text first in order to replace it.":"Tipp: Zuerst nach Text suchen um diesen zu ersetzen.","Advanced options":"Erweiterte Optionen","Find in the document":"Dokument durchsuchen","Insert a soft break (a <code><br></code> element)":"Einen weichen Zeilenumbruch einf\xFCgen (ein <code><br></code>-Element)","Insert a hard break (a new paragraph)":"Zeilenumbruch einf\xFCgen (einen neuen Abschnitt)",Emoji:"Emojis","Show all emoji...":"Alle Emojis anzeigen ...","Find an emoji (min. 2 characters)":"Emoji finden (min. 2 Zeichen)",'No emojis were found matching "%0".':"Es wurden keine Emojis gefunden, die zu \u201E%0\u201C passen.","Keep on typing to see the emoji.":"Weiteren Text eingeben, damit Emojis angezeigt werden.","The query must contain at least two characters.":"Die Anfrage muss aus mindestens zwei Zeichen bestehen.","Smileys & Expressions":"Smileys und Emotionen","Gestures & People":"Gesten und Personen","Animals & Nature":"Tiere und Natur","Food & Drinks":"Speisen und Getr\xE4nke","Travel & Places":"Reisen und Orte",Activities:"Aktivit\xE4ten",Objects:"Objekte",Symbols:"Symbole",Flags:"Flaggen","Select skin tone":"Hautfarbe w\xE4hlen","Default skin tone":"Standardhautfarbe","Light skin tone":"Helle Hautfarbe","Medium Light skin tone":"Mittelhelle Hautfarbe","Medium skin tone":"Mittlere Hautfarbe","Medium Dark skin tone":"Mitteldunkle Hautfarbe","Dark skin tone":"Dunkle Hautfarbe","Emoji picker":"Emoji-Auswahl",Cancel:"Abbrechen",Clear:"L\xF6schen","Remove color":"Farbe entfernen","Restore default":"Standard wiederherstellen",Save:"Speichern","Show more items":"Mehr anzeigen","%0 of %1":"%0 von %1","Cannot upload file:":"Die Datei kann nicht hochgeladen werden:","Rich Text Editor. Editing area: %0":"Rich Text Editor. Bearbeitungsbereich: %0","Insert with file manager":"Mit Dateimanager einf\xFCgen","Replace with file manager":"Mittels Dateimanager ersetzen","Insert image with file manager":"Bild mit dem Dateimanager einf\xFCgen","Replace image with file manager":"Bild mittels Dateimanager ersetzen",File:"Datei","With file manager":"Mit dem Dateimanager","Toggle caption off":"Tabellen\xFCberschrift deaktivieren","Toggle caption on":"Tabellen\xFCberschrift aktivieren","Content editing keystrokes":"Tastatureingaben zur Inhaltsverarbeitung","These keyboard shortcuts allow for quick access to content editing features.":"Diese Tastenkombinationen erm\xF6glichen einen schnellen Zugang zu den Inhaltsverarbeitungsfunktionen.","User interface and content navigation keystrokes":"Benutzeroberfl\xE4che und In
19haltsnavigationstasten","Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.":"Verwenden Sie die folgenden Tastatureingaben f\xFCr eine effizientere Navigation auf der CKEditor-5-Benutzeroberfl\xE4che.","Close contextual balloons, dropdowns, and dialogs":"Kontextsprechblasen, Dropdown-Men\xFC und Dialoge schlie\xDFen","Open the accessibility help dialog":"Den Dialog zur Eingabehilfe \xF6ffnen","Move focus between form fields (inputs, buttons, etc.)":"Fokus zwischen Formularfeldern verschieben (Eingaben, Tastenfelder etc.)","Move focus to the menu bar, navigate between menu bars":"Fokus auf die Men\xFCleiste richten, zwischen Men\xFCleisten navigieren","Move focus to the toolbar, navigate between toolbars":"Fokus auf die Symbolleiste verschieben, zwischen den Symbolleisten navigieren","Navigate through the toolbar or menu bar":"Durch die Werkzeugleiste oder Men\xFCleiste navigieren","Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.":"Ausf\xFChren der aktuell fokussierten Schaltfl\xE4che. Das Ausf\xFChren von Schaltfl\xE4chen, die mit dem Inhalt des Editors interagieren, richtet den Fokus zur\xFCck auf den Inhalt.",Accept:"Akzeptieren",Paragraph:"Absatz","Color picker":"Farbw\xE4hler","Please try a different phrase or check the spelling.":"Bitte versuchen Sie einen anderen Ausdruck oder \xFCberpr\xFCfen Sie die Schreibweise.",Source:"Quelle",Insert:"Einf\xFCgen",Update:"Aktualisieren",Back:"Zur\xFCck","Wrap text":"Text umflie\xDFt Bild","Break text":"Bild teilt Text",Custom:"Benutzerdefiniert",Original:"Original","The value must not be empty.":"Der Wert darf nicht leer sein.","The value should be a plain number.":"Der Wert sollte eine einfache Zahl sein.","Insert code block":"Code-Block einf\xFCgen","Plain text":"Nur Text","Leaving %0 code snippet":"%0 Code-Ausschnitt verlassen","Entering %0 code snippet":"%0 Code-Ausschnitt eingeben","Entering code snippet":"Code-Ausschnit eingeben","Leaving code snippet":"Code-Ausschnit verlassen","Code block":"Codeblock","Insert image or file":"Bild oder Datei einf\xFCgen","Could not obtain resized image URL.":"Die URL des angepassten Bildes konnte nicht abgerufen werden.","Selecting resized image failed":"Das angepasste Bild konnte nicht ausgew\xE4hlt werden.","Could not insert image at the current position.":"Das Bild konnte an der aktuellen Position nicht eingef\xFCgt werden.","Inserting image failed":"Einf\xFCgen des Bildes fehlgeschlagen","Open file manager":"Dateimanager \xF6ffnen","Cannot determine a category for the uploaded file.":"Die Kategorie f\xFCr die hochgeladene Datei konnte nicht bestimmt werden.","Cannot access default workspace.":"Zugriff auf Standardarbeitsbereich nicht m\xF6glich.","You have no image editing permissions.":"Sie haben keine Berechtigung zum Bearbeiten von Bildern.","Edit image":"Bild bearbeiten","Processing the edited image.":"Das bearbeitete Bild wird verarbeitet.","Server failed to process the image.":"Der Server konnte das Bild nicht verarbeiten.","Failed to determine category of edited image.":"Es konnte f\xFCr das bearbeitete Bild keine Kategorie ermittelt werden.","Copy selected content":"Markierten Inhalt kopieren","Paste content":"Inhalt einf\xFCgen","Paste content as plain text":"Inhalt als Klartext einf\xFCgen",Bookmark:"Lesezeichen","Edit bookmark":"Lesezeichen bearbeiten","Remove bookmark":"Lesezeichen entfernen","Bookmark name":"Name des Lesezeichens","Enter the bookmark name without spaces.":"Geben Sie den Namen des Lesezeichens ohne Leerzeichen ein.","Bookmark must not be empty.":"Das Lesezeichen darf nicht leer sein.","Bookmark name cannot contain space characters.":"Der Name des Lesezeichens darf keine Leerzeichen enthalten.","Bookmark name already exists.":"Der Lesezeichenname existiert bereits.","bookmark widget":"Lesezeichen-Widget","Bookmark toolbar":"Lesezeichen-Werkzeugleiste",Bookmarks:"Lesezeichen","No bookmarks available.":"Keine Lesezeichen verf\xFCgbar.","Scroll to bookmark":"Zu Lesezeichen scrollen","Block quote":"Blockzitat",Bold:"Fett",Italic:"Kursiv",Underline:"Unterstrichen",Code:"Code",Strikethrough:"Durchgestrichen",Subscript:"Tiefgestellt",Superscript:"Hochgestellt","Italic text":"Kursivschrift","Move out of an inline code style":"Inline C
19ode Style verlassen","Bold text":"Fettschrift","Underline text":"Text hervorheben","Strikethrough text":"Durchgestrichener Text","Saving changes":"\xC4nderungen werden gespeichert","Revert autoformatting action":"Automatischen Formatierungsvorgang r\xFCckg\xE4ngig machen","Align left":"Linksb\xFCndig","Align right":"Rechtsb\xFCndig","Align center":"Zentriert",Justify:"Blocksatz","Text alignment":"Textausrichtung","Text alignment toolbar":"Text-Ausrichtung Toolbar"},getPluralForm(e){return e!=1}}};return Xf($v);})(); 20/*! Bundled license information: 21 22@ckeditor/ckeditor5-utils/dist/index.js: 23 (** 24 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 25 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 26 *) 27 (** 28 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 29 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 30 *) 31 (* v8 ignore start -- @preserve *) 32 33@ckeditor/ckeditor5-utils/dist/index.js: 34@ckeditor/ckeditor5-utils/dist/index.js: 35@ckeditor/ckeditor5-utils/dist/index.js: 36@ckeditor/ckeditor5-utils/dist/index.js: 37@ckeditor/ckeditor5-utils/dist/index.js: 38@ckeditor/ckeditor5-utils/dist/index.js: 39@ckeditor/ckeditor5-utils/dist/index.js: 40@ckeditor/ckeditor5-utils/dist/index.js: 41@ckeditor/ckeditor5-utils/dist/index.js: 42@ckeditor/ckeditor5-utils/dist/index.js: 43@ckeditor/ckeditor5-utils/dist/index.js: 44@ckeditor/ckeditor5-engine/dist/index.js: 45@ckeditor/ckeditor5-engine/dist/index.js: 46@ckeditor/ckeditor5-engine/dist/index.js: 47@ckeditor/ckeditor5-engine/dist/index.js: 48@ckeditor/ckeditor5-engine/dist/index.js: 49@ckeditor/ckeditor5-engine/dist/index.js: 50@ckeditor/ckeditor5-engine/dist/index.js: 51@ckeditor/ckeditor5-engine/dist/index.js: 52@ckeditor/ckeditor5-engine/dist/index.js: 53@ckeditor/ckeditor5-engine/dist/index.js: 54@ckeditor/ckeditor5-engine/dist/index.js: 55@ckeditor/ckeditor5-core/dist/index.js: 56@ckeditor/ckeditor5-core/dist/index.js: 57@ckeditor/ckeditor5-icons/dist/index.js: 58@ckeditor/ckeditor5-ui/dist/index.js: 59@ckeditor/ckeditor5-ui/dist/index.js: 60@ckeditor/ckeditor5-ui/dist/index.js: 61@ckeditor/ckeditor5-ui/dist/index.js: 62@ckeditor/ckeditor5-ui/dist/index.js: 63@ckeditor/ckeditor5-ui/dist/index.js: 64@ckeditor/ckeditor5-ui/dist/index.js: 65@ckeditor/ckeditor5-ui/dist/index.js: 66@ckeditor/ckeditor5-ui/dist/index.js: 67@ckeditor/ckeditor5-ui/dist/index.js: 68@ckeditor/ckeditor5-ui/dist/index.js: 69@ckeditor/ckeditor5-ui/dist/index.js: 70@ckeditor/ckeditor5-ui/dist/index.js: 71@ckeditor/ckeditor5-ui/dist/index.js: 72@ckeditor/ckeditor5-ui/dist/index.js: 73@ckeditor/ckeditor5-ui/dist/index.js: 74@ckeditor/ckeditor5-ui/dist/index.js: 75@ckeditor/ckeditor5-ui/dist/index.js: 76@ckeditor/ckeditor5-ui/dist/index.js: 77@ckeditor/ckeditor5-ui/dist/index.js: 78@ckeditor/ckeditor5-ui/dist/index.js: 79@ckeditor/ckeditor5-ui/dist/index.js: 80@ckeditor/ckeditor5-ui/dist/index.js: 81@ckeditor/ckeditor5-ui/dist/index.js: 82@ckeditor/ckeditor5-ui/dist/index.js: 83@ckeditor/ckeditor5-ui/dist/index.js: 84@ckeditor/ckeditor5-ui/dist/index.js: 85@ckeditor/ckeditor5-ui/dist/index.js: 86@ckeditor/ckeditor5-ui/dist/index.js: 87@ckeditor/ckeditor5-ui/dist/index.js: 88@ckeditor/ckeditor5-ui/dist/index.js: 89@ckeditor/ckeditor5-ui/dist/index.js: 90@ckeditor/ckeditor5-ui/dist/index.js: 91@ckeditor/ckeditor5-ui/dist/index.js: 92@ckeditor/ckeditor5-ui/dist/index.js: 93@ckeditor/ckeditor5-ui/dist/index.js: 94@ckeditor/ckeditor5-ui/dist/index.js: 95@ckeditor/ckeditor5-ui/dist/index.js: 96@ckeditor/ckeditor5-ui/dist/index.js: 97@ckeditor/ckeditor5-typing/dist/index.js: 98@ckeditor/ckeditor5-widget/dist/index.js: 99@ckeditor/ckeditor5-widget/dist/index.js: 100@ckeditor/ckeditor5-widget/dist/index.js: 101@ckeditor/ckeditor5-widget/dist/index.js: 102@ckeditor/ckeditor5-widget/dist/index.js: 103@ckeditor/ckeditor5-widget/dist/index.js: 104@ckeditor/ckeditor5-basic-styles/dist/index.js: 105@ckeditor/ckeditor5-basic-styles/dist/index.js: 106@ckeditor/ckeditor5-basic-styles/dist/index.js: 107@ckeditor/ckeditor5-basic-styles/dist/index.js: 108@ckeditor/ckeditor5-basic-styles/dist/index.js: 109@ckeditor/ckeditor5-basic-styles/dist/index.js: 110@ckeditor/ckeditor5-basic-styles/dist/index.js: 111@ckeditor/ckeditor5-basic-styles/dist/index.js: 112@ckeditor/ckeditor5-basic-styles/dist/index.js: 113@ckeditor/ckeditor5-upload/dist/index.js: 114@ckeditor/ckeditor5-upload/dist/index.js: 115@ckeditor/ckeditor5-upload/dist/index.js: 116@ckeditor/ckeditor5-upload/dist/index.js: 117@ckeditor/ckeditor5-image/dist/index.js: 118@ckeditor/ckeditor5-image/dist/index.js: 119@ckeditor/ckeditor5-image/dist/index.js: 120@ckeditor/ckeditor5-image/dist/index.js: 121@ckeditor/ckeditor5-image/dist/index.js: 122@ckeditor/ckeditor5-image/dist/index.js: 123@ckeditor/ckeditor5-image/dist/index.js: 124@ckeditor/ckeditor5-image/dist/index.js: 125@ckeditor/ckeditor5-image/dist/index.js: 126@ckeditor/ckeditor5-image/dist/index.js: 127@ckeditor/ckeditor5-image/dist/index.js: 128@ckeditor/ckeditor5-image/dist/index.js: 129@ckeditor/ckeditor5-image/dist/index.js: 130@ckeditor/ckeditor5-image/dist/index.js: 131@ckeditor/ckeditor5-image/dist/index.js: 132@ckeditor/ckeditor5-image/dist/index.js: 133@ckeditor/ckeditor5-image/dist/index.js: 134@ckeditor/ckeditor5-image/dist/index.js: 135@ckeditor/ckeditor5-image/dist/index.js: 136@ckeditor/ckeditor5-image/dist/index.js: 137@ckeditor/ckeditor5-image/dist/index.js: 138@ckeditor/ckeditor5-image/dist/index.js: 139@ckeditor/ckeditor5-image/dist/index.js: 140@ckeditor/ckeditor5-image/dist/index.js: 141@ckeditor/ckeditor5-image/dist/index.js: 142@ckeditor/ckeditor5-image/dist/index.js: 143@ckeditor/ckeditor5-image/dist/index.js: 144@ckeditor/ckeditor5-image/dist/index.js: 145@ckeditor/ckeditor5-image/dist/index.js: 146@ckeditor/ckeditor5-image/dist/index.js: 147@ckeditor/ckeditor5-image/dist/index.js: 148@ckeditor/ckeditor5-image/dist/index.js: 149@ckeditor/ckeditor5-image/dist/index.js: 150@ckeditor/ckeditor5-image/dist/index.js: 151@ckeditor/ckeditor5-image/dist/index.js: 152@ckeditor/ckeditor5-image/dist/index.js: 153@ckeditor/ckeditor5-image/dist/index.js: 154@ckeditor/ckeditor5-image/dist/index.js: 155@ckeditor/ckeditor5-image/dist/index.js: 156@ckeditor/ckeditor5-image/dist/index.js: 157@ckeditor/ckeditor5-image/dist/index.js: 158@ckeditor/ckeditor5-image/dist/index.js: 159@ckeditor/ckeditor5-image/dist/index.js: 160@ckeditor/ckeditor5-image/dist/index.js: 161@ckeditor/ckeditor5-image/dist/index.js: 162@ckeditor/ckeditor5-image/dist/index.js: 163@ckeditor/ckeditor5-image/dist/index.js: 164@ckeditor/ckeditor5-image/dist/index.js: 165@ckeditor/ckeditor5-image/dist/index.js: 166@ckeditor/ckeditor5-image/dist/index.js: 167@ckeditor/ckeditor5-image/dist/index.js: 168@ckeditor/ckeditor5-image/dist/index.js: 169@ckeditor/ckeditor5-image/dist/index.js: 170@ckeditor/ckeditor5-image/dist/index.js: 171@ckeditor/ckeditor5-image/dist/index.js: 172@ckeditor/ckeditor5-image/dist/index.js: 173@ckeditor/ckeditor5-image/dist/index.js: 174@ckeditor/ckeditor5-link/dist/index.js: 175@ckeditor/ckeditor5-link/dist/index.js: 176@ckeditor/ckeditor5-link/dist/index.js: 177@ckeditor/ckeditor5-font/dist/index.js: 178@ckeditor/ckeditor5-font/dist/index.js: 179@ckeditor/ckeditor5-font/dist/index.js: 180@ckeditor/ckeditor5-font/dist/index.js: 181@ckeditor/ckeditor5-font/dist/index.js: 182@ckeditor/ckeditor5-font/dist/index.js: 183@ckeditor/ckeditor5-font/dist/index.js: 184@ckeditor/ckeditor5-font/dist/index.js: 185@ckeditor/ckeditor5-font/dist/index.js: 186@ckeditor/ckeditor5-font/dist/index.js: 187@ckeditor/ckeditor5-font/dist/index.js: 188@ckeditor/ckeditor5-font/dist/index.js: 189@ckeditor/ckeditor5-font/dist/index.js: 190@ckeditor/ckeditor5-font/dist/index.js: 191@ckeditor/ckeditor5-font/dist/index.js: 192@ckeditor/ckeditor5-font/dist/index.js: 193@ckeditor/ckeditor5-font/dist/index.js: 194@ckeditor/ckeditor5-font/dist/index.js: 195@ckeditor/ckeditor5-font/dist/index.js: 196@ckeditor/ckeditor5-font/dist/index.js: 197@ckeditor/ckeditor5-font/dist/index.js: 198@ckeditor/ckeditor5-list/dist/index.js: 199@ckeditor/ckeditor5-list/dist/index.js: 200@ckeditor/ckeditor5-list/dist/index.js: 201@ckeditor/ckeditor5-list/dist/index.js: 202@ckeditor/ckeditor5-list/dist/index.js: 203@ckeditor/ckeditor5-list/dist/index.js: 204@ckeditor/ckeditor5-list/dist/index.js: 205@ckeditor/ckeditor5-list/dist/index.js: 206@ckeditor/ckeditor5-list/dist/index.js: 207@ckeditor/ckeditor5-list/dist/index.js: 208@ckeditor/ckeditor5-list/dist/index.js: 209@ckeditor/ckeditor5-list/dist/index.js: 210@ckeditor/ckeditor5-list/dist/index.js: 211@ckeditor/ckeditor5-list/dist/index.js: 212@ckeditor/ckeditor5-list/dist/index.js: 213@ckeditor/ckeditor5-list/dist/index.js: 214@ckeditor/ckeditor5-list/dist/index.js: 215@ckeditor/ckeditor5-list/dist/index.js: 216@ckeditor/ckeditor5-list/dist/index.js: 217@ckeditor/ckeditor5-list/dist/index.js: 218@ckeditor/ckeditor5-list/dist/index.js: 219@ckeditor/ckeditor5-list/dist/index.js: 220@ckeditor/ckeditor5-list/dist/index.js: 221@ckeditor/ckeditor5-list/dist/index.js: 222@ckeditor/ckeditor5-list/dist/index.js: 223@ckeditor/ckeditor5-list/dist/index.js: 224@ckeditor/ckeditor5-list/dist/index.js: 225@ckeditor/ckeditor5-list/dist/index.js: 226@ckeditor/ckeditor5-list/dist/index.js: 227@ckeditor/ckeditor5-list/dist/index.js: 228@ckeditor/ckeditor5-list/dist/index.js: 229@ckeditor/ckeditor5-list/dist/index.js: 230@ckeditor/ckeditor5-list/dist/index.js: 231@ckeditor/ckeditor5-paragraph/dist/index.js: 232@ckeditor/ckeditor5-indent/dist/index.js: 233@ckeditor/ckeditor5-indent/dist/index.js: 234@ckeditor/ckeditor5-indent/dist/index.js: 235@ckeditor/ckeditor5-indent/dist/index.js: 236@ckeditor/ckeditor5-indent/dist/index.js: 237@ckeditor/ckeditor5-indent/dist/index.js: 238@ckeditor/ckeditor5-indent/dist/index.js: 239@ckeditor/ckeditor5-indent/dist/index.js: 240@ckeditor/ckeditor5-indent/dist/index.js: 241 (** 242 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 243 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 244 *) 245 246@ckeditor/ckeditor5-utils/dist/index.js: 247 (** 248 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 249 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 250 *) 251 (* v8 ignore next -- @preserve *) 252 253@ckeditor/ckeditor5-utils/dist/index.js: 254@ckeditor/ckeditor5-ui/dist/index.js: 255@ckeditor/ckeditor5-ui/dist/index.js: 256@ckeditor/ckeditor5-ui/dist/index.js: 257@ckeditor/ckeditor5-widget/dist/index.js: 258 (** 259 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 260 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 261 *) 262 (* v8 ignore else -- @preserve *) 263 264@ckeditor/ckeditor5-engine/dist/index.js: 265@ckeditor/ckeditor5-editor-classic/dist/index.js: 266@ckeditor/ckeditor5-typing/dist/index.js: 267@ckeditor/ckeditor5-widget/dist/index.js: 268@ckeditor/ckeditor5-select-all/dist/index.js: 269@ckeditor/ckeditor5-undo/dist/index.js:
270@ckeditor/ckeditor5-essentials/dist/index.js: 271@ckeditor/ckeditor5-basic-styles/dist/index.js: 272@ckeditor/ckeditor5-upload/dist/index.js: 273@ckeditor/ckeditor5-image/dist/index.js: 274@ckeditor/ckeditor5-font/dist/index.js: 275@ckeditor/ckeditor5-paragraph/dist/index.js: 276@ckeditor/ckeditor5-indent/dist/index.js: 277@ckeditor/ckeditor5-source-editing/dist/index.js: 278 (** 279 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 280 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 281 *) 282 (** 283 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 284 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 285 *) 286 287@ckeditor/ckeditor5-engine/dist/index.js: 288 (** 289 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 290 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 291 *) 292 (* v8 ignore next 4 -- @preserve *) 293 294@ckeditor/ckeditor5-engine/dist/index.js: 295 (** 296 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 297 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 298 *) 299 (* v8 ignore next -- @preserve *) 300 (* v8 ignore if -- @preserve *) 301 302@ckeditor/ckeditor5-watchdog/dist/index.js: 303 (** 304 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 305 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 306 *) 307 (** 308 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 309 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 310 *) 311 (* v8 ignore stop -- @preserve *) 312 313@ckeditor/ckeditor5-watchdog/dist/index.js: 314 (* v8 ignore stop -- @preserve *) 315 (** 316 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 317 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 318 *) 319 320@ckeditor/ckeditor5-core/dist/index.js: 321 (** 322 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 323 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 324 *) 325 (** 326 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 327 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 328 *) 329 (* v8 ignore next -- @preserve *) 330 (* v8 ignore else -- @preserve *) 331 332@ckeditor/ckeditor5-icons/dist/index.js: 333ckeditor5/dist/translations/de.js: 334 (** 335 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 336 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 337 *) 338 339@ckeditor/ckeditor5-ui/dist/index.js: 340@ckeditor/ckeditor5-enter/dist/index.js: 341 (** 342 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 343 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 344 *) 345 (** 346 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 347 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 348 *) 349 (* v8 ignore else -- @preserve *) 350 351@ckeditor/ckeditor5-clipboard/dist/index.js: 352 (** 353 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 354 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 355 *) 356 (** 357 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 358 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 359 *) 360 (* istanbul ignore file -- @preserve *) 361 (* istanbul ignore next -- @preserve *) 362 363@ckeditor/ckeditor5-link/dist/index.js: 364@ckeditor/ckeditor5-list/dist/index.js: 365 (** 366 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 367 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 368 *) 369 (** 370 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. 371 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 372 *) 373 (* istanbul ignore next -- @preserve *) 374*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.