@qualityunit/liveagent-components-editor 0.0.45 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ckeditor.js +1 -1
- package/dist/{ckeditor5-BRtzn9MD.js → ckeditor5-DbagB4Ow.js} +3908 -3812
- package/dist/editor-lib.js +1 -1
- package/dist/locale-af-Cv1OovtL.js +6 -0
- package/dist/locale-ar-BPTau1C3.js +7 -0
- package/dist/locale-ast-BA3jIJTT.js +6 -0
- package/dist/locale-az-DFSDeY8O.js +6 -0
- package/dist/locale-bg-DjmyjNfY.js +8 -0
- package/dist/locale-bn-r1jvfDDB.js +21 -0
- package/dist/locale-bs-CiPw2NNv.js +6 -0
- package/dist/locale-ca-DJ712OK8.js +6 -0
- package/dist/locale-cs-CZOf20P5.js +6 -0
- package/dist/locale-da-DhziycmZ.js +6 -0
- package/dist/locale-de-DHEXpm5Z.js +6 -0
- package/dist/locale-de-ch-CmvXNF-H.js +6 -0
- package/dist/locale-el-C-sYZACi.js +6 -0
- package/dist/locale-en-au-B5nfI1VJ.js +6 -0
- package/dist/locale-en-gb-CPwA7t3I.js +6 -0
- package/dist/locale-eo-Ck8AS5P4.js +6 -0
- package/dist/locale-es-CAaCBqwz.js +6 -0
- package/dist/locale-es-co-CDX7rJjR.js +6 -0
- package/dist/locale-et-CeaIUpYN.js +6 -0
- package/dist/locale-eu-tPiMUKkC.js +6 -0
- package/dist/locale-fa-CBznFdfz.js +6 -0
- package/dist/locale-fi-8iUalBcz.js +6 -0
- package/dist/locale-fr-4GX54JrH.js +6 -0
- package/dist/locale-gl-CoK6d0aJ.js +6 -0
- package/dist/locale-gu-Bk992sLF.js +6 -0
- package/dist/locale-he-DqBaXk8u.js +6 -0
- package/dist/locale-hi-Dxx5lt2X.js +6 -0
- package/dist/locale-hr-Cxb6cRzB.js +6 -0
- package/dist/locale-hu-BwZQlaW2.js +6 -0
- package/dist/locale-hy-B9XHtcia.js +6 -0
- package/dist/locale-id-DDXtYL05.js +6 -0
- package/dist/locale-it-BzqQkcgR.js +6 -0
- package/dist/locale-ja-PvNTejV3.js +6 -0
- package/dist/locale-jv-BPVva1ax.js +6 -0
- package/dist/locale-km-CMCkZJtz.js +6 -0
- package/dist/locale-kn-B62eCq_e.js +6 -0
- package/dist/locale-ko-oJKZ0Vkw.js +6 -0
- package/dist/locale-ku-CH4E2UNl.js +6 -0
- package/dist/locale-lt-CHV3dW_8.js +6 -0
- package/dist/locale-lv-B1CFJ5CF.js +6 -0
- package/dist/locale-ms-BjaM_Pxh.js +6 -0
- package/dist/locale-nb-D-EbA0lj.js +6 -0
- package/dist/locale-ne-BgDsdaxZ.js +6 -0
- package/dist/locale-nl-CSute3FC.js +7 -0
- package/dist/locale-no-BOBEhMCz.js +7 -0
- package/dist/locale-oc-Di-LlEDZ.js +6 -0
- package/dist/locale-pl-XVScd6LB.js +6 -0
- package/dist/locale-pt-br-DHMlpxYN.js +6 -0
- package/dist/locale-pt-v7Of_vmo.js +6 -0
- package/dist/locale-ro-DpTCM2qM.js +6 -0
- package/dist/locale-ru-CjgF_ZGx.js +7 -0
- package/dist/locale-si-BjMg4hV-.js +6 -0
- package/dist/locale-sk-BF_N-MJ-.js +6 -0
- package/dist/locale-sl-D_nbOpek.js +6 -0
- package/dist/locale-sq-CR0PVr0_.js +6 -0
- package/dist/locale-sr-D-j4FqYC.js +6 -0
- package/dist/locale-sr-latn-eT0wbhEJ.js +6 -0
- package/dist/locale-sv-GUJ9tOWv.js +6 -0
- package/dist/locale-th-XbtDtjYx.js +6 -0
- package/dist/locale-tk-DPiglvDu.js +6 -0
- package/dist/locale-tr-D__PNGN-.js +6 -0
- package/dist/locale-tt-C1w7MSLD.js +6 -0
- package/dist/locale-ug-Bb6Cvwxu.js +6 -0
- package/dist/locale-uk-CL95RoAj.js +6 -0
- package/dist/locale-ur-BM-_mQsf.js +6 -0
- package/dist/locale-uz-BOp9iuNM.js +6 -0
- package/dist/locale-vi-PDDgqg1b.js +6 -0
- package/dist/locale-zh-BGs_-Bsh.js +6 -0
- package/dist/locale-zh-cn-CNI3MWUp.js +6 -0
- package/package.json +4 -7
- package/dist/ckeditor.cjs +0 -1
- package/dist/ckeditor5-CvxwZg7m.cjs +0 -1747
- package/dist/editor-lib.cjs +0 -1
- package/dist/locales/af.js +0 -1
- package/dist/locales/ar.js +0 -1
- package/dist/locales/ast.js +0 -1
- package/dist/locales/az.js +0 -1
- package/dist/locales/bg.js +0 -1
- package/dist/locales/bn.js +0 -1
- package/dist/locales/bs.js +0 -1
- package/dist/locales/ca.js +0 -1
- package/dist/locales/cs.js +0 -1
- package/dist/locales/da.js +0 -1
- package/dist/locales/de-ch.js +0 -1
- package/dist/locales/de.js +0 -1
- package/dist/locales/el.js +0 -1
- package/dist/locales/en-au.js +0 -1
- package/dist/locales/en-gb.js +0 -1
- package/dist/locales/en.js +0 -33
- package/dist/locales/eo.js +0 -1
- package/dist/locales/es-co.js +0 -1
- package/dist/locales/es.js +0 -1
- package/dist/locales/et.js +0 -1
- package/dist/locales/eu.js +0 -1
- package/dist/locales/fa.js +0 -1
- package/dist/locales/fi.js +0 -1
- package/dist/locales/fr.js +0 -1
- package/dist/locales/gl.js +0 -1
- package/dist/locales/gu.js +0 -1
- package/dist/locales/he.js +0 -1
- package/dist/locales/hi.js +0 -1
- package/dist/locales/hr.js +0 -1
- package/dist/locales/hu.js +0 -1
- package/dist/locales/hy.js +0 -1
- package/dist/locales/id.js +0 -1
- package/dist/locales/it.js +0 -1
- package/dist/locales/ja.js +0 -1
- package/dist/locales/jv.js +0 -1
- package/dist/locales/km.js +0 -1
- package/dist/locales/kn.js +0 -1
- package/dist/locales/ko.js +0 -1
- package/dist/locales/ku.js +0 -1
- package/dist/locales/lt.js +0 -1
- package/dist/locales/lv.js +0 -1
- package/dist/locales/ms.js +0 -1
- package/dist/locales/nb.js +0 -1
- package/dist/locales/ne.js +0 -1
- package/dist/locales/nl.js +0 -1
- package/dist/locales/no.js +0 -1
- package/dist/locales/oc.js +0 -1
- package/dist/locales/pl.js +0 -1
- package/dist/locales/pt-br.js +0 -1
- package/dist/locales/pt.js +0 -1
- package/dist/locales/ro.js +0 -1
- package/dist/locales/ru.js +0 -1
- package/dist/locales/si.js +0 -1
- package/dist/locales/sk.js +0 -1
- package/dist/locales/sl.js +0 -1
- package/dist/locales/sq.js +0 -1
- package/dist/locales/sr-latn.js +0 -1
- package/dist/locales/sr.js +0 -1
- package/dist/locales/sv.js +0 -1
- package/dist/locales/th.js +0 -1
- package/dist/locales/tk.js +0 -1
- package/dist/locales/tr.js +0 -1
- package/dist/locales/tt.js +0 -1
- package/dist/locales/ug.js +0 -1
- package/dist/locales/uk.js +0 -1
- package/dist/locales/ur.js +0 -1
- package/dist/locales/uz.js +0 -1
- package/dist/locales/vi.js +0 -1
- package/dist/locales/zh-cn.js +0 -1
- package/dist/locales/zh.js +0 -1
|
@@ -1,1747 +0,0 @@
|
|
|
1
|
-
"use strict";var R1=Object.defineProperty;var V1=(n,e,t)=>e in n?R1(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pe=(n,e,t)=>(V1(n,typeof e!="symbol"?e+"":e,t),t);function B1(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function ti(){}function Oh(n){return n()}function Dl(){return Object.create(null)}function sn(n){n.forEach(Oh)}function Na(n){return typeof n=="function"}function Fh(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function M1(n){return Object.keys(n).length===0}function L1(n,e){n.appendChild(e)}function $a(n,e,t){n.insertBefore(e,t||null)}function Bo(n){n.parentNode&&n.parentNode.removeChild(n)}function O1(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function Ha(n){return document.createElement(n)}function Dh(n){return document.createTextNode(n)}function F1(){return Dh(" ")}function D1(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function Nh(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function N1(n){return Array.from(n.childNodes)}function $1(n,e){e=""+e,n.data!==e&&(n.data=e)}function H1(n,e){n.value=e??""}function z1(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function U1(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let Nn;function Pn(n){Nn=n}function W1(){if(!Nn)throw new Error("Function called outside component initialization");return Nn}function q1(){const n=W1();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const o=z1(e,t,{cancelable:i});return s.slice().forEach(r=>{r.call(n,o)}),!o.defaultPrevented}return!0}}const Fi=[],oo=[];let qi=[];const Hr=[],j1=Promise.resolve();let zr=!1;function G1(){zr||(zr=!0,j1.then(Ie))}function Ur(n){qi.push(n)}function K1(n){Hr.push(n)}const sr=new Set;let Si=0;function Ie(){if(Si!==0)return;const n=Nn;do{try{for(;Si<Fi.length;){const e=Fi[Si];Si++,Pn(e),Z1(e.$$)}}catch(e){throw Fi.length=0,Si=0,e}for(Pn(null),Fi.length=0,Si=0;oo.length;)oo.pop()();for(let e=0;e<qi.length;e+=1){const t=qi[e];sr.has(t)||(sr.add(t),t())}qi.length=0}while(Fi.length);for(;Hr.length;)Hr.pop()();zr=!1,sr.clear(),Pn(n)}function Z1(n){if(n.fragment!==null){n.update(),sn(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Ur)}}function J1(n){const e=[],t=[];qi.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),qi=e}const Ys=new Set;let Xt;function Y1(){Xt={r:0,c:[],p:Xt}}function Q1(){Xt.r||sn(Xt.c),Xt=Xt.p}function $h(n,e){n&&n.i&&(Ys.delete(n),n.i(e))}function X1(n,e,t,i){if(n&&n.o){if(Ys.has(n))return;Ys.add(n),Xt.c.push(()=>{Ys.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}function ew(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function tw(n){n&&n.c()}function Hh(n,e,t){const{fragment:i,after_update:s}=n.$$;i&&i.m(e,t),Ur(()=>{const o=n.$$.on_mount.map(Oh).filter(Na);n.$$.on_destroy?n.$$.on_destroy.push(...o):sn(o),n.$$.on_mount=[]}),s.forEach(Ur)}function zh(n,e){const t=n.$$;t.fragment!==null&&(J1(t.after_update),sn(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function iw(n,e){n.$$.dirty[0]===-1&&(Fi.push(n),G1(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Uh(n,e,t,i,s,o,r=null,a=[-1]){const l=Nn;Pn(n);const c=n.$$={fragment:null,ctx:[],props:o,update:ti,not_equal:s,bound:Dl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:Dl(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};r&&r(c.root);let u=!1;if(c.ctx=t?t(n,e.props||{},(d,h,...f)=>{const m=f.length?f[0]:h;return c.ctx&&s(c.ctx[d],c.ctx[d]=m)&&(!c.skip_bound&&c.bound[d]&&c.bound[d](m),u&&iw(n,d)),h}):[],c.update(),u=!0,sn(c.before_update),c.fragment=i?i(c.ctx):!1,e.target){if(e.hydrate){const d=N1(e.target);c.fragment&&c.fragment.l(d),d.forEach(Bo)}else c.fragment&&c.fragment.c();e.intro&&$h(n.$$.fragment),Hh(n,e.target,e.anchor),Ie()}Pn(l)}let Wh;typeof HTMLElement=="function"&&(Wh=class extends HTMLElement{constructor(e,t,i){super();pe(this,"$$ctor");pe(this,"$$s");pe(this,"$$c");pe(this,"$$cn",!1);pe(this,"$$d",{});pe(this,"$$r",!1);pe(this,"$$p_d",{});pe(this,"$$l",{});pe(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=t,i&&this.attachShadow({mode:"open"})}addEventListener(e,t,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const s=this.$$c.$on(e,t);this.$$l_u.set(t,s)}super.addEventListener(e,t,i)}removeEventListener(e,t,i){if(super.removeEventListener(e,t,i),this.$$c){const s=this.$$l_u.get(t);s&&(s(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(o){return()=>{let r;return{c:function(){r=Ha("slot"),o!=="default"&&Nh(r,"name",o)},m:function(c,u){$a(c,r,u)},d:function(c){c&&Bo(r)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},i=U1(this);for(const o of this.$$s)o in i&&(t[o]=[e(o)]);for(const o of this.attributes){const r=this.$$g_p(o.name);r in this.$$d||(this.$$d[r]=Qs(r,o.value,this.$$p_d,"toProp"))}for(const o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$scope:{ctx:[]}}});const s=()=>{this.$$r=!0;for(const o in this.$$p_d)if(this.$$d[o]=this.$$c.$$.ctx[this.$$c.$$.props[o]],this.$$p_d[o].reflect){const r=Qs(o,this.$$d[o],this.$$p_d,"toAttribute");r==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,r)}this.$$r=!1};this.$$c.$$.after_update.push(s),s();for(const o in this.$$l)for(const r of this.$$l[o]){const a=this.$$c.$on(o,r);this.$$l_u.set(r,a)}this.$$l={}}}attributeChangedCallback(e,t,i){var s;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Qs(e,i,this.$$p_d,"toProp"),(s=this.$$c)==null||s.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Qs(n,e,t,i){var o;const s=(o=t[n])==null?void 0:o.type;if(e=s==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!t[n])return e;if(i==="toAttribute")switch(s){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function qh(n,e,t,i,s,o){let r=class extends Wh{constructor(){super(n,t,s),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(r.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){var c;l=Qs(a,l,e),this.$$d[a]=l,(c=this.$$c)==null||c.$set({[a]:l})}})}),i.forEach(a=>{Object.defineProperty(r.prototype,a,{get(){var l;return(l=this.$$c)==null?void 0:l[a]}})}),o&&(r=o(r)),n.element=r,r}class jh{constructor(){pe(this,"$$");pe(this,"$$set")}$destroy(){zh(this,1),this.$destroy=ti}$on(e,t){if(!Na(t))return ti;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!M1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const nw="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nw);/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/function Mo({emitter:n,activator:e,callback:t,contextElements:i}){n.listenTo(document,"mousedown",(s,o)=>{if(!e())return;const r=typeof o.composedPath=="function"?o.composedPath():[],a=typeof i=="function"?i():i;for(const l of a)if(l.contains(o.target)||r.includes(l))return;t()})}/**
|
|
5
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
7
|
-
*/function za(n){class e extends n{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...i){super(...i),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}return e}/**
|
|
8
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
9
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
10
|
-
*/function Lo({view:n}){n.listenTo(n.element,"submit",(e,t)=>{t.preventDefault(),n.fire("submit")},{useCapture:!0})}/**
|
|
11
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
12
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
13
|
-
*/function as({keystrokeHandler:n,focusTracker:e,gridItems:t,numberOfColumns:i,uiLanguageDirection:s}){const o=typeof i=="number"?()=>i:i;n.set("arrowright",r((c,u)=>s==="rtl"?l(c,u.length):a(c,u.length))),n.set("arrowleft",r((c,u)=>s==="rtl"?a(c,u.length):l(c,u.length))),n.set("arrowup",r((c,u)=>{let d=c-o();return d<0&&(d=c+o()*Math.floor(u.length/o()),d>u.length-1&&(d-=o())),d})),n.set("arrowdown",r((c,u)=>{let d=c+o();return d>u.length-1&&(d=c%o()),d}));function r(c){return u=>{const d=t.find(m=>m.element===e.focusedElement),h=t.getIndex(d),f=c(h,t);t.get(f).focus(),u.stopPropagation(),u.preventDefault()}}function a(c,u){return c===u-1?0:c+1}function l(c,u){return c===0?u-1:c-1}}/**
|
|
14
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
15
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
16
|
-
*/function sw(){try{return navigator.userAgent.toLowerCase()}catch{return""}}const Wt=sw(),M={isMac:Gh(Wt),isWindows:ow(Wt),isGecko:rw(Wt),isSafari:aw(Wt),isiOS:lw(Wt),isAndroid:cw(Wt),isBlink:uw(Wt),features:{isRegExpUnicodePropertySupported:dw()}};function Gh(n){return n.indexOf("macintosh")>-1}function ow(n){return n.indexOf("windows")>-1}function rw(n){return!!n.match(/gecko\/\d+/)}function aw(n){return n.indexOf(" applewebkit/")>-1&&n.indexOf("chrome")===-1}function lw(n){return!!n.match(/iphone|ipad/i)||Gh(n)&&navigator.maxTouchPoints>0}function cw(n){return n.indexOf("android")>-1}function uw(n){return n.indexOf("chrome/")>-1&&n.indexOf("edge/")<0}function dw(){let n=!1;try{n="ć".search(new RegExp("[\\p{L}]","u"))===0}catch{}return n}/**
|
|
17
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
18
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
19
|
-
*/function Kh(n,e,t,i){t=t||function(l,c){return l===c};const s=Array.isArray(n)?n:Array.prototype.slice.call(n),o=Array.isArray(e)?e:Array.prototype.slice.call(e),r=hw(s,o,t);return i?mw(r,o.length):fw(o,r)}function hw(n,e,t){const i=Nl(n,e,t);if(i===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=$l(n,i),o=$l(e,i),r=Nl(s,o,t),a=n.length-r,l=e.length-r;return{firstIndex:i,lastIndexOld:a,lastIndexNew:l}}function Nl(n,e,t){for(let i=0;i<Math.max(n.length,e.length);i++)if(n[i]===void 0||e[i]===void 0||!t(n[i],e[i]))return i;return-1}function $l(n,e){return n.slice(e).reverse()}function fw(n,e){const t=[],{firstIndex:i,lastIndexOld:s,lastIndexNew:o}=e;return o-i>0&&t.push({index:i,type:"insert",values:n.slice(i,o)}),s-i>0&&t.push({index:i+(o-i),type:"delete",howMany:s-i}),t}function mw(n,e){const{firstIndex:t,lastIndexOld:i,lastIndexNew:s}=n;if(t===-1)return Array(e).fill("equal");let o=[];return t>0&&(o=o.concat(Array(t).fill("equal"))),s-t>0&&(o=o.concat(Array(s-t).fill("insert"))),i-t>0&&(o=o.concat(Array(i-t).fill("delete"))),s<e&&(o=o.concat(Array(e-s).fill("equal"))),o}/**
|
|
20
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
21
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
22
|
-
*/function Rn(n,e,t){t=t||function(p,_){return p===_};const i=n.length,s=e.length;if(i>200||s>200||i+s>300)return Rn.fastDiff(n,e,t,!0);let o,r;if(s<i){const p=n;n=e,e=p,o="delete",r="insert"}else o="insert",r="delete";const a=n.length,l=e.length,c=l-a,u={},d={};function h(p){const _=(d[p-1]!==void 0?d[p-1]:-1)+1,k=d[p+1]!==void 0?d[p+1]:-1,A=_>k?-1:1;u[p+A]&&(u[p]=u[p+A].slice(0)),u[p]||(u[p]=[]),u[p].push(_>k?o:r);let F=Math.max(_,k),U=F-p;for(;U<a&&F<l&&t(n[U],e[F]);)U++,F++,u[p].push("equal");return F}let f=0,m;do{for(m=-f;m<c;m++)d[m]=h(m);for(m=c+f;m>c;m--)d[m]=h(m);d[c]=h(c),f++}while(d[c]!==l);return u[c].slice(1)}Rn.fastDiff=Kh;/**
|
|
23
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
24
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
25
|
-
*/function Hl(){return function n(){n.called=!0}}/**
|
|
26
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
27
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
28
|
-
*/class xt{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=Hl(),this.off=Hl()}}/**
|
|
29
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
30
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
31
|
-
*/const Ee=new Array(256).fill("").map((n,e)=>("0"+e.toString(16)).slice(-2));function Ke(){const n=Math.random()*4294967296>>>0,e=Math.random()*4294967296>>>0,t=Math.random()*4294967296>>>0,i=Math.random()*4294967296>>>0;return"e"+Ee[n>>0&255]+Ee[n>>8&255]+Ee[n>>16&255]+Ee[n>>24&255]+Ee[e>>0&255]+Ee[e>>8&255]+Ee[e>>16&255]+Ee[e>>24&255]+Ee[t>>0&255]+Ee[t>>8&255]+Ee[t>>16&255]+Ee[t>>24&255]+Ee[i>>0&255]+Ee[i>>8&255]+Ee[i>>16&255]+Ee[i>>24&255]}/**
|
|
32
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
33
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
34
|
-
*/const $e={get(n="normal"){return typeof n!="number"?this[n]||this.normal:n},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};/**
|
|
35
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
36
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
37
|
-
*/function Zh(n,e){const t=$e.get(e.priority);for(let i=0;i<n.length;i++)if($e.get(n[i].priority)<t){n.splice(i,0,e);return}n.push(e)}/**
|
|
38
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
39
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
40
|
-
*/const gw="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class g extends Error{constructor(e,t,i){super(pw(e,i)),this.name="CKEditorError",this.context=t,this.data=i}is(e){return e==="CKEditorError"}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new g(e.message,t);throw i.stack=e.stack,i}}function D(n,e){console.warn(...ww(n,e))}function Jh(n){return`
|
|
41
|
-
Read more: ${gw}#error-${n}`}function pw(n,e){const t=new WeakSet,s=e?` ${JSON.stringify(e,(r,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return`[object ${a.constructor.name}]`;t.add(a)}return a})}`:"",o=Jh(n);return n+s+o}function ww(n,e){const t=Jh(n);return e?[n,e,t]:[n,t]}/**
|
|
42
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
43
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
44
|
-
*/const bw="41.3.1",_w=new Date(2024,3,16);/* istanbul ignore next -- @preserve */if(globalThis.CKEDITOR_VERSION)throw new g("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=bw;/**
|
|
45
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
46
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
47
|
-
*/const Di=Symbol("listeningTo"),Wr=Symbol("emitterId"),bt=Symbol("delegations"),Yh=Z(Object);function Z(n){if(!n)return Yh;class e extends n{on(i,s,o){this.listenTo(this,i,s,o)}once(i,s,o){let r=!1;const a=(l,...c)=>{r||(r=!0,l.off(),s.call(this,l,...c))};this.listenTo(this,i,a,o)}off(i,s){this.stopListening(this,i,s)}listenTo(i,s,o,r={}){let a,l;this[Di]||(this[Di]={});const c=this[Di];or(i)||Qh(i);const u=or(i);(a=c[u])||(a=c[u]={emitter:i,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(o),Cw(this,i,s,o,r)}stopListening(i,s,o){const r=this[Di];let a=i&&or(i);const l=r&&a?r[a]:void 0,c=l&&s?l.callbacks[s]:void 0;if(!(!r||i&&!l||s&&!c))if(o)rr(this,i,s,o),c.indexOf(o)!==-1&&(c.length===1?delete l.callbacks[s]:rr(this,i,s,o));else if(c){for(;o=c.pop();)rr(this,i,s,o);delete l.callbacks[s]}else if(l){for(s in l.callbacks)this.stopListening(i,s);delete r[a]}else{for(a in r)this.stopListening(r[a].emitter);delete this[Di]}}fire(i,...s){try{const o=i instanceof xt?i:new xt(this,i),r=o.name;let a=ef(this,r);if(o.path.push(this),a){const c=[o,...s];a=Array.from(a);for(let u=0;u<a.length&&(a[u].callback.apply(this,c),o.off.called&&(delete o.off.called,this._removeEventListener(r,a[u].callback)),!o.stop.called);u++);}const l=this[bt];if(l){const c=l.get(r),u=l.get("*");c&&zl(c,o,s),u&&zl(u,o,s)}return o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}delegate(...i){return{to:(s,o)=>{this[bt]||(this[bt]=new Map),i.forEach(r=>{const a=this[bt].get(r);a?a.set(s,o):this[bt].set(r,new Map([[s,o]]))})}}}stopDelegating(i,s){if(this[bt])if(!i)this[bt].clear();else if(!s)this[bt].delete(i);else{const o=this[bt].get(i);o&&o.delete(s)}}_addEventListener(i,s,o){kw(this,i);const r=qr(this,i),a=$e.get(o.priority),l={callback:s,priority:a};for(const c of r)Zh(c,l)}_removeEventListener(i,s){const o=qr(this,i);for(const r of o)for(let a=0;a<r.length;a++)r[a].callback==s&&(r.splice(a,1),a--)}}return e}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{Z[n]=Yh.prototype[n]});function vw(n,e){const t=n[Di];return t&&t[e]?t[e].emitter:null}function Qh(n,e){n[Wr]||(n[Wr]=e||Ke())}function or(n){return n[Wr]}function Xh(n){return n._events||Object.defineProperty(n,"_events",{value:{}}),n._events}function yw(){return{callbacks:[],childEvents:[]}}function kw(n,e){const t=Xh(n);if(t[e])return;let i=e,s=null;const o=[];for(;i!==""&&!t[i];)t[i]=yw(),o.push(t[i]),s&&t[i].childEvents.push(s),s=i,i=i.substr(0,i.lastIndexOf(":"));if(i!==""){for(const r of o)r.callbacks=t[i].callbacks.slice();t[i].childEvents.push(s)}}function qr(n,e){const t=Xh(n)[e];if(!t)return[];let i=[t.callbacks];for(let s=0;s<t.childEvents.length;s++){const o=qr(n,t.childEvents[s]);i=i.concat(o)}return i}function ef(n,e){let t;return!n._events||!(t=n._events[e])||!t.callbacks.length?e.indexOf(":")>-1?ef(n,e.substr(0,e.lastIndexOf(":"))):null:t.callbacks}function zl(n,e,t){for(let[i,s]of n){s?typeof s=="function"&&(s=s(e.name)):s=e.name;const o=new xt(e.source,s);o.path=[...e.path],i.fire(o,...t)}}function Cw(n,e,t,i,s){e._addEventListener?e._addEventListener(t,i,s):n._addEventListener.call(e,t,i,s)}function rr(n,e,t,i){e._removeEventListener?e._removeEventListener(t,i):n._removeEventListener.call(e,t,i)}var tf=typeof global=="object"&&global&&global.Object===Object&&global,Ew=typeof self=="object"&&self&&self.Object===Object&&self,at=tf||Ew||Function("return this")(),gt=at.Symbol,nf=Object.prototype,Tw=nf.hasOwnProperty,Aw=nf.toString,gn=gt?gt.toStringTag:void 0;function Sw(n){var e=Tw.call(n,gn),t=n[gn];try{n[gn]=void 0;var i=!0}catch{}var s=Aw.call(n);return i&&(e?n[gn]=t:delete n[gn]),s}var xw=Object.prototype,Iw=xw.toString;function Pw(n){return Iw.call(n)}var Rw="[object Null]",Vw="[object Undefined]",Ul=gt?gt.toStringTag:void 0;function Ht(n){return n==null?n===void 0?Vw:Rw:Ul&&Ul in Object(n)?Sw(n):Pw(n)}function Ze(n){return n!=null&&typeof n=="object"}var Bw="[object Symbol]";function Oo(n){return typeof n=="symbol"||Ze(n)&&Ht(n)==Bw}function Mw(n,e){for(var t=-1,i=n==null?0:n.length,s=Array(i);++t<i;)s[t]=e(n[t],t,n);return s}var ze=Array.isArray,Lw=1/0,Wl=gt?gt.prototype:void 0,ql=Wl?Wl.toString:void 0;function sf(n){if(typeof n=="string")return n;if(ze(n))return Mw(n,sf)+"";if(Oo(n))return ql?ql.call(n):"";var e=n+"";return e=="0"&&1/n==-Lw?"-0":e}var Ow=/\s/;function Fw(n){for(var e=n.length;e--&&Ow.test(n.charAt(e)););return e}var Dw=/^\s+/;function Nw(n){return n&&n.slice(0,Fw(n)+1).replace(Dw,"")}function Q(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var jl=NaN,$w=/^[-+]0x[0-9a-f]+$/i,Hw=/^0b[01]+$/i,zw=/^0o[0-7]+$/i,Uw=parseInt;function Gl(n){if(typeof n=="number")return n;if(Oo(n))return jl;if(Q(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Q(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Nw(n);var t=Hw.test(n);return t||zw.test(n)?Uw(n.slice(2),t?2:8):$w.test(n)?jl:+n}function Ot(n){return n}var Ww="[object AsyncFunction]",qw="[object Function]",jw="[object GeneratorFunction]",Gw="[object Proxy]";function ai(n){if(!Q(n))return!1;var e=Ht(n);return e==qw||e==jw||e==Ww||e==Gw}var ar=at["__core-js_shared__"],Kl=function(){var n=/[^.]+$/.exec(ar&&ar.keys&&ar.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Kw(n){return!!Kl&&Kl in n}var Zw=Function.prototype,Jw=Zw.toString;function gi(n){if(n!=null){try{return Jw.call(n)}catch{}try{return n+""}catch{}}return""}var Yw=/[\\^$.*+?()[\]{}|]/g,Qw=/^\[object .+?Constructor\]$/,Xw=Function.prototype,eb=Object.prototype,tb=Xw.toString,ib=eb.hasOwnProperty,nb=RegExp("^"+tb.call(ib).replace(Yw,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sb(n){if(!Q(n)||Kw(n))return!1;var e=ai(n)?nb:Qw;return e.test(gi(n))}function ob(n,e){return n==null?void 0:n[e]}function pi(n,e){var t=ob(n,e);return sb(t)?t:void 0}var jr=pi(at,"WeakMap"),Zl=Object.create,rb=function(){function n(){}return function(e){if(!Q(e))return{};if(Zl)return Zl(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();function ab(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function of(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var lb=800,cb=16,ub=Date.now;function db(n){var e=0,t=0;return function(){var i=ub(),s=cb-(i-t);if(t=i,s>0){if(++e>=lb)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function hb(n){return function(){return n}}var ro=function(){try{var n=pi(Object,"defineProperty");return n({},"",{}),n}catch{}}(),fb=ro?function(n,e){return ro(n,"toString",{configurable:!0,enumerable:!1,value:hb(e),writable:!0})}:Ot;const mb=fb;var gb=db(mb);function pb(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}var wb=9007199254740991,bb=/^(?:0|[1-9]\d*)$/;function Fo(n,e){var t=typeof n;return e=e??wb,!!e&&(t=="number"||t!="symbol"&&bb.test(n))&&n>-1&&n%1==0&&n<e}function Do(n,e,t){e=="__proto__"&&ro?ro(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function ls(n,e){return n===e||n!==n&&e!==e}var _b=Object.prototype,vb=_b.hasOwnProperty;function Ua(n,e,t){var i=n[e];(!(vb.call(n,e)&&ls(i,t))||t===void 0&&!(e in n))&&Do(n,e,t)}function on(n,e,t,i){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var a=e[o],l=i?i(t[a],n[a],a,t,n):void 0;l===void 0&&(l=n[a]),s?Do(t,a,l):Ua(t,a,l)}return t}var Jl=Math.max;function yb(n,e,t){return e=Jl(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,o=Jl(i.length-e,0),r=Array(o);++s<o;)r[s]=i[e+s];s=-1;for(var a=Array(e+1);++s<e;)a[s]=i[s];return a[e]=t(r),ab(n,this,a)}}function kb(n,e){return gb(yb(n,e,Ot),n+"")}var Cb=9007199254740991;function Wa(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Cb}function No(n){return n!=null&&Wa(n.length)&&!ai(n)}function Eb(n,e,t){if(!Q(t))return!1;var i=typeof e;return(i=="number"?No(t)&&Fo(e,t.length):i=="string"&&e in t)?ls(t[e],n):!1}function qa(n){return kb(function(e,t){var i=-1,s=t.length,o=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(o=n.length>3&&typeof o=="function"?(s--,o):void 0,r&&Eb(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++i<s;){var a=t[i];a&&n(e,a,i,o)}return e})}var Tb=Object.prototype;function ja(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Tb;return n===t}function Ab(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var Sb="[object Arguments]";function Yl(n){return Ze(n)&&Ht(n)==Sb}var rf=Object.prototype,xb=rf.hasOwnProperty,Ib=rf.propertyIsEnumerable,ao=Yl(function(){return arguments}())?Yl:function(n){return Ze(n)&&xb.call(n,"callee")&&!Ib.call(n,"callee")};function Pb(){return!1}var af=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ql=af&&typeof module=="object"&&module&&!module.nodeType&&module,Rb=Ql&&Ql.exports===af,Xl=Rb?at.Buffer:void 0,Vb=Xl?Xl.isBuffer:void 0,$n=Vb||Pb,Bb="[object Arguments]",Mb="[object Array]",Lb="[object Boolean]",Ob="[object Date]",Fb="[object Error]",Db="[object Function]",Nb="[object Map]",$b="[object Number]",Hb="[object Object]",zb="[object RegExp]",Ub="[object Set]",Wb="[object String]",qb="[object WeakMap]",jb="[object ArrayBuffer]",Gb="[object DataView]",Kb="[object Float32Array]",Zb="[object Float64Array]",Jb="[object Int8Array]",Yb="[object Int16Array]",Qb="[object Int32Array]",Xb="[object Uint8Array]",e0="[object Uint8ClampedArray]",t0="[object Uint16Array]",i0="[object Uint32Array]",ie={};ie[Kb]=ie[Zb]=ie[Jb]=ie[Yb]=ie[Qb]=ie[Xb]=ie[e0]=ie[t0]=ie[i0]=!0;ie[Bb]=ie[Mb]=ie[jb]=ie[Lb]=ie[Gb]=ie[Ob]=ie[Fb]=ie[Db]=ie[Nb]=ie[$b]=ie[Hb]=ie[zb]=ie[Ub]=ie[Wb]=ie[qb]=!1;function n0(n){return Ze(n)&&Wa(n.length)&&!!ie[Ht(n)]}function Ga(n){return function(e){return n(e)}}var lf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vn=lf&&typeof module=="object"&&module&&!module.nodeType&&module,s0=Vn&&Vn.exports===lf,lr=s0&&tf.process,Ki=function(){try{var n=Vn&&Vn.require&&Vn.require("util").types;return n||lr&&lr.binding&&lr.binding("util")}catch{}}(),ec=Ki&&Ki.isTypedArray,Ka=ec?Ga(ec):n0,o0=Object.prototype,r0=o0.hasOwnProperty;function cf(n,e){var t=ze(n),i=!t&&ao(n),s=!t&&!i&&$n(n),o=!t&&!i&&!s&&Ka(n),r=t||i||s||o,a=r?Ab(n.length,String):[],l=a.length;for(var c in n)(e||r0.call(n,c))&&!(r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Fo(c,l)))&&a.push(c);return a}function uf(n,e){return function(t){return n(e(t))}}var a0=uf(Object.keys,Object),l0=Object.prototype,c0=l0.hasOwnProperty;function u0(n){if(!ja(n))return a0(n);var e=[];for(var t in Object(n))c0.call(n,t)&&t!="constructor"&&e.push(t);return e}function cs(n){return No(n)?cf(n):u0(n)}function d0(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var h0=Object.prototype,f0=h0.hasOwnProperty;function m0(n){if(!Q(n))return d0(n);var e=ja(n),t=[];for(var i in n)i=="constructor"&&(e||!f0.call(n,i))||t.push(i);return t}function rn(n){return No(n)?cf(n,!0):m0(n)}var df=qa(function(n,e){on(e,rn(e),n)}),g0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,p0=/^\w*$/;function Za(n,e){if(ze(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||Oo(n)?!0:p0.test(n)||!g0.test(n)||e!=null&&n in Object(e)}var Hn=pi(Object,"create");function w0(){this.__data__=Hn?Hn(null):{},this.size=0}function b0(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var _0="__lodash_hash_undefined__",v0=Object.prototype,y0=v0.hasOwnProperty;function k0(n){var e=this.__data__;if(Hn){var t=e[n];return t===_0?void 0:t}return y0.call(e,n)?e[n]:void 0}var C0=Object.prototype,E0=C0.hasOwnProperty;function T0(n){var e=this.__data__;return Hn?e[n]!==void 0:E0.call(e,n)}var A0="__lodash_hash_undefined__";function S0(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=Hn&&e===void 0?A0:e,this}function li(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}li.prototype.clear=w0;li.prototype.delete=b0;li.prototype.get=k0;li.prototype.has=T0;li.prototype.set=S0;function x0(){this.__data__=[],this.size=0}function $o(n,e){for(var t=n.length;t--;)if(ls(n[t][0],e))return t;return-1}var I0=Array.prototype,P0=I0.splice;function R0(n){var e=this.__data__,t=$o(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():P0.call(e,t,1),--this.size,!0}function V0(n){var e=this.__data__,t=$o(e,n);return t<0?void 0:e[t][1]}function B0(n){return $o(this.__data__,n)>-1}function M0(n,e){var t=this.__data__,i=$o(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function Rt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Rt.prototype.clear=x0;Rt.prototype.delete=R0;Rt.prototype.get=V0;Rt.prototype.has=B0;Rt.prototype.set=M0;var zn=pi(at,"Map");function L0(){this.size=0,this.__data__={hash:new li,map:new(zn||Rt),string:new li}}function O0(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function Ho(n,e){var t=n.__data__;return O0(e)?t[typeof e=="string"?"string":"hash"]:t.map}function F0(n){var e=Ho(this,n).delete(n);return this.size-=e?1:0,e}function D0(n){return Ho(this,n).get(n)}function N0(n){return Ho(this,n).has(n)}function $0(n,e){var t=Ho(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function Vt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Vt.prototype.clear=L0;Vt.prototype.delete=F0;Vt.prototype.get=D0;Vt.prototype.has=N0;Vt.prototype.set=$0;var H0="Expected a function";function Ja(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(H0);var t=function(){var i=arguments,s=e?e.apply(this,i):i[0],o=t.cache;if(o.has(s))return o.get(s);var r=n.apply(this,i);return t.cache=o.set(s,r)||o,r};return t.cache=new(Ja.Cache||Vt),t}Ja.Cache=Vt;var z0=500;function U0(n){var e=Ja(n,function(i){return t.size===z0&&t.clear(),i}),t=e.cache;return e}var W0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q0=/\\(\\)?/g,j0=U0(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(W0,function(t,i,s,o){e.push(s?o.replace(q0,"$1"):i||t)}),e});function us(n){return n==null?"":sf(n)}function zo(n,e){return ze(n)?n:Za(n,e)?[n]:j0(us(n))}var G0=1/0;function an(n){if(typeof n=="string"||Oo(n))return n;var e=n+"";return e=="0"&&1/n==-G0?"-0":e}function Ya(n,e){e=zo(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[an(e[t++])];return t&&t==i?n:void 0}function Un(n,e,t){var i=n==null?void 0:Ya(n,e);return i===void 0?t:i}function hf(n,e){for(var t=-1,i=e.length,s=n.length;++t<i;)n[s+t]=e[t];return n}var Qa=uf(Object.getPrototypeOf,Object),K0="[object Object]",Z0=Function.prototype,J0=Object.prototype,ff=Z0.toString,Y0=J0.hasOwnProperty,Q0=ff.call(Object);function Ve(n){if(!Ze(n)||Ht(n)!=K0)return!1;var e=Qa(n);if(e===null)return!0;var t=Y0.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&ff.call(t)==Q0}function mf(n,e,t){var i=-1,s=n.length;e<0&&(e=-e>s?0:s+e),t=t>s?s:t,t<0&&(t+=s),s=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(s);++i<s;)o[i]=n[i+e];return o}function X0(n,e,t){var i=n.length;return t=t===void 0?i:t,!e&&t>=i?n:mf(n,e,t)}var e_="\\ud800-\\udfff",t_="\\u0300-\\u036f",i_="\\ufe20-\\ufe2f",n_="\\u20d0-\\u20ff",s_=t_+i_+n_,o_="\\ufe0e\\ufe0f",r_="\\u200d",a_=RegExp("["+r_+e_+s_+o_+"]");function gf(n){return a_.test(n)}function l_(n){return n.split("")}var pf="\\ud800-\\udfff",c_="\\u0300-\\u036f",u_="\\ufe20-\\ufe2f",d_="\\u20d0-\\u20ff",h_=c_+u_+d_,f_="\\ufe0e\\ufe0f",m_="["+pf+"]",Gr="["+h_+"]",Kr="\\ud83c[\\udffb-\\udfff]",g_="(?:"+Gr+"|"+Kr+")",wf="[^"+pf+"]",bf="(?:\\ud83c[\\udde6-\\uddff]){2}",_f="[\\ud800-\\udbff][\\udc00-\\udfff]",p_="\\u200d",vf=g_+"?",yf="["+f_+"]?",w_="(?:"+p_+"(?:"+[wf,bf,_f].join("|")+")"+yf+vf+")*",b_=yf+vf+w_,__="(?:"+[wf+Gr+"?",Gr,bf,_f,m_].join("|")+")",v_=RegExp(Kr+"(?="+Kr+")|"+__+b_,"g");function y_(n){return n.match(v_)||[]}function k_(n){return gf(n)?y_(n):l_(n)}function C_(n){return function(e){e=us(e);var t=gf(e)?k_(e):void 0,i=t?t[0]:e.charAt(0),s=t?X0(t,1).join(""):e.slice(1);return i[n]()+s}}var kf=C_("toUpperCase");function E_(n,e,t,i){var s=-1,o=n==null?0:n.length;for(i&&o&&(t=n[++s]);++s<o;)t=e(t,n[s],s,n);return t}function T_(n){return function(e){return n==null?void 0:n[e]}}var A_={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},S_=T_(A_);const x_=S_;var I_=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,P_="\\u0300-\\u036f",R_="\\ufe20-\\ufe2f",V_="\\u20d0-\\u20ff",B_=P_+R_+V_,M_="["+B_+"]",L_=RegExp(M_,"g");function O_(n){return n=us(n),n&&n.replace(I_,x_).replace(L_,"")}var F_=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function D_(n){return n.match(F_)||[]}var N_=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function $_(n){return N_.test(n)}var Cf="\\ud800-\\udfff",H_="\\u0300-\\u036f",z_="\\ufe20-\\ufe2f",U_="\\u20d0-\\u20ff",W_=H_+z_+U_,Ef="\\u2700-\\u27bf",Tf="a-z\\xdf-\\xf6\\xf8-\\xff",q_="\\xac\\xb1\\xd7\\xf7",j_="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",G_="\\u2000-\\u206f",K_=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Af="A-Z\\xc0-\\xd6\\xd8-\\xde",Z_="\\ufe0e\\ufe0f",Sf=q_+j_+G_+K_,xf="['’]",tc="["+Sf+"]",J_="["+W_+"]",If="\\d+",Y_="["+Ef+"]",Pf="["+Tf+"]",Rf="[^"+Cf+Sf+If+Ef+Tf+Af+"]",Q_="\\ud83c[\\udffb-\\udfff]",X_="(?:"+J_+"|"+Q_+")",ev="[^"+Cf+"]",Vf="(?:\\ud83c[\\udde6-\\uddff]){2}",Bf="[\\ud800-\\udbff][\\udc00-\\udfff]",Ni="["+Af+"]",tv="\\u200d",ic="(?:"+Pf+"|"+Rf+")",iv="(?:"+Ni+"|"+Rf+")",nc="(?:"+xf+"(?:d|ll|m|re|s|t|ve))?",sc="(?:"+xf+"(?:D|LL|M|RE|S|T|VE))?",Mf=X_+"?",Lf="["+Z_+"]?",nv="(?:"+tv+"(?:"+[ev,Vf,Bf].join("|")+")"+Lf+Mf+")*",sv="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ov="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rv=Lf+Mf+nv,av="(?:"+[Y_,Vf,Bf].join("|")+")"+rv,lv=RegExp([Ni+"?"+Pf+"+"+nc+"(?="+[tc,Ni,"$"].join("|")+")",iv+"+"+sc+"(?="+[tc,Ni+ic,"$"].join("|")+")",Ni+"?"+ic+"+"+nc,Ni+"+"+sc,ov,sv,If,av].join("|"),"g");function cv(n){return n.match(lv)||[]}function uv(n,e,t){return n=us(n),e=t?void 0:e,e===void 0?$_(n)?cv(n):D_(n):n.match(e)||[]}var dv="['’]",hv=RegExp(dv,"g");function fv(n){return function(e){return E_(uv(O_(e).replace(hv,"")),n,"")}}function mv(){this.__data__=new Rt,this.size=0}function gv(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function pv(n){return this.__data__.get(n)}function wv(n){return this.__data__.has(n)}var bv=200;function _v(n,e){var t=this.__data__;if(t instanceof Rt){var i=t.__data__;if(!zn||i.length<bv-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new Vt(i)}return t.set(n,e),this.size=t.size,this}function nt(n){var e=this.__data__=new Rt(n);this.size=e.size}nt.prototype.clear=mv;nt.prototype.delete=gv;nt.prototype.get=pv;nt.prototype.has=wv;nt.prototype.set=_v;function vv(n,e){return n&&on(e,cs(e),n)}function yv(n,e){return n&&on(e,rn(e),n)}var Of=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oc=Of&&typeof module=="object"&&module&&!module.nodeType&&module,kv=oc&&oc.exports===Of,rc=kv?at.Buffer:void 0,ac=rc?rc.allocUnsafe:void 0;function Ff(n,e){if(e)return n.slice();var t=n.length,i=ac?ac(t):new n.constructor(t);return n.copy(i),i}function Cv(n,e){for(var t=-1,i=n==null?0:n.length,s=0,o=[];++t<i;){var r=n[t];e(r,t,n)&&(o[s++]=r)}return o}function Df(){return[]}var Ev=Object.prototype,Tv=Ev.propertyIsEnumerable,lc=Object.getOwnPropertySymbols,Xa=lc?function(n){return n==null?[]:(n=Object(n),Cv(lc(n),function(e){return Tv.call(n,e)}))}:Df;function Av(n,e){return on(n,Xa(n),e)}var Sv=Object.getOwnPropertySymbols,Nf=Sv?function(n){for(var e=[];n;)hf(e,Xa(n)),n=Qa(n);return e}:Df;function xv(n,e){return on(n,Nf(n),e)}function $f(n,e,t){var i=e(n);return ze(n)?i:hf(i,t(n))}function Zr(n){return $f(n,cs,Xa)}function Iv(n){return $f(n,rn,Nf)}var Jr=pi(at,"DataView"),Yr=pi(at,"Promise"),Qr=pi(at,"Set"),cc="[object Map]",Pv="[object Object]",uc="[object Promise]",dc="[object Set]",hc="[object WeakMap]",fc="[object DataView]",Rv=gi(Jr),Vv=gi(zn),Bv=gi(Yr),Mv=gi(Qr),Lv=gi(jr),Yt=Ht;(Jr&&Yt(new Jr(new ArrayBuffer(1)))!=fc||zn&&Yt(new zn)!=cc||Yr&&Yt(Yr.resolve())!=uc||Qr&&Yt(new Qr)!=dc||jr&&Yt(new jr)!=hc)&&(Yt=function(n){var e=Ht(n),t=e==Pv?n.constructor:void 0,i=t?gi(t):"";if(i)switch(i){case Rv:return fc;case Vv:return cc;case Bv:return uc;case Mv:return dc;case Lv:return hc}return e});const Wn=Yt;var Ov=Object.prototype,Fv=Ov.hasOwnProperty;function Dv(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&Fv.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var lo=at.Uint8Array;function el(n){var e=new n.constructor(n.byteLength);return new lo(e).set(new lo(n)),e}function Nv(n,e){var t=e?el(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var $v=/\w*$/;function Hv(n){var e=new n.constructor(n.source,$v.exec(n));return e.lastIndex=n.lastIndex,e}var mc=gt?gt.prototype:void 0,gc=mc?mc.valueOf:void 0;function zv(n){return gc?Object(gc.call(n)):{}}function Hf(n,e){var t=e?el(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var Uv="[object Boolean]",Wv="[object Date]",qv="[object Map]",jv="[object Number]",Gv="[object RegExp]",Kv="[object Set]",Zv="[object String]",Jv="[object Symbol]",Yv="[object ArrayBuffer]",Qv="[object DataView]",Xv="[object Float32Array]",ey="[object Float64Array]",ty="[object Int8Array]",iy="[object Int16Array]",ny="[object Int32Array]",sy="[object Uint8Array]",oy="[object Uint8ClampedArray]",ry="[object Uint16Array]",ay="[object Uint32Array]";function ly(n,e,t){var i=n.constructor;switch(e){case Yv:return el(n);case Uv:case Wv:return new i(+n);case Qv:return Nv(n,t);case Xv:case ey:case ty:case iy:case ny:case sy:case oy:case ry:case ay:return Hf(n,t);case qv:return new i;case jv:case Zv:return new i(n);case Gv:return Hv(n);case Kv:return new i;case Jv:return zv(n)}}function zf(n){return typeof n.constructor=="function"&&!ja(n)?rb(Qa(n)):{}}var cy="[object Map]";function uy(n){return Ze(n)&&Wn(n)==cy}var pc=Ki&&Ki.isMap,dy=pc?Ga(pc):uy,hy="[object Set]";function fy(n){return Ze(n)&&Wn(n)==hy}var wc=Ki&&Ki.isSet,my=wc?Ga(wc):fy,gy=1,py=2,wy=4,Uf="[object Arguments]",by="[object Array]",_y="[object Boolean]",vy="[object Date]",yy="[object Error]",Wf="[object Function]",ky="[object GeneratorFunction]",Cy="[object Map]",Ey="[object Number]",qf="[object Object]",Ty="[object RegExp]",Ay="[object Set]",Sy="[object String]",xy="[object Symbol]",Iy="[object WeakMap]",Py="[object ArrayBuffer]",Ry="[object DataView]",Vy="[object Float32Array]",By="[object Float64Array]",My="[object Int8Array]",Ly="[object Int16Array]",Oy="[object Int32Array]",Fy="[object Uint8Array]",Dy="[object Uint8ClampedArray]",Ny="[object Uint16Array]",$y="[object Uint32Array]",X={};X[Uf]=X[by]=X[Py]=X[Ry]=X[_y]=X[vy]=X[Vy]=X[By]=X[My]=X[Ly]=X[Oy]=X[Cy]=X[Ey]=X[qf]=X[Ty]=X[Ay]=X[Sy]=X[xy]=X[Fy]=X[Dy]=X[Ny]=X[$y]=!0;X[yy]=X[Wf]=X[Iy]=!1;function ji(n,e,t,i,s,o){var r,a=e&gy,l=e&py,c=e&wy;if(t&&(r=s?t(n,i,s,o):t(n)),r!==void 0)return r;if(!Q(n))return n;var u=ze(n);if(u){if(r=Dv(n),!a)return of(n,r)}else{var d=Wn(n),h=d==Wf||d==ky;if($n(n))return Ff(n,a);if(d==qf||d==Uf||h&&!s){if(r=l||h?{}:zf(n),!a)return l?xv(n,yv(r,n)):Av(n,vv(r,n))}else{if(!X[d])return s?n:{};r=ly(n,d,a)}}o||(o=new nt);var f=o.get(n);if(f)return f;o.set(n,r),my(n)?n.forEach(function(_){r.add(ji(_,e,t,_,n,o))}):dy(n)&&n.forEach(function(_,k){r.set(k,ji(_,e,t,k,n,o))});var m=c?l?Iv:Zr:l?rn:cs,p=u?void 0:m(n);return pb(p||n,function(_,k){p&&(k=_,_=n[k]),Ua(r,k,ji(_,e,t,k,n,o))}),r}var Hy=4;function jf(n){return ji(n,Hy)}var zy=1,Uy=4;function Ye(n){return ji(n,zy|Uy)}var Wy=1,qy=4;function tl(n,e){return e=typeof e=="function"?e:void 0,ji(n,Wy|qy,e)}var jy="__lodash_hash_undefined__";function Gy(n){return this.__data__.set(n,jy),this}function Ky(n){return this.__data__.has(n)}function co(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new Vt;++e<t;)this.add(n[e])}co.prototype.add=co.prototype.push=Gy;co.prototype.has=Ky;function Zy(n,e){for(var t=-1,i=n==null?0:n.length;++t<i;)if(e(n[t],t,n))return!0;return!1}function Jy(n,e){return n.has(e)}var Yy=1,Qy=2;function Gf(n,e,t,i,s,o){var r=t&Yy,a=n.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(n),u=o.get(e);if(c&&u)return c==e&&u==n;var d=-1,h=!0,f=t&Qy?new co:void 0;for(o.set(n,e),o.set(e,n);++d<a;){var m=n[d],p=e[d];if(i)var _=r?i(p,m,d,e,n,o):i(m,p,d,n,e,o);if(_!==void 0){if(_)continue;h=!1;break}if(f){if(!Zy(e,function(k,A){if(!Jy(f,A)&&(m===k||s(m,k,t,i,o)))return f.push(A)})){h=!1;break}}else if(!(m===p||s(m,p,t,i,o))){h=!1;break}}return o.delete(n),o.delete(e),h}function Xy(n){var e=-1,t=Array(n.size);return n.forEach(function(i,s){t[++e]=[s,i]}),t}function ek(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var tk=1,ik=2,nk="[object Boolean]",sk="[object Date]",ok="[object Error]",rk="[object Map]",ak="[object Number]",lk="[object RegExp]",ck="[object Set]",uk="[object String]",dk="[object Symbol]",hk="[object ArrayBuffer]",fk="[object DataView]",bc=gt?gt.prototype:void 0,cr=bc?bc.valueOf:void 0;function mk(n,e,t,i,s,o,r){switch(t){case fk:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case hk:return!(n.byteLength!=e.byteLength||!o(new lo(n),new lo(e)));case nk:case sk:case ak:return ls(+n,+e);case ok:return n.name==e.name&&n.message==e.message;case lk:case uk:return n==e+"";case rk:var a=Xy;case ck:var l=i&tk;if(a||(a=ek),n.size!=e.size&&!l)return!1;var c=r.get(n);if(c)return c==e;i|=ik,r.set(n,e);var u=Gf(a(n),a(e),i,s,o,r);return r.delete(n),u;case dk:if(cr)return cr.call(n)==cr.call(e)}return!1}var gk=1,pk=Object.prototype,wk=pk.hasOwnProperty;function bk(n,e,t,i,s,o){var r=t&gk,a=Zr(n),l=a.length,c=Zr(e),u=c.length;if(l!=u&&!r)return!1;for(var d=l;d--;){var h=a[d];if(!(r?h in e:wk.call(e,h)))return!1}var f=o.get(n),m=o.get(e);if(f&&m)return f==e&&m==n;var p=!0;o.set(n,e),o.set(e,n);for(var _=r;++d<l;){h=a[d];var k=n[h],A=e[h];if(i)var F=r?i(A,k,h,e,n,o):i(k,A,h,n,e,o);if(!(F===void 0?k===A||s(k,A,t,i,o):F)){p=!1;break}_||(_=h=="constructor")}if(p&&!_){var U=n.constructor,Y=e.constructor;U!=Y&&"constructor"in n&&"constructor"in e&&!(typeof U=="function"&&U instanceof U&&typeof Y=="function"&&Y instanceof Y)&&(p=!1)}return o.delete(n),o.delete(e),p}var _k=1,_c="[object Arguments]",vc="[object Array]",Ts="[object Object]",vk=Object.prototype,yc=vk.hasOwnProperty;function yk(n,e,t,i,s,o){var r=ze(n),a=ze(e),l=r?vc:Wn(n),c=a?vc:Wn(e);l=l==_c?Ts:l,c=c==_c?Ts:c;var u=l==Ts,d=c==Ts,h=l==c;if(h&&$n(n)){if(!$n(e))return!1;r=!0,u=!1}if(h&&!u)return o||(o=new nt),r||Ka(n)?Gf(n,e,t,i,s,o):mk(n,e,l,t,i,s,o);if(!(t&_k)){var f=u&&yc.call(n,"__wrapped__"),m=d&&yc.call(e,"__wrapped__");if(f||m){var p=f?n.value():n,_=m?e.value():e;return o||(o=new nt),s(p,_,t,i,o)}}return h?(o||(o=new nt),bk(n,e,t,i,s,o)):!1}function ds(n,e,t,i,s){return n===e?!0:n==null||e==null||!Ze(n)&&!Ze(e)?n!==n&&e!==e:yk(n,e,t,i,ds,s)}var kk=1,Ck=2;function Ek(n,e,t,i){var s=t.length,o=s,r=!i;if(n==null)return!o;for(n=Object(n);s--;){var a=t[s];if(r&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++s<o;){a=t[s];var l=a[0],c=n[l],u=a[1];if(r&&a[2]){if(c===void 0&&!(l in n))return!1}else{var d=new nt;if(i)var h=i(c,u,l,n,e,d);if(!(h===void 0?ds(u,c,kk|Ck,i,d):h))return!1}}return!0}function Kf(n){return n===n&&!Q(n)}function Tk(n){for(var e=cs(n),t=e.length;t--;){var i=e[t],s=n[i];e[t]=[i,s,Kf(s)]}return e}function Zf(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function Ak(n){var e=Tk(n);return e.length==1&&e[0][2]?Zf(e[0][0],e[0][1]):function(t){return t===n||Ek(t,n,e)}}function Sk(n,e){return n!=null&&e in Object(n)}function xk(n,e,t){e=zo(e,n);for(var i=-1,s=e.length,o=!1;++i<s;){var r=an(e[i]);if(!(o=n!=null&&t(n,r)))break;n=n[r]}return o||++i!=s?o:(s=n==null?0:n.length,!!s&&Wa(s)&&Fo(r,s)&&(ze(n)||ao(n)))}function Ik(n,e){return n!=null&&xk(n,e,Sk)}var Pk=1,Rk=2;function Vk(n,e){return Za(n)&&Kf(e)?Zf(an(n),e):function(t){var i=Un(t,n);return i===void 0&&i===e?Ik(t,n):ds(e,i,Pk|Rk)}}function Bk(n){return function(e){return e==null?void 0:e[n]}}function Mk(n){return function(e){return Ya(e,n)}}function Lk(n){return Za(n)?Bk(an(n)):Mk(n)}function Ok(n){return typeof n=="function"?n:n==null?Ot:typeof n=="object"?ze(n)?Vk(n[0],n[1]):Ak(n):Lk(n)}function Fk(n){return function(e,t,i){for(var s=-1,o=Object(e),r=i(e),a=r.length;a--;){var l=r[n?a:++s];if(t(o[l],l,o)===!1)break}return e}}var Jf=Fk();function Dk(n,e){return n&&Jf(n,e,cs)}var ur=function(){return at.Date.now()},Nk="Expected a function",$k=Math.max,Hk=Math.min;function ci(n,e,t){var i,s,o,r,a,l,c=0,u=!1,d=!1,h=!0;if(typeof n!="function")throw new TypeError(Nk);e=Gl(e)||0,Q(t)&&(u=!!t.leading,d="maxWait"in t,o=d?$k(Gl(t.maxWait)||0,e):o,h="trailing"in t?!!t.trailing:h);function f(x){var v=i,C=s;return i=s=void 0,c=x,r=n.apply(C,v),r}function m(x){return c=x,a=setTimeout(k,e),u?f(x):r}function p(x){var v=x-l,C=x-c,B=e-v;return d?Hk(B,o-C):B}function _(x){var v=x-l,C=x-c;return l===void 0||v>=e||v<0||d&&C>=o}function k(){var x=ur();if(_(x))return A(x);a=setTimeout(k,p(x))}function A(x){return a=void 0,h&&i?f(x):(i=s=void 0,r)}function F(){a!==void 0&&clearTimeout(a),c=0,i=l=s=a=void 0}function U(){return a===void 0?r:A(ur())}function Y(){var x=ur(),v=_(x);if(i=arguments,s=this,l=x,v){if(a===void 0)return m(l);if(d)return clearTimeout(a),a=setTimeout(k,e),f(l)}return a===void 0&&(a=setTimeout(k,e)),r}return Y.cancel=F,Y.flush=U,Y}function Xr(n,e,t){(t!==void 0&&!ls(n[e],t)||t===void 0&&!(e in n))&&Do(n,e,t)}function zk(n){return Ze(n)&&No(n)}function ea(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function Uk(n){return on(n,rn(n))}function Wk(n,e,t,i,s,o,r){var a=ea(n,t),l=ea(e,t),c=r.get(l);if(c){Xr(n,t,c);return}var u=o?o(a,l,t+"",n,e,r):void 0,d=u===void 0;if(d){var h=ze(l),f=!h&&$n(l),m=!h&&!f&&Ka(l);u=l,h||f||m?ze(a)?u=a:zk(a)?u=of(a):f?(d=!1,u=Ff(l,!0)):m?(d=!1,u=Hf(l,!0)):u=[]:Ve(l)||ao(l)?(u=a,ao(a)?u=Uk(a):(!Q(a)||ai(a))&&(u=zf(l))):d=!1}d&&(r.set(l,u),s(u,l,i,o,r),r.delete(l)),Xr(n,t,u)}function il(n,e,t,i,s){n!==e&&Jf(e,function(o,r){if(s||(s=new nt),Q(o))Wk(n,e,r,t,il,i,s);else{var a=i?i(ea(n,r),o,r+"",n,e,s):void 0;a===void 0&&(a=o),Xr(n,r,a)}},rn)}var qk=qa(function(n,e,t,i){il(n,e,t,i)});function jk(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var Yf=/[\\^$.*+?()[\]{}|]/g,Gk=RegExp(Yf.source);function Kk(n){return n=us(n),n&&Gk.test(n)?n.replace(Yf,"\\$&"):n}var Zk="[object String]";function kc(n){return typeof n=="string"||!ze(n)&&Ze(n)&&Ht(n)==Zk}function Jk(n,e){return e.length<2?n:Ya(n,mf(e,0,-1))}function ui(n){return Ze(n)&&n.nodeType===1&&!Ve(n)}function uo(n,e){return ds(n,e)}function Yk(n,e,t){t=typeof t=="function"?t:void 0;var i=t?t(n,e):void 0;return i===void 0?ds(n,e,void 0,t):!!i}function Qk(n,e){var t={};return e=Ok(e),Dk(n,function(i,s,o){Do(t,s,e(i,s,o))}),t}var nl=qa(function(n,e,t){il(n,e,t)});function Xk(n,e){return e=zo(e,n),n=Jk(n,e),n==null||delete n[an(jk(e))]}function e2(n,e,t,i){if(!Q(n))return n;e=zo(e,n);for(var s=-1,o=e.length,r=o-1,a=n;a!=null&&++s<o;){var l=an(e[s]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(s!=r){var u=a[l];c=i?i(u,l,a):void 0,c===void 0&&(c=Q(u)?u:Fo(e[s+1])?[]:{})}Ua(a,l,c),a=a[l]}return n}function t2(n,e,t){return n==null?n:e2(n,e,t)}var i2=fv(function(n,e,t){return n+(t?" ":"")+kf(e)}),n2="Expected a function";function qn(n,e,t){var i=!0,s=!0;if(typeof n!="function")throw new TypeError(n2);return Q(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),ci(n,e,{leading:i,maxWait:e,trailing:s})}function s2(n,e){return n==null?!0:Xk(n,e)}/**
|
|
48
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
49
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
50
|
-
*/const ho=Symbol("observableProperties"),Uo=Symbol("boundObservables"),fo=Symbol("boundProperties"),xi=Symbol("decoratedMethods"),Cc=Symbol("decoratedOriginal"),Qf=W(Z());function W(n){if(!n)return Qf;class e extends n{set(i,s){if(Q(i)){Object.keys(i).forEach(r=>{this.set(r,i[r])},this);return}dr(this);const o=this[ho];if(i in this&&!o.has(i))throw new g("observable-set-cannot-override",this);Object.defineProperty(this,i,{enumerable:!0,configurable:!0,get(){return o.get(i)},set(r){const a=o.get(i);let l=this.fire(`set:${i}`,i,r,a);l===void 0&&(l=r),(a!==l||!o.has(i))&&(o.set(i,l),this.fire(`change:${i}`,i,l,a))}}),this[i]=s}bind(...i){if(!i.length||!Ec(i))throw new g("observable-bind-wrong-properties",this);if(new Set(i).size!==i.length)throw new g("observable-bind-duplicate-properties",this);dr(this);const s=this[fo];i.forEach(r=>{if(s.has(r))throw new g("observable-bind-rebind",this)});const o=new Map;return i.forEach(r=>{const a={property:r,to:[]};s.set(r,a),o.set(r,a)}),{to:o2,toMany:r2,_observable:this,_bindProperties:i,_to:[],_bindings:o}}unbind(...i){if(!this[ho])return;const s=this[fo],o=this[Uo];if(i.length){if(!Ec(i))throw new g("observable-unbind-wrong-properties",this);i.forEach(r=>{const a=s.get(r);a&&(a.to.forEach(([l,c])=>{const u=o.get(l),d=u[c];d.delete(a),d.size||delete u[c],Object.keys(u).length||(o.delete(l),this.stopListening(l,"change"))}),s.delete(r))})}else o.forEach((r,a)=>{this.stopListening(a,"change")}),o.clear(),s.clear()}decorate(i){dr(this);const s=this[i];if(!s)throw new g("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:i});this.on(i,(o,r)=>{o.return=s.apply(this,r)}),this[i]=function(...o){return this.fire(i,o)},this[i][Cc]=s,this[xi]||(this[xi]=[]),this[xi].push(i)}stopListening(i,s,o){if(!i&&this[xi]){for(const r of this[xi])this[r]=this[r][Cc];delete this[xi]}super.stopListening(i,s,o)}}return e}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{W[n]=Qf.prototype[n]});function dr(n){n[ho]||(Object.defineProperty(n,ho,{value:new Map}),Object.defineProperty(n,Uo,{value:new Map}),Object.defineProperty(n,fo,{value:new Map}))}function o2(...n){const e=l2(...n),t=Array.from(this._bindings.keys()),i=t.length;if(!e.callback&&e.to.length>1)throw new g("observable-bind-to-no-callback",this);if(i>1&&e.callback)throw new g("observable-bind-to-extra-callback",this);e.to.forEach(s=>{if(s.properties.length&&s.properties.length!==i)throw new g("observable-bind-to-properties-length",this);s.properties.length||(s.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(t[0]).callback=e.callback),d2(this._observable,this._to),u2(this),this._bindProperties.forEach(s=>{Xf(this._observable,s)})}function r2(n,e,t){if(this._bindings.size>1)throw new g("observable-bind-to-many-not-one-binding",this);this.to(...a2(n,e),t)}function a2(n,e){const t=n.map(i=>[i,e]);return Array.prototype.concat.apply([],t)}function Ec(n){return n.every(e=>typeof e=="string")}function l2(...n){if(!n.length)throw new g("observable-bind-to-parse-error",null);const e={to:[]};let t;return typeof n[n.length-1]=="function"&&(e.callback=n.pop()),n.forEach(i=>{if(typeof i=="string")t.properties.push(i);else if(typeof i=="object")t={observable:i,properties:[]},e.to.push(t);else throw new g("observable-bind-to-parse-error",null)}),e}function c2(n,e,t,i){const s=n[Uo],o=s.get(t),r=o||{};r[i]||(r[i]=new Set),r[i].add(e),o||s.set(t,r)}function u2(n){let e;n._bindings.forEach((t,i)=>{n._to.forEach(s=>{e=s.properties[t.callback?0:n._bindProperties.indexOf(i)],t.to.push([s.observable,e]),c2(n._observable,t,s.observable,e)})})}function Xf(n,e){const i=n[fo].get(e);let s;i.callback?s=i.callback.apply(n,i.to.map(o=>o[0][o[1]])):(s=i.to[0],s=s[0][s[1]]),Object.prototype.hasOwnProperty.call(n,e)?n[e]=s:n.set(e,s)}function d2(n,e){e.forEach(t=>{const i=n[Uo];let s;i.get(t.observable)||n.listenTo(t.observable,"change",(o,r)=>{s=i.get(t.observable)[r],s&&s.forEach(a=>{Xf(n,a.property)})})})}/**
|
|
51
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
52
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
53
|
-
*/class em{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=[]}}/**
|
|
54
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
55
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
56
|
-
*/function ta(n){let e=0;for(const t of n)e++;return e}/**
|
|
57
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
58
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
59
|
-
*/function Te(n,e){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)if(n[i]!=e[i])return i;return n.length==e.length?"same":n.length<e.length?"prefix":"extension"}/**
|
|
60
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
61
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
62
|
-
*/function Ue(n){return!!(n&&n[Symbol.iterator])}/**
|
|
63
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
64
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
65
|
-
*/function Fe(n,e,t={},i=[]){const s=t&&t.xmlns,o=s?n.createElementNS(s,e):n.createElement(e);for(const r in t)o.setAttribute(r,t[r]);(kc(i)||!Ue(i))&&(i=[i]);for(let r of i)kc(r)&&(r=n.createTextNode(r)),o.appendChild(r);return o}/**
|
|
66
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
67
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
68
|
-
*/class tm{constructor(e,t){this._config={},t&&this.define(Tc(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,s=!1){if(Ve(t)){this._setObjectToTarget(e,t,s);return}const o=t.split(".");t=o.pop();for(const r of o)Ve(e[r])||(e[r]={}),e=e[r];if(Ve(i)){Ve(e[t])||(e[t]={}),e=e[t],this._setObjectToTarget(e,i,s);return}s&&typeof e[t]<"u"||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const s of i){if(!Ve(e[s])){e=null;break}e=e[s]}return e?Tc(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(s=>{this._setToTarget(e,s,t[s],i)})}}function Tc(n){return tl(n,h2)}function h2(n){return ui(n)||typeof n=="function"?n:void 0}/**
|
|
69
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
70
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
71
|
-
*/function Dt(n){if(n){if(n.defaultView)return n instanceof n.defaultView.Document;if(n.ownerDocument&&n.ownerDocument.defaultView)return n instanceof n.ownerDocument.defaultView.Node}return!1}/**
|
|
72
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
73
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
74
|
-
*/function mo(n){const e=Object.prototype.toString.apply(n);return e=="[object Window]"||e=="[object global]"}/**
|
|
75
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
76
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
77
|
-
*/const im=qe(Z());function qe(n){if(!n)return im;class e extends n{listenTo(i,s,o,r={}){if(Dt(i)||mo(i)){const a={capture:!!r.useCapture,passive:!!r.usePassive},l=this._getProxyEmitter(i,a)||new f2(i,a);this.listenTo(l,s,o,r)}else super.listenTo(i,s,o,r)}stopListening(i,s,o){if(Dt(i)||mo(i)){const r=this._getAllProxyEmitters(i);for(const a of r)this.stopListening(a,s,o)}else super.stopListening(i,s,o)}_getProxyEmitter(i,s){return vw(this,nm(i,s))}_getAllProxyEmitters(i){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(s=>this._getProxyEmitter(i,s)).filter(s=>!!s)}}return e}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{qe[n]=im.prototype[n]});class f2 extends Z(){constructor(e,t){super(),Qh(this,nm(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;this._domListeners[e]&&(!(t=this._events[e])||!t.callbacks.length)&&this._domListeners[e].removeListener()}_addEventListener(e,t,i){this.attach(e),Z().prototype._addEventListener.call(this,e,t,i)}_removeEventListener(e,t){Z().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=i=>{this.fire(e,i)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function m2(n){return n["data-ck-expando"]||(n["data-ck-expando"]=Ke())}function nm(n,e){let t=m2(n);for(const i of Object.keys(e).sort())e[i]&&(t+="-"+i);return t}/**
|
|
78
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
79
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
80
|
-
*/let ia;try{ia={window,document}}catch{/* istanbul ignore next -- @preserve */ia={window:{},document:{}}}const S=ia;/**
|
|
81
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
82
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
83
|
-
*/function g2(n){const e=[];let t=n;for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}/**
|
|
84
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
85
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
86
|
-
*/function p2(n){return n instanceof HTMLTextAreaElement?n.value:n.innerHTML}/**
|
|
87
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
88
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
89
|
-
*/function sm(n){const e=n.ownerDocument.defaultView.getComputedStyle(n);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}/**
|
|
90
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
91
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
92
|
-
*/function fe(n){return Object.prototype.toString.call(n)=="[object Text]"}/**
|
|
93
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
94
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
95
|
-
*/function Wo(n){return Object.prototype.toString.apply(n)=="[object Range]"}/**
|
|
96
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
97
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
98
|
-
*/function om(n){return!n||!n.parentNode||n.offsetParent===S.document.body?null:n.offsetParent}/**
|
|
99
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
100
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
101
|
-
*/const rm=["top","right","bottom","left","width","height"];class L{constructor(e){const t=Wo(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),na(e)||t)if(t){const i=L.getDomRangeRects(e);As(this,L.getBoundingRect(i))}else As(this,e.getBoundingClientRect());else if(mo(e)){const{innerWidth:i,innerHeight:s}=e;As(this,{top:0,right:i,bottom:s,left:0,width:i,height:s})}else As(this,e)}clone(){return new L(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const i=new L(t);return i._source=this._source,i}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(Ac(e))return t;let i=e,s=e.parentNode||e.commonAncestorContainer,o;for(;s&&!Ac(s);){const r=w2(s)==="visible";i instanceof HTMLElement&&Sc(i)==="absolute"&&(o=i);const a=Sc(s);if(r||o&&(a==="relative"&&r||a!=="relative")){i=s,s=s.parentNode;continue}const l=new L(s),c=t.getIntersection(l);if(c)c.getArea()<t.getArea()&&(t=c);else return null;i=s,s=s.parentNode}return t}isEqual(e){for(const t of rm)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!!(t&&t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=S.window,i=this.clone().moveBy(e,t);if(na(i._source)){const s=om(i._source);s&&b2(i,s)}return i}excludeScrollbarsAndBorders(){const e=this._source;let t,i,s;if(mo(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,s=e.getComputedStyle(e.document.documentElement).direction;else{const o=sm(e);t=e.offsetWidth-e.clientWidth-o.left-o.right,i=e.offsetHeight-e.clientHeight-o.top-o.bottom,s=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=o.left,this.top+=o.top,this.right-=o.right,this.bottom-=o.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,s==="ltr"?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const s of i)t.push(new L(s));else{let s=e.startContainer;fe(s)&&(s=s.parentNode);const o=new L(s.getBoundingClientRect());o.right=o.left,o.width=0,t.push(o)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let i=0;for(const s of e)i++,t.left=Math.min(t.left,s.left),t.top=Math.min(t.top,s.top),t.right=Math.max(t.right,s.right),t.bottom=Math.max(t.bottom,s.bottom);return i==0?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new L(t))}}function As(n,e){for(const t of rm)n[t]=e[t]}function Ac(n){return na(n)?n===n.ownerDocument.body:!1}function na(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&typeof n.getBoundingClientRect=="function"}function Sc(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).position:"static"}function w2(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).overflow:"visible"}function b2(n,e){const t=new L(e),i=sm(e);let s=0,o=0;s-=t.left,o-=t.top,s+=e.scrollLeft,o+=e.scrollTop,s-=i.left,o-=i.top,n.moveBy(s,o)}/**
|
|
102
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
103
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
104
|
-
*/class ee{constructor(e,t){ee._observerInstance||ee._createObserver(),this._element=e,this._callback=t,ee._addElementCallback(e,t),ee._observerInstance.observe(e)}get element(){return this._element}destroy(){ee._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){ee._elementCallbacks||(ee._elementCallbacks=new Map);let i=ee._elementCallbacks.get(e);i||(i=new Set,ee._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=ee._getElementCallbacks(e);i&&(i.delete(t),i.size||(ee._elementCallbacks.delete(e),ee._observerInstance.unobserve(e))),ee._elementCallbacks&&!ee._elementCallbacks.size&&(ee._observerInstance=null,ee._elementCallbacks=null)}static _getElementCallbacks(e){return ee._elementCallbacks?ee._elementCallbacks.get(e):null}static _createObserver(){ee._observerInstance=new S.window.ResizeObserver(e=>{for(const t of e){const i=ee._getElementCallbacks(t.target);if(i)for(const s of i)s(t)}})}}ee._observerInstance=null;ee._elementCallbacks=null;/**
|
|
105
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
106
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
107
|
-
*/function xc(n,e){n instanceof HTMLTextAreaElement&&(n.value=e),n.innerHTML=e}/**
|
|
108
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
109
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
110
|
-
*/function ln(n){return e=>e+n}/**
|
|
111
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
112
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
113
|
-
*/function Ss(n){let e=0;for(;n.previousSibling;)n=n.previousSibling,e++;return e}/**
|
|
114
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
115
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
116
|
-
*/function am(n,e,t){n.insertBefore(t,n.childNodes[e]||null)}/**
|
|
117
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
118
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
119
|
-
*/function Bn(n){return n&&n.nodeType===Node.COMMENT_NODE}/**
|
|
120
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
121
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
122
|
-
*/function lm(n){try{S.document.createAttribute(n)}catch{return!1}return!0}/**
|
|
123
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
124
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
125
|
-
*/function di(n){return!!(n&&n.getClientRects&&n.getClientRects().length)}/**
|
|
126
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
127
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
128
|
-
*/function qo({element:n,target:e,positions:t,limiter:i,fitInViewport:s,viewportOffsetConfig:o}){ai(e)&&(e=e()),ai(i)&&(i=i());const r=om(n),a=_2(o),l=new L(n),c=Ic(e,a);let u;if(!c||!a.getIntersection(c))return null;const d={targetRect:c,elementRect:l,positionedElementAncestor:r,viewportRect:a};if(!i&&!s)u=new cm(t[0],d);else{if(i){const h=Ic(i,a);h&&(d.limiterRect=h)}u=v2(t,d)}return u}function Ic(n,e){const t=new L(n).getVisible();return t?t.getIntersection(e):null}function _2(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const e=new L(S.window);return e.top+=n.top,e.height-=n.top,e.bottom-=n.bottom,e.height-=n.bottom,e}function v2(n,e){const{elementRect:t}=e,i=t.getArea(),s=n.map(a=>new cm(a,e)).filter(a=>!!a.name);let o=0,r=null;for(const a of s){const{limiterIntersectionArea:l,viewportIntersectionArea:c}=a;if(l===i)return a;const u=c**2+l**2;u>o&&(o=u,r=a)}return r}class cm{constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!i)return;const{left:s,top:o,name:r,config:a}=i;this.name=r,this.config=a,this._positioningFunctionCoordinates={left:s,top:o},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const 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)}}/**
|
|
129
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
130
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
131
|
-
*/function Pc(n){const e=n.parentNode;e&&e.removeChild(n)}/**
|
|
132
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
133
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
134
|
-
*/function y2({target:n,viewportOffset:e=0,ancestorOffset:t=0,alignToTop:i,forceScroll:s}){const o=sl(n);let r=o,a=null;for(e=E2(e);r;){let l;r==o?l=Rc(n):l=Rc(a),C2({parent:l,getRect:()=>Vc(n,r),alignToTop:i,ancestorOffset:t,forceScroll:s});const c=Vc(n,r);if(k2({window:r,rect:c,viewportOffset:e,alignToTop:i,forceScroll:s}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null}}function k2({window:n,rect:e,alignToTop:t,forceScroll:i,viewportOffset:s}){const o=e.clone().moveBy(0,s.bottom),r=e.clone().moveBy(0,-s.top),a=new L(n).excludeScrollbarsAndBorders(),l=[r,o],c=t&&i,u=l.every(p=>a.contains(p));let{scrollX:d,scrollY:h}=n;const f=d,m=h;c?h-=a.top-e.top+s.top:u||(dm(r,a)?h-=a.top-e.top+s.top:um(o,a)&&(t?h+=e.top-a.top-s.top:h+=e.bottom-a.bottom+s.bottom)),u||(hm(e,a)?d-=a.left-e.left+s.left:fm(e,a)&&(d+=e.right-a.right+s.right)),(d!=f||h!==m)&&n.scrollTo(d,h)}function C2({parent:n,getRect:e,alignToTop:t,forceScroll:i,ancestorOffset:s=0,limiterElement:o}){const r=sl(n),a=t&&i;let l,c,u;const d=o||r.document.body;for(;n!=d;)c=e(),l=new L(n).excludeScrollbarsAndBorders(),u=l.contains(c),a?n.scrollTop-=l.top-c.top+s:u||(dm(c,l)?n.scrollTop-=l.top-c.top+s:um(c,l)&&(t?n.scrollTop+=c.top-l.top-s:n.scrollTop+=c.bottom-l.bottom+s)),u||(hm(c,l)?n.scrollLeft-=l.left-c.left+s:fm(c,l)&&(n.scrollLeft+=c.right-l.right+s)),n=n.parentNode}function um(n,e){return n.bottom>e.bottom}function dm(n,e){return n.top<e.top}function hm(n,e){return n.left<e.left}function fm(n,e){return n.right>e.right}function sl(n){return Wo(n)?n.startContainer.ownerDocument.defaultView:n.ownerDocument.defaultView}function Rc(n){if(Wo(n)){let e=n.commonAncestorContainer;return fe(e)&&(e=e.parentNode),e}else return n.parentNode}function Vc(n,e){const t=sl(n),i=new L(n);if(t===e)return i;{let s=t;for(;s!=e;){const o=s.frameElement,r=new L(o).excludeScrollbarsAndBorders();i.moveBy(r.left,r.top),s=s.parent}}return i}function E2(n){return typeof n=="number"?{top:n,bottom:n,left:n,right:n}:n}/**
|
|
135
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
136
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
137
|
-
*/const T2={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},A2={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},Bc={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},N=R2(),S2=Object.fromEntries(Object.entries(N).map(([n,e])=>{let t;return e in Bc?t=Bc[e]:t=n.charAt(0).toUpperCase()+n.slice(1),[e,t]}));function Zi(n){let e;if(typeof n=="string"){if(e=N[n.toLowerCase()],!e)throw new g("keyboard-unknown-key",null,{key:n})}else e=n.keyCode+(n.altKey?N.alt:0)+(n.ctrlKey?N.ctrl:0)+(n.shiftKey?N.shift:0)+(n.metaKey?N.cmd:0);return e}function hs(n){return typeof n=="string"&&(n=V2(n)),n.map(e=>typeof e=="string"?I2(e):e).reduce((e,t)=>t+e,0)}function go(n){let e=hs(n);return Object.entries(M.isMac||M.isiOS?T2:A2).reduce((s,[o,r])=>(e&N[o]&&(e&=~N[o],s+=r),s),"")+(e?S2[e]:"")}function x2(n){return n==N.arrowright||n==N.arrowleft||n==N.arrowup||n==N.arrowdown}function ol(n,e){const t=e==="ltr";switch(n){case N.arrowleft:return t?"left":"right";case N.arrowright:return t?"right":"left";case N.arrowup:return"up";case N.arrowdown:return"down"}}function I2(n){if(n.endsWith("!"))return Zi(n.slice(0,-1));const e=Zi(n);return(M.isMac||M.isiOS)&&e==N.ctrl?N.cmd:e}function P2(n,e){const t=ol(n,e);return t==="down"||t==="right"}function R2(){const n={pageup:33,pagedown:34,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++){const t=String.fromCharCode(e);n[t.toLowerCase()]=e}for(let e=48;e<=57;e++)n[e-48]=e;for(let e=112;e<=123;e++)n["f"+(e-111)]=e;return Object.assign(n,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),n}function V2(n){return n.split("+").map(e=>e.trim())}/**
|
|
138
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
139
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
140
|
-
*/const B2=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig"];function Mc(n){return B2.includes(n)?"rtl":"ltr"}/**
|
|
141
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
142
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
143
|
-
*/function z(n){return Array.isArray(n)?n:[n]}/**
|
|
144
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
145
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
146
|
-
*//* istanbul ignore else -- @preserve */S.window.CKEDITOR_TRANSLATIONS||(S.window.CKEDITOR_TRANSLATIONS={});function M2(n,e,t=1,i){if(typeof t!="number")throw new g("translation-service-quantity-not-a-number",null,{quantity:t});const s=i||S.window.CKEDITOR_TRANSLATIONS,o=F2(s);o===1&&(n=Object.keys(s)[0]);const r=e.id||e.string;if(o===0||!O2(n,r,s))return t!==1?e.plural:e.string;const a=s[n].dictionary,l=s[n].getPluralForm||(d=>d===1?0:1),c=a[r];if(typeof c=="string")return c;const u=Number(l(t));return c[u]}function L2(n){return Array.isArray(n)?n.reduce((e,t)=>nl(e,t)):n}function O2(n,e,t){return!!t[n]&&!!t[n].dictionary[e]}function F2(n){return Object.keys(n).length}/**
|
|
147
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
148
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
149
|
-
*/class D2{constructor({uiLanguage:e="en",contentLanguage:t,translations:i}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=Mc(this.uiLanguage),this.contentLanguageDirection=Mc(this.contentLanguage),this.translations=L2(i),this.t=(s,o)=>this._t(s,o)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=z(t),typeof e=="string"&&(e={string:e});const s=!!e.plural?t[0]:1,o=M2(this.uiLanguage,e,s,this.translations);return N2(o,t)}}function N2(n,e){return n.replace(/%(\d+)/g,(t,i)=>i<e.length?e[i]:t)}/**
|
|
150
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
151
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
152
|
-
*/class Ce extends Z(){constructor(e={},t={}){super();const i=Ue(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const s of e)this._items.push(s),this._itemMap.set(this._getItemIdBeforeAdding(s),s)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new g("collection-add-item-invalid-index",this);let i=0;for(const s of e){const o=this._getItemIdBeforeAdding(s),r=t+i;this._items.splice(r,0,s),this._itemMap.set(o,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 g("collection-get-invalid-arg",this);return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=this._idProperty,i=e[t];return i&&this._itemMap.has(i)}}getIndex(e){let t;return typeof e=="string"?t=this._itemMap.get(e):t=e,t?this._items.indexOf(t):-1}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}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);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new g("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(i=>new t(i))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(i=>i[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(s,o,r)=>{const a=t._bindToCollection==this,l=t._bindToInternalToExternalMap.get(o);if(a&&l)this._bindToExternalToInternalMap.set(o,l),this._bindToInternalToExternalMap.set(l,o);else{const c=e(o);if(!c){this._skippedIndexesFromExternal.push(r);return}let u=r;for(const d of this._skippedIndexesFromExternal)r>d&&u--;for(const d of t._skippedIndexesFromExternal)u>=d&&u++;this._bindToExternalToInternalMap.set(o,c),this._bindToInternalToExternalMap.set(c,o),this.add(c,u);for(let d=0;d<t._skippedIndexesFromExternal.length;d++)u<=t._skippedIndexesFromExternal[d]&&t._skippedIndexesFromExternal[d]++}};for(const s of t)i(null,s,t.getIndex(s));this.listenTo(t,"add",i),this.listenTo(t,"remove",(s,o,r)=>{const a=this._bindToExternalToInternalMap.get(o);a&&this.remove(a),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((l,c)=>(r<c&&l.push(c-1),r>c&&l.push(c),l),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],typeof i!="string")throw new g("collection-add-invalid-id",this);if(this.get(i))throw new g("collection-add-item-already-exists",this)}else e[t]=i=Ke();return i}_remove(e){let t,i,s,o=!1;const r=this._idProperty;if(typeof e=="string"?(i=e,s=this._itemMap.get(i),o=!s,s&&(t=this._items.indexOf(s))):typeof e=="number"?(t=e,s=this._items[t],o=!s,s&&(i=s[r])):(s=e,i=s[r],t=this._items.indexOf(s),o=t==-1||!this._itemMap.get(i)),o)throw new g("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const a=this._bindToInternalToExternalMap.get(s);return this._bindToInternalToExternalMap.delete(s),this._bindToExternalToInternalMap.delete(a),this.fire("remove",s,t),[s,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}/**
|
|
153
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
154
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
155
|
-
*/function J(n){const e=n.next();return e.done?null:e.value}/**
|
|
156
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
157
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
158
|
-
*/class te extends qe(W()){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new g("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}/**
|
|
159
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
160
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
161
|
-
*/class oe{constructor(){this._listener=new(qe())}listenTo(e){this._listener.listenTo(e,"keydown",(t,i)=>{this._listener.fire("_keydown:"+Zi(i),i)})}set(e,t,i={}){const s=hs(e),o=i.priority;this._listener.listenTo(this._listener,"_keydown:"+s,(r,a)=>{t(a,()=>{a.preventDefault(),a.stopPropagation(),r.stop()}),r.return=!0},{priority:o})}press(e){return!!this._listener.fire("_keydown:"+Zi(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}/**
|
|
162
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
163
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
164
|
-
*/function $2(n){const e=new Map;for(const t in n)e.set(t,n[t]);return e}/**
|
|
165
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
166
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
167
|
-
*/function pt(n){return Ue(n)?new Map(n):$2(n)}/**
|
|
168
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
169
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
170
|
-
*/const H2=1e4;function z2(n,e,t,i){if(Math.max(e.length,n.length)>H2)return n.slice(0,t).concat(e).concat(n.slice(t+i,n.length));{const s=Array.from(n);return s.splice(t,i,...e),s}}/**
|
|
171
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
172
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
173
|
-
*/function rl(n,e){let t;function i(...s){i.cancel(),t=setTimeout(()=>n(...s),e)}return i.cancel=()=>{clearTimeout(t)},i}/**
|
|
174
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
175
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
176
|
-
*/function U2(n){function e(d){return d.length>=40&&d.length<=255?"VALID":"INVALID"}if(!n)return"INVALID";let t="";try{t=atob(n)}catch{return"INVALID"}const i=t.split("-"),s=i[0],o=i[1];if(!o)return e(n);try{atob(o)}catch{try{if(atob(s),!atob(s).length)return e(n)}catch{return e(n)}}if(s.length<40||s.length>255)return"INVALID";let r="";try{atob(s),r=atob(o)}catch{return"INVALID"}if(r.length!==8)return"INVALID";const a=Number(r.substring(0,4)),l=Number(r.substring(4,6))-1,c=Number(r.substring(6,8)),u=new Date(a,l,c);return u<_w||isNaN(Number(u))?"INVALID":"VALID"}/**
|
|
177
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
178
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
179
|
-
*/function W2(n){return!!n&&n.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n)}function q2(n){return!!n&&n.length==1&&/[\ud800-\udbff]/.test(n)}function j2(n){return!!n&&n.length==1&&/[\udc00-\udfff]/.test(n)}function al(n,e){return q2(n.charAt(e-1))&&j2(n.charAt(e))}function ll(n,e){return W2(n.charAt(e))}const G2=K2();function mm(n,e){const t=String(n).matchAll(G2);return Array.from(t).some(i=>i.index<e&&e<i.index+i[0].length)}function K2(){const n=[new RegExp("\\p{Emoji}[\\u{E0020}-\\u{E007E}]+\\u{E007F}","u"),new RegExp("\\p{Emoji}\\u{FE0F}?\\u{20E3}","u"),new RegExp("\\p{Emoji}\\u{FE0F}","u"),new RegExp("(?=\\p{General_Category=Other_Symbol})\\p{Emoji}\\p{Emoji_Modifier}*","u")],e=new RegExp("\\p{Regional_Indicator}{2}","u").source,t="(?:"+n.map(s=>s.source).join("|")+")",i=`${e}|${t}(?:${t})*`;return new RegExp(i,"ug")}/**
|
|
180
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
181
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
182
|
-
*/class w extends W(){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Lc,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Lc),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Lc(n){n.return=!1,n.stop()}/**
|
|
183
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
184
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
185
|
-
*/class R extends W(){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;const i=e.model.document.selection,o=!(i.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!o)&&(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",Oc,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Oc),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Oc(n){n.return=!1,n.stop()}/**
|
|
186
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
187
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
188
|
-
*/class Fc extends R{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Zh(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}/**
|
|
189
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
190
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
191
|
-
*/class gm extends Z(){constructor(e,t=[],i=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(const[s,o]of i)this._contextPlugins.set(s,o),this._contextPlugins.set(o,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new g("plugincollection-plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const s=this,o=this._context;f(e),p(e);const r=e.filter(x=>!d(x,t)),a=[...m(r)];Y(a,i);const l=F(a);return U(l,"init").then(()=>U(l,"afterInit")).then(()=>l);function c(x){return typeof x=="function"}function u(x){return c(x)&&!!x.isContextPlugin}function d(x,v){return v.some(C=>C===x||h(x)===C||h(C)===x)}function h(x){return c(x)?x.pluginName||x.name:x}function f(x,v=new Set){x.forEach(C=>{c(C)&&(v.has(C)||(v.add(C),C.pluginName&&!s._availablePlugins.has(C.pluginName)&&s._availablePlugins.set(C.pluginName,C),C.requires&&f(C.requires,v)))})}function m(x,v=new Set){return x.map(C=>c(C)?C:s._availablePlugins.get(C)).reduce((C,B)=>v.has(B)?C:(v.add(B),B.requires&&(p(B.requires,B),m(B.requires,v).forEach(re=>C.add(re))),C.add(B)),new Set)}function p(x,v=null){x.map(C=>c(C)?C:s._availablePlugins.get(C)||C).forEach(C=>{_(C,v),k(C,v),A(C,v)})}function _(x,v){if(!c(x))throw v?new g("plugincollection-soft-required",o,{missingPlugin:x,requiredBy:h(v)}):new g("plugincollection-plugin-not-found",o,{plugin:x})}function k(x,v){if(u(v)&&!u(x))throw new g("plugincollection-context-required",o,{plugin:h(x),requiredBy:h(v)})}function A(x,v){if(v&&d(x,t))throw new g("plugincollection-required",o,{plugin:h(x),requiredBy:h(v)})}function F(x){return x.map(v=>{let C=s._contextPlugins.get(v);return C=C||new v(o),s._add(v,C),C})}function U(x,v){return x.reduce((C,B)=>!B[v]||s._contextPlugins.has(B)?C:C.then(B[v].bind(B)),Promise.resolve())}function Y(x,v){for(const C of v){if(typeof C!="function")throw new g("plugincollection-replace-plugin-invalid-type",null,{pluginItem:C});const B=C.pluginName;if(!B)throw new g("plugincollection-replace-plugin-missing-name",null,{pluginItem:C});if(C.requires&&C.requires.length)throw new g("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:B});const re=s._availablePlugins.get(B);if(!re)throw new g("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:B});const ct=x.indexOf(re);if(ct===-1){if(s._contextPlugins.has(re))return;throw new g("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:B})}if(re.requires&&re.requires.length)throw new g("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:B});x.splice(ct,1,C),s._availablePlugins.set(B,C)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new g("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}/**
|
|
192
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
193
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
194
|
-
*/class pm{constructor(e){this._contextOwner=null;const{translations:t,...i}=e||{};this.config=new tm(i,this.constructor.defaultConfig);const s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new gm(this,s);const o=this.config.get("language")||{};this.locale=new D2({uiLanguage:typeof o=="string"?o:o.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new Ce}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if(typeof i!="function")throw new g("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new g("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 g("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}/**
|
|
195
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
196
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
197
|
-
*/class wm extends W(){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}/**
|
|
198
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
199
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
200
|
-
*/const Xs=new WeakMap;let Dc=!1;function bm({view:n,element:e,text:t,isDirectHost:i=!0,keepOnFocus:s=!1}){const o=n.document;Xs.has(o)||(Xs.set(o,new Map),o.registerPostFixer(a=>hr(o,a)),o.on("change:isComposing",()=>{n.change(a=>hr(o,a))},{priority:"high"})),e.is("editableElement")&&e.on("change:placeholder",(a,l,c)=>{r(c)}),e.placeholder?r(e.placeholder):t&&r(t),t&&X2();function r(a){Xs.get(o).set(e,{text:a,isDirectHost:i,keepOnFocus:s,hostElement:i?e:null}),n.change(l=>hr(o,l))}}function Z2(n,e){return e.hasClass("ck-placeholder")?!1:(n.addClass("ck-placeholder",e),!0)}function J2(n,e){return e.hasClass("ck-placeholder")?(n.removeClass("ck-placeholder",e),!0):!1}function Y2(n,e){if(!n.isAttached()||Array.from(n.getChildren()).some(r=>!r.is("uiElement")))return!1;const i=n.document,o=i.selection.anchor;return i.isComposing&&o&&o.parent===n?!1:e||!i.isFocused?!0:!!o&&o.parent!==n}function hr(n,e){const t=Xs.get(n),i=[];let s=!1;for(const[o,r]of t)r.isDirectHost&&(i.push(o),Nc(e,o,r)&&(s=!0));for(const[o,r]of t){if(r.isDirectHost)continue;const a=Q2(o);a&&(i.includes(a)||(r.hostElement=a,Nc(e,o,r)&&(s=!0)))}return s}function Nc(n,e,t){const{text:i,isDirectHost:s,hostElement:o}=t;let r=!1;return o.getAttribute("data-placeholder")!==i&&(n.setAttribute("data-placeholder",i,o),r=!0),(s||e.childCount==1)&&Y2(o,t.keepOnFocus)?Z2(n,o)&&(r=!0):J2(n,o)&&(r=!0),r}function Q2(n){if(n.childCount){const e=n.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}function X2(){Dc||D("enableplaceholder-deprecated-text-option"),Dc=!0}/**
|
|
201
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
202
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
203
|
-
*/let wi=class{is(){throw new Error("is() method is abstract")}};/**
|
|
204
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
205
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
206
|
-
*/let bi=class extends Z(wi){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 g("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),s=e.getAncestors(t);let o=0;for(;i[o]==s[o]&&i[o];)o++;return o===0?null:i[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),s=Te(t,i);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<i[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=jf(this);return delete e.parent,e}};bi.prototype.is=function(n){return n==="node"||n==="view:node"};/**
|
|
207
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
208
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
209
|
-
*/let ne=class sa extends bi{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof sa?this===e||this.data===e.data:!1}_clone(){return new sa(this.document,this.data)}};ne.prototype.is=function(n){return n==="$text"||n==="view:$text"||n==="text"||n==="view:text"||n==="node"||n==="view:node"};/**
|
|
210
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
211
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
212
|
-
*/let dt=class extends wi{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new g("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new g("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;i!==null;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}};dt.prototype.is=function(n){return n==="$textProxy"||n==="view:$textProxy"||n==="textProxy"||n==="view:textProxy"};/**
|
|
213
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
214
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
215
|
-
*/class Nt{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)(typeof t=="string"||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const i of this._patterns){const s=$c(t,i);if(s)return{element:t,pattern:i,match:s}}return null}matchAll(...e){const t=[];for(const i of e)for(const s of this._patterns){const o=$c(i,s);o&&t.push({element:i,pattern:s,match:o})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;const e=this._patterns[0],t=e.name;return typeof e!="function"&&t&&!(t instanceof RegExp)?t:null}}function $c(n,e){if(typeof e=="function")return e(n);const t={};return e.name&&(t.name=eC(e.name,n.name),!t.name)||e.attributes&&(t.attributes=sC(e.attributes,n),!t.attributes)||e.classes&&(t.classes=oC(e.classes,n),!t.classes)||e.styles&&(t.styles=rC(e.styles,n),!t.styles)?null:t}function eC(n,e){return n instanceof RegExp?!!e.match(n):n===e}function cl(n,e,t){const i=tC(n),s=Array.from(e),o=[];if(i.forEach(([r,a])=>{s.forEach(l=>{iC(r,l)&&nC(a,l,t)&&o.push(l)})}),!(!i.length||o.length<i.length))return o}function tC(n){return Array.isArray(n)?n.map(e=>Ve(e)?((e.key===void 0||e.value===void 0)&&D("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]):Ve(n)?Object.entries(n):[[n,!0]]}function iC(n,e){return n===!0||n===e||n instanceof RegExp&&e.match(n)}function nC(n,e,t){if(n===!0)return!0;const i=t(e);return n===i||n instanceof RegExp&&!!String(i).match(n)}function sC(n,e){const t=new Set(e.getAttributeKeys());return Ve(n)?(n.style!==void 0&&D("matcher-pattern-deprecated-attributes-style-key",n),n.class!==void 0&&D("matcher-pattern-deprecated-attributes-class-key",n)):(t.delete("style"),t.delete("class")),cl(n,t,i=>e.getAttribute(i))}function oC(n,e){return cl(n,e.getClassNames(),()=>{})}function rC(n,e){return cl(n,e.getStyleNames(!0),t=>e.getStyle(t))}/**
|
|
216
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
217
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
218
|
-
*/class po{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();const t=lC(e);for(const[i,s]of t)this._styleProcessor.toNormalizedForm(i,s,this._styles)}has(e){if(this.isEmpty)return!1;const i=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);return Array.isArray(i)}set(e,t){if(Q(e))for(const[i,s]of Object.entries(e))this._styleProcessor.toNormalizedForm(i,s,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=oa(e);s2(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!Q(this._styles[e]))return this._styles[e];const i=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);if(Array.isArray(i))return i[1]}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this.getStylesEntries().map(([i])=>i)}clear(){this._styles={}}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const s=t.splice(0,t.length-1).join("."),o=Un(this._styles,s);if(!o)return;!Object.keys(o).length&&this.remove(s)}}class aC{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(Q(t)){fr(i,oa(e),t);return}if(this._normalizers.has(e)){const s=this._normalizers.get(e),{path:o,value:r}=s(t);fr(i,o,r)}else fr(i,e,t)}getNormalized(e,t){if(!e)return nl({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if(typeof i=="string")return Un(t,i);const s=i(e,t);if(s)return s}return Un(t,oa(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);return i===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(i):[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(s=>{const o=this.getNormalized(s,e);return o&&typeof o=="object"?Object.keys(o).length:o}),i=new Set([...t,...Object.keys(e)]);return Array.from(i)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function lC(n){let e=null,t=0,i=0,s=null;const o=new Map;if(n==="")return o;n.charAt(n.length-1)!=";"&&(n=n+";");for(let r=0;r<n.length;r++){const a=n.charAt(r);if(e===null)switch(a){case":":s||(s=n.substr(t,r-t),i=r+1);break;case'"':case"'":e=a;break;case";":{const l=n.substr(i,r-i);s&&o.set(s.trim(),l.trim()),s=null,t=r+1;break}}else a===e&&(e=null)}return o}function oa(n){return n.replace("-",".")}function fr(n,e,t){let i=t;Q(t)&&(i=nl({},Un(n,e),t)),t2(n,e,i)}/**
|
|
219
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
220
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
221
|
-
*/let st=class _m extends bi{constructor(e,t,i,s){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=cC(i),this._children=[],s&&this._insertChild(0,s),this._classes=new Set,this._attrs.has("class")){const o=this._attrs.get("class");Hc(this._classes,o),this._attrs.delete("class")}this._styles=new po(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if(e=="class")return this._classes.size>0?[...this._classes].join(" "):void 0;if(e=="style"){const t=this._styles.toString();return t==""?void 0:t}return this._attrs.get(e)}hasAttribute(e){return e=="class"?this._classes.size>0:e=="style"?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof _m))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Nt(...e);let i=this.parent;for(;i&&!i.is("documentFragment");){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map(s=>`${s[0]}="${s[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(i==""?"":` ${i}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const s of this.getChildren())t.push(s._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._unsafeAttributesToRender=this._unsafeAttributesToRender,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const s=uC(this.document,t);for(const o of s)o.parent!==null&&o._remove(),o.parent=this,o.document=this.document,this._children.splice(e,0,o),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const i=String(t);this._fireChange("attributes",this),e=="class"?Hc(this._classes,i):e=="style"?this._styles.setTo(i):this._attrs.set(e,i)}_removeAttribute(e){return this._fireChange("attributes",this),e=="class"?this._classes.size>0?(this._classes.clear(),!0):!1:e=="style"?this._styles.isEmpty?!1:(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of z(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of z(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),typeof e!="string"?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of z(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};st.prototype.is=function(n,e){return e?e===this.name&&(n==="element"||n==="view:element"):n==="element"||n==="view:element"||n==="node"||n==="view:node"};function cC(n){const e=pt(n);for(const[t,i]of e)i===null?e.delete(t):typeof i!="string"&&e.set(t,String(i));return e}function Hc(n,e){const t=e.split(/\s+/);n.clear(),t.forEach(i=>n.add(i))}function uC(n,e){return typeof e=="string"?[new ne(n,e)]:(Ue(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new ne(n,t):t instanceof dt?new ne(n,t.data):t))}/**
|
|
222
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
223
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
224
|
-
*/class jn extends st{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=dC}}jn.prototype.is=function(n,e){return e?e===this.name&&(n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function dC(){const n=[...this.getChildren()],e=n[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const t of n)if(!t.is("uiElement"))return null;return this.childCount}/**
|
|
225
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
226
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
227
|
-
*/class jo extends W(jn){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",o=>o&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}jo.prototype.is=function(n,e){return e?e===this.name&&(n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};/**
|
|
228
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
229
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
230
|
-
*/const zc=Symbol("rootName");class vm extends jo{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(zc)}set rootName(e){this._setCustomProperty(zc,e)}set _name(e){this.name=e}}vm.prototype.is=function(n,e){return e?e===this.name&&(n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};/**
|
|
231
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
232
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
233
|
-
*/let ei=class{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new g("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new g("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=E._createAt(e.startPosition):this._position=E._createAt(e.boundaries[e.direction=="backward"?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i;do i=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=i)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(i.parent===null&&e.offset===i.childCount)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;if(i instanceof ne){if(e.isAtEnd)return this._position=E._createAfter(i),this._next();s=i.data[e.offset]}else s=i.getChild(e.offset);if(s instanceof st){if(!this.shallow)e=new E(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}return this._position=e,this._formatReturnValue("elementStart",s,t,e,1)}if(s instanceof ne){if(this.singleCharacters)return e=new E(s,0),this._position=e,this._next();let o=s.data.length,r;return s==this._boundaryEndParent?(o=this.boundaries.end.offset,r=new dt(s,0,o),e=E._createAfter(r)):(r=new dt(s,0,s.data.length),e.offset++),this._position=e,this._formatReturnValue("text",r,t,e,o)}if(typeof s=="string"){let o;this.singleCharacters?o=1:o=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;const r=new dt(i,e.offset,o);return e.offset+=o,this._position=e,this._formatReturnValue("text",r,t,e,o)}return e=E._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(i.parent===null&&e.offset===0)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(i instanceof ne){if(e.isAtStart)return this._position=E._createBefore(i),this._previous();s=i.data[e.offset-1]}else s=i.getChild(e.offset-1);if(s instanceof st)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",s,t,e,1)):(e=new E(s,s.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,t,e));if(s instanceof ne){if(this.singleCharacters)return e=new E(s,s.data.length),this._position=e,this._previous();let o=s.data.length,r;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;r=new dt(s,a,s.data.length-a),o=r.data.length,e=E._createBefore(r)}else r=new dt(s,0,s.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",r,t,e,o)}if(typeof s=="string"){let o;if(this.singleCharacters)o=1;else{const a=i===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-a}e.offset-=o;const r=new dt(i,e.offset,o);return this._position=e,this._formatReturnValue("text",r,t,e,o)}return e=E._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,s,o){return t instanceof dt&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=E._createAfter(t.textNode),this._position=s):i=E._createAfter(t.textNode)),t.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=E._createBefore(t.textNode),this._position=s):i=E._createBefore(t.textNode))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:s,length:o}}}};/**
|
|
234
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
235
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
236
|
-
*/let E=class vt extends wi{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof jo);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const t=vt._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new ei(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]==i[s]&&t[s];)s++;return s===0?null:t[s-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const s=Te(t,i);switch(s){case"prefix":return"before";case"extension":return"after";default:return t[s]<i[s]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new ei(e)}clone(){return new vt(this.parent,this.offset)}static _createAt(e,t){if(e instanceof vt)return new this(e.parent,e.offset);{const i=e;if(t=="end")t=i.is("$text")?i.data.length:i.childCount;else{if(t=="before")return this._createBefore(i);if(t=="after")return this._createAfter(i);if(t!==0&&!t)throw new g("view-createpositionat-offset-required",i)}return new vt(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new vt(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new g("view-position-after-root",e,{root:e});return new vt(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new vt(e.textNode,e.offsetInText);if(!e.parent)throw new g("view-position-before-root",e,{root:e});return new vt(e.parent,e.index)}};E.prototype.is=function(n){return n==="position"||n==="view:position"};/**
|
|
237
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
238
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
239
|
-
*/let O=class Mt extends wi{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new ei({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(xs,{direction:"backward"}),t=this.end.getLastMatchingPosition(xs);return e.parent.is("$text")&&e.isAtStart&&(e=E._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=E._createAfter(t.parent)),new Mt(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(xs);if(e.isAfter(this.end)||e.isEqual(this.end))return new Mt(e,e);let t=this.end.getLastMatchingPosition(xs,{direction:"backward"});const i=e.nodeAfter,s=t.nodeBefore;return i&&i.is("$text")&&(e=new E(i,0)),s&&s.is("$text")&&(t=new E(s,s.data.length)),new Mt(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new Mt(this.start,e.start)),this.containsPosition(e.end)&&t.push(new Mt(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new Mt(t,i)}return null}getWalker(e={}){return e.boundaries=this,new ei(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new Mt(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ei(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new ei(e);yield t.position;for(const i of t)yield i.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,s){return new this(new E(e,t),new E(i,s))}static _createFromPositionAndShift(e,t){const i=e,s=e.getShiftedBy(t);return t>0?new this(i,s):new this(s,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(E._createBefore(e),t)}};O.prototype.is=function(n){return n==="range"||n==="view:range"};function xs(n){return!!(n.item.is("attributeElement")||n.item.is("uiElement"))}/**
|
|
240
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
241
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
242
|
-
*/let At=class ym extends Z(wi){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const s of e._ranges)if(t.isEqual(s)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=ta(this.getRanges()),i=ta(e.getRanges());if(t!=i)return!1;if(t==0)return!0;for(let s of this.getRanges()){s=s.getTrimmed();let o=!1;for(let r of e.getRanges())if(r=r.getTrimmed(),s.start.isEqual(r.start)&&s.end.isEqual(r.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,i,s]=e;if(typeof i=="object"&&(s=i,i=void 0),t===null)this._setRanges([]),this._setFakeOptions(s);else if(t instanceof ym||t instanceof ul)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof O)this._setRanges([t],s&&s.backward),this._setFakeOptions(s);else if(t instanceof E)this._setRanges([new O(t)]),this._setFakeOptions(s);else if(t instanceof bi){const o=!!s&&!!s.backward;let r;if(i===void 0)throw new g("view-selection-setto-required-second-parameter",this);i=="in"?r=O._createIn(t):i=="on"?r=O._createOn(t):r=new O(E._createAt(t,i)),this._setRanges([r],o),this._setFakeOptions(s)}else if(Ue(t))this._setRanges(t,s&&s.backward),this._setFakeOptions(s);else throw new g("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new g("view-selection-setfocus-no-ranges",this);const i=E._createAt(e,t);if(i.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.pop(),i.compareWith(s)=="before"?this._addRange(new O(i,s),!0):this._addRange(new O(s,i)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const i of e)this._addRange(i);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof O))throw new g("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new g("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new O(e.start,e.end))}};At.prototype.is=function(n){return n==="selection"||n==="view:selection"};/**
|
|
243
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
244
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
245
|
-
*/let ul=class extends Z(wi){constructor(...e){super(),this._selection=new At,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};ul.prototype.is=function(n){return n==="selection"||n=="documentSelection"||n=="view:selection"||n=="view:documentSelection"};/**
|
|
246
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
247
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
248
|
-
*/class cn extends xt{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}}/**
|
|
249
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
250
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
251
|
-
*/const mr=Symbol("bubbling contexts");function ra(n){class e extends n{fire(i,...s){try{const o=i instanceof xt?i:new xt(this,i),r=gr(this);if(!r.size)return;if(pn(o,"capturing",this),Ii(r,"$capture",o,...s))return o.return;const a=o.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,c=l?!!km(r,l):!1;let u=l||hC(a);if(pn(o,"atTarget",u),!c){if(Ii(r,"$text",o,...s))return o.return;pn(o,"bubbling",u)}for(;u;){if(u.is("rootElement")){if(Ii(r,"$root",o,...s))return o.return}else if(u.is("element")&&Ii(r,u.name,o,...s))return o.return;if(Ii(r,u,o,...s))return o.return;u=u.parent,pn(o,"bubbling",u)}return pn(o,"bubbling",this),Ii(r,"$document",o,...s),o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}_addEventListener(i,s,o){const r=z(o.context||"$document"),a=gr(this);for(const l of r){let c=a.get(l);c||(c=new(Z()),a.set(l,c)),this.listenTo(c,i,s,o)}}_removeEventListener(i,s){const o=gr(this);for(const r of o.values())this.stopListening(r,i,s)}}return e}{const n=ra(Object);["fire","_addEventListener","_removeEventListener"].forEach(e=>{ra[e]=n.prototype[e]})}function pn(n,e,t){n instanceof cn&&(n._eventPhase=e,n._currentTarget=t)}function Ii(n,e,t,...i){const s=typeof e=="string"?n.get(e):km(n,e);return s?(s.fire(t,...i),t.stop.called):!1}function km(n,e){for(const[t,i]of n)if(typeof t=="function"&&t(e))return i;return null}function gr(n){return n[mr]||(n[mr]=new Map),n[mr]}function hC(n){if(!n)return null;const e=n.start.parent,t=n.end.parent,i=e.getPath(),s=t.getPath();return i.length>s.length?e:t}/**
|
|
252
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
253
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
254
|
-
*/let Cm=class extends ra(W()){constructor(e){super(),this._postFixers=new Set,this.selection=new ul,this.roots=new Ce({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const i of this._postFixers)if(t=i(e),t)break;while(t)}};/**
|
|
255
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
256
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
257
|
-
*/const Em=10;class ii extends st{constructor(e,t,i,s){super(e,t,i,s),this._priority=Em,this._id=null,this._clonesGroup=null,this.getFillerOffset=fC}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new g("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}ii.DEFAULT_PRIORITY=Em;ii.prototype.is=function(n,e){return e?e===this.name&&(n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"):n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function fC(){if(pr(this))return null;let n=this.parent;for(;n&&n.is("attributeElement");){if(pr(n)>1)return null;n=n.parent}return!n||pr(n)>1?null:this.childCount}function pr(n){return Array.from(n.getChildren()).filter(e=>!e.is("uiElement")).length}/**
|
|
258
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
259
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
260
|
-
*/class dl extends st{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=mC}_insertChild(e,t){if(t&&(t instanceof bi||Array.from(t).length>0))throw new g("view-emptyelement-cannot-add",[this,t]);return 0}}dl.prototype.is=function(n,e){return e?e===this.name&&(n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"):n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function mC(){return null}/**
|
|
261
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
262
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
263
|
-
*/class Go extends st{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=pC}_insertChild(e,t){if(t&&(t instanceof bi||Array.from(t).length>0))throw new g("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const i of this.getAttributeKeys())t.setAttribute(i,this.getAttribute(i));return t}}Go.prototype.is=function(n,e){return e?e===this.name&&(n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"):n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function gC(n){n.document.on("arrowKey",(e,t)=>wC(e,t,n.domConverter),{priority:"low"})}function pC(){return null}function wC(n,e,t){if(e.keyCode==N.arrowright){const i=e.domTarget.ownerDocument.defaultView.getSelection(),s=i.rangeCount==1&&i.getRangeAt(0).collapsed;if(s||e.shiftKey){const o=i.focusNode,r=i.focusOffset,a=t.domPositionToView(o,r);if(a===null)return;let l=!1;const c=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){const u=t.viewPositionToDom(c);s?i.collapse(u.parent,u.offset):i.extend(u.parent,u.offset)}}}}/**
|
|
264
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
265
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
266
|
-
*/class hl extends st{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=bC}_insertChild(e,t){if(t&&(t instanceof bi||Array.from(t).length>0))throw new g("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}hl.prototype.is=function(n,e){return e?e===this.name&&(n==="rawElement"||n==="view:rawElement"||n==="element"||n==="view:element"):n==="rawElement"||n==="view:rawElement"||n===this.name||n==="view:"+this.name||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function bC(){return null}/**
|
|
267
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
268
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
269
|
-
*/let ni=class extends Z(wi){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const s=_C(this.document,t);for(const o of s)o.parent!==null&&o._remove(),o.parent=this,this._children.splice(e,0,o),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};ni.prototype.is=function(n){return n==="documentFragment"||n==="view:documentFragment"};function _C(n,e){return typeof e=="string"?[new ne(n,e)]:(Ue(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new ne(n,t):t instanceof dt?new ne(n,t.data):t))}/**
|
|
270
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
271
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
272
|
-
*/class Tm{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new ni(this.document,e)}createText(e){return new ne(this.document,e)}createAttributeElement(e,t,i={}){const s=new ii(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 o=null;Ve(i)?s=i:o=i;const r=new jn(this.document,e,t,o);return s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}createEditableElement(e,t,i={}){const s=new jo(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEmptyElement(e,t,i={}){const s=new dl(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createUIElement(e,t,i){const s=new Go(this.document,e,t);return i&&(s.render=i),s}createRawElement(e,t,i,s={}){const o=new hl(this.document,e,t);return i&&(o.render=i),s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){Ve(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 E?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new g("view-writer-break-non-container-element",this.document);if(!t.parent)throw new g("view-writer-break-root",this.document);if(e.isAtStart)return E._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(E._createAfter(t),i);const s=new O(e,E._createAt(t,"end")),o=new E(i,0);this.move(s,o)}return E._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&i.childCount===0){const r=i.parent,a=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new E(r,a))}const s=i.getChild(t-1),o=i.getChild(t);if(!s||!o)return e;if(s.is("$text")&&o.is("$text"))return Wc(s,o);if(s.is("attributeElement")&&o.is("attributeElement")&&s.isSimilar(o)){const r=s.childCount;return s._appendChild(o.getChildren()),o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new E(s,r))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!t||!i||!t.is("containerElement")||!i.is("containerElement"))throw new g("view-writer-merge-containers-invalid-position",this.document);const s=t.getChild(t.childCount-1),o=s instanceof ne?E._createAt(s,"end"):E._createAt(t,"end");return this.move(O._createIn(i),E._createAt(t,"end")),this.remove(O._createOn(i)),o}insert(e,t){t=Ue(t)?[...t]:[t],Am(t,this.document);const i=t.reduce((r,a)=>{const l=r[r.length-1],c=!a.is("uiElement");return!l||l.breakAttributes!=c?r.push({breakAttributes:c,nodes:[a]}):l.nodes.push(a),r},[]);let s=null,o=e;for(const{nodes:r,breakAttributes:a}of i){const l=this._insertNodes(o,r,a);s||(s=l.start),o=l.end}return s?new O(s,o):new O(e)}remove(e){const t=e instanceof O?e:O._createOn(e);if(wn(t,this.document),t.isCollapsed)return new ni(this.document);const{start:i,end:s}=this._breakAttributesRange(t,!0),o=i.parent,r=s.offset-i.offset,a=o._removeChildren(i.offset,r);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(i);return t.start=l,t.end=l.clone(),new ni(this.document,a)}clear(e,t){wn(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of i){const o=s.item;let r;if(o.is("element")&&t.isSimilar(o))r=O._createOn(o);else if(!s.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const a=o.getAncestors().find(l=>l.is("element")&&t.isSimilar(l));a&&(r=O._createIn(a))}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);const s=t.parent,o=s.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=s.childCount-o}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof ii))throw new g("view-writer-wrap-invalid-attribute",this.document);if(wn(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&!vC(i.parent)&&(i=i.getLastMatchingPosition(o=>o.item.is("uiElement"))),i=this._wrapPosition(i,t);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new O(i)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof ii))throw new g("view-writer-unwrap-invalid-attribute",this.document);if(wn(e,this.document),e.isCollapsed)return e;const{start:i,end:s}=this._breakAttributesRange(e,!0),o=i.parent,r=this._unwrapChildren(o,i.offset,s.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new O(a,l)}rename(e,t){const i=new jn(this.document,e,t.getAttributes());return this.insert(E._createAfter(t),i),this.move(O._createIn(t),E._createAt(i,0)),this.remove(O._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return E._createAt(e,t)}createPositionAfter(e){return E._createAfter(e)}createPositionBefore(e){return E._createBefore(e)}createRange(e,t){return new O(e,t)}createRangeOn(e){return O._createOn(e)}createRangeIn(e){return O._createIn(e)}createSelection(...e){return new At(...e)}createSlot(e="children"){if(!this._slotFactory)throw new g("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=aa(e):s=e.parent.is("$text")?e.parent.parent:e.parent,!s)throw new g("view-writer-invalid-position-container",this.document);let o;i?o=this._breakAttributes(e,!0):o=e.parent.is("$text")?wr(e):e;const r=s._insertChild(o.offset,t);for(const u of t)this._addToClonedElementsGroup(u);const a=o.getShiftedBy(r),l=this.mergeAttributes(o);l.isEqual(o)||a.offset--;const c=this.mergeAttributes(a);return new O(l,c)}_wrapChildren(e,t,i,s){let o=t;const r=[];for(;o<i;){const l=e.getChild(o),c=l.is("$text"),u=l.is("attributeElement");if(u&&this._wrapAttributeElement(s,l))r.push(new E(e,o));else if(c||!u||yC(s,l)){const d=s._clone();l._remove(),d._appendChild(l),e._insertChild(o,d),this._addToClonedElementsGroup(d),r.push(new E(e,o))}else this._wrapChildren(l,0,l.childCount,s);o++}let a=0;for(const l of r){if(l.offset-=a,l.offset==t)continue;this.mergeAttributes(l).isEqual(l)||(a++,i--)}return O._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,s){let o=t;const r=[];for(;o<i;){const l=e.getChild(o);if(!l.is("attributeElement")){o++;continue}if(l.isSimilar(s)){const c=l.getChildren(),u=l.childCount;l._remove(),e._insertChild(o,c),this._removeFromClonedElementsGroup(l),r.push(new E(e,o),new E(e,o+u)),o+=u,i+=u-1;continue}if(this._unwrapAttributeElement(s,l)){r.push(new E(e,o),new E(e,o+1)),o++;continue}this._unwrapChildren(l,0,l.childCount,s),o++}let a=0;for(const l of r){if(l.offset-=a,l.offset==t||l.offset==i)continue;this.mergeAttributes(l).isEqual(l)||(a++,i--)}return O._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:s}=this._breakAttributesRange(e,!0),o=i.parent,r=this._wrapChildren(o,i.offset,s.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new O(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Uc(e.clone());e.parent.is("$text")&&(e=wr(e));const i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const s=new O(e,e.getShiftedBy(1));this.wrap(s,t);const o=new E(i.parent,i.index);i._remove();const r=o.nodeBefore,a=o.nodeAfter;return r instanceof ne&&a instanceof ne?Wc(r,a):Uc(o)}_wrapAttributeElement(e,t){if(!qc(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if(!(i==="class"||i==="style")&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())i==="class"||i==="style"||t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t);for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!qc(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if(!(i==="class"||i==="style")&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())i==="class"||i==="style"||this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,s=e.end;if(wn(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new O(l,l)}const o=this._breakAttributes(s,t),r=o.parent.childCount,a=this._breakAttributes(i,t);return o.offset+=o.parent.childCount-r,new O(a,o)}_breakAttributes(e,t=!1){const i=e.offset,s=e.parent;if(e.parent.is("emptyElement"))throw new g("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new g("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new g("view-writer-cannot-break-raw-element",this.document);if(!t&&s.is("$text")&&la(s.parent)||la(s))return e.clone();if(s.is("$text"))return this._breakAttributes(wr(e),t);const o=s.childCount;if(i==o){const r=new E(s.parent,s.index+1);return this._breakAttributes(r,t)}else if(i===0){const r=new E(s.parent,s.index);return this._breakAttributes(r,t)}else{const r=s.index+1,a=s._clone();s.parent._insertChild(r,a),this._addToClonedElementsGroup(a);const l=s.childCount-i,c=s._removeChildren(i,l);a._appendChild(c);const u=new E(s.parent,r);return this._breakAttributes(u,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const s of e.getChildren())this._addToClonedElementsGroup(s);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const s of e.getChildren())this._removeFromClonedElementsGroup(s);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function vC(n){return Array.from(n.getChildren()).some(e=>!e.is("uiElement"))}function aa(n){let e=n.parent;for(;!la(e);){if(!e)return;e=e.parent}return e}function yC(n,e){return n.priority<e.priority?!0:n.priority>e.priority?!1:n.getIdentity()<e.getIdentity()}function Uc(n){const e=n.nodeBefore;if(e&&e.is("$text"))return new E(e,e.data.length);const t=n.nodeAfter;return t&&t.is("$text")?new E(t,0):n}function wr(n){if(n.offset==n.parent.data.length)return new E(n.parent.parent,n.parent.index+1);if(n.offset===0)return new E(n.parent.parent,n.parent.index);const e=n.parent.data.slice(n.offset);return n.parent._data=n.parent.data.slice(0,n.offset),n.parent.parent._insertChild(n.parent.index+1,new ne(n.root.document,e)),new E(n.parent.parent,n.parent.index+1)}function Wc(n,e){const t=n.data.length;return n._data+=e.data,e._remove(),new E(n,t)}const kC=[ne,ii,jn,dl,hl,Go];function Am(n,e){for(const t of n){if(!kC.some(i=>t instanceof i))throw new g("view-writer-insert-invalid-node-type",e);t.is("$text")||Am(t.getChildren(),e)}}function la(n){return n&&(n.is("containerElement")||n.is("documentFragment"))}function wn(n,e){const t=aa(n.start),i=aa(n.end);if(!t||!i||t!==i)throw new g("view-writer-invalid-range-container",e)}function qc(n,e){return n.id===null&&e.id===null}/**
|
|
273
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
274
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
275
|
-
*/const Sm=n=>n.createTextNode(" "),xm=n=>{const e=n.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},Im=n=>{const e=n.createElement("br");return e.dataset.ckeFiller="true",e},tt=7,Gn="".repeat(tt);function De(n){return typeof n=="string"?n.substr(0,tt)===Gn:fe(n)&&n.data.substr(0,tt)===Gn}function Sn(n){return n.data.length==tt&&De(n)}function jc(n){const e=typeof n=="string"?n:n.data;return De(n)?e.slice(tt):e}function CC(n){n.document.on("arrowKey",EC,{priority:"low"})}function EC(n,e){if(e.keyCode==N.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(t.rangeCount==1&&t.getRangeAt(0).collapsed){const i=t.getRangeAt(0).startContainer,s=t.getRangeAt(0).startOffset;De(i)&&s<=tt&&t.collapse(i,0)}}}/**
|
|
276
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
277
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
278
|
-
*/class TC extends W(){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),M.isBlink&&!M.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()}),this.set("isComposing",!1),this.on("change:isComposing",()=>{this.isComposing||this.render()})}markToSync(e,t){if(e==="text")this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e==="attributes")this.markedAttributes.add(t);else if(e==="children")this.markedChildren.add(t);else throw new g("view-renderer-unknown-type",this)}}render(){if(this.isComposing&&!M.isAndroid)return;let e=null;const t=M.isBlink&&!M.isAndroid?!this.isSelecting:!0;for(const i of this.markedChildren)this._updateChildrenMappings(i);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=E._createBefore(e.parent)));for(const i of this.markedAttributes)this._updateAttrs(i);for(const i of this.markedChildren)this._updateChildren(i,{inlineFillerPosition:e});for(const i of this.markedTexts)!this.markedChildren.has(i.parent)&&this.domConverter.mapViewToDom(i.parent)&&this._updateText(i,{inlineFillerPosition:e});if(t)if(e){const i=this.domConverter.viewPositionToDom(e),s=i.parent.ownerDocument;De(i.parent)?this._inlineFiller=i.parent:this._inlineFiller=Gc(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){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.childNodes),s=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),o=this._diffNodeLists(i,s),r=this._findUpdateActions(o,i,s,SC);if(r.indexOf("update")!==-1){const a={equal:0,insert:0,delete:0};for(const l of r)if(l==="update"){const c=a.equal+a.insert,u=a.equal+a.delete,d=e.getChild(c);d&&!d.is("uiElement")&&!d.is("rawElement")&&this._updateElementMappings(d,i[u]),Pc(s[c]),a.equal++}else a[l]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?E._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&fe(t.parent)&&De(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!De(e))throw new g("view-renderer-filler-was-lost",this);Sn(e)?e.remove():e.data=e.data.substr(tt),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!AC(t)||i===t.getFillerOffset())return!1;const s=e.nodeBefore,o=e.nodeAfter;return!(s instanceof ne||o instanceof ne||M.isAndroid&&(s||o))}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e);let o=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(o=Gn+o),Kc(i,o)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map(o=>o.name),s=e.getAttributeKeys();for(const o of s)this.domConverter.setDomElementAttribute(t,o,e.getAttribute(o),e);for(const o of i)e.hasAttribute(o)||this.domConverter.removeDomElementAttribute(t,o)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;if(M.isAndroid){let d=null;for(const h of Array.from(i.childNodes)){if(d&&fe(d)&&fe(h)){i.normalize();break}d=h}}const s=t.inlineFillerPosition,o=i.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));s&&s.parent===e&&Gc(i.ownerDocument,r,s.offset);const a=this._diffNodeLists(o,r),l=this._findUpdateActions(a,o,r,xC);let c=0;const u=new Set;for(const d of l)d==="delete"?(u.add(o[c]),Pc(o[c])):(d==="equal"||d==="update")&&c++;c=0;for(const d of l)d==="insert"?(am(i,c,r[c]),c++):d==="update"?(Kc(o[c],r[c].data),c++):d==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(r[c])),c++);for(const d of u)d.parentNode||this.domConverter.unbindDomElement(d)}_diffNodeLists(e,t){return e=RC(e,this._fakeSelectionContainer),Rn(e,t,IC.bind(null,this.domConverter))}_findUpdateActions(e,t,i,s){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let o=[],r=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)c==="insert"?a.push(i[l.equal+l.insert]):c==="delete"?r.push(t[l.equal+l.delete]):(o=o.concat(Rn(r,a,s).map(u=>u==="equal"?"update":u)),o.push("equal"),r=[],a=[]),l[c]++;return o.concat(Rn(r,a,s).map(c=>c==="equal"?"update":c))}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(M.isBlink&&!M.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}const e=this.domConverter.mapViewToDom(this.selection.editableElement);!this.isFocused||!e||(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&M.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=VC(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!i.parentElement||i.parentElement!=e)&&e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const s=t.getSelection(),o=t.createRange();s.removeAllRanges(),o.selectNodeContents(i),s.addRange(o)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),s=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(i.parent,i.offset,s.parent,s.offset),M.isGecko&&PC(s,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||i.anchorNode!==t&&!t.contains(i.anchorNode)?!0:t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const i=e.activeElement,s=this.domConverter.mapDomToView(i);i&&s&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function AC(n){if(n.getAttribute("contenteditable")=="false")return!1;const e=n.findAncestor(t=>t.hasAttribute("contenteditable"));return!e||e.getAttribute("contenteditable")=="true"}function Gc(n,e,t){const i=e instanceof Array?e:e.childNodes,s=i[t];if(fe(s))return s.data=Gn+s.data,s;{const o=n.createTextNode(Gn);return Array.isArray(e)?i.splice(t,0,o):am(e,t,o),o}}function SC(n,e){return Dt(n)&&Dt(e)&&!fe(n)&&!fe(e)&&!Bn(n)&&!Bn(e)&&n.tagName.toLowerCase()===e.tagName.toLowerCase()}function xC(n,e){return Dt(n)&&Dt(e)&&fe(n)&&fe(e)}function IC(n,e,t){return e===t?!0:fe(e)&&fe(t)?e.data===t.data:!!(n.isBlockFiller(e)&&n.isBlockFiller(t))}function PC(n,e){const t=n.parent;if(t.nodeType!=Node.ELEMENT_NODE||n.offset!=t.childNodes.length-1)return;const i=t.childNodes[n.offset];i&&i.tagName=="BR"&&e.addRange(e.getRangeAt(0))}function RC(n,e){const t=Array.from(n);return t.length==0||!e||t[t.length-1]==e&&t.pop(),t}function VC(n){const e=n.createElement("div");return e.className="ck-fake-selection-container",Object.assign(e.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),e.textContent=" ",e}function Kc(n,e){const t=n.data;if(t==e)return;const i=Kh(t,e);for(const s of i)s.type==="insert"?n.insertData(s.index,s.values.join("")):n.deleteData(s.index,s.howMany)}/**
|
|
279
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
280
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
281
|
-
*/const BC=Im(S.document),MC=Sm(S.document),LC=xm(S.document),Is="data-ck-unsafe-attribute-",Zc="data-ck-unsafe-element";class Pm{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Nt,this._inlineObjectElementMatcher=new Nt,this._elementsWithTemporaryCustomProperties=new Set,this.document=e,this.renderingMode=i,this.blockFillerMode=t||(i==="editing"?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?S.document:S.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new At(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const i of Array.from(e.children))this.unbindDomElement(i)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,i){return this.renderingMode==="data"?!0:(e=e.toLowerCase(),e.startsWith("on")||e==="srcdoc"&&t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:i==="img"&&(e==="src"||e==="srcset")||i==="source"&&e==="srcset"?!0:!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data"){e.innerHTML=t;return}const i=new DOMParser().parseFromString(t,"text/html"),s=i.createDocumentFragment(),o=i.body.childNodes;for(;o.length>0;)s.appendChild(o[0]);const r=i.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=r.nextNode();)a.push(l);for(const c of a){for(const d of c.getAttributeNames())this.setDomElementAttribute(c,d,c.getAttribute(d));const u=c.tagName.toLowerCase();this._shouldRenameElement(u)&&(Yc(u),c.replaceWith(this._createReplacementDomElement(u,c)))}for(;e.firstChild;)e.firstChild.remove();e.append(s)}viewToDom(e,t={}){if(e.is("$text")){const i=this._processDataFromViewText(e);return this._domDocument.createTextNode(i)}else{const 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)?(Yc(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(const o of i.getAttributeKeys())this.setDomElementAttribute(s,o,i.getAttribute(o),i)}if(t.withChildren!==!1)for(const o of this.viewChildrenToDom(i,t))s.appendChild(o);return s}}setDomElementAttribute(e,t,i,s){const o=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(t);if(o||D("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),!lm(t)){D("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});return}e.hasAttribute(t)&&!o?e.removeAttribute(t):e.hasAttribute(Is+t)&&o&&e.removeAttribute(Is+t),e.setAttribute(o?t:Is+t,i)}removeDomElementAttribute(e,t){t!=Zc&&(e.removeAttribute(t),e.removeAttribute(Is+t))}*viewChildrenToDom(e,t={}){const i=e.getFillerOffset&&e.getFillerOffset();let s=0;for(const o of e.getChildren()){i===s&&(yield this._getBlockFiller());const r=o.is("element")&&!!o.getCustomProperty("dataPipeline:transparentRendering")&&!J(o.getAttributes());r&&this.renderingMode=="data"?yield*this.viewChildrenToDom(o,t):(r&&D("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:o}),yield this.viewToDom(o,t)),s++}i===s&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),s=this._domDocument.createRange();return s.setStart(t.parent,t.offset),s.setEnd(i.parent,i.offset),s}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let s=e.offset;return De(i)&&(s+=tt),{parent:i,offset:s}}else{let i,s,o;if(e.offset===0){if(i=this.mapViewToDom(t),!i)return null;o=i.childNodes[0]}else{const a=e.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;i=s.parentNode,o=s.nextSibling}if(fe(o)&&De(o))return{parent:o,offset:tt};const r=s?Ss(s)+1:0;return{parent:i,offset:r}}}domToView(e,t={}){const i=[],s=this._domToView(e,t,i),o=s.next().value;return!o||(s.next(),this._processDomInlineNodes(null,i,t),o.is("$text")&&o.data.length==0)?null:o}*domChildrenToView(e,t={},i=[]){for(let s=0;s<e.childNodes.length;s++){const o=e.childNodes[s],r=this._domToView(o,t,i),a=r.next().value;a!==null&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,i,t),yield a,r.next())}this._processDomInlineNodes(e,i,t)}domSelectionToView(e){if(DC(e))return new At([]);if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;fe(s)&&(s=s.parentNode);const o=this.fakeSelectionToView(s);if(o)return o}const t=this.isDomSelectionBackward(e),i=[];for(let s=0;s<e.rangeCount;s++){const o=e.getRangeAt(s),r=this.domRangeToView(o);r&&i.push(r)}return new At(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new O(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,Ss(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return E._createBefore(i);if(fe(e)){if(Sn(e))return this.domPositionToView(e.parentNode,Ss(e));const s=this.findCorrespondingViewText(e);let o=t;return s?(De(e)&&(o-=tt,o=o<0?0:o),new E(s,o)):null}else{if(t===0){const s=this.mapDomToView(e);if(s)return new E(s,0)}else{const s=e.childNodes[t-1];if(fe(s)&&Sn(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,Ss(s));const o=fe(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(o&&o.parent)return new E(o.parent,o.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Sn(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const s=this.mapDomToView(i);if(s){const o=s.nextSibling;return o instanceof ne?o:null}}else{const s=this.mapDomToView(e.parentNode);if(s){const o=s.getChild(0);return o instanceof ne?o:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:i,scrollY:s}=S.window,o=[];Jc(t,r=>{const{scrollLeft:a,scrollTop:l}=r;o.push([a,l])}),t.focus(),Jc(t,r=>{const[a,l]=o.shift();r.scrollLeft=a,r.scrollTop=l}),S.window.scrollTo(i,s)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const 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(BC):e.tagName==="BR"&&Rm(e,this.blockElements)&&e.parentNode.childNodes.length===1?!0:e.isEqualNode(LC)||FC(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=g2(e);for(t.pop();t.length;){const i=t.pop(),s=this._domToViewMapping.get(i);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Sm(this._domDocument);case"markedNbsp":return xm(this._domDocument);case"br":return Im(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(fe(e)&&De(e)&&t<tt||this.isElement(e)&&De(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!(i&&(i.is("uiElement")||i.is("rawElement")))}*_domToView(e,t,i){if(this.isBlockFiller(e))return null;const s=this.getHostViewElement(e);if(s)return s;if(Bn(e)&&t.skipComments)return null;if(fe(e)){if(Sn(e))return null;{const o=e.data;if(o==="")return null;const r=new ne(this.document,o);return i.push(r),r}}else{let o=this.mapDomToView(e);if(o)return this._isInlineObjectElement(o)&&i.push(o),o;if(this.isDocumentFragment(e))o=new ni(this.document),t.bind&&this.bindDocumentFragments(e,o);else{o=this._createViewElement(e,t),t.bind&&this.bindElements(e,o);const a=e.attributes;if(a)for(let l=a.length,c=0;c<l;c++)o._setAttribute(a[c].name,a[c].value);if(this._isViewElementWithRawContent(o,t))return o._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(o)||i.push(o),o;if(Bn(e))return o._setCustomProperty("$rawContent",e.data),o}yield o;const r=[];if(t.withChildren!==!1)for(const a of this.domChildrenToView(e,t,r))o._appendChild(a);if(this._isInlineObjectElement(o))i.push(o);else for(const a of r)i.push(a)}}_processDomInlineNodes(e,t,i){if(!t.length||e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let s=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!r.is("$text")){s=!1;continue}let a,l=!1;if(OC(r,this.preElements))a=jc(r.data);else{a=r.data.replace(/[ \n\t\r]{1,}/g," "),l=/[^\S\u00A0]/.test(a.charAt(a.length-1));const c=o>0?t[o-1]:null,u=o+1<t.length?t[o+1]:null,d=!c||c.is("element")&&c.name=="br"||s,h=u?!1:!De(r.data);i.withChildren!==!1&&(d&&(a=a.replace(/^ /,"")),h&&(a=a.replace(/ $/,""))),a=jc(a),a=a.replace(/ \u00A0/g," ");const f=u&&u.is("element")&&u.name!="br",m=u&&u.is("$text")&&u.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(a)||!u||f||m)&&(a=a.replace(/\u00A0$/," ")),(d||c&&c.is("element")&&c.name!="br")&&(a=a.replace(/^\u00A0/," "))}a.length==0&&r.parent?(r._remove(),t.splice(o,1),o--):(r._data=a,s=l)}t.length=0}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(i=>this.preElements.includes(i.name)))return t;if(t.charAt(0)==" "){const i=this._getTouchingInlineViewNode(e,!1);(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i)||!i)&&(t=" "+t.substr(1))}if(t.charAt(t.length-1)==" "){const i=this._getTouchingInlineViewNode(e,!0),s=i&&i.is("$textProxy")&&i.data.charAt(0)==" ";(t.charAt(t.length-2)==" "||!i||s)&&(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(i=>this.preElements.includes(i.name)))return!1;const t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_getTouchingInlineViewNode(e,t){const i=new ei({startPosition:t?E._createAfter(e):E._createBefore(e),direction:t?"forward":"backward"});for(const s of i){if(s.item.is("element","br"))return null;if(this._isInlineObjectElement(s.item))return s.item;if(s.item.is("containerElement"))return null;if(s.item.is("$textProxy"))return s.item}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(Bn(e))return new Go(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new st(this.document,i)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const i=this._domDocument.createElement("span");if(i.setAttribute(Zc,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const s of t.getAttributeNames())i.setAttribute(s,t.getAttribute(s))}return i}}function OC(n,e){return n.getAncestors().some(t=>t.is("element")&&e.includes(t.name))}function Jc(n,e){let t=n;for(;t;)e(t),t=t.parentElement}function FC(n,e){return n.isEqualNode(MC)&&Rm(n,e)&&n.parentNode.childNodes.length===1}function Rm(n,e){const t=n.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Yc(n){n==="script"&&D("domconverter-unsafe-script-element-detected"),n==="style"&&D("domconverter-unsafe-style-element-detected")}function DC(n){if(!M.isGecko||!n.rangeCount)return!1;const e=n.getRangeAt(0).startContainer;try{Object.prototype.toString.call(e)}catch{return!0}return!1}/**
|
|
282
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
283
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
284
|
-
*/class wt extends qe(){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}/**
|
|
285
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
286
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
287
|
-
*/class Ji{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,df(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}/**
|
|
288
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
289
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
290
|
-
*/class zt extends wt{constructor(){super(...arguments),this.useCapture=!1}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(i=>{this.listenTo(e,i,(s,o)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(o.target)&&this.onDomEvent(o)},{useCapture:this.useCapture})})}stopObserving(e){this.stopListening(e)}fire(e,t,i){this.isEnabled&&this.document.fire(e,new Ji(this.view,t,i))}}/**
|
|
291
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
292
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
293
|
-
*/class NC extends zt{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Zi(this)}};this.fire(e.type,e,t)}}/**
|
|
294
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
295
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
296
|
-
*/class $C extends wt{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=ci(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new At(t.getRanges(),{backward:t.isBackward,fake:!1});(e==N.arrowleft||e==N.arrowup)&&i.setTo(i.getFirstPosition()),(e==N.arrowright||e==N.arrowdown)&&i.setTo(i.getLastPosition());const s={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",s),this._fireSelectionChangeDoneDebounced(s)}}/**
|
|
297
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
298
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
299
|
-
*/let Vm=class extends wt{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const t=this.domConverter,i=new Set,s=new Set;for(const r of e){const a=t.mapDomToView(r.target);a&&(a.is("uiElement")||a.is("rawElement")||r.type==="childList"&&!this._isBogusBrMutation(r)&&s.add(a))}for(const r of e){const a=t.mapDomToView(r.target);if(!(a&&(a.is("uiElement")||a.is("rawElement")))&&r.type==="characterData"){const l=t.findCorrespondingViewText(r.target);l&&!s.has(l.parent)?i.add(l):!l&&De(r.target)&&s.add(t.mapDomToView(r.target.parentNode))}}let o=!1;for(const r of i)o=!0,this.renderer.markToSync("text",r);for(const r of s){const a=t.mapViewToDom(r),l=Array.from(r.getChildren()),c=Array.from(t.domChildrenToView(a,{withChildren:!1}));Yk(l,c,HC)||(o=!0,this.renderer.markToSync("children",r))}o&&this.view.forceRender()}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}};function HC(n,e){if(!Array.isArray(n))return n===e?!0:n.is("$text")&&e.is("$text")?n.data===e.data:!1}/**
|
|
300
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
301
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
302
|
-
*/class wo extends zt{constructor(e){super(e),this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this.flush(),e.change(()=>{})},50)}),t.on("blur",(i,s)=>{const o=t.selection.editableElement;(o===null||o===s.target)&&(t.isFocused=!1,this._isFocusChanging=!1,e.change(()=>{}))})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}/**
|
|
303
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
304
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
305
|
-
*/class zC extends wt{constructor(e){super(e),this.mutationObserver=e.getObserver(Vm),this.focusObserver=e.getObserver(wo),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=ci(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=ci(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,i=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},s=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",i,{priority:"highest"}),this.listenTo(e,"keydown",s,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",s,{priority:"highest",useCapture:!0}),!this._documents.has(t)&&(this.listenTo(t,"mouseup",s,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(o,r)=>{this.document.isComposing&&!M.isAndroid||(this._handleSelectionChange(r,t),this._documentIsSelectingInactivityTimeoutDebounced())}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const i=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(i.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(i);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(i))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(this.selection.isSimilar(s))this.view.forceRender();else{const o={oldSelection:this.selection,newSelection:s,domSelection:i};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}/**
|
|
306
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
307
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
308
|
-
*/class UC extends zt{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
|
|
309
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
310
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
311
|
-
*/class Bm{constructor(e,t={}){this._files=t.cacheFiles?Qc(e):null,this._native=e}get files(){return this._files||(this._files=Qc(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 Qc(n){const e=Array.from(n.files||[]),t=Array.from(n.items||[]);return e.length?e:t.filter(i=>i.kind==="file").map(i=>i.getAsFile())}/**
|
|
312
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
313
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
314
|
-
*/class WC extends zt{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),i=this.view,s=i.document;let o=null,r=null,a=[];if(e.dataTransfer&&(o=new Bm(e.dataTransfer)),e.data!==null?r=e.data:o&&(r=o.getData("text/plain")),s.selection.isFake)a=Array.from(s.selection.getRanges());else if(t.length)a=t.map(l=>{const c=i.domConverter.domPositionToView(l.startContainer,l.startOffset),u=i.domConverter.domPositionToView(l.endContainer,l.endOffset);if(c)return i.createRange(c,u);if(u)return i.createRange(u)}).filter(l=>!!l);else if(M.isAndroid){const l=e.target.ownerDocument.defaultView.getSelection();a=Array.from(i.domConverter.domSelectionToView(l).getRanges())}if(M.isAndroid&&e.inputType=="insertCompositionText"&&r&&r.endsWith(`
|
|
315
|
-
`)){this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(a[0].end)]});return}if(e.inputType=="insertText"&&r&&r.includes(`
|
|
316
|
-
`)){const l=r.split(/\n{1,2}/g);let c=a;for(let u=0;u<l.length;u++){const d=l[u];d!=""&&(this.fire(e.type,e,{data:d,dataTransfer:o,targetRanges:c,inputType:e.inputType,isComposing:e.isComposing}),c=[s.selection.getFirstRange()]),u+1<l.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:c}),c=[s.selection.getFirstRange()])}return}this.fire(e.type,e,{data:r,dataTransfer:o,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}/**
|
|
317
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
318
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
319
|
-
*/class qC extends wt{constructor(e){super(e),this.document.on("keydown",(t,i)=>{if(this.isEnabled&&x2(i.keyCode)){const s=new cn(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(s,i),s.stop.called&&t.stop()}})}observe(){}stopObserving(){}}/**
|
|
320
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
321
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
322
|
-
*/class jC extends wt{constructor(e){super(e);const t=this.document;t.on("keydown",(i,s)=>{if(!this.isEnabled||s.keyCode!=N.tab||s.ctrlKey)return;const o=new cn(t,"tab",t.selection.getFirstRange());t.fire(o,s),o.stop.called&&i.stop()})}observe(){}stopObserving(){}}/**
|
|
323
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
324
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
325
|
-
*/let GC=class extends W(){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new Cm(e),this.domConverter=new Pm(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new TC(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Tm(this.document),this.addObserver(Vm),this.addObserver(wo),this.addObserver(zC),this.addObserver(NC),this.addObserver($C),this.addObserver(UC),this.addObserver(qC),this.addObserver(WC),this.addObserver(jC),CC(this),gC(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}),M.isiOS&&this.listenTo(this.document,"blur",(t,i)=>{this.domConverter.mapDomToView(i.domEvent.relatedTarget)||this.domConverter._clearDomSelection()})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const s={};for(const{name:r,value:a}of Array.from(e.attributes))s[r]=a,r==="class"?this._writer.addClass(a.split(" "),i):this._writer.setAttribute(r,a,i);this._initialDomRootAttributes.set(e,s);const o=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};o(),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,a)=>this._renderer.markToSync("children",a)),i.on("change:attributes",(r,a)=>this._renderer.markToSync("attributes",a)),i.on("change:text",(r,a)=>this._renderer.markToSync("text",a)),i.on("change:isReadOnly",()=>this.change(o)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const r of this._observers.values())r.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:s})=>t.removeAttribute(s));const i=this._initialDomRootAttributes.get(t);for(const s in i)t.setAttribute(s,i[s]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const s of this._observers.values())s.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[i,s]of this.domRoots)t.observe(s,i);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:i=20,ancestorOffset:s=20}={}){const o=this.document.selection.getFirstRange();if(!o)return;const r=Ye({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:s});typeof i=="number"&&(i={top:i,bottom:i,left:i,right:i});const a={target:this.domConverter.viewRangeToDom(o),viewportOffset:i,ancestorOffset:s,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",a,r),y2(a)}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new g("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(t){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(wo).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return E._createAt(e,t)}createPositionAfter(e){return E._createAfter(e)}createPositionBefore(e){return E._createBefore(e)}createRange(e,t){return new O(e,t)}createRangeOn(e){return O._createOn(e)}createRangeIn(e){return O._createIn(e)}createSelection(...e){return new At(...e)}_disableRendering(e){this._renderingDisabled=e,e==!1&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}};/**
|
|
326
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
327
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
328
|
-
*/class Ut{is(){throw new Error("is() method is abstract")}}/**
|
|
329
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
330
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
331
|
-
*/let _i=class extends Ut{constructor(e){super(),this.parent=null,this._attrs=pt(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))===null)throw new g("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if((e=this.parent.getChildStartOffset(this))===null)throw new g("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent===null?!1:this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),s=e.getAncestors(t);let o=0;for(;i[o]==s[o]&&i[o];)o++;return o===0?null:i[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),s=Te(t,i);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<i[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((t,i)=>(t[i[0]]=i[1],t),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=pt(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};_i.prototype.is=function(n){return n==="node"||n==="model:node"};/**
|
|
332
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
333
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
334
|
-
*/class Mn{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return t==-1?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return t===null?null:this._nodes.slice(0,t).reduce((i,s)=>i+s.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new g("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new g("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const i of t)if(!(i instanceof _i))throw new g("model-nodelist-insertnodes-not-node",this);this._nodes=z2(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}/**
|
|
335
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
336
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
337
|
-
*/class G extends _i{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new G(this.data,this.getAttributes())}static fromJSON(e){return new G(e.data,e.attributes)}}G.prototype.is=function(n){return n==="$text"||n==="model:$text"||n==="text"||n==="model:text"||n==="node"||n==="model:node"};/**
|
|
338
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
339
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
340
|
-
*/class it extends Ut{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new g("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new g("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return this.textNode.startOffset!==null?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset!==null?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}it.prototype.is=function(n){return n==="$textProxy"||n==="model:$textProxy"||n==="textProxy"||n==="model:textProxy"};/**
|
|
341
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
342
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
343
|
-
*/class q extends _i{constructor(e,t,i){super(t),this._children=new Mn,this.name=e,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(i=>i._clone(!0)):void 0;return new q(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=KC(t);for(const s of i)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const s of i)s.parent=null;return i}static fromJSON(e){let t;if(e.children){t=[];for(const i of e.children)i.name?t.push(q.fromJSON(i)):t.push(G.fromJSON(i))}return new q(e.name,e.attributes,t)}}q.prototype.is=function(n,e){return e?e===this.name&&(n==="element"||n==="model:element"):n==="element"||n==="model:element"||n==="node"||n==="model:node"};function KC(n){return typeof n=="string"?[new G(n)]:(Ue(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new G(e):e instanceof it?new G(e.data,e.getAttributes()):e))}/**
|
|
344
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
345
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
346
|
-
*/class Tt{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new g("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new g("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=y._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,o;do s=this.position,o=this._visitedParent,{done:t,value:i}=this.next();while(!t&&e(i));t||(this._position=s,this._visitedParent=o)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(i.parent===null&&t.offset===i.maxOffset)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const s=Ln(t,i),o=s||Mm(t,i,s);if(o instanceof q){if(!this.shallow)t.path.push(0),this._visitedParent=o;else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,qt("elementStart",o,e,t,1)}if(o instanceof G){let r;if(this.singleCharacters)r=1;else{let c=o.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),r=c-t.offset}const a=t.offset-o.startOffset,l=new it(o,a,r);return t.offset+=r,this._position=t,qt("text",l,e,t,r)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():qt("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(i.parent===null&&t.offset===0)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const s=t.parent,o=Ln(t,s),r=o||Lm(t,s,o);if(r instanceof q)return t.offset--,this.shallow?(this._position=t,qt("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this._position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():qt("elementEnd",r,e,t));if(r instanceof G){let a;if(this.singleCharacters)a=1;else{let u=r.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>u&&(u=this.boundaries.start.offset),a=t.offset-u}const l=t.offset-r.startOffset,c=new it(r,l-a,a);return t.offset-=a,this._position=t,qt("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,qt("elementStart",i,e,t,1)}}function qt(n,e,t,i,s){return{done:!1,value:{type:n,item:e,previousPosition:t,nextPosition:i,length:s}}}/**
|
|
347
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
348
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
349
|
-
*/class y extends Ut{constructor(e,t,i="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new g("model-position-root-invalid",e);if(!(t instanceof Array)||t.length===0)throw new g("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new g("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new g("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Ln(this,this.parent)}get nodeAfter(){const e=this.parent;return Mm(this,e,Ln(this,e))}get nodeBefore(){const e=this.parent;return Lm(this,e,Ln(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=Te(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new Tt(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=Te(this.path,e.path),i=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]==i[s]&&t[s];)s++;return s===0?null:t[s-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return this.compareWith(e)=="after"}isBefore(e){return this.compareWith(e)=="before"}isEqual(e){return this.compareWith(e)=="same"}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let i=0;i<t;i++){const s=this.path[i]-e.path[i];if(s<-1||s>1)return!1;if(s===1)return Xc(e,this,i);if(s===-1)return Xc(this,e,i)}return this.path.length===e.path.length?!0:this.path.length>e.path.length?ca(this.path,t):ca(e.path,t)}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),i=e.getParentPath();return Te(t,i)=="same"}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=y._createAt(this);break}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&this.stickiness=="toNext"?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange,i=t.containsPosition(this)||t.start.isEqual(this);let s;return i?(s=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(s=s._getTransformedByDeletion(e.deletionPosition,1))):this.isEqual(e.deletionPosition)?s=y._createAt(e.deletionPosition):s=this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),s}_getTransformedByDeletion(e,t){const i=y._createAt(this);if(this.root!=e.root)return i;if(Te(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if(Te(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;if(e.offset<=this.path[s]){if(e.offset+t>this.path[s])return null;i.path[s]-=t}}return i}_getTransformedByInsertion(e,t){const i=y._createAt(this);if(this.root!=e.root)return i;if(Te(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(i.offset+=t);else if(Te(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;e.offset<=this.path[s]&&(i.path[s]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return y._createAt(this);const s=this._getTransformedByDeletion(e,i);return s===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(i).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):s._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,s=y._createAt(t);return s.stickiness=this.stickiness,s.offset=s.offset+this.path[i]-e.offset,s.path=[...s.path,...this.path.slice(i+1)],s}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof y)return new y(e.root,e.path,e.stickiness);{const s=e;if(t=="end")t=s.maxOffset;else{if(t=="before")return this._createBefore(s,i);if(t=="after")return this._createAfter(s,i);if(t!==0&&!t)throw new g("model-createpositionat-offset-required",[this,e])}if(!s.is("element")&&!s.is("documentFragment"))throw new g("model-position-parent-incorrect",[this,e]);const o=s.getPath();return o.push(t),new this(s.root,o,i)}}static _createAfter(e,t){if(!e.parent)throw new g("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new g("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const i=new y(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new g("model-position-fromjson-no-root",t,{rootName:e.root});return new y(t.getRoot(e.root),e.path,e.stickiness)}}y.prototype.is=function(n){return n==="position"||n==="model:position"};function Ln(n,e){const t=e.getChild(e.offsetToIndex(n.offset));return t&&t.is("$text")&&t.startOffset<n.offset?t:null}function Mm(n,e,t){return t!==null?null:e.getChild(e.offsetToIndex(n.offset))}function Lm(n,e,t){return t!==null?null:e.getChild(e.offsetToIndex(n.offset)-1)}function Xc(n,e,t){return!(t+1===n.path.length||!ca(e.path,t+1)||!ZC(n,t+1))}function ca(n,e){for(;e<n.length;){if(n[e]!==0)return!1;e++}return!0}function ZC(n,e){let t=n.parent,i=n.path.length-1,s=0;for(;i>=e;){if(n.path[i]+s!==t.maxOffset)return!1;s=1,i--,t=t.parent}return!0}/**
|
|
350
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
351
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
352
|
-
*/class b extends Ut{constructor(e,t){super(),this.start=y._createAt(e),this.end=t?y._createAt(t):y._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new Tt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return Te(e,t)=="same"}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}containsItem(e){const t=y._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new b(this.start,e.start)),this.containsPosition(e.end)&&t.push(new b(e.end,this.end))):t.push(new b(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new b(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(this.start.isBefore(e.start)?i=t?this.end.isTouching(e.start):this.end.isEqual(e.start):i=t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let s=this.start,o=this.end;return e.start.isBefore(s)&&(s=e.start),e.end.isAfter(o)&&(o=e.end),new b(s,o)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=y._createAt(this.start);let s=i.parent;for(;i.path.length>t+1;){const o=s.maxOffset-i.offset;o!==0&&e.push(new b(i,i.getShiftedBy(o))),i.path=i.path.slice(0,-1),i.offset++,s=s.parent}for(;i.path.length<=this.end.path.length;){const o=this.end.path[i.path.length-1],r=o-i.offset;r!==0&&e.push(new b(i,i.getShiftedBy(r))),i.offset=o,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Tt(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Tt(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new Tt(e);yield t.position;for(const i of t)yield i.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new b(this.start,this.end)]}getTransformedByOperations(e){const t=[new b(this.start,this.end)];for(const i of e)for(let s=0;s<t.length;s++){const o=t[s].getTransformedByOperation(i);t.splice(s,1,...o),s+=o.length-1}for(let i=0;i<t.length;i++){const s=t[i];for(let o=i+1;o<t.length;o++){const r=t[o];(s.containsRange(r)||r.containsRange(s)||s.isEqual(r))&&t.splice(o,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,s=e.howMany,o=e.targetPosition;return this._getTransformedByMove(i,o,s,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new b(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new b(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=y._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new b(t,i)):new b(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new b(this.start,e),new b(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const s=new b(this.start,this.end);return s.start=s.start._getTransformedByInsertion(e,t),s.end=s.end._getTransformedByInsertion(e,t),[s]}}_getTransformedByMove(e,t,i,s=!1){if(this.isCollapsed){const d=this.start._getTransformedByMove(e,t,i);return[new b(d)]}const o=b._createFromPositionAndShift(e,i),r=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!s&&(o.containsPosition(this.start)||o.containsPosition(this.end))){const d=this.start._getTransformedByMove(e,t,i),h=this.end._getTransformedByMove(e,t,i);return[new b(d,h)]}let a;const l=this.getDifference(o);let c=null;const u=this.getIntersection(o);if(l.length==1?c=new b(l[0].start._getTransformedByDeletion(e,i),l[0].end._getTransformedByDeletion(e,i)):l.length==2&&(c=new b(this.start,this.end._getTransformedByDeletion(e,i))),c?a=c._getTransformedByInsertion(r,i,u!==null||s):a=[],u){const d=new b(u.start._getCombined(o.start,r),u.end._getCombined(o.start,r));a.length==2?a.splice(1,0,d):a.push(d)}return a}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),s=this.end._getTransformedByDeletion(e,t);return i==null&&s==null?null:(i==null&&(i=e),s==null&&(s=e),new b(i,s))}static _createFromPositionAndShift(e,t){const i=e,s=e.getShiftedBy(t);return t>0?new this(i,s):new this(s,i)}static _createIn(e){return new this(y._createAt(e,0),y._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(y._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new g("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((o,r)=>o.start.isAfter(r.start)?1:-1);const i=e.indexOf(t),s=new this(t.start,t.end);if(i>0)for(let o=i-1;e[o].end.isEqual(s.start);o++)s.start=y._createAt(e[o].start);for(let o=i+1;o<e.length&&e[o].start.isEqual(s.end);o++)s.end=y._createAt(e[o].end);return s}static fromJSON(e,t){return new this(y.fromJSON(e.start,t),y.fromJSON(e.end,t))}}b.prototype.is=function(n){return n==="range"||n==="model:range"};/**
|
|
353
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
354
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
355
|
-
*/class Om extends Z(){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new g("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),s=this._viewToModelMapping.get(i),o=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=y._createAt(s,o)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const s of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(s);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const s=this._elementToMarkerNames.get(e)||new Set;s.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,s)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),i.size==0&&this._markerNameToElements.delete(t));const s=this._elementToMarkerNames.get(e);s&&(s.delete(t),s.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new b(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new O(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const s of t)if(s.is("attributeElement"))for(const o of s.getElementsWithSameId())i.add(o);else i.add(s);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e){const o=this._toModelOffset(e.parent,e.index,i),r=this._toModelOffset(e,t,e);return o+r}if(e.is("$text"))return t;let s=0;for(let o=0;o<t;o++)s+=this.getModelLength(e.getChild(o));return s}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name))return this._viewToModelLengthCallbacks.get(e.name)(e);if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,s=0,o=0,r=0;if(e.is("$text"))return new E(e,t);for(;o<t;)i=e.getChild(r),s=this.getModelLength(i),o+=s,r++;return o==t?this._moveViewPositionToTextNode(new E(e,r)):this.findPositionIn(i,t-(o-s))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof ne?new E(t,t.data.length):i instanceof ne?new E(i,0):e}}/**
|
|
356
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
357
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
358
|
-
*/class JC{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Ps(t),e instanceof it&&(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=Ps(t),e instanceof it&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=Ps(t),e instanceof it&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(i===void 0)return null;const s=i.get(t);return s===void 0?null:s}revert(e,t){t=Ps(t),e instanceof it&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return i===!1?(this._consumable.get(e).set(t,!0),!0):i===!0?!1:null}verifyAllConsumed(e){const t=[];for(const[i,s]of this._consumable)for(const[o,r]of s){const a=o.split(":")[0];r&&e==a&&t.push({event:o,item:i.name||i.description})}if(t.length)throw new g("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const s=i.get(e.endOffset);s&&(t=s.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,i=e.endOffset,s=e.parent,o=Symbol("$textProxy:"+e.data);let r,a;return r=this._textProxyRegistry.get(t),r||(r=new Map,this._textProxyRegistry.set(t,r)),a=r.get(i),a||(a=new Map,r.set(i,a)),a.set(s,o),o}}function Ps(n){const e=n.split(":");return e[0]=="insert"?e[0]:e[0]=="addMarker"||e[0]=="removeMarker"?n:e.length>1?e[0]+":"+e[1]:e[0]}/**
|
|
359
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
360
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
361
|
-
*/class Fm extends Z(){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,i){const s=this._createConversionApi(i,e.getRefreshedItems());for(const r of e.getMarkersToRemove())this._convertMarkerRemove(r.name,r.range,s);const o=this._reduceChanges(e.getChanges());for(const r of o)r.type==="insert"?this._convertInsert(b._createFromPositionAndShift(r.position,r.length),s):r.type==="reinsert"?this._convertReinsert(b._createFromPositionAndShift(r.position,r.length),s):r.type==="remove"?this._convertRemove(r.position,r.length,r.name,s):this._convertAttribute(r.range,r.attributeKey,r.attributeOldValue,r.attributeNewValue,s);s.mapper.flushDeferredBindings();for(const r of s.mapper.flushUnboundMarkerNames()){const a=t.get(r).getRange();this._convertMarkerRemove(r,a,s),this._convertMarkerAdd(r,a,s)}for(const r of e.getMarkersToAdd())this._convertMarkerAdd(r.name,r.range,s);s.consumable.verifyAllConsumed("insert")}convert(e,t,i,s={}){const o=this._createConversionApi(i,void 0,s);this._convertInsert(e,o);for(const[r,a]of t)this._convertMarkerAdd(r,a,o);o.consumable.verifyAllConsumed("insert")}convertSelection(e,t,i){const s=this._createConversionApi(i);this.fire("cleanSelection",{selection:e},s);const o=e.getFirstPosition().root;if(!s.mapper.toViewElement(o))return;const r=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(s.consumable,e,r),this.fire("selection",{selection:e},s),!!e.isCollapsed){for(const a of r)if(s.consumable.test(e,"addMarker:"+a.name)){const l=a.getRange();if(!YC(e.getFirstPosition(),a,s.mapper))continue;const c={item:e,markerName:a.name,markerRange:l};this.fire(`addMarker:${a.name}`,c,s)}for(const a of e.getAttributeKeys())if(s.consumable.test(e,"attribute:"+a)){const l={item:e,range:e.getFirstRange(),attributeKey:a,attributeOldValue:null,attributeNewValue:e.getAttribute(a)};this.fire(`attribute:${a}:$text`,l,s)}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const s of Array.from(e.getWalker({shallow:!0})).map(eu))this._testAndFire("insert",s,t)}_convertRemove(e,t,i,s){this.fire(`remove:${i}`,{position:e,length:t},s)}_convertAttribute(e,t,i,s,o){this._addConsumablesForRange(o.consumable,e,`attribute:${t}`);for(const r of e){const a={item:r.item,range:b._createFromPositionAndShift(r.previousPosition,r.length),attributeKey:t,attributeOldValue:i,attributeNewValue:s};this._testAndFire(`attribute:${t}`,a,o)}}_convertReinsert(e,t){const i=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,i);for(const s of i.map(eu))this._testAndFire("insert",{...s,reconversion:!0},t)}_convertMarkerAdd(e,t,i){if(t.root.rootName=="$graveyard")return;const s=`addMarker:${e}`;if(i.consumable.add(t,s),this.fire(s,{markerName:e,markerRange:t},i),!!i.consumable.consume(t,s)){this._addConsumablesForRange(i.consumable,t,s);for(const o of t.getItems()){if(!i.consumable.test(o,s))continue;const r={item:o,range:b._createOn(o),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){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const i of t){const s=i.item;if(e.test(s,"insert")===null){e.add(s,"insert");for(const o of s.getAttributeKeys())e.add(s,"attribute:"+o)}}return e}_addConsumablesForRange(e,t,i){for(const s of t.getItems())e.add(s,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(const s of i)e.add(t,"addMarker:"+s.name);for(const s of t.getAttributeKeys())e.add(t,"attribute:"+s);return e}_testAndFire(e,t,i){const s=QC(e,t),o=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,r=this._firedEventsMap.get(i),a=r.get(o);if(!a)r.set(o,new Set([s]));else if(!a.has(s))a.add(s);else return;this.fire(s,t,i)}_testAndFireAddAttributes(e,t){const i={item:e,range:b._createOn(e)};for(const s of i.item.getAttributeKeys())i.attributeKey=s,i.attributeOldValue=null,i.attributeNewValue=i.item.getAttribute(s),this._testAndFire(`attribute:${s}`,i,t)}_createConversionApi(e,t=new Set,i={}){const s={...this._conversionApi,consumable:new JC,writer:e,options:i,convertItem:o=>this._convertInsert(b._createOn(o),s),convertChildren:o=>this._convertInsert(b._createIn(o),s,{doNotAddConsumables:!0}),convertAttributes:o=>this._testAndFireAddAttributes(o,s),canReuseView:o=>!t.has(s.mapper.toModelElement(o))};return this._firedEventsMap.set(s,new Map),s}}function YC(n,e,t){const i=e.getRange(),s=Array.from(n.getAncestors());return s.shift(),s.reverse(),!s.some(r=>{if(i.containsItem(r))return!!t.toViewElement(r).getCustomProperty("addHighlight")})}function QC(n,e){const t=e.item.is("element")?e.item.name:"$text";return`${n}:${t}`}function eu(n){const e=n.item,t=b._createFromPositionAndShift(n.previousPosition,n.length);return{item:e,range:t}}/**
|
|
362
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
363
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
364
|
-
*/class Ne extends Z(Ut){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return this._ranges.length===1?this._ranges[0].isCollapsed:!1}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const s of e._ranges)if(t.isEqual(s)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new b(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?new b(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?new b(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,i,s]=e;if(typeof i=="object"&&(s=i,i=void 0),t===null)this._setRanges([]);else if(t instanceof Ne)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof b)this._setRanges([t],!!s&&!!s.backward);else if(t instanceof y)this._setRanges([new b(t)]);else if(t instanceof _i){const o=!!s&&!!s.backward;let r;if(i=="in")r=b._createIn(t);else if(i=="on")r=b._createOn(t);else if(i!==void 0)r=new b(y._createAt(t,i));else throw new g("model-selection-setto-required-second-parameter",[this,t]);this._setRanges([r],o)}else if(Ue(t))this._setRanges(t,s&&!!s.backward);else throw new g("model-selection-setto-not-selectable",[this,t])}_setRanges(e,t=!1){const i=Array.from(e),s=i.some(o=>{if(!(o instanceof b))throw new g("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(r=>!r.isEqual(o))});i.length===this._ranges.length&&!s||(this._replaceAllRanges(i),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new g("model-selection-setfocus-no-ranges",[this,e]);const i=y._createAt(e,t);if(i.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.length&&this._popRange(),i.compareWith(s)=="before"?(this._pushRange(new b(i,s)),this._lastRangeBackward=!0):(this._pushRange(new b(s,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=tu(t.start,e);e5(i,t)&&(yield i);for(const o of t.getWalker()){const r=o.item;o.type=="elementEnd"&&XC(r,e,t)&&(yield r)}const s=tu(t.end,e);t5(s,t)&&(yield s)}}containsEntireContent(e=this.anchor.root){const t=y._createAt(e,0),i=y._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new b(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new g("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}Ne.prototype.is=function(n){return n==="selection"||n==="model:selection"};function Dm(n,e){return e.has(n)?!1:(e.add(n),n.root.document.model.schema.isBlock(n)&&!!n.parent)}function XC(n,e,t){return Dm(n,e)&&fl(n,t)}function tu(n,e){const i=n.parent.root.document.model.schema,s=n.parent.getAncestors({parentFirst:!0,includeSelf:!0});let o=!1;const r=s.find(a=>o?!1:(o=i.isLimit(a),!o&&Dm(a,e)));return s.forEach(a=>e.add(a)),r}function fl(n,e){const t=i5(n);return t?!e.containsRange(b._createOn(t),!0):!0}function e5(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.start.isTouching(y._createAt(n,n.maxOffset))?!1:fl(n,e):!1}function t5(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.end.isTouching(y._createAt(n,0))?!1:fl(n,e):!1}function i5(n){const e=n.root.document.model.schema;let t=n.parent;for(;t;){if(e.isBlock(t))return t;t=t.parent}}/**
|
|
365
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
366
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
367
|
-
*/class He extends Z(b){constructor(e,t){super(e,t),n5.call(this)}detach(){this.stopListening()}toRange(){return new b(this.start,this.end)}static fromRange(e){return new He(e.start,e.end)}}He.prototype.is=function(n){return n==="liveRange"||n==="model:liveRange"||n=="range"||n==="model:range"};function n5(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&s5.call(this,t)},{priority:"low"})}function s5(n){const e=this.getTransformedByOperation(n),t=b._createFromRanges(e),i=!t.isEqual(this),s=o5(this,n);let o=null;if(i){t.root.rootName=="$graveyard"&&(n.type=="remove"?o=n.sourcePosition:o=n.deletionPosition);const r=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",r,{deletionPosition:o})}else s&&this.fire("change:content",this.toRange(),{deletionPosition:o})}function o5(n,e){switch(e.type){case"insert":return n.containsPosition(e.position);case"move":case"remove":case"reinsert":case"merge":return n.containsPosition(e.sourcePosition)||n.start.isEqual(e.sourcePosition)||n.containsPosition(e.targetPosition);case"split":return n.containsPosition(e.splitPosition)||n.containsPosition(e.insertionPosition)}return!1}/**
|
|
368
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
369
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
370
|
-
*/const Kn="selection:";class ot extends Z(Ut){constructor(e){super(),this._selection=new r5(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Kn+e}static _isStoreAttributeKey(e){return e.startsWith(Kn)}}ot.prototype.is=function(n){return n==="selection"||n=="model:selection"||n=="documentSelection"||n=="model:documentSelection"};class r5 extends Ne{constructor(e){super(),this.markers=new Ce({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,i)=>{const s=i[0];!s.isDocumentOperation||s.type=="marker"||s.type=="rename"||s.type=="noop"||(this._ranges.length==0&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,i,s,o)=>{this._updateMarker(i,o)}),this.listenTo(this._document,"change",(t,i)=>{a5(this._model,i)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const i=[e];this.fire("change:attribute",{attributeKeys:i,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=Ke();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new g("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new g("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=He.fromRange(e);return t.on("change:range",(i,s,o)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const r=this._ranges.indexOf(t);this._ranges.splice(r,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const s of this._model.markers){const o=s.name.split(":",1)[0];if(!this._observedMarkers.has(o))continue;const r=s.getRange();for(const a of this.getRanges())r.containsRange(a,!a.isCollapsed)&&e.push(s)}const i=Array.from(this.markers);for(const s of e)this.markers.has(s)||(this.markers.add(s),t=!0);for(const s of Array.from(this.markers))e.includes(s)||(this.markers.remove(s),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let s=!1;const o=Array.from(this.markers),r=this.markers.has(e);if(!t)r&&(this.markers.remove(e),s=!0);else{let a=!1;for(const l of this.getRanges())if(t.containsRange(l,!l.isCollapsed)){a=!0;break}a&&!r?(this.markers.add(e),s=!0):!a&&r&&(this.markers.remove(e),s=!0)}s&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=pt(this._getSurroundingAttributes()),i=pt(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[o,r]of this._attributePriority)r=="low"&&(this._attrs.delete(o),this._attributePriority.delete(o));this._setAttributesTo(t);const s=[];for(const[o,r]of this.getAttributes())(!i.has(o)||i.get(o)!==r)&&s.push(o);for(const[o]of i)this.hasAttribute(o)||s.push(o);s.length>0&&this.fire("change:attribute",{attributeKeys:s,directChange:!1})}_setAttribute(e,t,i=!0){const s=i?"normal":"low";return s=="low"&&this._attributePriority.get(e)=="normal"||super.getAttribute(e)===t?!1:(this._attrs.set(e,t),this._attributePriority.set(e,s),!0)}_removeAttribute(e,t=!0){const i=t?"normal":"low";return i=="low"&&this._attributePriority.get(e)=="normal"||(this._attributePriority.set(e,i),!super.hasAttribute(e))?!1:(this._attrs.delete(e),!0)}_setAttributesTo(e){const t=new Set;for(const[i,s]of this.getAttributes())e.get(i)!==s&&this._removeAttribute(i,!1);for(const[i,s]of e)this._setAttribute(i,s,!1)&&t.add(i);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(Kn)&&(yield[t.substr(Kn.length),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if(e.root.rootName=="$graveyard")return null;let i=null;if(this.isCollapsed){const s=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=bn(s,t)),i||(i=bn(o,t)),!this.isGravityOverridden&&!i){let r=s;for(;r&&!i;)r=r.previousSibling,i=bn(r,t)}if(!i){let r=o;for(;r&&!i;)r=r.nextSibling,i=bn(r,t)}i||(i=this.getStoredAttributes())}else{const s=this.getFirstRange();for(const o of s){if(o.item.is("element")&&t.isObject(o.item)){i=bn(o.item,t);break}if(o.type=="text"){i=o.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function bn(n,e){if(!n)return null;if(n instanceof it||n instanceof G)return n.getAttributes();if(!e.isInline(n))return null;if(!e.isObject(n))return[];const t=[];for(const[i,s]of n.getAttributes())e.checkAttribute("$text",i)&&e.getAttributeProperties(i).copyFromObject!==!1&&t.push([i,s]);return t}function a5(n,e){const t=n.document.differ;for(const i of t.getChanges()){if(i.type!="insert")continue;const s=i.position.parent;i.length===s.maxOffset&&n.enqueueChange(e,r=>{const a=Array.from(s.getAttributeKeys()).filter(l=>l.startsWith(Kn));for(const l of a)r.removeAttribute(l,s)})}}/**
|
|
371
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
372
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
373
|
-
*/class Nm{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}/**
|
|
374
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
375
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
376
|
-
*/class l5 extends Nm{elementToElement(e){return this.add(A5(e))}elementToStructure(e){return this.add(S5(e))}attributeToElement(e){return this.add(x5(e))}attributeToAttribute(e){return this.add(I5(e))}markerToElement(e){return this.add(P5(e))}markerToHighlight(e){return this.add(V5(e))}markerToData(e){return this.add(R5(e))}}function $m(){return(n,e,t)=>{if(!t.consumable.consume(e.item,n.name))return;const i=t.writer,s=t.mapper.toViewPosition(e.range.start),o=i.createText(e.item.data);i.insert(s,o)}}function Hm(){return(n,e,t)=>{t.convertAttributes(e.item),!e.reconversion&&e.item.is("element")&&!e.item.isEmpty&&t.convertChildren(e.item)}}function c5(){return(n,e,t)=>{const i=t.mapper.toViewPosition(e.position),s=e.position.getShiftedBy(e.length),o=t.mapper.toViewPosition(s,{isPhantom:!0}),r=t.writer.createRange(i,o),a=t.writer.remove(r.getTrimmed());for(const l of t.writer.createRangeIn(a).getItems())t.mapper.unbindViewElement(l,{defer:!0})}}function zm(n,e){const t=n.createAttributeElement("span",e.attributes);return e.classes&&t._addClass(e.classes),typeof e.priority=="number"&&(t._priority=e.priority),t._id=e.id,t}function u5(){return(n,e,t)=>{const i=e.selection;if(i.isCollapsed||!t.consumable.consume(i,"selection"))return;const s=[];for(const o of i.getRanges())s.push(t.mapper.toViewRange(o));t.writer.setSelection(s,{backward:i.isBackward})}}function d5(){return(n,e,t)=>{const i=e.selection;if(!i.isCollapsed||!t.consumable.consume(i,"selection"))return;const s=t.writer,o=i.getFirstPosition(),r=t.mapper.toViewPosition(o),a=s.breakAttributes(r);s.setSelection(a)}}function h5(){return(n,e,t)=>{const i=t.writer,s=i.document.selection;for(const o of s.getRanges())o.isCollapsed&&o.end.parent.isAttached()&&t.writer.mergeAttributes(o.start);i.setSelection(null)}}function f5(n){return(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n(t.attributeOldValue,i,t),o=n(t.attributeNewValue,i,t);if(!s&&!o)return;i.consumable.consume(t.item,e.name);const r=i.writer,a=r.document.selection;if(t.item instanceof Ne||t.item instanceof ot)r.wrap(a.getFirstRange(),o);else{let l=i.mapper.toViewRange(t.range);t.attributeOldValue!==null&&s&&(l=r.unwrap(l,s)),t.attributeNewValue!==null&&o&&r.wrap(l,o)}}}function m5(n,e=N5){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const o=n(i.item,s,i);if(!o)return;e(i.item,s.consumable);const r=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,o),s.writer.insert(r,o),s.convertAttributes(i.item),Gm(o,i.item.getChildren(),s,{reconversion:i.reconversion})}}function g5(n,e){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const o=new Map;s.writer._registerSlotFactory(L5(i.item,o,s));const r=n(i.item,s,i);if(s.writer._clearSlotFactory(),!r)return;O5(i.item,o,s),e(i.item,s.consumable);const a=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,r),s.writer.insert(a,r),s.convertAttributes(i.item),F5(r,o,s,{reconversion:i.reconversion})}}function p5(n){return(e,t,i)=>{t.isOpening=!0;const s=n(t,i);t.isOpening=!1;const o=n(t,i);if(!s||!o)return;const r=t.markerRange;if(r.isCollapsed&&!i.consumable.consume(r,e.name))return;for(const c of r)if(!i.consumable.consume(c.item,e.name))return;const a=i.mapper,l=i.writer;l.insert(a.toViewPosition(r.start),s),i.mapper.bindElementToMarker(s,t.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),o),i.mapper.bindElementToMarker(o,t.markerName)),e.stop()}}function w5(){return(n,e,t)=>{const i=t.mapper.markerNameToElements(e.markerName);if(i){for(const s of i)t.mapper.unbindElementFromMarkerName(s,e.markerName),t.writer.clear(t.writer.createRangeOn(s),s);t.writer.clearClonedElementsGroup(e.markerName),n.stop()}}}function b5(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const o=t.markerRange;i.consumable.consume(o,e.name)&&(iu(o,!1,i,t,s),iu(o,!0,i,t,s),e.stop())}}function iu(n,e,t,i,s){const o=e?n.start:n.end,r=o.nodeAfter&&o.nodeAfter.is("element")?o.nodeAfter:null,a=o.nodeBefore&&o.nodeBefore.is("element")?o.nodeBefore:null;if(r||a){let c,u;e&&r||!e&&!a?(c=r,u=!0):(c=a,u=!1);const d=t.mapper.toViewElement(c);if(d){_5(d,e,u,t,i,s);return}}const l=t.mapper.toViewPosition(o);v5(l,e,t,i,s)}function _5(n,e,t,i,s,o){const r=`data-${o.group}-${e?"start":"end"}-${t?"before":"after"}`,a=n.hasAttribute(r)?n.getAttribute(r).split(","):[];a.unshift(o.name),i.writer.setAttribute(r,a.join(","),n),i.mapper.bindElementToMarker(n,s.markerName)}function v5(n,e,t,i,s){const o=`${s.group}-${e?"start":"end"}`,r=s.name?{name:s.name}:null,a=t.writer.createUIElement(o,r);t.writer.insert(n,a),t.mapper.bindElementToMarker(a,i.markerName)}function y5(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const o=i.mapper.markerNameToElements(t.markerName);if(!o)return;for(const a of o)i.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("containerElement")?(r(`data-${s.group}-start-before`,a),r(`data-${s.group}-start-after`,a),r(`data-${s.group}-end-before`,a),r(`data-${s.group}-end-after`,a)):i.writer.clear(i.writer.createRangeOn(a),a);i.writer.clearClonedElementsGroup(t.markerName),e.stop();function r(a,l){if(l.hasAttribute(a)){const c=new Set(l.getAttribute(a).split(","));c.delete(s.name),c.size==0?i.writer.removeAttribute(a,l):i.writer.setAttribute(a,Array.from(c).join(","),l)}}}}function k5(n){return(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n(t.attributeOldValue,i,t),o=n(t.attributeNewValue,i,t);if(!s&&!o)return;i.consumable.consume(t.item,e.name);const r=i.mapper.toViewElement(t.item),a=i.writer;if(!r)throw new g("conversion-attribute-to-attribute-on-text",i.dispatcher,t);if(t.attributeOldValue!==null&&s)if(s.key=="class"){const l=typeof s.value=="string"?s.value.split(/\s+/):s.value;for(const c of l)a.removeClass(c,r)}else if(s.key=="style")if(typeof s.value=="string"){const l=new po(a.document.stylesProcessor);l.setTo(s.value);for(const[c]of l.getStylesEntries())a.removeStyle(c,r)}else{const l=Object.keys(s.value);for(const c of l)a.removeStyle(c,r)}else a.removeAttribute(s.key,r);if(t.attributeNewValue!==null&&o)if(o.key=="class"){const l=typeof o.value=="string"?o.value.split(/\s+/):o.value;for(const c of l)a.addClass(c,r)}else if(o.key=="style")if(typeof o.value=="string"){const l=new po(a.document.stylesProcessor);l.setTo(o.value);for(const[c,u]of l.getStylesEntries())a.setStyle(c,u,r)}else{const l=Object.keys(o.value);for(const c of l)a.setStyle(c,o.value[c],r)}else a.setAttribute(o.key,o.value,r)}}function C5(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof Ne||t.item instanceof ot)&&!t.item.is("$textProxy"))return;const s=ml(n,t,i);if(!s||!i.consumable.consume(t.item,e.name))return;const o=i.writer,r=zm(o,s),a=o.document.selection;if(t.item instanceof Ne||t.item instanceof ot)o.wrap(a.getFirstRange(),r);else{const l=i.mapper.toViewRange(t.range),c=o.wrap(l,r);for(const u of c.getItems())if(u.is("attributeElement")&&u.isSimilar(r)){i.mapper.bindElementToMarker(u,t.markerName);break}}}}function E5(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof q))return;const s=ml(n,t,i);if(!s||!i.consumable.test(t.item,e.name))return;const o=i.mapper.toViewElement(t.item);if(o&&o.getCustomProperty("addHighlight")){i.consumable.consume(t.item,e.name);for(const a of b._createIn(t.item))i.consumable.consume(a.item,e.name);o.getCustomProperty("addHighlight")(o,s,i.writer),i.mapper.bindElementToMarker(o,t.markerName)}}}function T5(n){return(e,t,i)=>{if(t.markerRange.isCollapsed)return;const s=ml(n,t,i);if(!s)return;const o=zm(i.writer,s),r=i.mapper.markerNameToElements(t.markerName);if(r){for(const a of r)i.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("attributeElement")?i.writer.unwrap(i.writer.createRangeOn(a),o):a.getCustomProperty("removeHighlight")(a,s.id,i.writer);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}}function A5(n){const e=Um(n.model),t=Zn(n.view,"container");return e.attributes.length&&(e.children=!0),i=>{i.on(`insert:${e.name}`,m5(t,jm(e)),{priority:n.converterPriority||"normal"}),(e.children||e.attributes.length)&&i.on("reduceChanges",qm(e),{priority:"low"})}}function S5(n){const e=Um(n.model),t=Zn(n.view,"container");return e.children=!0,i=>{if(i._conversionApi.schema.checkChild(e.name,"$text"))throw new g("conversion-element-to-structure-disallowed-text",i,{elementName:e.name});i.on(`insert:${e.name}`,g5(t,jm(e)),{priority:n.converterPriority||"normal"}),i.on("reduceChanges",qm(e),{priority:"low"})}}function x5(n){n=Ye(n);let e=n.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)n.view[s]=Zn(n.view[s],"attribute");else n.view=Zn(n.view,"attribute");const i=Wm(n);return s=>{s.on(t,f5(i),{priority:n.converterPriority||"normal"})}}function I5(n){n=Ye(n);let e=n.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)n.view[s]=nu(n.view[s]);else n.view=nu(n.view);const i=Wm(n);return s=>{s.on(t,k5(i),{priority:n.converterPriority||"normal"})}}function P5(n){const e=Zn(n.view,"ui");return t=>{t.on(`addMarker:${n.model}`,p5(e),{priority:n.converterPriority||"normal"}),t.on(`removeMarker:${n.model}`,w5(),{priority:n.converterPriority||"normal"})}}function R5(n){n=Ye(n);const e=n.model;let t=n.view;return t||(t=i=>({group:e,name:i.substr(n.model.length+1)})),i=>{i.on(`addMarker:${e}`,b5(t),{priority:n.converterPriority||"normal"}),i.on(`removeMarker:${e}`,y5(t),{priority:n.converterPriority||"normal"})}}function V5(n){return e=>{e.on(`addMarker:${n.model}`,C5(n.view),{priority:n.converterPriority||"normal"}),e.on(`addMarker:${n.model}`,E5(n.view),{priority:n.converterPriority||"normal"}),e.on(`removeMarker:${n.model}`,T5(n.view),{priority:n.converterPriority||"normal"})}}function Um(n){return typeof n=="string"&&(n={name:n}),{name:n.name,attributes:n.attributes?z(n.attributes):[],children:!!n.children}}function Zn(n,e){return typeof n=="function"?n:(t,i)=>B5(n,i,e)}function B5(n,e,t){typeof n=="string"&&(n={name:n});let i;const s=e.writer,o=Object.assign({},n.attributes);if(t=="container")i=s.createContainerElement(n.name,o);else if(t=="attribute"){const r={priority:n.priority||ii.DEFAULT_PRIORITY};i=s.createAttributeElement(n.name,o,r)}else i=s.createUIElement(n.name,o);if(n.styles){const r=Object.keys(n.styles);for(const a of r)s.setStyle(a,n.styles[a],i)}if(n.classes){const r=n.classes;if(typeof r=="string")s.addClass(r,i);else for(const a of r)s.addClass(a,i)}return i}function Wm(n){return n.model.values?(e,t,i)=>{const s=n.view[e];return s?s(e,t,i):null}:n.view}function nu(n){return typeof n=="string"?e=>({key:n,value:e}):typeof n=="object"?n.value?()=>n:e=>({key:n.key,value:e}):n}function ml(n,e,t){const i=typeof n=="function"?n(e,t):n;return i?(i.priority||(i.priority=10),i.id||(i.id=e.markerName),i):null}function M5(n){return(e,t)=>{if(!e.is("element",n.name))return!1;if(t.type=="attribute"){if(n.attributes.includes(t.attributeKey))return!0}else{/* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */if(n.children)return!0}return!1}}function qm(n){const e=M5(n);return(t,i)=>{const s=[];i.reconvertedElements||(i.reconvertedElements=new Set);for(const o of i.changes){const r=o.type=="attribute"?o.range.start.nodeAfter:o.position.parent;if(!r||!e(r,o)){s.push(o);continue}if(!i.reconvertedElements.has(r)){i.reconvertedElements.add(r);const a=y._createBefore(r);let l=s.length;for(let c=s.length-1;c>=0;c--){const u=s[c],h=(u.type=="attribute"?u.range.start:u.position).compareWith(a);if(h=="before"||u.type=="remove"&&h=="same")break;l=c}s.splice(l,0,{type:"remove",name:r.name,position:a,length:1},{type:"reinsert",name:r.name,position:a,length:1})}}i.changes=s}}function jm(n){return(e,t,i={})=>{const s=["insert"];for(const o of n.attributes)e.hasAttribute(o)&&s.push(`attribute:${o}`);return s.every(o=>t.test(e,o))?(i.preflight||s.forEach(o=>t.consume(e,o)),!0):!1}}function L5(n,e,t){return(i,s)=>{const o=i.createContainerElement("$slot");let r=null;if(s==="children")r=Array.from(n.getChildren());else if(typeof s=="function")r=Array.from(n.getChildren()).filter(a=>s(a));else throw new g("conversion-slot-mode-unknown",t.dispatcher,{modeOrFilter:s});return e.set(o,r),o}}function O5(n,e,t){const i=Array.from(e.values()).flat(),s=new Set(i);if(s.size!=i.length)throw new g("conversion-slot-filter-overlap",t.dispatcher,{element:n});if(s.size!=n.childCount)throw new g("conversion-slot-filter-incomplete",t.dispatcher,{element:n})}function F5(n,e,t,i){t.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of e)Gm(n,o,t,i),t.writer.move(t.writer.createRangeIn(s),t.writer.createPositionBefore(s)),t.writer.remove(s);t.mapper.off("modelToViewPosition",r);function r(a,l){const c=l.modelPosition.nodeAfter,u=o.indexOf(c);u<0||(l.viewPosition=l.mapper.findPositionIn(s,u))}}function Gm(n,e,t,i){for(const s of e)D5(n.root,s,t,i)||t.convertItem(s)}function D5(n,e,t,i){const{writer:s,mapper:o}=t;if(!i.reconversion)return!1;const r=o.toViewElement(e);return!r||r.root==n||!t.canReuseView(r)?!1:(s.move(s.createRangeOn(r),o.toViewPosition(y._createBefore(e))),!0)}function N5(n,e,{preflight:t}={}){return t?e.test(n,"insert"):e.consume(n,"insert")}/**
|
|
377
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
378
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
379
|
-
*/function Km(n){const{schema:e,document:t}=n.model;for(const i of t.getRoots())if(i.isEmpty&&!e.checkChild(i,"$text")&&e.checkChild(i,"paragraph"))return n.insertElement("paragraph",i),!0;return!1}function Zm(n,e,t){const i=t.createContext(n);return!(!t.checkChild(i,"paragraph")||!t.checkChild(i.push("paragraph"),e))}function Jm(n,e){const t=e.createElement("paragraph");return e.insert(t,n),e.createPositionAt(t,0)}/**
|
|
380
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
381
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
382
|
-
*/class $5 extends Nm{elementToElement(e){return this.add(Ym(e))}elementToAttribute(e){return this.add(U5(e))}attributeToAttribute(e){return this.add(W5(e))}elementToMarker(e){return this.add(q5(e))}dataToMarker(e){return this.add(j5(e))}}function su(){return(n,e,t)=>{if(!e.modelRange&&t.consumable.consume(e.viewItem,{name:!0})){const{modelRange:i,modelCursor:s}=t.convertChildren(e.viewItem,e.modelCursor);e.modelRange=i,e.modelCursor=s}}}function H5(){return(n,e,{schema:t,consumable:i,writer:s})=>{let o=e.modelCursor;if(!i.test(e.viewItem))return;if(!t.checkChild(o,"$text")){if(!Zm(o,"$text",t)||e.viewItem.data.trim().length==0)return;const a=o.nodeBefore;o=Jm(o,s),a&&a.is("element","$marker")&&(s.move(s.createRangeOn(a),o),o=s.createPositionAfter(a))}i.consume(e.viewItem);const r=s.createText(e.viewItem.data);s.insert(r,o),e.modelRange=s.createRange(o,o.getShiftedBy(r.offsetSize)),e.modelCursor=e.modelRange.end}}function z5(n,e){return(t,i)=>{const s=i.newSelection,o=[];for(const a of s.getRanges())o.push(e.toModelRange(a));const r=n.createSelection(o,{backward:s.isBackward});r.isEqual(n.document.selection)||n.change(a=>{a.setSelection(r)})}}function Ym(n){n=Ye(n);const e=ua(n),t=gl(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"normal"})}}function U5(n){n=Ye(n),Qm(n);const e=Xm(n,!1),t=gl(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"low"})}}function W5(n){n=Ye(n);let e=null;(typeof n.view=="string"||n.view.key)&&(e=Z5(n)),Qm(n,e);const t=Xm(n,!0);return i=>{i.on("element",t,{priority:n.converterPriority||"low"})}}function q5(n){const e=Q5(n.model);return Ym({...n,model:e})}function j5(n){n=Ye(n),n.model||(n.model=s=>s?n.view+":"+s:n.view);const e={view:n.view,model:n.model},t=ua(ou(e,"start")),i=ua(ou(e,"end"));return s=>{s.on(`element:${n.view}-start`,t,{priority:n.converterPriority||"normal"}),s.on(`element:${n.view}-end`,i,{priority:n.converterPriority||"normal"});const o=$e.low,r=$e.highest,a=$e.get(n.converterPriority)/r;s.on("element",G5(e),{priority:o+a})}}function G5(n){return(e,t,i)=>{const s=`data-${n.view}`;if(!i.consumable.test(t.viewItem,{attributes:s+"-end-after"})&&!i.consumable.test(t.viewItem,{attributes:s+"-start-after"})&&!i.consumable.test(t.viewItem,{attributes:s+"-end-before"})&&!i.consumable.test(t.viewItem,{attributes:s+"-start-before"}))return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor)),i.consumable.consume(t.viewItem,{attributes:s+"-end-after"})&&o(t.modelRange.end,t.viewItem.getAttribute(s+"-end-after").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-start-after"})&&o(t.modelRange.end,t.viewItem.getAttribute(s+"-start-after").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-end-before"})&&o(t.modelRange.start,t.viewItem.getAttribute(s+"-end-before").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-start-before"})&&o(t.modelRange.start,t.viewItem.getAttribute(s+"-start-before").split(","));function o(r,a){for(const l of a){const c=n.model(l,i),u=i.writer.createElement("$marker",{"data-name":c});i.writer.insert(u,r),t.modelCursor.isEqual(r)?t.modelCursor=t.modelCursor.getShiftedBy(1):t.modelCursor=t.modelCursor._getTransformedByInsertion(r,1),t.modelRange=t.modelRange._getTransformedByInsertion(r,1)[0]}}}}function gl(n){return typeof n=="string"?n:typeof n=="object"&&typeof n.name=="string"?n.name:null}function ua(n){const e=new Nt(n.view);return(t,i,s)=>{const o=e.match(i.viewItem);if(!o)return;const r=o.match;if(r.name=!0,!s.consumable.test(i.viewItem,r))return;const a=K5(n.model,i.viewItem,s);a&&s.safeInsert(a,i.modelCursor)&&(s.consumable.consume(i.viewItem,r),s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i))}}function K5(n,e,t){return n instanceof Function?n(e,t):t.writer.createElement(n)}function Z5(n){typeof n.view=="string"&&(n.view={key:n.view});const e=n.view.key,t=typeof n.view.value>"u"?/[\s\S]*/:n.view.value;let i;return e=="class"||e=="style"?i={[e=="class"?"classes":"styles"]:t}:i={attributes:{[e]:t}},n.view.name&&(i.name=n.view.name),n.view=i,e}function Qm(n,e=null){const t=e===null?!0:o=>o.getAttribute(e),i=typeof n.model!="object"?n.model:n.model.key,s=typeof n.model!="object"||typeof n.model.value>"u"?t:n.model.value;n.model={key:i,value:s}}function Xm(n,e){const t=new Nt(n.view);return(i,s,o)=>{if(!s.modelRange&&e)return;const r=t.match(s.viewItem);if(!r||(J5(n.view,s.viewItem)?r.match.name=!0:delete r.match.name,!o.consumable.test(s.viewItem,r.match)))return;const a=n.model.key,l=typeof n.model.value=="function"?n.model.value(s.viewItem,o):n.model.value;if(l===null)return;s.modelRange||Object.assign(s,o.convertChildren(s.viewItem,s.modelCursor)),Y5(s.modelRange,{key:a,value:l},e,o)&&(o.consumable.test(s.viewItem,{name:!0})&&(r.match.name=!0),o.consumable.consume(s.viewItem,r.match))}}function J5(n,e){const t=typeof n=="function"?n(e):n;return typeof t=="object"&&!gl(t)?!1:!t.classes&&!t.attributes&&!t.styles}function Y5(n,e,t,i){let s=!1;for(const o of Array.from(n.getItems({shallow:t})))i.schema.checkAttribute(o,e.key)&&(s=!0,!o.hasAttribute(e.key)&&i.writer.setAttribute(e.key,e.value,o));return s}function Q5(n){return(e,t)=>{const i=typeof n=="string"?n:n(e,t);return t.writer.createElement("$marker",{"data-name":i})}}function ou(n,e){const t=(i,s)=>{const o=i.getAttribute("name"),r=n.model(o,s);return s.writer.createElement("$marker",{"data-name":r})};return{view:`${n.view}-${e}`,model:t}}/**
|
|
383
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
384
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
385
|
-
*/function X5(n){n.document.registerPostFixer(e=>eE(e,n))}function eE(n,e){const t=e.document.selection,i=e.schema,s=[];let o=!1;for(const r of t.getRanges()){const a=eg(r,i);a&&!a.isEqual(r)?(s.push(a),o=!0):s.push(r)}return o&&n.setSelection(sE(s),{backward:t.isBackward}),!1}function eg(n,e){return n.isCollapsed?tE(n,e):iE(n,e)}function tE(n,e){const t=n.start,i=e.getNearestSelectionRange(t);if(!i){const o=t.getAncestors().reverse().find(r=>e.isObject(r));return o?b._createOn(o):null}if(!i.isCollapsed)return i;const s=i.start;return t.isEqual(s)?null:new b(s)}function iE(n,e){const{start:t,end:i}=n,s=e.checkChild(t,"$text"),o=e.checkChild(i,"$text"),r=e.getLimitElement(t),a=e.getLimitElement(i);if(r===a){if(s&&o)return null;if(nE(t,i,e)){const d=t.nodeAfter&&e.isSelectable(t.nodeAfter)?null:e.getNearestSelectionRange(t,"forward"),f=i.nodeBefore&&e.isSelectable(i.nodeBefore)?null:e.getNearestSelectionRange(i,"backward"),m=d?d.start:t,p=f?f.end:i;return new b(m,p)}}const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const u=t.nodeAfter&&i.nodeBefore&&t.nodeAfter.parent===i.nodeBefore.parent,d=l&&(!u||!au(t.nodeAfter,e)),h=c&&(!u||!au(i.nodeBefore,e));let f=t,m=i;return d&&(f=y._createBefore(ru(r,e))),h&&(m=y._createAfter(ru(a,e))),new b(f,m)}return null}function ru(n,e){let t=n,i=t;for(;e.isLimit(i)&&i.parent;)t=i,i=i.parent;return t}function nE(n,e,t){const i=n.nodeAfter&&!t.isLimit(n.nodeAfter)||t.checkChild(n,"$text"),s=e.nodeBefore&&!t.isLimit(e.nodeBefore)||t.checkChild(e,"$text");return i||s}function sE(n){const e=[...n],t=new Set;let i=1;for(;i<e.length;){const o=e[i],r=e.slice(0,i);for(const[a,l]of r.entries())if(!t.has(a)){if(o.isEqual(l))t.add(a);else if(o.isIntersecting(l)){t.add(a),t.add(i);const c=o.getJoined(l);e.push(c)}}i++}return e.filter((o,r)=>!t.has(r))}function au(n,e){return n&&e.isSelectable(n)}/**
|
|
386
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
387
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
388
|
-
*/class oE extends W(){constructor(e,t){super(),this.model=e,this.view=new GC(t),this.mapper=new Om,this.downcastDispatcher=new Fm({mapper:this.mapper,schema:e.schema});const i=this.model.document,s=i.selection,o=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,o,r),this.downcastDispatcher.convertSelection(s,o,r)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",z5(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",rE(this.mapper,this.model.schema,this.view),{priority:"high"}),this.downcastDispatcher.on("insert:$text",$m(),{priority:"lowest"}),this.downcastDispatcher.on("insert",Hm(),{priority:"lowest"}),this.downcastDispatcher.on("remove",c5(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",h5()),this.downcastDispatcher.on("selection",u5(),{priority:"low"}),this.downcastDispatcher.on("selection",d5(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(r=>{if(r.rootName=="$graveyard")return null;const a=new vm(this.view.document,r.name);return a.rootName=r.rootName,this.mapper.bindElements(r,a),a})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,i=this.model.markers.get(t);if(!i)throw new g("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(i)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}function rE(n,e,t){return(i,s)=>{if(!(t.document.isComposing&&!M.isAndroid))for(let o=0;o<s.targetRanges.length;o++){const r=s.targetRanges[o],a=n.toModelRange(r),l=eg(a,e);!l||l.isEqual(a)||(s.targetRanges[o]=n.toViewRange(l))}}}/**
|
|
389
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
390
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
391
|
-
*/class On{constructor(){this._consumables=new Map}add(e,t){let i;if(e.is("$text")||e.is("documentFragment")){this._consumables.set(e,!0);return}this._consumables.has(e)?i=this._consumables.get(e):(i=new aE(e),this._consumables.set(e,i)),i.add(t)}test(e,t){const i=this._consumables.get(e);return i===void 0?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return this.test(e,t)?(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0):!1}revert(e,t){const i=this._consumables.get(e);i!==void 0&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const r of i)r=="style"||r=="class"||t.attributes.push(r);const s=e.getClassNames();for(const r of s)t.classes.push(r);const o=e.getStyleNames();for(const r of o)t.styles.push(r);return t}static createFrom(e,t){if(t||(t=new On),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,On.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=On.createFrom(i,t);return t}}const Rs=["attributes","classes","styles"];class aE{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of Rs)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of Rs)if(t in e){const i=this._test(t,e[t]);if(i!==!0)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of Rs)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of Rs)t in e&&this._revert(t,e[t])}_add(e,t){const i=z(t),s=this._consumables[e];for(const o of i){if(e==="attributes"&&(o==="class"||o==="style"))throw new g("viewconsumable-invalid-attribute",this);if(s.set(o,!0),e==="styles")for(const r of this.element.document.stylesProcessor.getRelatedStyles(o))s.set(r,!0)}}_test(e,t){const i=z(t),s=this._consumables[e];for(const o of i)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles",a=this._test(r,[...this._consumables[r].keys()]);if(a!==!0)return a}else{const r=s.get(o);if(r===void 0)return null;if(!r)return!1}return!0}_consume(e,t){const i=z(t),s=this._consumables[e];for(const o of i)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles";this._consume(r,[...this._consumables[r].keys()])}else if(s.set(o,!1),e=="styles")for(const r of this.element.document.stylesProcessor.getRelatedStyles(o))s.set(r,!1)}_revert(e,t){const i=z(t),s=this._consumables[e];for(const o of i)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles";this._revert(r,[...this._consumables[r].keys()])}else s.get(o)===!1&&s.set(o,!0)}}/**
|
|
392
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
393
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
394
|
-
*/class lE extends W(){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new si(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new si(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new g("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 g("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return typeof e=="string"?t=e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?t="$text":t=e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!!(t&&t.isBlock)}isLimit(e){const t=this.getDefinition(e);return t?!!(t.isLimit||t.isObject):!1}isObject(e){const t=this.getDefinition(e);return t?!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent):!1}isInline(e){const t=this.getDefinition(e);return!!(t&&t.isInline)}isSelectable(e){const t=this.getDefinition(e);return t?!!(t.isSelectable||t.isObject):!1}isContent(e){const t=this.getDefinition(e);return t?!!(t.isContent||t.isObject):!1}checkChild(e,t){return t?this._checkContextMatch(t,e):!1}checkAttribute(e,t){const i=this.getDefinition(e.last);return i?i.allowAttributes.includes(t):!1}checkMerge(e,t){if(e instanceof y){const i=e.nodeBefore,s=e.nodeAfter;if(!(i instanceof q))throw new g("schema-check-merge-no-element-before",this);if(!(s instanceof q))throw new g("schema-check-merge-no-element-after",this);return this.checkMerge(i,s)}for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[i,s])=>{if(!s)return;const o=e(i,s);typeof o=="boolean"&&(t.stop(),t.return=o)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[i,s])=>{const o=e(i,s);typeof o=="boolean"&&(t.stop(),t.return=o)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(e instanceof y?t=e.parent:t=(e instanceof b?[e]:Array.from(e.getRanges())).reduce((s,o)=>{const r=o.getCommonAncestor();return s?s.getCommonAncestor(r,{includeSelf:!0}):r},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const s=[...e.getFirstPosition().getAncestors(),new G("",e.getAttributes())];return this.checkAttribute(s,t)}else{const i=e.getRanges();for(const s of i)for(const o of s)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=EE(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new b(e);let i,s;const o=e.getAncestors().reverse().find(r=>this.isLimit(r))||e.root;(t=="both"||t=="backward")&&(i=new Tt({boundaries:b._createIn(o),startPosition:e,direction:"backward"})),(t=="both"||t=="forward")&&(s=new Tt({boundaries:b._createIn(o),startPosition:e}));for(const r of CE(i,s)){const a=r.walker==i?"elementEnd":"elementStart",l=r.value;if(l.type==a&&this.isObject(l.item))return b._createOn(l.item);if(this.checkChild(l.nextPosition,"$text"))return new b(l.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}setAllowedAttributes(e,t,i){const s=i.model;for(const[o,r]of Object.entries(t))s.schema.checkAttribute(e,o)&&i.setAttribute(o,r,e)}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))lu(this,i,t);else{const o=b._createIn(i).getPositions();for(const r of o){const a=r.nodeBefore||r.parent;lu(this,a,t)}}}getAttributesWithProperty(e,t,i){const s={};for(const[o,r]of e.getAttributes()){const a=this.getAttributeProperties(o);a[t]!==void 0&&(i===void 0||i===a[t])&&(s[o]=r)}return s}createContext(e){return new si(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const s of i)e[s]=cE(t[s],s);for(const s of i)uE(e,s);for(const s of i)dE(e,s);for(const s of i)hE(e,s);for(const s of i)fE(e,s),mE(e,s);for(const s of i)gE(e,s),pE(e,s),wE(e,s);this._compiledDefinitions=e}_checkContextMatch(e,t,i=t.length-1){const s=t.getItem(i);if(e.allowIn.includes(s.name)){if(i==0)return!0;{const o=this.getDefinition(s);return this._checkContextMatch(o,t,i-1)}}else return!1}*_getValidRangesForRange(e,t){let i=e.start,s=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(b._createIn(o),t)),this.checkAttribute(o,t)||(i.isEqual(s)||(yield new b(i,s)),i=y._createAfter(o)),s=y._createAfter(o);i.isEqual(s)||(yield new b(i,s))}findOptimalInsertionRange(e,t){const i=e.getSelectedElement();if(i&&this.isObject(i)&&!this.isInline(i))return t=="before"||t=="after"?new b(y._createAt(i,t)):b._createOn(i);const s=J(e.getSelectedBlocks());if(!s)return new b(e.focus);if(s.isEmpty)return new b(y._createAt(s,0));const o=y._createAfter(s);return e.focus.isTouching(o)?new b(o):new b(y._createBefore(s))}}class si{constructor(e){if(e instanceof si)return e;let t;typeof e=="string"?t=[e]:Array.isArray(e)?t=e:t=e.getAncestors({includeSelf:!0}),this._items=t.map(kE)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new si([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function cE(n,e){const t={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return bE(n,t),jt(n,t,"allowIn"),jt(n,t,"allowContentOf"),jt(n,t,"allowWhere"),jt(n,t,"allowAttributes"),jt(n,t,"allowAttributesOf"),jt(n,t,"allowChildren"),jt(n,t,"inheritTypesFrom"),_E(n,t),t}function uE(n,e){const t=n[e];for(const i of t.allowChildren){const s=n[i];s&&s.allowIn.push(e)}t.allowChildren.length=0}function dE(n,e){for(const t of n[e].allowContentOf)n[t]&&vE(n,t).forEach(s=>{s.allowIn.push(e)});delete n[e].allowContentOf}function hE(n,e){for(const t of n[e].allowWhere){const i=n[t];if(i){const s=i.allowIn;n[e].allowIn.push(...s)}}delete n[e].allowWhere}function fE(n,e){for(const t of n[e].allowAttributesOf){const i=n[t];if(i){const s=i.allowAttributes;n[e].allowAttributes.push(...s)}}delete n[e].allowAttributesOf}function mE(n,e){const t=n[e];for(const i of t.inheritTypesFrom){const s=n[i];if(s){const o=Object.keys(s).filter(r=>r.startsWith("is"));for(const r of o)r in t||(t[r]=s[r])}}delete t.inheritTypesFrom}function gE(n,e){const t=n[e],i=t.allowIn.filter(s=>n[s]);t.allowIn=Array.from(new Set(i))}function pE(n,e){const t=n[e];for(const i of t.allowIn)n[i].allowChildren.push(e)}function wE(n,e){const t=n[e];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function bE(n,e){for(const t of n){const i=Object.keys(t).filter(s=>s.startsWith("is"));for(const s of i)e[s]=!!t[s]}}function jt(n,e,t){for(const i of n){const s=i[t];typeof s=="string"?e[t].push(s):Array.isArray(s)&&e[t].push(...s)}}function _E(n,e){for(const t of n){const i=t.inheritAllFrom;i&&(e.allowContentOf.push(i),e.allowWhere.push(i),e.allowAttributesOf.push(i),e.inheritTypesFrom.push(i))}}function vE(n,e){const t=n[e];return yE(n).filter(i=>i.allowIn.includes(t.name))}function yE(n){return Object.keys(n).map(e=>n[e])}function kE(n){return typeof n=="string"||n.is("documentFragment")?{name:typeof n=="string"?n:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:n.is("element")?n.name:"$text",*getAttributeKeys(){yield*n.getAttributeKeys()},getAttribute(e){return n.getAttribute(e)}}}function*CE(n,e){let t=!1;for(;!t;){if(t=!0,n){const i=n.next();i.done||(t=!1,yield{walker:n,value:i.value})}if(e){const i=e.next();i.done||(t=!1,yield{walker:e,value:i.value})}}}function*EE(n){for(const e of n)yield*e.getMinimalFlatRanges()}function lu(n,e,t){for(const i of e.getAttributeKeys())n.checkAttribute(e,i)||t.removeAttribute(i,e)}/**
|
|
395
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
396
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
397
|
-
*/class TE extends Z(){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(t,i)=>this._convertItem(t,i),convertChildren:(t,i)=>this._convertChildren(t,i),safeInsert:(t,i)=>this._safeInsert(t,i),updateConversionResult:(t,i)=>this._updateConversionResult(t,i),splitToAllowedParent:(t,i)=>this._splitToAllowedParent(t,i),getSplitParts:t=>this._getSplitParts(t),keepEmptyElement:t=>this._keepEmptyElement(t)}}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=SE(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=On.createFrom(e),this.conversionApi.store={};const{modelRange:s}=this._convertItem(e,this._modelCursor),o=t.createDocumentFragment();if(s){this._removeEmptyElements();for(const r of Array.from(this._modelCursor.parent.getChildren()))t.append(r,o);o.markers=AE(o,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,t){const i={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof b))throw new g("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:y._createAt(t,0);const s=new b(i);for(const o of Array.from(e.getChildren())){const r=this._convertItem(o,i);r.modelRange instanceof b&&(s.end=r.modelRange.end,i=r.modelCursor)}return{modelRange:s,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return i?(this.conversionApi.writer.insert(e,i.position),!0):!1}_updateConversionResult(e,t){const i=this._getSplitParts(e),s=this.conversionApi.writer;t.modelRange||(t.modelRange=s.createRange(s.createPositionBefore(e),s.createPositionAfter(i[i.length-1])));const o=this._cursorParents.get(e);o?t.modelCursor=s.createPositionAt(o,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:s}=this.conversionApi;let o=i.findAllowedParent(t,e);if(o){if(o===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return Zm(t,e,i)?{position:Jm(t,s)}:null;const r=this.conversionApi.writer.split(t,o),a=[];for(const c of r.range.getWalker())if(c.type=="elementEnd")a.push(c.item);else{const u=a.pop(),d=c.item;this._registerSplitPair(u,d)}const l=r.range.end.parent;return this._cursorParents.set(e,l),{position:r.position,cursorParent:l}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return this._splitParts.has(e)?t=this._splitParts.get(e):t=[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}function AE(n,e){const t=new Set,i=new Map,s=b._createIn(n).getItems();for(const o of s)o.is("element","$marker")&&t.add(o);for(const o of t){const r=o.getAttribute("data-name"),a=e.createPositionBefore(o);i.has(r)?i.get(r).end=a.clone():i.set(r,new b(a.clone())),e.remove(o)}return i}function SE(n,e){let t;for(const i of new si(n)){const s={};for(const r of i.getAttributeKeys())s[r]=i.getAttribute(r);const o=e.createElement(i.name,s);t&&e.insert(o,t),t=y._createAt(o,0)}return t}/**
|
|
398
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
399
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
400
|
-
*/class xE{getHtml(e){const i=S.document.implementation.createHTMLDocument("").createElement("div");return i.appendChild(e),i.innerHTML}}/**
|
|
401
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
402
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
403
|
-
*/class IE{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new Pm(e,{renderingMode:"data"}),this.htmlWriter=new xE}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e=="marked"?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),s=t.body.childNodes;for(;s.length>0;)i.appendChild(s[0]);return i}}/**
|
|
404
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
405
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
406
|
-
*/class PE extends Z(){constructor(e,t){super(),this.model=e,this.mapper=new Om,this.downcastDispatcher=new Fm({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",$m(),{priority:"lowest"}),this.downcastDispatcher.on("insert",Hm(),{priority:"lowest"}),this.upcastDispatcher=new TE({schema:e.schema}),this.viewDocument=new Cm(t),this.stylesProcessor=t,this.htmlProcessor=new IE(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Tm(this.viewDocument),this.upcastDispatcher.on("text",H5(),{priority:"lowest"}),this.upcastDispatcher.on("element",su(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",su(),{priority:"lowest"}),W().prototype.decorate.call(this,"init"),W().prototype.decorate.call(this,"set"),W().prototype.decorate.call(this,"get"),W().prototype.decorate.call(this,"toView"),W().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},Km)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new g("datacontroller-get-non-existent-root",this);const s=this.model.document.getRoot(t);return s.isAttached()||D("datacontroller-get-detached-root",this),i==="empty"&&!this.model.hasContent(s,{ignoreWhitespaces:!0})?"":this.stringify(s,e)}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,s=this._viewWriter;this.mapper.clearBindings();const o=b._createIn(e),r=new ni(i);this.mapper.bindElements(e,r);const a=e.is("documentFragment")?e.markers:RE(e);return this.downcastDispatcher.convert(o,a,s,t),r}init(e){if(this.model.document.version)throw new g("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new g("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},i=>{for(const s of Object.keys(t)){const o=this.model.document.getRoot(s);i.insert(this.parse(t[s],o),o,0)}}),Promise.resolve()}set(e,t={}){let i={};if(typeof e=="string"?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new g("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},s=>{s.setSelection(null),s.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(i)){const r=this.model.document.getRoot(o);s.remove(s.createRangeIn(r)),s.insert(this.parse(i[o],r),r,0)}})}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}function RE(n){const e=[],t=n.root.document;if(!t)return new Map;const i=b._createIn(n);for(const s of t.model.markers){const o=s.getRange(),r=o.isCollapsed,a=o.start.isEqual(i.start)||o.end.isEqual(i.end);if(r&&a)e.push([s.name,o]);else{const l=i.getIntersection(o);l&&e.push([s.name,l])}}return e.sort(([s,o],[r,a])=>{if(o.end.compareWith(a.start)!=="after")return 1;if(o.start.compareWith(a.end)!=="before")return-1;switch(o.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(o.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return r.localeCompare(s)}}}),new Map(e)}/**
|
|
407
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
408
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
409
|
-
*/class VE{constructor(e,t){this._helpers=new Map,this._downcast=z(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=z(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new g("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new g("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of br(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of br(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of br(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new g("conversion-group-exists",this);const s=i?new l5(t):new $5(t);this._helpers.set(e,s)}}function*br(n){if(n.model.values)for(const e of n.model.values){const t={key:n.model.key,value:e},i=n.view[e],s=n.upcastAlso?n.upcastAlso[e]:void 0;yield*cu(t,i,s)}else yield*cu(n.model,n.view,n.upcastAlso)}function*cu(n,e,t){if(yield{model:n,view:e},t)for(const i of z(t))yield{model:n,view:i}}/**
|
|
410
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
411
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
412
|
-
*/class We{constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}/**
|
|
413
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
414
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
415
|
-
*/function pl(n,e){const t=ig(e),i=t.reduce((r,a)=>r+a.offsetSize,0),s=n.parent;Qn(n);const o=n.index;return s._insertChild(o,t),Yn(s,o+t.length),Yn(s,o),new b(n,n.getShiftedBy(i))}function tg(n){if(!n.isFlat)throw new g("operation-utils-remove-range-not-flat",this);const e=n.start.parent;Qn(n.start),Qn(n.end);const t=e._removeChildren(n.start.index,n.end.index-n.start.index);return Yn(e,n.start.index),t}function Jn(n,e){if(!n.isFlat)throw new g("operation-utils-move-range-not-flat",this);const t=tg(n);return e=e._getTransformedByDeletion(n.start,n.end.offset-n.start.offset),pl(e,t)}function BE(n,e,t){Qn(n.start),Qn(n.end);for(const i of n.getItems({shallow:!0})){const s=i.is("$textProxy")?i.textNode:i;t!==null?s._setAttribute(e,t):s._removeAttribute(e),Yn(s.parent,s.index)}Yn(n.end.parent,n.end.index)}function ig(n){const e=[];function t(i){if(typeof i=="string")e.push(new G(i));else if(i instanceof it)e.push(new G(i.data,i.getAttributes()));else if(i instanceof _i)e.push(i);else if(Ue(i))for(const s of i)t(s)}t(n);for(let i=1;i<e.length;i++){const s=e[i],o=e[i-1];s instanceof G&&o instanceof G&&ng(s,o)&&(e.splice(i-1,2,new G(o.data+s.data,o.getAttributes())),i--)}return e}function Yn(n,e){const t=n.getChild(e-1),i=n.getChild(e);if(t&&i&&t.is("$text")&&i.is("$text")&&ng(t,i)){const s=new G(t.data+i.data,t.getAttributes());n._removeChildren(e-1,2),n._insertChild(e-1,s)}}function Qn(n){const e=n.textNode,t=n.parent;if(e){const i=n.offset-e.startOffset,s=e.index;t._removeChildren(s,1);const o=new G(e.data.substr(0,i),e.getAttributes()),r=new G(e.data.substr(i),e.getAttributes());t._insertChild(s,[o,r])}}function ng(n,e){const t=n.getAttributes(),i=e.getAttributes();for(const s of t){if(s[1]!==e.getAttribute(s[0]))return!1;i.next()}return i.next().done}/**
|
|
416
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
417
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
418
|
-
*/class H extends We{constructor(e,t,i,s){super(s),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[b._createFromPositionAndShift(this.sourcePosition,this.howMany),b._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new H(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new H(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,s=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new g("move-operation-nodes-do-not-exist",this);if(e===t&&i<s&&s<i+this.howMany)throw new g("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&Te(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const o=this.sourcePosition.path.length-1;if(this.targetPosition.path[o]>=i&&this.targetPosition.path[o]<i+this.howMany)throw new g("move-operation-node-into-itself",this)}}_execute(){Jn(b._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=y.fromJSON(e.sourcePosition,t),s=y.fromJSON(e.targetPosition,t);return new this(i,e.howMany,s,e.baseVersion)}}/**
|
|
419
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
420
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
421
|
-
*/class be extends We{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Mn(ig(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new Mn([...this.nodes].map(i=>i._clone(!0))),t=new be(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new y(e,[0]);return new H(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new g("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Mn([...e].map(t=>t._clone(!0))),pl(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const o of e.nodes)o.name?i.push(q.fromJSON(o)):i.push(G.fromJSON(o));const s=new be(y.fromJSON(e.position,t),i,e.baseVersion);return s.shouldReceiveAttributes=e.shouldReceiveAttributes,s}}/**
|
|
422
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
423
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
424
|
-
*/class K extends We{constructor(e,t,i,s,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=s?s.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new y(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new b(this.splitPosition,e)}get affectedSelectable(){const e=[b._createFromPositionAndShift(this.splitPosition,0),b._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(b._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new K(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new y(e,[0]);return new le(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new g("split-operation-position-invalid",this);if(e.parent){if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new g("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new g("split-operation-graveyard-position-invalid",this)}else throw new g("split-operation-split-in-root",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Jn(b._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const i=e._clone();pl(this.insertionPosition,i)}const t=new b(y._createAt(e,this.splitPosition.offset),y._createAt(e,e.maxOffset));Jn(t,this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new y(e.root,t,"toPrevious")}static fromJSON(e,t){const i=y.fromJSON(e.splitPosition,t),s=y.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?y.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,s,o,e.baseVersion)}}/**
|
|
425
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
426
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
427
|
-
*/class le extends We{constructor(e,t,i,s,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=s.clone()}get type(){return"merge"}get deletionPosition(){return new y(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new b(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[b._createOn(e),b._createFromPositionAndShift(this.targetPosition,0),b._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new le(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new y(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new K(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(e.parent)if(t.parent){if(this.howMany!=e.maxOffset)throw new g("merge-operation-how-many-invalid",this)}else throw new g("merge-operation-target-position-invalid",this);else throw new g("merge-operation-source-position-invalid",this)}_execute(){const e=this.sourcePosition.parent,t=b._createIn(e);Jn(t,this.targetPosition),Jn(b._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=y.fromJSON(e.sourcePosition,t),s=y.fromJSON(e.targetPosition,t),o=y.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,s,o,e.baseVersion)}}/**
|
|
428
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
429
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
430
|
-
*/class Be extends We{constructor(e,t,i,s,o,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=o,this._markers=s}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new Be(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Be(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Be(e.name,e.oldRange?b.fromJSON(e.oldRange,t):null,e.newRange?b.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}/**
|
|
431
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
432
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
433
|
-
*/class ue extends We{constructor(e,t,i,s,o){super(o),this.range=e.clone(),this.key=t,this.oldValue=i===void 0?null:i,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new ue(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new ue(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new g("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!uo(e.getAttribute(this.key),this.oldValue))throw new g("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new g("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){uo(this.oldValue,this.newValue)||BE(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new ue(b.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
|
|
434
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
435
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
436
|
-
*/class me extends We{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new me(this.baseVersion)}getReversed(){return new me(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}/**
|
|
437
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
438
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
439
|
-
*/class Me extends We{constructor(e,t,i,s){super(s),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new Me(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Me(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(e instanceof q){if(e.name!==this.oldName)throw new g("rename-operation-wrong-name",this)}else throw new g("rename-operation-wrong-position",this)}_execute(){const e=this.position.nodeAfter;e.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Me(y.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}/**
|
|
440
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
441
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
442
|
-
*/class St extends We{constructor(e,t,i,s,o){super(o),this.root=e,this.key=t,this.oldValue=i===void 0?null:i,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new St(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new St(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new g("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new g("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 g("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new g("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new St(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
|
|
443
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
444
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
445
|
-
*/class ft extends We{constructor(e,t,i,s,o){if(super(o),this.rootName=e,this.elementName=t,this.isAdd=i,this._document=s,!this._document.getRoot(this.rootName)){const r=this._document.createRoot(this.elementName,this.rootName);r._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new ft(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new ft(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new ft(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}/**
|
|
446
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
447
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
448
|
-
*/const Qe={};Qe[ue.className]=ue;Qe[be.className]=be;Qe[Be.className]=Be;Qe[H.className]=H;Qe[me.className]=me;Qe[We.className]=We;Qe[Me.className]=Me;Qe[St.className]=St;Qe[ft.className]=ft;Qe[K.className]=K;Qe[le.className]=le;class ME{static fromJSON(e,t){return Qe[e.__className].fromJSON(e,t)}}/**
|
|
449
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
450
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
451
|
-
*/const da=new Map;function $(n,e,t){let i=da.get(n);i||(i=new Map,da.set(n,i)),i.set(e,t)}function LE(n,e){const t=da.get(n);return t&&t.has(e)?t.get(e):OE}function OE(n){return[n]}function uu(n,e,t={}){const i=LE(n.constructor,e.constructor);try{return n=n.clone(),i(n,e,t)}catch(s){throw s}}function FE(n,e,t){n=n.slice(),e=e.slice();const i=new DE(t.document,t.useRelations,t.forceWeakRemove);i.setOriginalOperations(n),i.setOriginalOperations(e);const s=i.originalOperations;if(n.length==0||e.length==0)return{operationsA:n,operationsB:e,originalOperations:s};const o=new WeakMap;for(const l of n)o.set(l,0);const r={nextBaseVersionA:n[n.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:n.length,originalOperationsBCount:e.length};let a=0;for(;a<n.length;){const l=n[a],c=o.get(l);if(c==e.length){a++;continue}const u=e[c],d=uu(l,u,i.getContext(l,u,!0)),h=uu(u,l,i.getContext(u,l,!1));i.updateRelation(l,u),i.setOriginalOperations(d,l),i.setOriginalOperations(h,u);for(const f of d)o.set(f,c+h.length);n.splice(a,1,...d),e.splice(c,1,...h)}if(t.padWithNoOps){const l=n.length-r.originalOperationsACount,c=e.length-r.originalOperationsBCount;hu(n,c-l),hu(e,l-c)}return du(n,r.nextBaseVersionB),du(e,r.nextBaseVersionA),{operationsA:n,operationsB:e,originalOperations:s}}class DE{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const s of e)this.originalOperations.set(s,i||s)}updateRelation(e,t){if(e instanceof H)t instanceof le?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof 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 K){if(t instanceof le)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{const i=b._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const s=i.end.offset-e.splitPosition.offset,o=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:s,offset:o})}}}else if(e instanceof le)t instanceof le?(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 K?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 Be){const i=e.newRange;if(!i)return;if(t instanceof H){const s=b._createFromPositionAndShift(t.sourcePosition,t.howMany),o=s.containsPosition(i.start)||s.start.isEqual(i.start),r=s.containsPosition(i.end)||s.end.isEqual(i.end);(o||r)&&!s.containsRange(i)&&this._setRelation(e,t,{side:o?"left":"right",path:o?i.start.path.slice():i.end.path.slice()})}else if(t instanceof le){const s=i.start.isEqual(t.targetPosition),o=i.start.isEqual(t.deletionPosition),r=i.end.isEqual(t.deletionPosition),a=i.end.isEqual(t.sourcePosition);(s||o||r||a)&&this._setRelation(e,t,{wasInLeftElement:s,wasStartBeforeMergedElement:o,wasEndBeforeMergedElement:r,wasInRightElement:a})}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),s=this._history.getUndoneOperation(i);if(!s)return null;const o=this.originalOperations.get(e),r=this._relations.get(o);return r&&r.get(s)||null}_setRelation(e,t,i){const s=this.originalOperations.get(e),o=this.originalOperations.get(t);let r=this._relations.get(s);r||(r=new Map,this._relations.set(s,r)),r.set(o,i)}}function du(n,e){for(const t of n)t.baseVersion=e++}function hu(n,e){for(let t=0;t<e;t++)n.push(new me(0))}$(ue,ue,(n,e,t)=>{if(n.key===e.key&&n.range.start.hasSameParentAs(e.range.start)){const i=n.range.getDifference(e.range).map(o=>new ue(o,n.key,n.oldValue,n.newValue,0)),s=n.range.getIntersection(e.range);return s&&t.aIsStrong&&i.push(new ue(s,e.key,e.newValue,n.newValue,0)),i.length==0?[new me(0)]:i}else return[n]});$(ue,be,(n,e)=>{if(n.range.start.hasSameParentAs(e.position)&&n.range.containsPosition(e.position)){const i=n.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(s=>new ue(s,n.key,n.oldValue,n.newValue,n.baseVersion));if(e.shouldReceiveAttributes){const s=sg(e,n.key,n.oldValue);s&&i.unshift(s)}return i}return n.range=n.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[n]});function sg(n,e,t){const s=n.nodes.getNode(0).getAttribute(e);if(s==t)return null;const o=new b(n.position,n.position.getShiftedBy(n.howMany));return new ue(o,e,s,t,0)}$(ue,le,(n,e)=>{const t=[];n.range.start.hasSameParentAs(e.deletionPosition)&&(n.range.containsPosition(e.deletionPosition)||n.range.start.isEqual(e.deletionPosition))&&t.push(b._createFromPositionAndShift(e.graveyardPosition,1));const i=n.range._getTransformedByMergeOperation(e);return i.isCollapsed||t.push(i),t.map(s=>new ue(s,n.key,n.oldValue,n.newValue,n.baseVersion))});$(ue,H,(n,e)=>NE(n.range,e).map(i=>new ue(i,n.key,n.oldValue,n.newValue,n.baseVersion)));function NE(n,e){const t=b._createFromPositionAndShift(e.sourcePosition,e.howMany);let i=null,s=[];t.containsRange(n,!0)?i=n:n.start.hasSameParentAs(t.start)?(s=n.getDifference(t),i=n.getIntersection(t)):s=[n];const o=[];for(let r of s){r=r._getTransformedByDeletion(e.sourcePosition,e.howMany);const a=e.getMovedRangeStart(),l=r.start.hasSameParentAs(a),c=r._getTransformedByInsertion(a,e.howMany,l);o.push(...c)}return i&&o.push(i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany,!1)[0]),o}$(ue,K,(n,e)=>{if(n.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||n.range.end.offset++,[n];if(n.range.start.hasSameParentAs(e.splitPosition)&&n.range.containsPosition(e.splitPosition)){const t=n.clone();return t.range=new b(e.moveTargetPosition.clone(),n.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),n.range.end=e.splitPosition.clone(),n.range.end.stickiness="toPrevious",[n,t]}return n.range=n.range._getTransformedBySplitOperation(e),[n]});$(be,ue,(n,e)=>{const t=[n];if(n.shouldReceiveAttributes&&n.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(n.position)){const i=sg(n,e.key,e.newValue);i&&t.push(i)}return t});$(be,be,(n,e,t)=>n.position.isEqual(e.position)&&t.aIsStrong?[n]:(n.position=n.position._getTransformedByInsertOperation(e),[n]));$(be,H,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n]));$(be,K,(n,e)=>(n.position=n.position._getTransformedBySplitOperation(e),[n]));$(be,le,(n,e)=>(n.position=n.position._getTransformedByMergeOperation(e),[n]));$(Be,be,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByInsertOperation(e)[0]),n.newRange&&(n.newRange=n.newRange._getTransformedByInsertOperation(e)[0]),[n]));$(Be,Be,(n,e,t)=>{if(n.name==e.name)if(t.aIsStrong)n.oldRange=e.newRange?e.newRange.clone():null;else return[new me(0)];return[n]});$(Be,le,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByMergeOperation(e)),n.newRange&&(n.newRange=n.newRange._getTransformedByMergeOperation(e)),[n]));$(Be,H,(n,e,t)=>{if(n.oldRange&&(n.oldRange=b._createFromRanges(n.oldRange._getTransformedByMoveOperation(e))),n.newRange){if(t.abRelation){const i=b._createFromRanges(n.newRange._getTransformedByMoveOperation(e));if(t.abRelation.side=="left"&&e.targetPosition.isEqual(n.newRange.start))return n.newRange.end=i.end,n.newRange.start.path=t.abRelation.path,[n];if(t.abRelation.side=="right"&&e.targetPosition.isEqual(n.newRange.end))return n.newRange.start=i.start,n.newRange.end.path=t.abRelation.path,[n]}n.newRange=b._createFromRanges(n.newRange._getTransformedByMoveOperation(e))}return[n]});$(Be,K,(n,e,t)=>{if(n.oldRange&&(n.oldRange=n.oldRange._getTransformedBySplitOperation(e)),n.newRange){if(t.abRelation){const i=n.newRange._getTransformedBySplitOperation(e);return n.newRange.start.isEqual(e.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?n.newRange.start=y._createAt(e.insertionPosition):n.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(n.newRange.start=y._createAt(e.moveTargetPosition)),n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?n.newRange.end=y._createAt(e.moveTargetPosition):n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?n.newRange.end=y._createAt(e.insertionPosition):n.newRange.end=i.end,[n]}n.newRange=n.newRange._getTransformedBySplitOperation(e)}return[n]});$(le,be,(n,e)=>(n.sourcePosition.hasSameParentAs(e.position)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByInsertOperation(e),n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e),[n]));$(le,le,(n,e,t)=>{if(n.sourcePosition.isEqual(e.sourcePosition)&&n.targetPosition.isEqual(e.targetPosition))if(t.bWasUndone){const i=e.graveyardPosition.path.slice();return i.push(0),n.sourcePosition=new y(e.graveyardPosition.root,i),n.howMany=0,[n]}else return[new me(0)];if(n.sourcePosition.isEqual(e.sourcePosition)&&!n.targetPosition.isEqual(e.targetPosition)&&!t.bWasUndone&&t.abRelation!="splitAtSource"){const i=n.targetPosition.root.rootName=="$graveyard",s=e.targetPosition.root.rootName=="$graveyard";if(s&&!i||!(i&&!s)&&t.aIsStrong){const l=e.targetPosition._getTransformedByMergeOperation(e),c=n.targetPosition._getTransformedByMergeOperation(e);return[new H(l,n.howMany,c,0)]}else return[new me(0)]}return n.sourcePosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByMergeOperation(e),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),(!n.graveyardPosition.isEqual(e.graveyardPosition)||!t.aIsStrong)&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(e)),[n]});$(le,H,(n,e,t)=>{const i=b._createFromPositionAndShift(e.sourcePosition,e.howMany);return e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&n.deletionPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(n.sourcePosition)?[new me(0)]:(e.sourcePosition.getShiftedBy(e.howMany).isEqual(n.sourcePosition)?n.sourcePosition.stickiness="toNone":e.targetPosition.isEqual(n.sourcePosition)&&t.abRelation=="mergeSourceAffected"?n.sourcePosition.stickiness="toNext":e.sourcePosition.isEqual(n.targetPosition)?(n.targetPosition.stickiness="toNone",n.howMany-=e.howMany):e.targetPosition.isEqual(n.targetPosition)&&t.abRelation=="mergeTargetWasBefore"?(n.targetPosition.stickiness="toPrevious",n.howMany+=e.howMany):(n.sourcePosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.sourcePosition.hasSameParentAs(e.sourcePosition)&&(n.howMany-=e.howMany)),n.sourcePosition=n.sourcePosition._getTransformedByMoveOperation(e),n.targetPosition=n.targetPosition._getTransformedByMoveOperation(e),n.sourcePosition.stickiness="toPrevious",n.targetPosition.stickiness="toNext",n.graveyardPosition.isEqual(e.targetPosition)||(n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(e)),[n])});$(le,K,(n,e,t)=>{if(e.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),n.deletionPosition.isEqual(e.graveyardPosition)&&(n.howMany=e.howMany)),n.targetPosition.isEqual(e.splitPosition)){const i=e.howMany!=0,s=e.graveyardPosition&&n.deletionPosition.isEqual(e.graveyardPosition);if(i||s||t.abRelation=="mergeTargetNotMoved")return n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(e),[n]}if(n.sourcePosition.isEqual(e.splitPosition)){if(t.abRelation=="mergeSourceNotMoved")return n.howMany=0,n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n];if(t.abRelation=="mergeSameElement"||n.sourcePosition.offset>0)return n.sourcePosition=e.moveTargetPosition.clone(),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n]}return n.sourcePosition.hasSameParentAs(e.splitPosition)&&(n.howMany=e.splitPosition.offset),n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(e),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n]});$(H,be,(n,e)=>{const i=b._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByInsertOperation(e,!1)[0];return n.sourcePosition=i.start,n.howMany=i.end.offset-i.start.offset,n.targetPosition.isEqual(e.position)||(n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e)),[n]});$(H,H,(n,e,t)=>{const i=b._createFromPositionAndShift(n.sourcePosition,n.howMany),s=b._createFromPositionAndShift(e.sourcePosition,e.howMany);let o=t.aIsStrong,r=!t.aIsStrong;t.abRelation=="insertBefore"||t.baRelation=="insertAfter"?r=!0:(t.abRelation=="insertAfter"||t.baRelation=="insertBefore")&&(r=!1);let a;if(n.targetPosition.isEqual(e.targetPosition)&&r?a=n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):a=n.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),fu(n,e)&&fu(e,n))return[e.getReversed()];if(i.containsPosition(e.targetPosition)&&i.containsRange(s,!0))return i.start=i.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),i.end=i.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Wi([i],a);if(s.containsPosition(n.targetPosition)&&s.containsRange(i,!0))return i.start=i.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),i.end=i.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),Wi([i],a);const u=Te(n.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if(u=="prefix"||u=="extension")return i.start=i.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),i.end=i.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Wi([i],a);n.type=="remove"&&e.type!="remove"&&!t.aWasUndone&&!t.forceWeakRemove?o=!0:n.type!="remove"&&e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&(o=!1);const d=[],h=i.getDifference(s);for(const m of h){m.start=m.start._getTransformedByDeletion(e.sourcePosition,e.howMany),m.end=m.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const p=Te(m.start.getParentPath(),e.getMovedRangeStart().getParentPath())=="same",_=m._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,p);d.push(..._)}const f=i.getIntersection(s);return f!==null&&o&&(f.start=f.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),f.end=f.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),d.length===0?d.push(f):d.length==1?s.start.isBefore(i.start)||s.start.isEqual(i.start)?d.unshift(f):d.push(f):d.splice(1,0,f)),d.length===0?[new me(n.baseVersion)]:Wi(d,a)});$(H,K,(n,e,t)=>{let i=n.targetPosition.clone();(!n.targetPosition.isEqual(e.insertionPosition)||!e.graveyardPosition||t.abRelation=="moveTargetAfter")&&(i=n.targetPosition._getTransformedBySplitOperation(e));const s=b._createFromPositionAndShift(n.sourcePosition,n.howMany);if(s.end.isEqual(e.insertionPosition))return e.graveyardPosition||n.howMany++,n.targetPosition=i,[n];if(s.start.hasSameParentAs(e.splitPosition)&&s.containsPosition(e.splitPosition)){let a=new b(e.splitPosition,s.end);a=a._getTransformedBySplitOperation(e);const l=[new b(s.start,e.splitPosition),a];return Wi(l,i)}n.targetPosition.isEqual(e.splitPosition)&&t.abRelation=="insertAtSource"&&(i=e.moveTargetPosition),n.targetPosition.isEqual(e.insertionPosition)&&t.abRelation=="insertBetween"&&(i=n.targetPosition);const r=[s._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const a=s.start.isEqual(e.graveyardPosition)||s.containsPosition(e.graveyardPosition);n.howMany>1&&a&&!t.aWasUndone&&r.push(b._createFromPositionAndShift(e.insertionPosition,1))}return Wi(r,i)});$(H,le,(n,e,t)=>{const i=b._createFromPositionAndShift(n.sourcePosition,n.howMany);if(e.deletionPosition.hasSameParentAs(n.sourcePosition)&&i.containsPosition(e.sourcePosition)){if(n.type=="remove"&&!t.forceWeakRemove){if(!t.aWasUndone){const r=[];let a=e.graveyardPosition.clone(),l=e.targetPosition._getTransformedByMergeOperation(e);n.howMany>1&&(r.push(new H(n.sourcePosition,n.howMany-1,n.targetPosition,0)),a=a._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany-1),l=l._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany-1));const c=e.deletionPosition._getCombined(n.sourcePosition,n.targetPosition),u=new H(a,1,c,0),d=u.getMovedRangeStart().path.slice();d.push(0);const h=new y(u.targetPosition.root,d);l=l._getTransformedByMove(a,c,1);const f=new H(l,e.howMany,h,0);return r.push(u),r.push(f),r}}else if(n.howMany==1)return t.bWasUndone?(n.sourcePosition=e.graveyardPosition.clone(),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),[n]):[new me(0)]}const o=b._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByMergeOperation(e);return n.sourcePosition=o.start,n.howMany=o.end.offset-o.start.offset,n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),[n]});$(Me,be,(n,e)=>(n.position=n.position._getTransformedByInsertOperation(e),[n]));$(Me,le,(n,e)=>n.position.isEqual(e.deletionPosition)?(n.position=e.graveyardPosition.clone(),n.position.stickiness="toNext",[n]):(n.position=n.position._getTransformedByMergeOperation(e),[n]));$(Me,H,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n]));$(Me,Me,(n,e,t)=>{if(n.position.isEqual(e.position))if(t.aIsStrong)n.oldName=e.newName;else return[new me(0)];return[n]});$(Me,K,(n,e)=>{const t=n.position.path,i=e.splitPosition.getParentPath();if(Te(t,i)=="same"&&!e.graveyardPosition){const s=new Me(n.position.getShiftedBy(1),n.oldName,n.newName,0);return[n,s]}return n.position=n.position._getTransformedBySplitOperation(e),[n]});$(St,St,(n,e,t)=>{if(n.root===e.root&&n.key===e.key){if(!t.aIsStrong||n.newValue===e.newValue)return[new me(0)];n.oldValue=e.newValue}return[n]});$(ft,ft,(n,e)=>n.rootName===e.rootName&&n.isAdd===e.isAdd?[new me(0)]:[n]);$(K,be,(n,e)=>(n.splitPosition.hasSameParentAs(e.position)&&n.splitPosition.offset<e.position.offset&&(n.howMany+=e.howMany),n.splitPosition=n.splitPosition._getTransformedByInsertOperation(e),n.insertionPosition=n.insertionPosition._getTransformedByInsertOperation(e),[n]));$(K,le,(n,e,t)=>{if(!n.graveyardPosition&&!t.bWasUndone&&n.splitPosition.hasSameParentAs(e.sourcePosition)){const i=e.graveyardPosition.path.slice();i.push(0);const s=new y(e.graveyardPosition.root,i),o=K.getInsertionPosition(new y(e.graveyardPosition.root,i)),r=new K(s,0,o,null,0);return n.splitPosition=n.splitPosition._getTransformedByMergeOperation(e),n.insertionPosition=K.getInsertionPosition(n.splitPosition),n.graveyardPosition=r.insertionPosition.clone(),n.graveyardPosition.stickiness="toNext",[r,n]}return n.splitPosition.hasSameParentAs(e.deletionPosition)&&!n.splitPosition.isAfter(e.deletionPosition)&&n.howMany--,n.splitPosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.splitPosition=n.splitPosition._getTransformedByMergeOperation(e),n.insertionPosition=K.getInsertionPosition(n.splitPosition),n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(e)),[n]});$(K,H,(n,e,t)=>{const i=b._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.graveyardPosition){const o=i.start.isEqual(n.graveyardPosition)||i.containsPosition(n.graveyardPosition);if(!t.bWasUndone&&o){const r=n.splitPosition._getTransformedByMoveOperation(e),a=n.graveyardPosition._getTransformedByMoveOperation(e),l=a.path.slice();l.push(0);const c=new y(a.root,l);return[new H(r,n.howMany,c,0)]}n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(e)}const s=n.splitPosition.isEqual(e.targetPosition);if(s&&(t.baRelation=="insertAtSource"||t.abRelation=="splitBefore"))return n.howMany+=e.howMany,n.splitPosition=n.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),n.insertionPosition=K.getInsertionPosition(n.splitPosition),[n];if(s&&t.abRelation&&t.abRelation.howMany){const{howMany:o,offset:r}=t.abRelation;return n.howMany+=o,n.splitPosition=n.splitPosition.getShiftedBy(r),[n]}if(n.splitPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(n.splitPosition)){const o=e.howMany-(n.splitPosition.offset-e.sourcePosition.offset);return n.howMany-=o,n.splitPosition.hasSameParentAs(e.targetPosition)&&n.splitPosition.offset<e.targetPosition.offset&&(n.howMany+=e.howMany),n.splitPosition=e.sourcePosition.clone(),n.insertionPosition=K.getInsertionPosition(n.splitPosition),[n]}return e.sourcePosition.isEqual(e.targetPosition)||(n.splitPosition.hasSameParentAs(e.sourcePosition)&&n.splitPosition.offset<=e.sourcePosition.offset&&(n.howMany-=e.howMany),n.splitPosition.hasSameParentAs(e.targetPosition)&&n.splitPosition.offset<e.targetPosition.offset&&(n.howMany+=e.howMany)),n.splitPosition.stickiness="toNone",n.splitPosition=n.splitPosition._getTransformedByMoveOperation(e),n.splitPosition.stickiness="toNext",n.graveyardPosition?n.insertionPosition=n.insertionPosition._getTransformedByMoveOperation(e):n.insertionPosition=K.getInsertionPosition(n.splitPosition),[n]});$(K,K,(n,e,t)=>{if(n.splitPosition.isEqual(e.splitPosition)){if(!n.graveyardPosition&&!e.graveyardPosition)return[new me(0)];if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition))return[new me(0)];if(t.abRelation=="splitBefore")return n.howMany=0,n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(e),[n]}if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition)){const i=n.splitPosition.root.rootName=="$graveyard",s=e.splitPosition.root.rootName=="$graveyard";if(s&&!i||!(i&&!s)&&t.aIsStrong){const l=[];return e.howMany&&l.push(new H(e.moveTargetPosition,e.howMany,e.splitPosition,0)),n.howMany&&l.push(new H(n.splitPosition,n.howMany,n.moveTargetPosition,0)),l}else return[new me(0)]}if(n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(e)),n.splitPosition.isEqual(e.insertionPosition)&&t.abRelation=="splitBefore")return n.howMany++,[n];if(e.splitPosition.isEqual(n.insertionPosition)&&t.baRelation=="splitBefore"){const i=e.insertionPosition.path.slice();i.push(0);const s=new y(e.insertionPosition.root,i),o=new H(n.insertionPosition,1,s,0);return[n,o]}return n.splitPosition.hasSameParentAs(e.splitPosition)&&n.splitPosition.offset<e.splitPosition.offset&&(n.howMany-=e.howMany),n.splitPosition=n.splitPosition._getTransformedBySplitOperation(e),n.insertionPosition=K.getInsertionPosition(n.splitPosition),[n]});function fu(n,e){return n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function Wi(n,e){const t=[];for(let i=0;i<n.length;i++){const s=n[i],o=new H(s.start,s.end.offset-s.start.offset,e,0);t.push(o);for(let r=i+1;r<n.length;r++)n[r]=n[r]._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)[0];e=e._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)}return t}/**
|
|
452
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
453
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
454
|
-
*/class _e extends Z(y){constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new g("model-liveposition-root-not-rootelement",e);$E.call(this)}detach(){this.stopListening()}toPosition(){return new y(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}_e.prototype.is=function(n){return n==="livePosition"||n==="model:livePosition"||n=="position"||n==="model:position"};function $E(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&HE.call(this,t)},{priority:"low"})}function HE(n){const e=this.getTransformedByOperation(n);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}/**
|
|
455
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
456
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
457
|
-
*/class Pi{constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},D("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:i=!0,isUndo:s=!1,isTyping:o=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=s,this.isTyping=o}get type(){return D("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}/**
|
|
458
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
459
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
460
|
-
*/class zE{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){const t=e;switch(t.type){case"insert":{if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break}case"addAttribute":case"removeAttribute":case"changeAttribute":{for(const i of t.range.getItems({shallow:!0}))this._isInInsertedElement(i.parent)||this._markAttribute(i);break}case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const i=this._isInInsertedElement(t.sourcePosition.parent),s=this._isInInsertedElement(t.targetPosition.parent);i||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),s||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const i=b._createFromPositionAndShift(t.position,1);for(const s of this._markerCollection.getMarkersIntersectingRange(i)){const o=s.getData();this.bufferMarkerChange(s.name,o,o)}break}case"split":{const i=t.splitPosition.parent;this._isInInsertedElement(i)||this._markRemove(i,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const i=t.sourcePosition.parent;this._isInInsertedElement(i.parent)||this._markRemove(i.parent,i.startOffset,1);const s=t.graveyardPosition.parent;this._markInsert(s,t.graveyardPosition.offset,1);const o=t.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,t.targetPosition.offset,i.maxOffset);break}case"detachRoot":case"addRoot":{const i=t.affectedSelectable;if(!i._isLoaded||i.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const i=t.root.rootName;this._bufferRootAttributeChange(i,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),i.range&&i.range.root.is("rootElement")&&!i.range.root._isLoaded&&(i.range=null);let s=this._changedMarkers.get(e);s?s.newMarkerData=i:(s={newMarkerData:i,oldMarkerData:t},this._changedMarkers.set(e,s)),s.oldMarkerData.range==null&&i.range==null&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)i.oldMarkerData.range!=null&&e.push({name:t,range:i.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)i.newMarkerData.range!=null&&e.push({name:t,range:i.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this.getChanges().length||this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const i=e.range&&!t.range,s=!e.range&&t.range,o=e.range&&t.range&&!e.range.isEqual(t.range);if(i||s||o)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const i of this._changesInElement.keys()){const s=this._changesInElement.get(i).sort((u,d)=>u.offset===d.offset?u.type!=d.type?u.type=="remove"?-1:1:0:u.offset<d.offset?-1:1),o=this._elementSnapshots.get(i),r=mu(i.getChildren()),a=UE(o.length,s);let l=0,c=0;for(const u of a)if(u==="i")t.push(this._getInsertDiff(i,l,r[l])),l++;else if(u==="r")t.push(this._getRemoveDiff(i,l,o[c])),c++;else if(u==="a"){const d=r[l].attributes,h=o[c].attributes;let f;if(r[l].name=="$text")f=new b(y._createAt(i,l),y._createAt(i,l+1));else{const m=i.offsetToIndex(l);f=new b(y._createAt(i,l),y._createAt(i.getChild(m),0))}t.push(...this._getAttributesDiff(f,h,d)),l++,c++}else l++,c++}t.sort((i,s)=>i.position.root!=s.position.root?i.position.root.rootName<s.position.root.rootName?-1:1:i.position.isEqual(s.position)?i.changeCount-s.changeCount:i.position.isBefore(s.position)?-1:1);for(let i=1,s=0;i<t.length;i++){const o=t[s],r=t[i],a=o.type=="remove"&&r.type=="remove"&&o.name=="$text"&&r.name=="$text"&&o.position.isEqual(r.position),l=o.type=="insert"&&r.type=="insert"&&o.name=="$text"&&r.name=="$text"&&o.position.parent==r.position.parent&&o.position.offset+o.length==r.position.offset,c=o.type=="attribute"&&r.type=="attribute"&&o.position.parent==r.position.parent&&o.range.isFlat&&r.range.isFlat&&o.position.offset+o.length==r.position.offset&&o.attributeKey==r.attributeKey&&o.attributeOldValue==r.attributeOldValue&&o.attributeNewValue==r.attributeNewValue;a||l||c?(o.length++,c&&(o.range.end=o.range.end.getShiftedBy(1)),t[i]=null):s=i}t=t.filter(i=>i);for(const i of t)delete i.changeCount,i.type=="attribute"&&(delete i.position,delete i.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(WE),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t={...e};return t.state!==void 0&&delete t.attributes,t})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e)){this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});return}const i=this._changedRoots.get(e);i.state!==void 0?(delete i.state,i.attributes===void 0&&this._changedRoots.delete(e)):i.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,i,s){const o=this._changedRoots.get(e)||{name:e},r=o.attributes||{};if(r[t]){const a=r[t];s===a.oldValue?delete r[t]:a.newValue=s}else r[t]={oldValue:i,newValue:s};Object.entries(r).length===0?(delete o.attributes,o.state===void 0&&this._changedRoots.delete(e)):(o.attributes=r,this._changedRoots.set(e,o))}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e);const t=b._createOn(e);for(const i of this._markerCollection.getMarkersIntersectingRange(t)){const s=i.getData();this.bufferMarkerChange(i.name,s,s)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const i=t.getData();this.bufferMarkerChange(t.name,{...i,range:null},i)}}}_markInsert(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const s={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,s)}_markRemove(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const s={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,s),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let s=0;s<i.length;s++)i[s].howMany<1&&(i.splice(s,1),s--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,mu(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const s=e.offset+e.howMany,o=i.offset+i.howMany;if(e.type=="insert"&&(i.type=="insert"&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<o&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),i.type=="remove"&&e.offset<i.offset&&(i.offset+=e.howMany),i.type=="attribute")){if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<o){const r=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:s,howMany:r-i.howMany,count:this._changeCount++})}}if(e.type=="remove"){if(i.type=="insert"){if(s<=i.offset)i.offset-=e.howMany;else if(s<=o)if(e.offset<i.offset){const r=s-i.offset;i.offset=e.offset,i.howMany-=r,e.nodesToHandle-=r}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<o){const r=o-e.offset;i.howMany-=r,e.nodesToHandle-=r}}if(i.type=="remove"&&(s<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),i.type=="attribute"){if(s<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const r=s-i.offset;i.offset=e.offset,i.howMany-=r}else if(e.offset<o)if(s<=o){const r=i.howMany;i.howMany=e.offset-i.offset;const a=r-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:a,count:this._changeCount++})}else i.howMany-=o-e.offset}}if(e.type=="attribute"){if(i.type=="insert")if(e.offset<i.offset&&s>i.offset){if(s>o){const r={type:"attribute",offset:o,howMany:s-o,count:this._changeCount++};this._handleChange(r,t),t.push(r)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<o&&(s>o?(e.nodesToHandle=s-o,e.offset=o):e.nodesToHandle=0);if(i.type=="remove"&&e.offset<i.offset&&s>i.offset){const r={type:"attribute",offset:i.offset,howMany:s-i.offset,count:this._changeCount++};this._handleChange(r,t),t.push(r),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}i.type=="attribute"&&(e.offset>=i.offset&&s<=o?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&s>=o&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i){return{type:"insert",position:y._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++,_element:i.element}}_getRemoveDiff(e,t,i){return{type:"remove",position:y._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++,_element:i.element}}_getAttributesDiff(e,t,i){const s=[];i=new Map(i);for(const[o,r]of t){const a=i.has(o)?i.get(o):null;a!==r&&s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:r,attributeNewValue:a,changeCount:this._changeCount++}),i.delete(o)}for(const[o,r]of i)s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:null,attributeNewValue:r,changeCount:this._changeCount++});return s}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),s=e.startOffset;if(i){for(const o of i)if(o.type=="insert"&&s>=o.offset&&s<o.offset+o.howMany)return!0}return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const s=new b(y._createAt(e,t),y._createAt(e,t+i));for(const o of s.getItems({shallow:!0}))o.is("element")&&(this._elementSnapshots.delete(o),this._changesInElement.delete(o),this._removeAllNestedChanges(o,0,o.maxOffset))}}function mu(n){const e=[];for(const t of n)if(t.is("$text"))for(let i=0;i<t.data.length;i++)e.push({name:"$text",attributes:new Map(t.getAttributes())});else e.push({name:t.name,attributes:new Map(t.getAttributes()),element:t});return e}function UE(n,e){const t=[];let i=0,s=0;for(const o of e){if(o.offset>i){for(let r=0;r<o.offset-i;r++)t.push("e");s+=o.offset-i}if(o.type=="insert"){for(let r=0;r<o.howMany;r++)t.push("i");i=o.offset+o.howMany}else if(o.type=="remove"){for(let r=0;r<o.howMany;r++)t.push("r");i=o.offset,s+=o.howMany}else t.push(..."a".repeat(o.howMany).split("")),i=o.offset+o.howMany,s+=o.howMany}if(s<n)for(let o=0;o<n-s-i;o++)t.push("e");return t}function WE(n){const e="position"in n&&n.position.root.rootName=="$graveyard",t="range"in n&&n.range.root.rootName=="$graveyard";return!e&&!t}/**
|
|
461
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
462
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
463
|
-
*/class qE{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new g("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const i=this._operations[0];e===void 0&&(e=i.baseVersion);let s=t-1;for(const[a,l]of this._gaps)e>a&&e<l&&(e=l),s>a&&s<l&&(s=a-1);if(s<i.baseVersion||e>this.lastOperation.baseVersion)return[];let o=this._baseVersionToOperationIndex.get(e);o===void 0&&(o=0);let r=this._baseVersionToOperationIndex.get(s);return r===void 0&&(r=this._operations.length-1),this._operations.slice(o,r+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}/**
|
|
464
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
465
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
466
|
-
*/class bo extends q{constructor(e,t,i="main"){super(t),this._isAttached=!0,this._isLoaded=!0,this._document=e,this.rootName=i}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}bo.prototype.is=function(n,e){return e?e===this.name&&(n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"):n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"||n==="node"||n==="model:node"};/**
|
|
467
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
468
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
469
|
-
*/const gu="$graveyard";class jE extends Z(){constructor(e){super(),this.model=e,this.history=new qE,this.selection=new ot(this),this.roots=new Ce({idProperty:"rootName"}),this.differ=new zE(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",gu),this.listenTo(e,"applyOperation",(t,i)=>{const s=i[0];s.isDocumentOperation&&this.differ.bufferOperation(s)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,i)=>{const s=i[0];s.isDocumentOperation&&this.history.addOperation(s)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,i,s,o,r)=>{const a={...i.getData(),range:o};this.differ.bufferMarkerChange(i.name,r,a),s===null&&i.on("change",(l,c)=>{const u=i.getData();this.differ.bufferMarkerChange(i.name,{...u,range:c},u)})}),this.registerPostFixer(t=>{let i=!1;for(const s of this.roots)!s.isAttached()&&!s.isEmpty&&(t.remove(t.createRangeIn(s)),i=!0);for(const s of this.model.markers)s.getRange().root.isAttached()||(t.removeMarker(s),i=!0);return i})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(gu)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new g("model-document-createroot-name-exists",this,{name:t});const i=new bo(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(){const e=jf(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(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,s=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(s)||t.createRange(s)}_validateSelectionRange(e){return pu(e.start)&&pu(e.end)}_callPostFixers(e){let t=!1;do for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break;while(t)}}function pu(n){const e=n.textNode;if(e){const t=e.data,i=n.offset-e.startOffset;return!al(t,i)&&!ll(t,i)}return!0}/**
|
|
470
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
471
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
472
|
-
*/class GE extends Z(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof $i?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,s=!1){const o=e instanceof $i?e.name:e;if(o.includes(","))throw new g("markercollection-incorrect-marker-name",this);const r=this._markers.get(o);if(r){const c=r.getData(),u=r.getRange();let d=!1;return u.isEqual(t)||(r._attachLiveRange(He.fromRange(t)),d=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,d=!0),typeof s=="boolean"&&s!=r.affectsData&&(r._affectsData=s,d=!0),d&&this.fire(`update:${o}`,r,u,t,c),r}const a=He.fromRange(t),l=new $i(o,a,i,s);return this._markers.set(o,l),this.fire(`update:${o}`,l,null,t,{...l.getData(),range:null}),l}_remove(e){const t=e instanceof $i?e.name:e,i=this._markers.get(t);return i?(this._markers.delete(t),this.fire(`update:${t}`,i,i.getRange(),null,i.getData()),this._destroyMarker(i),!0):!1}_refresh(e){const t=e instanceof $i?e.name:e,i=this._markers.get(t);if(!i)throw new g("markercollection-refresh-marker-not-exists",this);const s=i.getRange();this.fire(`update:${t}`,i,s,s,i.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class $i extends Z(Ut){constructor(e,t,i,s){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=s}get managedUsingOperations(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}$i.prototype.is=function(n){return n==="marker"||n==="model:marker"};/**
|
|
473
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
474
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
475
|
-
*/class KE extends We{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new g("detach-operation-on-document-node",this)}_execute(){tg(b._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}/**
|
|
476
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
477
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
478
|
-
*/class Ct extends Ut{constructor(e){super(),this.markers=new Map,this._children=new Mn,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(q.fromJSON(i)):t.push(G.fromJSON(i));return new Ct(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=ZE(t);for(const s of i)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const s of i)s.parent=null;return i}}Ct.prototype.is=function(n){return n==="documentFragment"||n==="model:documentFragment"};function ZE(n){return typeof n=="string"?[new G(n)]:(Ue(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new G(e):e instanceof it?new G(e.data,e.getAttributes()):e))}/**
|
|
479
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
480
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
481
|
-
*/class JE{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new G(e,t)}createElement(e,t){return new q(e,t)}createDocumentFragment(){return new Ct}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof G&&e.data=="")return;const s=y._createAt(t,i);if(e.parent)if(_u(e.root,s.root)){this.move(b._createOn(e),s);return}else{if(e.root.document)throw new g("model-writer-insert-forbidden-move",this);this.remove(e)}const o=s.root.document?s.root.document.version:null,r=new be(s,e,o);if(e instanceof G&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof Ct)for(const[a,l]of e.markers){const c=y._createAt(l.root,0),d={range:new b(l.start._getCombined(c,s),l.end._getCombined(c,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(a)?this.updateMarker(a,d):this.addMarker(a,d)}}insertText(e,t,i,s){t instanceof Ct||t instanceof q||t instanceof y?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,s)}insertElement(e,t,i,s){t instanceof Ct||t instanceof q||t instanceof y?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 Ct||t instanceof q?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof Ct||t instanceof q?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof b){const s=i.getMinimalFlatRanges();for(const o of s)wu(this,e,t,o)}else bu(this,e,t,i)}setAttributes(e,t){for(const[i,s]of pt(e))this.setAttribute(i,s,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof b){const i=t.getMinimalFlatRanges();for(const s of i)wu(this,e,null,s)}else bu(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=i=>{for(const s of i.getAttributeKeys())this.removeAttribute(s,i)};if(!(e instanceof b))t(e);else for(const i of e.getItems())t(i)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof b))throw new g("writer-move-invalid-range",this);if(!e.isFlat)throw new g("writer-move-range-not-flat",this);const s=y._createAt(t,i);if(s.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!_u(e.root,s.root))throw new g("writer-move-different-document",this);const o=e.root.document?e.root.document.version:null,r=new H(e.start,e.end.offset-e.start.offset,s,o);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const i=(e instanceof b?e:b._createOn(e)).getMinimalFlatRanges().reverse();for(const s of i)this._addOperationForAffectedMarkers("move",s),YE(s.start,s.end.offset-s.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof q))throw new g("writer-merge-no-element-before",this);if(!(i instanceof q))throw new g("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(b._createIn(i),y._createAt(t,"end")),this.remove(i)}_merge(e){const t=y._createAt(e.nodeBefore,"end"),i=y._createAt(e.nodeAfter,0),s=e.root.document.graveyard,o=new y(s,[0]),r=e.root.document.version,a=new le(i,e.nodeAfter.maxOffset,t,o,r);this.batch.addOperation(a),this.model.applyOperation(a)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof q))throw new g("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,s=new Me(y._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 g("writer-split-element-no-parent",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new g("writer-split-invalid-limit-element",this);let s,o;do{const r=i.root.document?i.root.document.version:null,a=i.maxOffset-e.offset,l=K.getInsertionPosition(e),c=new K(e,a,l,null,r);this.batch.addOperation(c),this.model.applyOperation(c),!s&&!o&&(s=i,o=e.parent.nextSibling),e=this.createPositionAfter(e.parent),i=e.parent}while(i!==t);return{position:e,range:new b(y._createAt(s,"end"),y._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new g("writer-wrap-range-not-flat",this);const i=t instanceof q?t:new q(t);if(i.childCount>0)throw new g("writer-wrap-element-not-empty",this);if(i.parent!==null)throw new g("writer-wrap-element-attached",this);this.insert(i,e.start);const s=new b(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(s,y._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new g("writer-unwrap-element-no-parent",this);this.move(b._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!="boolean")throw new g("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,s=t.range,o=t.affectsData===void 0?!1:t.affectsData;if(this.model.markers.has(e))throw new g("writer-addmarker-marker-exists",this);if(!s)throw new g("writer-addmarker-no-range",this);return i?(_n(this,e,null,s,o),this.model.markers.get(e)):this.model.markers._set(e,s,i,o)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i=typeof e=="string"?e:e.name,s=this.model.markers.get(i);if(!s)throw new g("writer-updatemarker-marker-not-exists",this);if(!t){D("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),this.model.markers._refresh(s);return}const o=typeof t.usingOperation=="boolean",r=typeof t.affectsData=="boolean",a=r?t.affectsData:s.affectsData;if(!o&&!t.range&&!r)throw new g("writer-updatemarker-wrong-options",this);const l=s.getRange(),c=t.range?t.range:l;if(o&&t.usingOperation!==s.managedUsingOperations){t.usingOperation?_n(this,i,null,c,a):(_n(this,i,l,null,a),this.model.markers._set(i,c,void 0,a));return}s.managedUsingOperations?_n(this,i,l,c,a):this.model.markers._set(i,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new g("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations){this.model.markers._remove(t);return}const s=i.getRange();_n(this,t,s,null,i.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new g("writer-addroot-root-exists",this);const s=this.model.document,o=new ft(e,t,!0,s,s.version);return this.batch.addOperation(o),this.model.applyOperation(o),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new g("writer-detachroot-no-root",this);for(const o of this.model.markers)o.getRange().root===t&&this.removeMarker(o);for(const o of t.getAttributeKeys())this.removeAttribute(o,t);this.remove(this.createRangeIn(t));const i=this.model.document,s=new ft(t.rootName,t.name,!1,i,i.version);this.batch.addOperation(s),this.model.applyOperation(s)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._setSelectionAttribute(e,t);else for(const[i,s]of pt(e))this._setSelectionAttribute(i,s)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const s=ot._getStoreAttributeKey(e);this.setAttribute(s,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=ot._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new g("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const s=i.getRange();let o=!1;if(e==="move"){const r=t;o=r.containsPosition(s.start)||r.start.isEqual(s.start)||r.containsPosition(s.end)||r.end.isEqual(s.end)}else{const r=t,a=r.nodeBefore,l=r.nodeAfter,c=s.start.parent==a&&s.start.isAtEnd,u=s.end.parent==l&&s.end.offset==0,d=s.end.nodeAfter==l,h=s.start.nodeAfter==l;o=c||u||d||h}o&&this.updateMarker(i.name,{range:s})}}}function wu(n,e,t,i){const s=n.model,o=s.document;let r=i.start,a,l,c;for(const d of i.getWalker({shallow:!0}))c=d.item.getAttribute(e),a&&l!=c&&(l!=t&&u(),r=a),a=d.nextPosition,l=c;a instanceof y&&a!=r&&l!=t&&u();function u(){const d=new b(r,a),h=d.root.document?o.version:null,f=new ue(d,e,l,t,h);n.batch.addOperation(f),s.applyOperation(f)}}function bu(n,e,t,i){const s=n.model,o=s.document,r=i.getAttribute(e);let a,l;if(r!=t){if(i.root===i){const u=i.document?o.version:null;l=new St(i,e,r,t,u)}else{a=new b(y._createBefore(i),n.createPositionAfter(i));const u=a.root.document?o.version:null;l=new ue(a,e,r,t,u)}n.batch.addOperation(l),s.applyOperation(l)}}function _n(n,e,t,i,s){const o=n.model,r=o.document,a=new Be(e,t,i,o.markers,!!s,r.version);n.batch.addOperation(a),o.applyOperation(a)}function YE(n,e,t,i){let s;if(n.root.document){const o=i.document,r=new y(o.graveyard,[0]);s=new H(n,e,r,o.version)}else s=new KE(n,e);t.addOperation(s),i.applyOperation(s)}function _u(n,e){return n===e||n instanceof bo&&e instanceof bo}/**
|
|
482
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
483
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
484
|
-
*/function QE(n,e,t={}){if(e.isCollapsed)return;const i=e.getFirstRange();if(i.root.rootName=="$graveyard")return;const s=n.schema;n.change(o=>{if(!t.doNotResetEntireContent&&aT(s,e)){rT(o,e);return}const r={};if(!t.doNotAutoparagraph){const c=e.getSelectedElement();c&&Object.assign(r,s.getAttributesWithProperty(c,"copyOnReplace",!0))}const[a,l]=XE(i);a.isTouching(l)||o.remove(o.createRange(a,l)),t.leaveUnmerged||(tT(o,a,l),s.removeDisallowedAttributes(a.parent.getChildren(),o)),lg(o,e,a),!t.doNotAutoparagraph&&sT(s,a)&&ag(o,a,e,r),a.detach(),l.detach()})}function XE(n){const e=n.root.document.model,t=n.start;let i=n.end;if(e.hasContent(n,{ignoreMarkers:!0})){const s=eT(i);if(s&&i.isTouching(e.createPositionAt(s,0))){const o=e.createSelection(n);e.modifySelection(o,{direction:"backward"});const r=o.getLastPosition(),a=e.createRange(r,i);e.hasContent(a,{ignoreMarkers:!0})||(i=r)}}return[_e.fromPosition(t,"toPrevious"),_e.fromPosition(i,"toNext")]}function eT(n){const e=n.parent,t=e.root.document.model.schema,i=e.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of i){if(t.isLimit(s))return null;if(t.isBlock(s))return s}}function tT(n,e,t){const i=n.model;if(!wl(n.model.schema,e,t))return;const[s,o]=nT(e,t);!s||!o||(!i.hasContent(s,{ignoreMarkers:!0})&&i.hasContent(o,{ignoreMarkers:!0})?rg(n,e,t,s.parent):og(n,e,t,s.parent))}function og(n,e,t,i){const s=e.parent,o=t.parent;if(!(s==i||o==i)){for(e=n.createPositionAfter(s),t=n.createPositionBefore(o),t.isEqual(e)||n.insert(o,e),n.merge(e);t.parent.isEmpty;){const r=t.parent;t=n.createPositionBefore(r),n.remove(r)}wl(n.model.schema,e,t)&&og(n,e,t,i)}}function rg(n,e,t,i){const s=e.parent,o=t.parent;if(!(s==i||o==i)){for(e=n.createPositionAfter(s),t=n.createPositionBefore(o),t.isEqual(e)||n.insert(s,t);e.parent.isEmpty;){const r=e.parent;e=n.createPositionBefore(r),n.remove(r)}t=n.createPositionBefore(o),iT(n,t),wl(n.model.schema,e,t)&&rg(n,e,t,i)}}function iT(n,e){const t=e.nodeBefore,i=e.nodeAfter;t.name!=i.name&&n.rename(t,i.name),n.clearAttributes(t),n.setAttributes(Object.fromEntries(i.getAttributes()),t),n.merge(e)}function wl(n,e,t){const i=e.parent,s=t.parent;return i==s||n.isLimit(i)||n.isLimit(s)?!1:oT(e,t,n)}function nT(n,e){const t=n.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]&&t[s]==i[s];)s++;return[t[s],i[s]]}function sT(n,e){const t=n.checkChild(e,"$text"),i=n.checkChild(e,"paragraph");return!t&&i}function oT(n,e,t){const i=new b(n,e);for(const s of i.getWalker())if(t.isLimit(s.item))return!1;return!0}function ag(n,e,t,i={}){const s=n.createElement("paragraph");n.model.schema.setAllowedAttributes(s,i,n),n.insert(s,e),lg(n,t,n.createPositionAt(s,0))}function rT(n,e){const t=n.model.schema.getLimitElement(e);n.remove(n.createRangeIn(t)),ag(n,n.createPositionAt(t,0),e)}function aT(n,e){const t=n.getLimitElement(e);if(!e.containsEntireContent(t))return!1;const i=e.getFirstRange();return i.start.parent==i.end.parent?!1:n.checkChild(t,"paragraph")}function lg(n,e,t){e instanceof ot?n.setSelection(t):e.setTo(t)}/**
|
|
485
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
486
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
487
|
-
*/function lT(n,e){return n.change(t=>{const i=t.createDocumentFragment(),s=e.getFirstRange();if(!s||s.isCollapsed)return i;const o=s.start.root,r=s.start.getCommonPath(s.end),a=o.getNodeByPath(r);let l;s.start.parent==s.end.parent?l=s:l=t.createRange(t.createPositionAt(a,s.start.path[r.length]),t.createPositionAt(a,s.end.path[r.length]+1));const c=l.end.offset-l.start.offset;for(const u of l.getItems({shallow:!0}))u.is("$textProxy")?t.appendText(u.data,u.getAttributes(),i):t.append(t.cloneElement(u,!0),i);if(l!=s){const u=s._getTransformedByMove(l.start,t.createPositionAt(i,0),c)[0],d=t.createRange(t.createPositionAt(i,0),u.start),h=t.createRange(u.end,t.createPositionAt(i,"end"));vu(h,t),vu(d,t)}return i})}function vu(n,e){const t=[];Array.from(n.getItems({direction:"backward"})).map(i=>e.createRangeOn(i)).filter(i=>(i.start.isAfter(n.start)||i.start.isEqual(n.start))&&(i.end.isBefore(n.end)||i.end.isEqual(n.end))).forEach(i=>{t.push(i.start.parent),e.remove(i)}),t.forEach(i=>{let s=i;for(;s.parent&&s.isEmpty;){const o=e.createRangeOn(s);s=s.parent,e.remove(o)}})}/**
|
|
488
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
489
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
490
|
-
*/function cT(n,e,t){return n.change(i=>{const s=t||n.document.selection;s.isCollapsed||n.deleteContent(s,{doNotAutoparagraph:!0});const o=new uT(n,i,s.anchor),r=[];let a;if(e.is("documentFragment")){if(e.markers.size){const u=[];for(const[d,h]of e.markers){const{start:f,end:m}=h,p=f.isEqual(m);u.push({position:f,name:d,isCollapsed:p},{position:m,name:d,isCollapsed:p})}u.sort(({position:d},{position:h})=>d.isBefore(h)?1:-1);for(const{position:d,name:h,isCollapsed:f}of u){let m=null,p=null;const _=d.parent===e&&d.isAtStart,k=d.parent===e&&d.isAtEnd;!_&&!k?(m=i.createElement("$marker"),i.insert(m,d)):f&&(p=_?"start":"end"),r.push({name:h,element:m,collapsed:p})}}a=e.getChildren()}else a=[e];o.handleNodes(a);let l=o.getSelectionRange();if(e.is("documentFragment")&&r.length){const u=l?He.fromRange(l):null,d={};for(let h=r.length-1;h>=0;h--){const{name:f,element:m,collapsed:p}=r[h],_=!d[f];if(_&&(d[f]=[]),m){const k=i.createPositionAt(m,"before");d[f].push(k),i.remove(m)}else{const k=o.getAffectedRange();if(!k){p&&d[f].push(o.position);continue}p?d[f].push(k[p]):d[f].push(_?k.start:k.end)}}for(const[h,[f,m]]of Object.entries(d))f&&m&&f.root===m.root&&f.root.document&&!i.model.markers.has(h)&&i.addMarker(h,{usingOperation:!0,affectsData:!0,range:new b(f,m)});u&&(l=u.toRange(),u.detach())}/* istanbul ignore else -- @preserve */l&&(s instanceof ot?i.setSelection(l):s.setTo(l));const c=o.getAffectedRange()||n.createRange(s.anchor);return o.destroy(),c})}class uT{constructor(e,t,i){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){this._lastNode=e;/* istanbul ignore if -- @preserve */if(this.position.parent!=e||!this.position.isAtEnd)throw new g("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?b._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new b(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(this.schema.isObject(e)){this._handleObject(e);return}let t=this._checkAndAutoParagraphToAllowedPosition(e);if(!t&&(t=this._checkAndSplitToAllowedPosition(e),!t)){this._handleDisallowedNode(e);return}this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=_e.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){/* istanbul ignore if -- @preserve */if(!this.schema.checkChild(this.position,e))throw new g("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=_e.fromPosition(e,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=_e.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof q)||!this._canMergeLeft(e))return;const t=_e._createBefore(e);t.stickiness="toNext";const i=_e.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=_e._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=_e._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof q)||!this._canMergeRight(e))return;const t=_e._createAfter(e);t.stickiness="toNext";/* istanbul ignore if -- @preserve */if(!this.position.isEqual(t))throw new g("insertcontent-invalid-insertion-position",this);this.position=y._createAt(t.nodeBefore,"end");const i=_e.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=_e._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=_e._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof q&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof q&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!0}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const i=this.position.parent;this.position=this.writer.createPositionBefore(i),i.isEmpty&&i.parent===t&&this.writer.remove(i)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const i=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=i,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}/**
|
|
491
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
492
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
493
|
-
*/function dT(n,e,t,i={}){if(!n.schema.isObject(e))throw new g("insertobject-element-not-an-object",n,{object:e});const s=t||n.document.selection;let o=s;i.findOptimalPosition&&n.schema.isBlock(e)&&(o=n.createSelection(n.schema.findOptimalInsertionRange(s,i.findOptimalPosition)));const r=J(s.getSelectedBlocks()),a={};return r&&Object.assign(a,n.schema.getAttributesWithProperty(r,"copyOnReplace",!0)),n.change(l=>{o.isCollapsed||n.deleteContent(o,{doNotAutoparagraph:!0});let c=e;const u=o.anchor.parent;!n.schema.checkChild(u,e)&&n.schema.checkChild(u,"paragraph")&&n.schema.checkChild("paragraph",e)&&(c=l.createElement("paragraph"),l.insert(e,c)),n.schema.setAllowedAttributes(c,a,l);const d=n.insertContent(c,o);return d.isCollapsed||i.setSelection&&hT(l,e,i.setSelection,a),d})}function hT(n,e,t,i){const s=n.model;if(t=="on"){n.setSelection(e,"on");return}if(t!="after")throw new g("insertobject-invalid-place-parameter-value",s);let o=e.nextSibling;if(s.schema.isInline(e)){n.setSelection(e,"after");return}!(o&&s.schema.checkChild(o,"$text"))&&s.schema.checkChild(e.parent,"paragraph")&&(o=n.createElement("paragraph"),s.schema.setAllowedAttributes(o,i,n),s.insertContent(o,n.createPositionAfter(e))),o&&n.setSelection(o,0)}/**
|
|
494
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
495
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
496
|
-
*/const fT=' ,.?!:;"-()';function mT(n,e,t={}){const i=n.schema,s=t.direction!="backward",o=t.unit?t.unit:"character",r=!!t.treatEmojiAsSingleUnit,a=e.focus,l=new Tt({boundaries:bT(a,s),singleCharacters:!0,direction:s?"forward":"backward"}),c={walker:l,schema:i,isForward:s,unit:o,treatEmojiAsSingleUnit:r};let u;for(;u=l.next();){if(u.done)return;const d=gT(c,u.value);if(d){e instanceof ot?n.change(h=>{h.setSelectionFocus(d)}):e.setFocus(d);return}}}function gT(n,e){const{isForward:t,walker:i,unit:s,schema:o,treatEmojiAsSingleUnit:r}=n,{type:a,item:l,nextPosition:c}=e;if(a=="text")return n.unit==="word"?wT(i,t):pT(i,s,r);if(a==(t?"elementStart":"elementEnd")){if(o.isSelectable(l))return y._createAt(l,t?"after":"before");if(o.checkChild(c,"$text"))return c}else{if(o.isLimit(l)){i.skip(()=>!0);return}if(o.checkChild(c,"$text"))return c}}function pT(n,e,t){const i=n.position.textNode;if(i){const s=i.data;let o=n.position.offset-i.startOffset;for(;al(s,o)||e=="character"&&ll(s,o)||t&&mm(s,o);)n.next(),o=n.position.offset-i.startOffset}return n.position}function wT(n,e){let t=n.position.textNode;for(t||(t=e?n.position.nodeAfter:n.position.nodeBefore);t&&t.is("$text");){const i=n.position.offset-t.startOffset;if(vT(t,i,e))t=e?n.position.nodeAfter:n.position.nodeBefore;else{if(_T(t.data,i,e))break;n.next()}}return n.position}function bT(n,e){const t=n.root,i=y._createAt(t,e?"end":0);return e?new b(n,i):new b(i,n)}function _T(n,e,t){const i=e+(t?0:-1);return fT.includes(n.charAt(i))}function vT(n,e,t){return e===(t?n.offsetSize:0)}/**
|
|
497
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
498
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
499
|
-
*/let yT=class extends W(){constructor(){super(),this.markers=new GE,this.document=new jE(this),this.schema=new lE,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if(t.name==="$marker")return!0}),X5(this),this.document.registerPostFixer(Km),this.on("insertContent",(e,[t,i])=>{e.return=cT(this,t,i)}),this.on("insertObject",(e,[t,i,s])=>{e.return=dT(this,t,i,s)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new Pi,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){/* istanbul ignore next -- @preserve */g.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){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(i,this)}}applyOperation(e){e._execute()}insertContent(e,t,i,...s){const o=_r(t,i);return this.fire("insertContent",[e,o,i,...s])}insertObject(e,t,i,s,...o){const r=_r(t,i);return this.fire("insertObject",[e,r,s,s,...o])}deleteContent(e,t){QE(this,e,t)}modifySelection(e,t){mT(this,e,t)}getSelectedContent(e){return lT(this,e)}hasContent(e,t={}){const i=e instanceof b?e:b._createIn(e);if(i.isCollapsed)return!1;const{ignoreWhitespaces:s=!1,ignoreMarkers:o=!1}=t;if(!o){for(const r of this.markers.getMarkersIntersectingRange(i))if(r.affectsData)return!0}for(const r of i.getItems())if(this.schema.isContent(r))if(r.is("$textProxy"))if(s){if(r.data.search(/\S/)!==-1)return!0}else return!0;else return!0;return!1}canEditAt(e){const t=_r(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new y(e,t,i)}createPositionAt(e,t){return y._createAt(e,t)}createPositionAfter(e){return y._createAfter(e)}createPositionBefore(e){return y._createBefore(e)}createRange(e,t){return new b(e,t)}createRangeIn(e){return b._createIn(e)}createRangeOn(e){return b._createOn(e)}createSelection(...e){return new Ne(...e)}createBatch(e){return new Pi(e)}createOperationFromJSON(e){return ME.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new JE(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}};function _r(n,e){if(n)return n instanceof Ne||n instanceof ot?n:n instanceof _i?e||e===0?new Ne(n,e):n.is("rootElement")?new Ne(n,"in"):new Ne(n,"on"):new Ne(n)}/**
|
|
500
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
501
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
502
|
-
*/class kT extends zt{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
503
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
504
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
505
|
-
*/class Ko extends zt{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
506
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
507
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
508
|
-
*/class vi{constructor(e){this.document=e}createDocumentFragment(e){return new ni(this.document,e)}createElement(e,t,i){return new st(this.document,e,t,i)}createText(e){return new ne(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const s=i.getChildIndex(e);return this.removeChildren(s,1,i),this.insertChild(s,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new st(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){Ve(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return E._createAt(e,t)}createPositionAfter(e){return E._createAfter(e)}createPositionBefore(e){return E._createBefore(e)}createRange(e,t){return new O(e,t)}createRangeOn(e){return O._createOn(e)}createRangeIn(e){return O._createIn(e)}createSelection(...e){return new At(...e)}}/**
|
|
509
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
510
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
511
|
-
*/const CT=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,ET=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,TT=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,AT=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,ST=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,xT=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,IT=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function PT(n){return n.startsWith("#")?CT.test(n):n.startsWith("rgb")?ET.test(n)||TT.test(n):n.startsWith("hsl")?AT.test(n)||ST.test(n):IT.has(n.toLowerCase())}const RT=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function VT(n){return RT.test(n)}const BT=/^[+-]?[0-9]*([.][0-9]+)?%$/;function MT(n){return BT.test(n)}const LT=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function OT(n){return LT.includes(n)}const FT=["center","top","bottom","left","right"];function DT(n){return FT.includes(n)}const NT=["fixed","scroll","local"];function $T(n){return NT.includes(n)}const HT=/^url\(/;function zT(n){return HT.test(n)}function UT(n=""){if(n==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const e=cg(n),t=e[0],i=e[2]||t,s=e[1]||t,o=e[3]||s;return{top:t,bottom:i,right:s,left:o}}function WT(n){return e=>{const{top:t,right:i,bottom:s,left:o}=e,r=[];return[t,i,o,s].every(a=>!!a)?r.push([n,qT(e)]):(t&&r.push([n+"-top",t]),i&&r.push([n+"-right",i]),s&&r.push([n+"-bottom",s]),o&&r.push([n+"-left",o])),r}}function qT({top:n,right:e,bottom:t,left:i}){const s=[];return i!==e?s.push(n,e,t,i):t!==n?s.push(n,e,t):e!==n?s.push(n,e):s.push(n),s.join(" ")}function jT(n){return e=>({path:n,value:UT(e)})}function cg(n){const e=n.matchAll(xT);return Array.from(e).map(t=>t[0])}/**
|
|
512
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
513
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
514
|
-
*/function GT(n){n.setNormalizer("background",KT()),n.setNormalizer("background-color",ZT()),n.setReducer("background",JT()),n.setStyleRelation("background",["background-color"])}function KT(){return n=>{const e={},t=cg(n);for(const i of t)OT(i)?(e.repeat=e.repeat||[],e.repeat.push(i)):DT(i)?(e.position=e.position||[],e.position.push(i)):$T(i)?e.attachment=i:PT(i)?e.color=i:zT(i)&&(e.image=i);return{path:"background",value:e}}}function ZT(){return n=>({path:"background.color",value:n})}function JT(){return n=>{const e=[];return e.push(["background-color",n.color]),e}}/**
|
|
515
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
516
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
517
|
-
*/function YT(n){n.setNormalizer("margin",jT("margin")),n.setNormalizer("margin-top",e=>({path:"margin.top",value:e})),n.setNormalizer("margin-right",e=>({path:"margin.right",value:e})),n.setNormalizer("margin-bottom",e=>({path:"margin.bottom",value:e})),n.setNormalizer("margin-left",e=>({path:"margin.left",value:e})),n.setReducer("margin",WT("margin")),n.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}/**
|
|
518
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
519
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
520
|
-
*/class QT{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new g("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}/**
|
|
521
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
522
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
523
|
-
*/class XT extends oe{constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){const s=t;t=(o,r)=>{this.editor.execute(s),r()}}super.set(e,t,i)}}/**
|
|
524
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
525
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
526
|
-
*/const vr="contentEditing",yu="common";class eA{constructor(e){this.keystrokeInfos=new Map,this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:vr,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const 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:yu}),s&&s.forEach(o=>{this.addKeystrokeInfoGroup({categoryId:e,...o})})}addKeystrokeInfoGroup({categoryId:e=vr,id:t,label:i,keystrokes:s}){const o=this.keystrokeInfos.get(e);if(!o)throw new g("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});o.groups.set(t,{id:t,label:i,keystrokes:s||[]})}addKeystrokeInfos({categoryId:e=vr,groupId:t=yu,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new g("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const s=this.keystrokeInfos.get(e);if(!s.groups.has(t))throw new g("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});s.groups.get(t).keystrokes.push(...i)}}/**
|
|
527
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
528
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
529
|
-
*/class tA extends W(){constructor(e={}){super();const t=this.constructor,{translations:i,...s}=t.defaultConfig||{},{translations:o=i,...r}=e,a=e.language||s.language;this._context=e.context||new pm({language:a,translations:o}),this._context._addEditor(this,!e.context);const l=Array.from(t.builtinPlugins||[]);this.config=new tm(r,s),this.config.define("plugins",l),this.config.define(this._context._getEditorConfig()),this.plugins=new gm(this,l,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new QT,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new yT,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const c=new aC;this.data=new PE(this.model,c),this.editing=new oE(this.model,c),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new VE([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 XT(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new eA(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new g("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new g("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 g("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)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],o=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(s),i,o)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(i){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}/**
|
|
530
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
531
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
532
|
-
*/function iA(n){if(!ai(n.updateSourceElement))throw new g("attachtoform-missing-elementapi-interface",n);const e=n.sourceElement;if(nA(e)&&e.form){let t;const i=e.form,s=()=>n.updateSourceElement();ai(i.submit)&&(t=i.submit,i.submit=()=>{s(),t.apply(i)}),i.addEventListener("submit",s),n.on("destroy",()=>{i.removeEventListener("submit",s),t&&(i.submit=t)})}}function nA(n){return!!n&&n.tagName.toLowerCase()==="textarea"}/**
|
|
533
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
534
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
535
|
-
*/function ha(n){class e extends n{updateSourceElement(i){if(!this.sourceElement)throw new g("editor-missing-sourceelement",this);const s=this.config.get("updateSourceElementOnDestroy"),o=this.sourceElement instanceof HTMLTextAreaElement;if(!s&&!o){xc(this.sourceElement,"");return}const r=typeof i=="string"?i:this.data.get();xc(this.sourceElement,r)}}return e}ha.updateSourceElement=ha(Object).prototype.updateSourceElement;/**
|
|
536
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
537
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
538
|
-
*/class _o extends wm{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Ce({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new g("pendingactions-add-invalid-message",this);const t=new(W());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]()}}const sA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',oA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',rA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',aA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',lA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',cA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',uA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1z"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052z"/><path d="M11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',dA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',hA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z"/></svg>',fA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/></svg>',mA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',gA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',pA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1l4.16-4.482ZM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1h15.6Zm-5.655 6a2.128 2.128 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7Z"/></svg>',wA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/></svg>',bA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.723 2.805a2.094 2.094 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.133 2.133 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path clip-rule="evenodd" d="M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.843.843 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.844.844 0 0 1 .247.597Zm-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z"/></svg>',_A='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.401 5.401 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023c.449.131.887.32 1.307.573l.058.033c.046.028.09.057.135.086V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.118 2.118 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978Z"/><path d="M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.647.647 0 0 0-.096.492.664.664 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.741 1.741 0 0 1 2.478-.463 1.869 1.869 0 0 1 .476 2.55.637.637 0 0 0-.071.5.646.646 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.228 3.228 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.626.626 0 0 0 .092-.475.638.638 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.741 1.741 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.647.647 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.609.609 0 0 0-.845.17Z"/><path d="M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236l1.268-1.907Z"/></svg>',vA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',yA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',kA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',CA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',EA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',TA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',AA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',SA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',xA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',IA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',PA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',RA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',VA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',BA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',MA='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',LA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2ZM13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7h11Z"/></svg>',OA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2ZM7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11h5Z"/></svg>',FA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2ZM10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9h8Z"/></svg>',DA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',NA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',$A='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',HA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',zA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',UA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',WA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',qA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',jA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',GA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',KA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',ZA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',JA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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.75zm-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.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-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.75z"/></svg>',YA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 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-.75z"/></svg>',QA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',XA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',eS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',tS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 9v10h-2v-8h-2V9h4zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1v4.5z"/></svg>',iS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z"/></svg>',nS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z"/></svg>',sS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z"/></svg>',oS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z"/></svg>',rS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z"/></svg>',aS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',lS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',cS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.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>',uS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.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>',dS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>';/**
|
|
539
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
540
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
541
|
-
*/const P={bold:UA,cancel:sA,caption:oA,check:rA,cog:aA,colorPalette:lA,eraser:cA,history:uA,image:pA,imageUpload:wA,imageAssetManager:bA,imageUrl:_A,lowVision:dA,textAlternative:hA,loupe:fA,previousArrow:mA,nextArrow:gA,importExport:GA,paragraph:WA,plus:qA,text:jA,alignBottom:vA,alignMiddle:yA,alignTop:kA,alignLeft:CA,alignCenter:EA,alignRight:TA,alignJustify:AA,objectLeft:VA,objectCenter:xA,objectRight:BA,objectFullWidth:PA,objectInline:RA,objectBlockLeft:SA,objectBlockRight:IA,objectSizeFull:MA,objectSizeLarge:LA,objectSizeSmall:OA,objectSizeMedium:FA,pencil:DA,pilcrow:NA,quote:$A,threeVerticalDots:HA,dragIndicator:zA,redo:KA,undo:ZA,bulletedList:JA,numberedList:YA,todoList:QA,codeBlock:XA,browseFiles:eS,heading1:tS,heading2:iS,heading3:nS,heading4:sS,heading5:oS,heading6:rS,horizontalLine:aS,html:lS,indent:cS,outdent:uS,table:dS};/**
|
|
542
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
543
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
544
|
-
*/class xe extends Ce{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(t,i,s)=>{this._renderViewIntoCollectionParent(i,s)}),this.on("remove",(t,i)=>{i.element&&this._parentElement&&i.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!hS(e))throw new g("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const s of e)i.delegate(s).to(t);this.on("add",(i,s)=>{for(const o of e)s.delegate(o).to(t)}),this.on("remove",(i,s)=>{for(const o of e)s.stopDelegating(o,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 hS(n){return n.every(e=>typeof e=="string")}/**
|
|
545
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
546
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
547
|
-
*/const fS="http://www.w3.org/1999/xhtml";class Le extends Z(){constructor(e){super(),Object.assign(this,Cu(ku(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=Au(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new g("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(const i of t.children)vo(i)?yield i:bl(i)&&(yield*e(i))}yield*e(this)}static bind(e,t){return{to(i,s){return new mS({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:s})},if(i,s,o){return new ug({observable:e,emitter:t,attribute:i,valueIfTrue:s,callback:o})}}}static extend(e,t){if(e._isRendered)throw new g("template-extend-render",[this,e]);mg(e,Cu(ku(t)))}_renderNode(e){let t;if(e.node?t=this.tag&&this.text:t=this.tag?this.text:!this.text,t)throw new g("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||fS,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(""),eo(this.text)?this._bindToObservable({schema:this.text,updater:pS(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,i=e.revertData;for(const s in this.attributes){const o=t.getAttribute(s),r=this.attributes[s];i&&(i.attributes[s]=o);const a=Tu(r)?r[0].ns:null;if(eo(r)){const l=Tu(r)?r[0].value:r;i&&Su(s)&&l.unshift(o),this._bindToObservable({schema:l,updater:wS(t,s,a),data:e})}else if(s=="style"&&typeof r[0]!="string")this._renderStyleAttribute(r[0],e);else{i&&o&&Su(s)&&r.unshift(o);const l=r.map(c=>c&&(c.value||c)).reduce((c,u)=>c.concat(u),[]).reduce(fg,"");Yi(l)||t.setAttributeNS(a,s,l)}}}_renderStyleAttribute(e,t){const i=t.node;for(const s in e){const o=e[s];eo(o)?this._bindToObservable({schema:[o],updater:bS(i,s),data:t}):i.style[s]=o}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,s=e.isApplying;let o=0;for(const r of this.children)if(_l(r)){if(!s){r.setParent(t);for(const a of r)i.appendChild(a.element)}}else if(vo(r))s||(r.isRendered||r.render(),i.appendChild(r.element));else if(Dt(r))i.appendChild(r);else if(s){const a=e.revertData,l=Au();a.children.push(l),r._renderNode({intoFragment:!1,node:i.childNodes[o++],isApplying:!0,revertData:l})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(s=>{const[o,r]=t.split("@");return s.activateDomEventListener(o,r,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const s=i.revertData;dg(e,t,i);const o=e.filter(r=>!Yi(r)).filter(r=>r.observable).map(r=>r.activateAttributeListener(e,t,i));s&&s.bindings.push(o)}_revertTemplateFromNode(e,t){for(const s of t.bindings)for(const o of s)o();if(t.text){e.textContent=t.text;return}const i=e;for(const s in t.attributes){const o=t.attributes[s];o===null?i.removeAttribute(s):i.setAttribute(s,o)}for(let s=0;s<t.children.length;++s)this._revertTemplateFromNode(i.childNodes[s],t.children[s])}}class fs{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const s=()=>dg(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class mS extends fs{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,i){const s=(o,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)}}}class ug extends fs{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return Yi(t)?!1:this.valueIfTrue||!0}}function eo(n){return n?(n.value&&(n=n.value),Array.isArray(n)?n.some(eo):n instanceof fs):!1}function gS(n,e){return n.map(t=>t instanceof fs?t.getValue(e):t)}function dg(n,e,{node:t}){const i=gS(n,t);let s;n.length==1&&n[0]instanceof ug?s=i[0]:s=i.reduce(fg,""),Yi(s)?e.remove():e.set(s)}function pS(n){return{set(e){n.textContent=e},remove(){n.textContent=""}}}function wS(n,e,t){return{set(i){n.setAttributeNS(t,e,i)},remove(){n.removeAttributeNS(t,e)}}}function bS(n,e){return{set(t){n.style[e]=t},remove(){n.style[e]=null}}}function ku(n){return tl(n,t=>{if(t&&(t instanceof fs||bl(t)||vo(t)||_l(t)))return t})}function Cu(n){if(typeof n=="string"?n=yS(n):n.text&&kS(n),n.on&&(n.eventListeners=vS(n.on),delete n.on),!n.text){n.attributes&&_S(n.attributes);const e=[];if(n.children)if(_l(n.children))e.push(n.children);else for(const t of n.children)bl(t)||vo(t)||Dt(t)?e.push(t):e.push(new Le(t));n.children=e}return n}function _S(n){for(const e in n)n[e].value&&(n[e].value=z(n[e].value)),hg(n,e)}function vS(n){for(const e in n)hg(n,e);return n}function yS(n){return{text:[n]}}function kS(n){n.text=z(n.text)}function hg(n,e){n[e]=z(n[e])}function fg(n,e){return Yi(e)?n:Yi(n)?e:`${n} ${e}`}function Eu(n,e){for(const t in e)n[t]?n[t].push(...e[t]):n[t]=e[t]}function mg(n,e){if(e.attributes&&(n.attributes||(n.attributes={}),Eu(n.attributes,e.attributes)),e.eventListeners&&(n.eventListeners||(n.eventListeners={}),Eu(n.eventListeners,e.eventListeners)),e.text&&n.text.push(...e.text),e.children&&e.children.length){if(n.children.length!=e.children.length)throw new g("ui-template-extend-children-mismatch",n);let t=0;for(const i of e.children)mg(n.children[t++],i)}}function Yi(n){return!n&&n!==0}function vo(n){return n instanceof T}function bl(n){return n instanceof Le}function _l(n){return n instanceof xe}function Tu(n){return Q(n[0])&&n[0].ns}function Au(){return{children:[],bindings:[],attributes:{}}}function Su(n){return n=="class"||n=="style"}/**
|
|
548
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
549
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
550
|
-
*/class T extends qe(W()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Ce,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=Le.bind(this,this)}createCollection(e){const t=new xe(e);return this._viewCollections.add(t),t}registerChild(e){Ue(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Ue(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Le(e)}extendTemplate(e){Le.extend(this.template,e)}render(){if(this.isRendered)throw new g("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)}}/**
|
|
551
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
552
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
553
|
-
*/class un extends T{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${Ke()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}/**
|
|
554
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
555
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
556
|
-
*/class CS extends T{constructor(e,t){super(e);const i=e.t,s=new un;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:[Fe(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())),s]})}focus(){this.element.focus()}_createCategories(e){return e.map(t=>{const i=[Fe(document,"h3",{},t.label),...Array.from(t.groups.values()).map(s=>this._createGroup(s)).flat()];return t.description&&i.splice(1,0,Fe(document,"p",{},t.description)),Fe(document,"section",{},i)})}_createGroup(e){const t=e.keystrokes.sort((s,o)=>s.label.localeCompare(o.label)).map(s=>this._createGroupRow(s)).flat(),i=[Fe(document,"dl",{},t)];return e.label&&i.unshift(Fe(document,"h4",{},e.label)),i}_createGroupRow(e){const t=this.locale.t,i=Fe(document,"dt"),s=Fe(document,"dd"),o=TS(e.keystroke),r=[];for(const a of o)r.push(a.map(ES).join(""));return i.innerHTML=e.label,s.innerHTML=r.join(", ")+(e.mayRequireFn&&M.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[i,s]}}function ES(n){return go(n).split("+").map(e=>`<kbd>${e}</kbd>`).join("+")}function TS(n){return typeof n=="string"?[[n]]:typeof n[0]=="string"?[n]:n}const xu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8.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-.103V9.125Z"/><path clip-rule="evenodd" d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17Zm0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z"/></svg>';/**
|
|
557
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
558
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
559
|
-
*/class AS extends w{constructor(){super(...arguments),this.contentView=null}static get requires(){return[kt]}static get pluginName(){return"AccessibilityHelp"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",()=>{const i=this._createButton(V);return i.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),i}),e.ui.componentFactory.add("menuBar:accessibilityHelp",()=>{const i=this._createButton(he);return i.label=t("Accessibility"),i}),e.keystrokes.set("Alt+0",(i,s)=>{this._showDialog(),s()}),this._setupRootLabels()}_createButton(e){const i=this.editor.locale,s=new e(i);return s.set({keystroke:"Alt+0",icon:xu}),s.on("execute",()=>this._showDialog()),s}_setupRootLabels(){const e=this.editor,t=e.editing.view,i=e.t;e.ui.on("ready",()=>{t.change(o=>{for(const r of t.document.roots)s(o,r)}),e.on("addRoot",(o,r)=>{const a=e.editing.view.document.getRoot(r.rootName);t.change(l=>s(l,a))},{priority:"low"})});function s(o,r){const l=`${r.getAttribute("aria-label")}. ${i("Press %0 for help.",[go("Alt+0")])}`;o.setAttribute("aria-label",l,r)}}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.contentView||(this.contentView=new CS(e.locale,e.accessibility.keystrokeInfos)),t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:i("Accessibility help"),icon:xu,hasCloseButton:!0,content:this.contentView})}}/**
|
|
560
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
561
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
562
|
-
*/class SS extends xe{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new Le({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=Fe(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&e.childElementCount==0&&e.remove()}}/**
|
|
563
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
564
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
565
|
-
*/class lt extends T{constructor(){super();const e=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",e.if("isVisible","ck-hidden",t=>!t),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const t=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),i=t.getAttribute("viewBox");i&&(this.viewBox=i);for(const{name:s,value:o}of Array.from(t.attributes))lt.presentationalAttributeNames.includes(s)&&this.element.setAttribute(s,o);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}lt.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"];/**
|
|
566
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
567
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
568
|
-
*/class xS extends T{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const 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")}]})}}/**
|
|
569
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
570
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
571
|
-
*/class V extends T{constructor(e,t=new xS){super(e),this._focusDelayed=null;const i=this.bindTemplate,s=Ke();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 lt,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const o={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-label":i.to("ariaLabel"),"aria-labelledby":i.to("ariaLabelledBy"),"aria-disabled":i.if("isEnabled",!0,r=>!r),"aria-pressed":i.to("isOn",r=>this.isToggleable?String(!!r):!1),"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()})}};M.isSafari&&(this._focusDelayed||(this._focusDelayed=rl(()=>this.focus(),0)),o.on.mousedown=i.to(()=>{this._focusDelayed()}),o.on.mouseup=i.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(o)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new T;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>go(t))}]}),e}_getTooltipString(e,t,i){return e?typeof e=="string"?e:(i&&(i=go(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}/**
|
|
572
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
573
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
574
|
-
*/class ms extends V{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new T;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}/**
|
|
575
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
576
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
577
|
-
*/class gg extends V{constructor(e){super(e),this.buttonView=this,this._fileInputView=new IS(e),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)}}class IS extends T{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}const Zo='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';/**
|
|
578
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
579
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
580
|
-
*/class pg extends T{constructor(e,t){super(e);const i=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),t&&this.children.addMany(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",i.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:i.if("isCollapsed","hidden"),"aria-labelledby":i.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){const e=new V(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:Zo}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",i=>String(i))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",i=>!i),e.on("execute",()=>{this.isCollapsed=!this.isCollapsed}),e}}/**
|
|
581
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
582
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
583
|
-
*/function PS(n,e){const t=n.t,i={Black:t("Black"),"Dim grey":t("Dim grey"),Grey:t("Grey"),"Light grey":t("Light grey"),White:t("White"),Red:t("Red"),Orange:t("Orange"),Yellow:t("Yellow"),"Light green":t("Light green"),Green:t("Green"),Aquamarine:t("Aquamarine"),Turquoise:t("Turquoise"),"Light blue":t("Light blue"),Blue:t("Blue"),Purple:t("Purple")};return e.map(s=>{const o=i[s.label];return o&&o!=s.label&&(s.label=o),s})}function RS(n){return n.map(VS).filter(e=>!!e)}function VS(n){return typeof n=="string"?{model:n,label:n,hasBorder:!1,view:{name:"span",styles:{color:n}}}:{model:n.color,label:n.label||n.color,hasBorder:n.hasBorder===void 0?!1:n.hasBorder,view:{name:"span",styles:{color:`${n.color}`}}}}const BS='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>';/**
|
|
584
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
585
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
586
|
-
*/class wg extends V{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=BS,this.extendTemplate({attributes:{style:{backgroundColor:t.to("color")},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}/**
|
|
587
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
588
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
589
|
-
*/class Iu extends T{constructor(e,t){super(e);const i=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const s={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new te,this.keystrokes=new oe,this.items.on("add",(o,r)=>{r.isOn=r.color===this.selectedColor}),i.forEach(o=>{const r=new wg;r.set({color:o.color,label:o.label,tooltip:!0,hasBorder:o.options.hasBorder}),r.on("execute",()=>{this.fire("execute",{value:o.color,hasBorder:o.options.hasBorder,label:o.label})}),this.items.add(r)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:s}}),this.on("change:selectedColor",(o,r,a)=>{for(const l of this.items)l.isOn=l.color===a})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),as({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}function bg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _g={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Pu=bg(_g);var Ru={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Vu(n){var e,t=[],i=1,s;if(typeof n=="string")if(Pu[n])t=Pu[n].slice(),s="rgb";else if(n==="transparent")i=0,s="rgb",t=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(n)){var o=n.slice(1),r=o.length,a=r<=4;i=1,a?(t=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],r===4&&(i=parseInt(o[3]+o[3],16)/255)):(t=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],r===8&&(i=parseInt(o[6]+o[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(n)){var l=e[1],c=l==="rgb",o=l.replace(/a$/,"");s=o;var r=o==="cmyk"?4:o==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(h,f){if(/%$/.test(h))return f===r?parseFloat(h)/100:o==="rgb"?parseFloat(h)*255/100:parseFloat(h);if(o[f]==="h"){if(/deg$/.test(h))return parseFloat(h);if(Ru[h]!==void 0)return Ru[h]}return parseFloat(h)}),l===o&&t.push(1),i=c||t[r]===void 0?1:t[r],t=t.slice(0,r)}else n.length>10&&/[0-9](?:\s|\/)/.test(n)&&(t=n.match(/([0-9]+)/g).map(function(u){return parseFloat(u)}),s=n.match(/([a-z])/ig).join("").toLowerCase());else isNaN(n)?Array.isArray(n)||n.length?(t=[n[0],n[1],n[2]],s="rgb",i=n.length===4?n[3]:1):n instanceof Object&&(n.r!=null||n.red!=null||n.R!=null?(s="rgb",t=[n.r||n.red||n.R||0,n.g||n.green||n.G||0,n.b||n.blue||n.B||0]):(s="hsl",t=[n.h||n.hue||n.H||0,n.s||n.saturation||n.S||0,n.l||n.lightness||n.L||n.b||n.brightness]),i=n.a||n.alpha||n.opacity||1,n.opacity!=null&&(i/=100)):(s="rgb",t=[n>>>16,(n&65280)>>>8,n&255]);return{space:s,values:t,alpha:i}}const Xn=_g,vg={};for(const n of Object.keys(Xn))vg[Xn[n]]=n;const I={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var yg=I;for(const n of Object.keys(I)){if(!("channels"in I[n]))throw new Error("missing channels property: "+n);if(!("labels"in I[n]))throw new Error("missing channel labels property: "+n);if(I[n].labels.length!==I[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:e,labels:t}=I[n];delete I[n].channels,delete I[n].labels,Object.defineProperty(I[n],"channels",{value:e}),Object.defineProperty(I[n],"labels",{value:t})}I.rgb.hsl=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),o=Math.max(e,t,i),r=o-s;let a,l;o===s?a=0:e===o?a=(t-i)/r:t===o?a=2+(i-e)/r:i===o&&(a=4+(e-t)/r),a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+o)/2;return o===s?l=0:c<=.5?l=r/(o+s):l=r/(2-o-s),[a,l*100,c*100]};I.rgb.hsv=function(n){let e,t,i,s,o;const r=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(r,a,l),u=c-Math.min(r,a,l),d=function(h){return(c-h)/6/u+1/2};return u===0?(s=0,o=0):(o=u/c,e=d(r),t=d(a),i=d(l),r===c?s=i-t:a===c?s=1/3+e-i:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,o*100,c*100]};I.rgb.hwb=function(n){const e=n[0],t=n[1];let i=n[2];const s=I.rgb.hsl(n)[0],o=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,o*100,i*100]};I.rgb.cmyk=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),o=(1-e-s)/(1-s)||0,r=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[o*100,r*100,a*100,s*100]};function MS(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}I.rgb.keyword=function(n){const e=vg[n];if(e)return e;let t=1/0,i;for(const s of Object.keys(Xn)){const o=Xn[s],r=MS(n,o);r<t&&(t=r,i=s)}return i};I.keyword.rgb=function(n){return Xn[n]};I.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805,o=e*.2126+t*.7152+i*.0722,r=e*.0193+t*.1192+i*.9505;return[s*100,o*100,r*100]};I.rgb.lab=function(n){const e=I.rgb.xyz(n);let t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const o=116*i-16,r=500*(t-i),a=200*(i-s);return[o,r,a]};I.hsl.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;let s,o,r;if(t===0)return r=i*255,[r,r,r];i<.5?s=i*(1+t):s=i+t-i*t;const a=2*i-s,l=[0,0,0];for(let c=0;c<3;c++)o=e+1/3*-(c-1),o<0&&o++,o>1&&o--,6*o<1?r=a+(s-a)*6*o:2*o<1?r=s:3*o<2?r=a+(s-a)*(2/3-o)*6:r=a,l[c]=r*255;return l};I.hsl.hsv=function(n){const e=n[0];let t=n[1]/100,i=n[2]/100,s=t;const o=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=o<=1?o:2-o;const r=(i+t)/2,a=i===0?2*s/(o+s):2*t/(i+t);return[e,a*100,r*100]};I.hsv.rgb=function(n){const e=n[0]/60,t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-t),a=255*i*(1-t*o),l=255*i*(1-t*(1-o));switch(i*=255,s){case 0:return[i,l,r];case 1:return[a,i,r];case 2:return[r,i,l];case 3:return[r,a,i];case 4:return[l,r,i];case 5:return[i,r,a]}};I.hsv.hsl=function(n){const e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01);let o,r;r=(2-t)*i;const a=(2-t)*s;return o=t*s,o/=a<=1?a:2-a,o=o||0,r/=2,[e,o*100,r*100]};I.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100,i=n[2]/100;const s=t+i;let o;s>1&&(t/=s,i/=s);const r=Math.floor(6*e),a=1-i;o=6*e-r,r&1&&(o=1-o);const l=t+o*(a-t);let c,u,d;switch(r){default:case 6:case 0:c=a,u=l,d=t;break;case 1:c=l,u=a,d=t;break;case 2:c=t,u=a,d=l;break;case 3:c=t,u=l,d=a;break;case 4:c=l,u=t,d=a;break;case 5:c=a,u=t,d=l;break}return[c*255,u*255,d*255]};I.cmyk.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,o=1-Math.min(1,e*(1-s)+s),r=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[o*255,r*255,a*255]};I.xyz.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100;let s,o,r;return s=e*3.2406+t*-1.5372+i*-.4986,o=e*-.9689+t*1.8758+i*.0415,r=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),[s*255,o*255,r*255]};I.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16,o=500*(e-t),r=200*(t-i);return[s,o,r]};I.lab.xyz=function(n){const e=n[0],t=n[1],i=n[2];let s,o,r;o=(e+16)/116,s=t/500+o,r=o-i/200;const a=o**3,l=s**3,c=r**3;return o=a>.008856?a:(o-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,s*=95.047,o*=100,r*=108.883,[s,o,r]};I.lab.lch=function(n){const e=n[0],t=n[1],i=n[2];let s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);const r=Math.sqrt(t*t+i*i);return[e,r,s]};I.lch.lab=function(n){const e=n[0],t=n[1],s=n[2]/360*2*Math.PI,o=t*Math.cos(s),r=t*Math.sin(s);return[e,o,r]};I.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let o=e===null?I.rgb.hsv(n)[2]:e;if(o=Math.round(o/50),o===0)return 30;let r=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return o===2&&(r+=60),r};I.hsv.ansi16=function(n){return I.rgb.ansi16(I.hsv.rgb(n),n[2])};I.rgb.ansi256=function(n){const e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)};I.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(~~(n>50)+1)*.5,i=(e&1)*t*255,s=(e>>1&1)*t*255,o=(e>>2&1)*t*255;return[i,s,o]};I.ansi256.rgb=function(n){if(n>=232){const o=(n-232)*10+8;return[o,o,o]}n-=16;let e;const t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]};I.rgb.hex=function(n){const t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};I.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));const i=parseInt(t,16),s=i>>16&255,o=i>>8&255,r=i&255;return[s,o,r]};I.rgb.hcg=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),o=Math.min(Math.min(e,t),i),r=s-o;let a,l;return r<1?a=o/(1-r):a=0,r<=0?l=0:s===e?l=(t-i)/r%6:s===t?l=2+(i-e)/r:l=4+(e-t)/r,l/=6,l%=1,[l*360,r*100,a*100]};I.hsl.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t);let s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]};I.hsv.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=e*t;let s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]};I.hcg.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];const s=[0,0,0],o=e%1*6,r=o%1,a=1-r;let l=0;switch(Math.floor(o)){case 0:s[0]=1,s[1]=r,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=r;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=r,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*i,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]};I.hcg.hsv=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);let s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]};I.hcg.hsl=function(n){const e=n[1]/100,i=n[2]/100*(1-e)+.5*e;let s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]};I.hcg.hwb=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};I.hwb.hcg=function(n){const e=n[1]/100,i=1-n[2]/100,s=i-e;let o=0;return s<1&&(o=(i-s)/(1-s)),[n[0],s*100,o*100]};I.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};I.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};I.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};I.gray.hsl=function(n){return[0,0,n[0]]};I.gray.hsv=I.gray.hsl;I.gray.hwb=function(n){return[0,100,n[0]]};I.gray.cmyk=function(n){return[0,0,0,n[0]]};I.gray.lab=function(n){return[n[0],0,0]};I.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i};I.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};const yo=yg;function LS(){const n={},e=Object.keys(yo);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function OS(n){const e=LS(),t=[n];for(e[n].distance=0;t.length;){const i=t.pop(),s=Object.keys(yo[i]);for(let o=s.length,r=0;r<o;r++){const a=s[r],l=e[a];l.distance===-1&&(l.distance=e[i].distance+1,l.parent=i,t.unshift(a))}}return e}function FS(n,e){return function(t){return e(n(t))}}function DS(n,e){const t=[e[n].parent,n];let i=yo[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=FS(yo[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}var NS=function(n){const e=OS(n),t={},i=Object.keys(e);for(let s=i.length,o=0;o<s;o++){const r=i[o];e[r].parent!==null&&(t[r]=DS(r,e))}return t};const fa=yg,$S=NS,Hi={},HS=Object.keys(fa);function zS(n){const e=function(...t){const i=t[0];return i==null?i:(i.length>1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function US(n){const e=function(...t){const i=t[0];if(i==null)return i;i.length>1&&(t=i);const s=n(t);if(typeof s=="object")for(let o=s.length,r=0;r<o;r++)s[r]=Math.round(s[r]);return s};return"conversion"in n&&(e.conversion=n.conversion),e}HS.forEach(n=>{Hi[n]={},Object.defineProperty(Hi[n],"channels",{value:fa[n].channels}),Object.defineProperty(Hi[n],"labels",{value:fa[n].labels});const e=$S(n);Object.keys(e).forEach(i=>{const s=e[i];Hi[n][i]=US(s),Hi[n][i].raw=zS(s)})});var kg=Hi;const WS=bg(kg),Cg=B1({__proto__:null,default:WS},[kg]);/**
|
|
590
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
591
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
592
|
-
*/function Eg(n,e){if(!n)return"";const t=Tg(n);if(!t)return"";if(t.space===e)return n;if(!KS(t))return"";const s=Cg[t.space][e];if(!s)return"";const o=s(t.space==="hex"?t.hexValue:t.values);return GS(o,e)}function qS(n){if(!n)return"";const e=Tg(n);return e?e.space==="hex"?e.hexValue:Eg(n,"hex"):"#000"}function jS(n,e){customElements.get(n)===void 0&&customElements.define(n,e)}function GS(n,e){switch(e){case"hex":return`#${n}`;case"rgb":return`rgb( ${n[0]}, ${n[1]}, ${n[2]} )`;case"hsl":return`hsl( ${n[0]}, ${n[1]}%, ${n[2]}% )`;case"hwb":return`hwb( ${n[0]}, ${n[1]}, ${n[2]} )`;case"lab":return`lab( ${n[0]}% ${n[1]} ${n[2]} )`;case"lch":return`lch( ${n[0]}% ${n[1]} ${n[2]} )`;default:return""}}function Tg(n){if(n.startsWith("#")){const t=Vu(n);return{space:"hex",values:t.values,hexValue:n,alpha:t.alpha}}const e=Vu(n);return e.space?e:null}function KS(n){return Object.keys(Cg).includes(n.space)}/**
|
|
593
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
594
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
595
|
-
*/class dn extends T{constructor(e,t){super(e);const i=`ck-labeled-field-view-${Ke()}`,s=`ck-labeled-field-view-status-${Ke()}`;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,a)=>r||a);const o=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",o.to("class"),o.if("isEnabled","ck-disabled",r=>!r),o.if("isEmpty","ck-labeled-field-view_empty"),o.if("isFocused","ck-labeled-field-view_focused"),o.if("placeholder","ck-labeled-field-view_placeholder"),o.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new un(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new T(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)}}/**
|
|
596
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
597
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
598
|
-
*/class ZS extends T{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 te,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),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=JS(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?"":e}}function JS(n){return!n.value}/**
|
|
599
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
600
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
601
|
-
*/class Ag extends ZS{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}/**
|
|
602
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
603
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
604
|
-
*/class YS extends Ag{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}/**
|
|
605
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
606
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
607
|
-
*/class QS extends Ag{constructor(e,{min:t,max:i,step:s}={}){super(e);const o=this.bindTemplate;this.set("min",t),this.set("max",i),this.set("step",s),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:o.to("min"),max:o.to("max"),step:o.to("step")}})}}/**
|
|
608
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
609
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
610
|
-
*/class XS extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",i=>`ck-dropdown__panel_${i}`),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to(i=>{i.target.tagName.toLocaleLowerCase()!=="input"&&i.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():D("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}/**
|
|
611
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
612
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
613
|
-
*/class Qi extends T{constructor(e,t,i){super(e);const s=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new oe,this.focusTracker=new te,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",s.to("class"),s.if("isEnabled","ck-disabled",o=>!o)],id:s.to("id"),"aria-describedby":s.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":s.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.on("change:isOpen",(t,i,s)=>{if(s)if(this.panelPosition==="auto"){const o=Qi._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=o?o.name:this._panelPositions[0].name}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);const e=(t,i)=>{this.isOpen&&(this.isOpen=!1,i())};this.keystrokes.set("arrowdown",(t,i)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,i())}),this.keystrokes.set("arrowright",(t,i)=>{this.isOpen&&i()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:s,northEast:o,northWest:r,southMiddleEast:a,southMiddleWest:l,northMiddleEast:c,northMiddleWest:u}=Qi.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[i,s,a,l,e,o,r,c,u,t]:[s,i,l,a,e,r,o,u,c,t]}}Qi.defaultPanelPositions={south:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)/2,name:"s"}),southEast:n=>({top:n.bottom,left:n.left,name:"se"}),southWest:(n,e)=>({top:n.bottom,left:n.left-e.width+n.width,name:"sw"}),southMiddleEast:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)/4,name:"sme"}),southMiddleWest:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)*3/4,name:"smw"}),north:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)/2,name:"n"}),northEast:(n,e)=>({top:n.top-e.height,left:n.left,name:"ne"}),northWest:(n,e)=>({top:n.top-e.height,left:n.left-e.width+n.width,name:"nw"}),northMiddleEast:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)/4,name:"nme"}),northMiddleWest:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)*3/4,name:"nmw"})};Qi._getOptimalPosition=qo;/**
|
|
614
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
615
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
616
|
-
*/class Sg extends V{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",t=>String(t))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new lt;return e.content=Zo,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}/**
|
|
617
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
618
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
619
|
-
*/class Ae extends Z(){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(const t in e.actions){let i=e.actions[t];typeof i=="string"&&(i=[i]);for(const s of i)e.keystrokeHandler.set(s,(o,r)=>{this[t](),r()})}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"})}get first(){return this.focusables.find(yr)||null}get last(){return this.focusables.filter(yr).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)=>{const 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(){const 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(){const 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)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const i=this.current;if(i===null)return this[e===1?"first":"last"];let s=this.focusables.get(i),o=(i+t+e)%t;do{const r=this.focusables.get(o);if(yr(r)){s=r;break}o=(o+t+e)%t}while(o!==i);return s}}function yr(n){return gs(n)&&di(n.element)}function gs(n){return"focus"in n&&typeof n.focus=="function"}function ex(n){return gs(n)&&"focusCycler"in n&&n.focusCycler instanceof Ae}/**
|
|
620
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
621
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
622
|
-
*/class xg extends T{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}/**
|
|
623
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
624
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
625
|
-
*/class tx extends T{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}/**
|
|
626
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
627
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
628
|
-
*/function ix(n){return n.bindTemplate.to(e=>{e.target===n.element&&e.preventDefault()})}/**
|
|
629
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
630
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
631
|
-
*/function Ig(n){if(Array.isArray(n))return{items:n,removeItems:[]};const e={items:[],removeItems:[]};return n?{...e,...n}:e}/**
|
|
632
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
633
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
634
|
-
*/const{threeVerticalDots:Pg}=P,nx={alignLeft:P.alignLeft,bold:P.bold,importExport:P.importExport,paragraph:P.paragraph,plus:P.plus,text:P.text,threeVerticalDots:P.threeVerticalDots,pilcrow:P.pilcrow,dragIndicator:P.dragIndicator};class vl extends T{constructor(e,t){super(e);const i=this.bindTemplate,s=this.t;this.options=t||{},this.set("ariaLabel",s("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new te,this.keystrokes=new oe,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new sx(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const o=e.uiLanguageDirection==="rtl";this._focusCycler=new Ae({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[o?"arrowright":"arrowleft","arrowup"],focusNext:[o?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:ix(this)}}),this._behavior=this.options.shouldGroupWhenFull?new rx(this):new ox(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,i){this.items.addMany(this._buildItemsFromConfig(e,t,i))}_buildItemsFromConfig(e,t,i){const s=Ig(e),o=i||s.removeItems;return this._cleanItemsConfiguration(s.items,t,o).map(a=>Q(a)?this._createNestedToolbarDropdown(a,t,o):a==="|"?new xg:a==="-"?new tx:t.create(a)).filter(a=>!!a)}_cleanItemsConfiguration(e,t,i){const s=e.filter((o,r,a)=>o==="|"?!0:i.indexOf(o)!==-1?!1:o==="-"?this.options.shouldGroupWhenFull?(D("toolbarview-line-break-ignored-when-grouping-items",a),!1):!0:!Q(o)&&!t.has(o)?(D("toolbarview-item-unavailable",{item:o}),!1):!0);return this._cleanSeparatorsAndLineBreaks(s)}_cleanSeparatorsAndLineBreaks(e){const t=r=>r!=="-"&&r!=="|",i=e.length,s=e.findIndex(t);if(s===-1)return[];const o=i-e.slice().reverse().findIndex(t);return e.slice(s,o).filter((r,a,l)=>t(r)?!0:!(a>0&&l[a-1]===r))}_createNestedToolbarDropdown(e,t,i){let{label:s,icon:o,items:r,tooltip:a=!0,withText:l=!1}=e;if(r=this._cleanItemsConfiguration(r,t,i),!r.length)return null;const c=this.locale,u=ge(c);return s||D("toolbarview-nested-toolbar-dropdown-missing-label",e),u.class="ck-toolbar__nested-toolbar-dropdown",u.buttonView.set({label:s,tooltip:a,withText:!!l}),o!==!1?u.buttonView.icon=nx[o]||o||Pg:u.buttonView.withText=!0,Jo(u,()=>u.toolbarView._buildItemsFromConfig(r,t,i)),u}}class sx extends T{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class ox{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(i=>i),e.focusables.bindTo(e.items).using(i=>gs(i)?i:null),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class rx{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using(t=>t),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",(t,i)=>{const s=i.index,o=Array.from(i.added);for(const r of i.removed)s>=this.ungroupedItems.length?this.groupedItems.remove(r):this.ungroupedItems.remove(r);for(let r=s;r<s+o.length;r++){const a=o[r-s];r>this.ungroupedItems.length?this.groupedItems.add(a,r-this.ungroupedItems.length):this.ungroupedItems.add(a,r)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!di(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new L(e.lastChild),s=new L(e);if(!this.cachedPadding){const o=S.window.getComputedStyle(e),r=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[r])}return t==="ltr"?i.right>s.right-this.cachedPadding:i.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new ee(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 xg),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=ge(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",Jo(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:Pg}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{gs(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}/**
|
|
635
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
636
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
637
|
-
*/class Xi extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",i=>!i)],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}/**
|
|
638
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
639
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
640
|
-
*/class yl extends T{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}/**
|
|
641
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
642
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
643
|
-
*/class to extends T{constructor(e,t=new un){super(e);const i=this.bindTemplate,s=new kl(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",o=>!o)]},children:this.children})}focus(){if(this.items){const e=this.items.find(t=>!(t instanceof yl));e&&e.focus()}}}/**
|
|
644
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
645
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
646
|
-
*/class kl extends T{constructor(e){super(e),this._listItemGroupToChangeListeners=new WeakMap;const t=this.bindTemplate;this.focusables=new xe,this.items=this.createCollection(),this.focusTracker=new te,this.keystrokes=new oe,this._focusCycler=new Ae({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(const e of this.items)e instanceof to?this._registerFocusableItemsGroup(e):e instanceof Xi&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(const i of t.removed)i instanceof to?this._deregisterFocusableItemsGroup(i):i instanceof Xi&&this._deregisterFocusableListItem(i);for(const i of Array.from(t.added).reverse())i instanceof to?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(const s of i.removed)this._deregisterFocusableListItem(s);for(const s of Array.from(i.added).reverse())this._registerFocusableListItem(s,this.items.getIndex(e)+i.index)}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((s,o)=>{const r=typeof t<"u"?t+o:void 0;this._registerFocusableListItem(s,r)});const i=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,i),e.items.on("change",i)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}/**
|
|
647
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
648
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
649
|
-
*/class hn extends T{constructor(e,t){super(e);const 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 oe,this.focusTracker=new te,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){const t=e||new V;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(){const e=new V,t=e.bindTemplate;return e.icon=Zo,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}}/**
|
|
650
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
651
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
652
|
-
*/function ge(n,e=Sg){const t=typeof e=="function"?new e(n):e,i=new XS(n),s=new Qi(n,t,i);return t.bind("isEnabled").to(s),t instanceof hn?t.arrowView.bind("isOn").to(s,"isOpen"):t.bind("isOn").to(s,"isOpen"),ax(s),s}function Jo(n,e,t={}){n.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),n.isOpen?Bu(n,e,t):n.once("change:isOpen",()=>Bu(n,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&Yo(n,()=>n.toolbarView.items.find(i=>i.isOn))}function Bu(n,e,t){const i=n.locale,s=i.t,o=n.toolbarView=new vl(i),r=typeof e=="function"?e():e;o.ariaLabel=t.ariaLabel||s("Dropdown toolbar"),t.maxWidth&&(o.maxWidth=t.maxWidth),t.class&&(o.class=t.class),t.isCompact&&(o.isCompact=t.isCompact),t.isVertical&&(o.isVertical=!0),r instanceof xe?o.items.bindTo(r).using(a=>a):o.items.addMany(r),n.panelView.children.add(o),o.items.delegate("execute").to(n)}function yi(n,e,t={}){n.isOpen?Mu(n,e,t):n.once("change:isOpen",()=>Mu(n,e,t),{priority:"highest"}),Yo(n,()=>n.listView.items.find(i=>i instanceof Xi?i.children.first.isOn:!1))}function Mu(n,e,t){const i=n.locale,s=n.listView=new kl(i),o=typeof e=="function"?e():e;s.ariaLabel=t.ariaLabel,s.role=t.role,Rg(n,s.items,o,i),n.panelView.children.add(s),s.items.delegate("execute").to(n)}function Yo(n,e){n.on("change:isOpen",()=>{if(!n.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():D("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:$e.low-10})}function ax(n){lx(n),cx(n),ux(n),dx(n),hx(n),fx(n)}function lx(n){n.on("render",()=>{Mo({emitter:n,activator:()=>n.isOpen,callback:()=>{n.isOpen=!1},contextElements:()=>[n.element,...n.focusTracker._elements]})})}function cx(n){n.on("execute",e=>{e.source instanceof ms||(n.isOpen=!1)})}function ux(n){n.focusTracker.on("change:isFocused",(e,t,i)=>{n.isOpen&&!i&&(n.isOpen=!1)})}function dx(n){n.keystrokes.set("arrowdown",(e,t)=>{n.isOpen&&(n.panelView.focus(),t())}),n.keystrokes.set("arrowup",(e,t)=>{n.isOpen&&(n.panelView.focusLast(),t())})}function hx(n){n.on("change:isOpen",(e,t,i)=>{if(i)return;const s=n.panelView.element;s&&s.contains(S.document.activeElement)&&n.buttonView.focus()})}function fx(n){n.on("change:isOpen",(e,t,i)=>{i&&n.panelView.focus()},{priority:"low"})}function Rg(n,e,t,i){e.bindTo(t).using(s=>{if(s.type==="separator")return new yl(i);if(s.type==="group"){const o=new to(i);return o.set({label:s.label}),Rg(n,o.items,s.items,i),o.items.delegate("execute").to(n),o}else if(s.type==="button"||s.type==="switchbutton"){const o=new Xi(i);let r;return s.type==="button"?(r=new V(i),r.bind("ariaChecked").to(r,"isOn")):r=new ms(i),r.bind(...Object.keys(s.model)).to(s.model),r.delegate("execute").to(o),o.children.add(r),o}return null})}/**
|
|
653
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
654
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
655
|
-
*/const ps=(n,e,t)=>{const i=new YS(n.locale);return i.set({id:e,ariaDescribedById:t}),i.bind("isReadOnly").to(n,"isEnabled",s=>!s),i.bind("hasError").to(n,"errorText",s=>!!s),i.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(i),i},mx=(n,e,t)=>{const i=new QS(n.locale);return i.set({id:e,ariaDescribedById:t,inputMode:"numeric"}),i.bind("isReadOnly").to(n,"isEnabled",s=>!s),i.bind("hasError").to(n,"errorText",s=>!!s),i.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(i),i},es=(n,e=0,t=1)=>n>t?t:n<e?e:n,ye=(n,e=0,t=Math.pow(10,e))=>Math.round(t*n)/t,gx=n=>vx(ma(n)),ma=n=>(n[0]==="#"&&(n=n.substring(1)),n.length<6?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?ye(parseInt(n[3]+n[3],16)/255,2):1}:{r:parseInt(n.substring(0,2),16),g:parseInt(n.substring(2,4),16),b:parseInt(n.substring(4,6),16),a:n.length===8?ye(parseInt(n.substring(6,8),16)/255,2):1}),px=n=>_x(bx(n)),wx=({h:n,s:e,v:t,a:i})=>{const s=(200-e)*t/100;return{h:ye(n),s:ye(s>0&&s<200?e*t/100/(s<=100?s:200-s)*100:0),l:ye(s/2),a:ye(i,2)}},ga=n=>{const{h:e,s:t,l:i}=wx(n);return`hsl(${e}, ${t}%, ${i}%)`},bx=({h:n,s:e,v:t,a:i})=>{n=n/360*6,e=e/100,t=t/100;const s=Math.floor(n),o=t*(1-e),r=t*(1-(n-s)*e),a=t*(1-(1-n+s)*e),l=s%6;return{r:ye([t,r,o,o,a,t][l]*255),g:ye([a,t,t,r,o,o][l]*255),b:ye([o,o,a,t,t,r][l]*255),a:ye(i,2)}},Vs=n=>{const e=n.toString(16);return e.length<2?"0"+e:e},_x=({r:n,g:e,b:t,a:i})=>{const s=i<1?Vs(ye(i*255)):"";return"#"+Vs(n)+Vs(e)+Vs(t)+s},vx=({r:n,g:e,b:t,a:i})=>{const s=Math.max(n,e,t),o=s-Math.min(n,e,t),r=o?s===n?(e-t)/o:s===e?2+(t-n)/o:4+(n-e)/o:0;return{h:ye(60*(r<0?r+6:r)),s:ye(s?o/s*100:0),v:ye(s/255*100),a:i}},Vg=(n,e)=>{if(n===e)return!0;for(const t in n)if(n[t]!==e[t])return!1;return!0},yx=(n,e)=>n.toLowerCase()===e.toLowerCase()?!0:Vg(ma(n),ma(e)),Lu={},Bg=n=>{let e=Lu[n];return e||(e=document.createElement("template"),e.innerHTML=n,Lu[n]=e),e},Cl=(n,e,t)=>{n.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))};let Gi=!1;const pa=n=>"touches"in n,kx=n=>Gi&&!pa(n)?!1:(Gi||(Gi=pa(n)),!0),Ou=(n,e)=>{const t=pa(e)?e.touches[0]:e,i=n.el.getBoundingClientRect();Cl(n.el,"move",n.getMove({x:es((t.pageX-(i.left+window.pageXOffset))/i.width),y:es((t.pageY-(i.top+window.pageYOffset))/i.height)}))},Cx=(n,e)=>{const t=e.keyCode;t>40||n.xy&&t<37||t<33||(e.preventDefault(),Cl(n.el,"move",n.getMove({x:t===39?.01:t===37?-.01:t===34?.05:t===33?-.05:t===35?1:t===36?-1:0,y:t===40?.01:t===38?-.01:0},!0)))};class Mg{constructor(e,t,i,s){const o=Bg(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(o.content.cloneNode(!0));const r=e.querySelector(`[part=${t}]`);r.addEventListener("mousedown",this),r.addEventListener("touchstart",this),r.addEventListener("keydown",this),this.el=r,this.xy=s,this.nodes=[r.firstChild,r]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(Gi?"touchmove":"mousemove",this),t(Gi?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!kx(e)||!Gi&&e.button!=0)return;this.el.focus(),Ou(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Ou(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":Cx(this,e);break}}style(e){e.forEach((t,i)=>{for(const s in t)this.nodes[i].style.setProperty(s,t[s])})}}class Ex extends Mg{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:`${e/360*100}%`,color:ga({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${ye(e)}`)}getMove(e,t){return{h:t?es(this.h+e.x*360,0,360):360*e.x}}}class Tx extends Mg{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:ga(e)},{"background-color":ga({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${ye(e.s)}%, Brightness ${ye(e.v)}%`)}getMove(e,t){return{s:t?es(this.hsva.s+e.x*100,0,100):e.x*100,v:t?es(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}}const Ax=':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',Sx="[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}",xx="[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}",Bs=Symbol("same"),kr=Symbol("color"),Fu=Symbol("hsva"),Cr=Symbol("update"),Du=Symbol("parts"),Nu=Symbol("css"),$u=Symbol("sliders");class Ix extends HTMLElement{static get observedAttributes(){return["color"]}get[Nu](){return[Ax,Sx,xx]}get[$u](){return[Tx,Ex]}get color(){return this[kr]}set color(e){if(!this[Bs](e)){const t=this.colorModel.toHsva(e);this[Cr](t),this[kr]=e}}constructor(){super();const e=Bg(`<style>${this[Nu].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Du]=this[$u].map(i=>new i(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const s=this.colorModel.fromAttr(i);this[Bs](s)||(this.color=s)}handleEvent(e){const t=this[Fu],i={...t,...e.detail};this[Cr](i);let s;!Vg(i,t)&&!this[Bs](s=this.colorModel.fromHsva(i))&&(this[kr]=s,Cl(this,"color-changed",{value:s}))}[Bs](e){return this.color&&this.colorModel.equal(e,this.color)}[Cr](e){this[Fu]=e,this[Du].forEach(t=>t.update(e))}}const Px={defaultColor:"#000",toHsva:gx,fromHsva:({h:n,s:e,v:t})=>px({h:n,s:e,v:t,a:1}),equal:yx,fromAttr:n=>n};class Rx extends Ix{get colorModel(){return Px}}/**
|
|
656
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
657
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
658
|
-
*/const Vx=150;class Bx extends T{constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const i=this.createCollection();t.hideInput||i.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:i}),this._config=t,this._debounceColorPickerEvent=ci(s=>{this.set("color",s),this.fire("colorSelected",{color:this.color})},Vx,{leading:!0}),this.on("set:color",(s,o,r)=>{s.return=Eg(r,this._config.format||"hsl")}),this.on("change:color",()=>{this._hexColor=Er(this.color)}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Er(this.color)!=Er(this._hexColor)&&(this.color=this._hexColor)})}render(){if(super.render(),jS("hex-color-picker",Rx),this.picker=S.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",e=>{const t=e.detail.value;this._debounceColorPickerEvent(t)})}focus(){/* istanbul ignore next -- @preserve */!this._config.hideInput&&(M.isGecko||M.isiOS||M.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const i=[...this.picker.shadowRoot.children].filter(s=>s.getAttribute("role")==="slider").map(s=>new Mx(s));this.slidersView=this.createCollection(),i.forEach(s=>{this.slidersView.add(s)})}_createInputRow(){const e=new Lx,t=this._createColorInput();return new Ox(this.locale,[e,t])}_createColorInput(){const e=new dn(this.locale,ps),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",i=>e.isFocused?e.fieldView.value:i.startsWith("#")?i.substring(1):i),e.fieldView.on("input",()=>{const i=e.fieldView.element.value;if(i){const s=i.trim(),o=s.startsWith("#")?s.substring(1):s;[3,4,6,8].includes(o.length)&&/(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})/.test(o)&&this._debounceColorPickerEvent("#"+o)}}),e}}function Er(n){let e=qS(n);return e||(e="#000"),e.length===4&&(e="#"+[e[1],e[1],e[2],e[2],e[3],e[3]].join("")),e.toLowerCase()}class Mx extends T{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class Lx extends T{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class Ox extends T{constructor(e,t){super(e),this.children=this.createCollection(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}}/**
|
|
659
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
660
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
661
|
-
*/class Fx extends W(Ce){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",this.length===0)})}add(e,t){return this.find(i=>i.color===e.color)?this:super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}/**
|
|
662
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
663
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
664
|
-
*/const{eraser:Dx,colorPalette:Nx}=P;class $x extends T{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:l,focusables:c}){super(e);const u=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=l,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=i,this.documentColors=new Fx,this.documentColorsCount=r,this._focusables=c,this._removeButtonLabel=s,this._colorPickerLabel=a,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",u.if("isVisible","ck-hidden",d=>!d)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const i=e.document,s=this.documentColorsCount;this.documentColors.clear();for(const o of i.getRoots()){const r=e.createRangeIn(o);for(const a of r.getItems())if(a.is("$textProxy")&&a.hasAttribute(t)&&(this._addColorToDocumentColors(a.getAttribute(t)),this.documentColors.length>=s))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=Le.bind(this.documentColors,this.documentColors),t=new un(this.locale);t.text=this._documentColorsLabel,t.extendTemplate({attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]}}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new V,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:Nx,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show")})}_createRemoveColorButton(){const e=new V;return e.set({withText:!0,icon:Dx,label:this._removeButtonLabel}),e.class="ck-color-selector__remove-color",e.on("execute",()=>{this.fire("execute",{value:null,source:"removeColorButton"})}),e.render(),e}_createStaticColorsGrid(){const e=new Iu(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",(t,i)=>{this.fire("execute",{value:i.value,source:"staticColorsGrid"})}),e}_createDocumentColorsGrid(){const e=Le.bind(this.documentColors,this.documentColors),t=new Iu(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(i=>{const s=new wg;return s.set({color:i.color,hasBorder:i.options&&i.options.hasBorder}),i.label&&s.set({label:i.label,tooltip:!0}),s.on("execute",()=>{this.fire("execute",{value:i.color,source:"documentColorsGrid"})}),s}),this.documentColors.on("change:isEmpty",(i,s,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(i=>i.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}/**
|
|
665
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
666
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
667
|
-
*/class Hx extends T{constructor(e,{focusTracker:t,focusables:i,keystrokes:s,colorPickerViewConfig:o}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=s,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=i,this._colorPickerViewConfig=o;const r=this.bindTemplate,{saveButtonView:a,cancelButtonView:l}=this._createActionButtons();this.saveButtonView=a,this.cancelButtonView=l,this.actionBarView=this._createActionBarView({saveButtonView:a,cancelButtonView:l}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",r.if("isVisible","ck-hidden",c=>!c)]},children:this.items})}render(){super.render();const e=new Bx(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,i,s)=>{e.color=s}),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}_executeOnEnterPress(){this.keystrokes.set("enter",e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())})}_stopPropagationOnArrowsKeys(){const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const t of this.colorPickerView.slidersView)this.focusTracker.add(t.element),this._focusables.add(t);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const i=new T,s=this.createCollection();return s.add(e),s.add(t),i.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:s}),i}_createActionButtons(){const e=this.locale,t=e.t,i=new V(e),s=new V(e);return i.set({icon:P.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),s.set({icon:P.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),i.on("execute",()=>{this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})}),s.on("execute",()=>{this.fire("colorPicker:cancel")}),{saveButtonView:i,cancelButtonView:s}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",(e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)})}}/**
|
|
668
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
669
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
670
|
-
*/class Lg extends T{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,colorPickerViewConfig:l}){super(e),this.items=this.createCollection(),this.focusTracker=new te,this.keystrokes=new oe,this._focusables=new xe,this._colorPickerViewConfig=l,this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new $x(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new Hx(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:l}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",(c,u,d)=>{this.colorGridsFragmentView.set("selectedColor",d),this.colorPickerFragmentView.set("selectedColor",d)}),this.colorGridsFragmentView.on("change:selectedColor",(c,u,d)=>{this.set("selectedColor",d)}),this.colorPickerFragmentView.on("change:selectedColor",(c,u,d)=>{this.set("selectedColor",d)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){!this.colorPickerFragmentView.colorPickerView||this._isColorPickerFragmentVisible||(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsFragmentView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate("execute").to(this),this.colorGridsFragmentView.delegate("colorPicker:show").to(this))}_appendColorPickerFragment(){this.items.length!==2&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{this.showColorPickerFragment()}),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}/**
|
|
671
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
672
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
673
|
-
*/class zx{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(Tr(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new g("componentfactory-item-missing",this,{name:e});return this._components.get(Tr(e)).callback(this.editor.locale)}has(e){return this._components.has(Tr(e))}}function Tr(n){return String(n).toLowerCase()}/**
|
|
674
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
675
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
676
|
-
*/class Og extends T{constructor(e,t={}){super(e);const 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 lt,this.iconView.content=t.icon,this.children.add(this.iconView));const s=new T(e);s.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:i.to("label")}]}),this.children.add(s)}}/**
|
|
677
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
678
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
679
|
-
*/function Ux(n){class e extends n{constructor(...i){super(...i),this._onDragBound=this._onDrag.bind(this),this._onDragEndBound=this._onDragEnd.bind(this),this._lastDraggingCoordinates={x:0,y:0},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(S.document,"mouseup",this._onDragEndBound),this.listenTo(S.document,"touchend",this._onDragEndBound),this.listenTo(S.document,"mousemove",this._onDragBound),this.listenTo(S.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(S.document,"mouseup",this._onDragEndBound),this.stopListening(S.document,"touchend",this._onDragEndBound),this.stopListening(S.document,"mousemove",this._onDragBound),this.stopListening(S.document,"touchmove",this._onDragBound)}_onDragStart(i,s){if(!this._isHandleElementPressed(s))return;this._attachDragListeners();let o=0,r=0;s instanceof MouseEvent?(o=s.clientX,r=s.clientY):(o=s.touches[0].clientX,r=s.touches[0].clientY),this._lastDraggingCoordinates={x:o,y:r},this.isDragging=!0}_onDrag(i,s){if(!this.isDragging){this._detachDragListeners();return}let o=0,r=0;s instanceof MouseEvent?(o=s.clientX,r=s.clientY):(o=s.touches[0].clientX,r=s.touches[0].clientY),s.preventDefault(),this.fire("drag",{deltaX:Math.round(o-this._lastDraggingCoordinates.x),deltaY:Math.round(r-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:o,y:r}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(i){return this.dragHandleElement?this.dragHandleElement===i.target||i.target instanceof HTMLElement&&this.dragHandleElement.contains(i.target):!1}}return e}/**
|
|
680
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
681
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
682
|
-
*/class Wx extends T{constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new oe,this._focusTracker=new te,this._focusables=new xe,this.focusCycler=new Ae({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(const t of e){const i=new V(this.locale);let 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()}_updateFocusCyclableItems(){Array.from(this.children).forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}}/**
|
|
683
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
684
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
685
|
-
*/class qx extends T{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)}}/**
|
|
686
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
687
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
688
|
-
*/const Xe={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"},Hu=ln("px");class en extends Ux(T){constructor(e,{getCurrentDomRoot:t,getViewportOffset:i}){super(e),this.wasMoved=!1;const s=this.bindTemplate,o=e.t;this.set("className",""),this.set("ariaLabel",o("Editor dialog")),this.set("isModal",!1),this.set("position",Xe.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=i,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new oe,this.focusTracker=new te,this._focusables=new xe,this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",s.if("isModal","ck-dialog-overlay__transparent",r=>!r),s.if("_isVisible","ck-hidden",r=>!r)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",s.to("className")],role:"dialog","aria-label":s.to("ariaLabel"),style:{top:s.to("_top",r=>Hu(r)),left:s.to("_left",r=>Hu(r)),visibility:s.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",(e,t)=>{this.fire("close",{source:"escKeyPress"}),t()}),this.on("drag",(e,{deltaX:t,deltaY:i})=>{this.wasMoved=!0,this.moveBy(t,i)}),this.listenTo(S.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(S.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on("change:_isVisible",(e,t,i)=>{i&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:i=!0,content:s,actionButtons:o}){t&&(this.headerView=new Og(this.locale,{icon:e}),i&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),s&&(s instanceof T&&(s=[s]),this.contentView=new qx(this.locale),this.contentView.children.addMany(s),this.parts.add(this.contentView)),o&&(this.actionsView=new Wx(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const i=this._getViewportRect(),s=this._getDialogRect();e+s.width>i.right&&(e=i.right-s.width),e<i.left&&(e=i.left),t<i.top&&(t=i.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t=this.position,i;this._getCurrentDomRoot()?i=this._getVisibleDomRootRect(e):t=Xe.SCREEN_CENTER;const s=en.defaultOffset,o=this._getDialogRect();switch(t){case Xe.EDITOR_TOP_SIDE:{if(i){const r=this.locale.contentLanguageDirection==="ltr"?i.right-o.width-s:i.left+s;this.moveTo(r,i.top+s)}else this._moveOffScreen();break}case Xe.EDITOR_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),Math.round(i.top+i.height/2-o.height/2)):this._moveOffScreen();break}case Xe.SCREEN_CENTER:{this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break}case Xe.EDITOR_TOP_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top+s):this._moveOffScreen();break}case Xe.EDITOR_BOTTOM_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.bottom-o.height-s):this._moveOffScreen();break}case Xe.EDITOR_ABOVE_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top-o.height-s):this._moveOffScreen();break}case Xe.EDITOR_BELOW_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.bottom+s):this._moveOffScreen();break}}}_getVisibleDomRootRect(e){let t=new L(this._getCurrentDomRoot()).getVisible();if(t){if(t=e.getIntersection(t),!t)return null}else return null;return t}_getDialogRect(){return new L(this.element.firstElementChild)}_getViewportRect(){return jx(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)gs(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element),ex(t)&&(this.listenTo(t.focusCycler,"forwardCycle",i=>{this._focusCycler.focusNext(),this._focusCycler.next!==this._focusCycler.focusables.get(this._focusCycler.current)&&i.stop()}),this.listenTo(t.focusCycler,"backwardCycle",i=>{this._focusCycler.focusPrevious(),this._focusCycler.previous!==this._focusCycler.focusables.get(this._focusCycler.current)&&i.stop()}))})}_createCloseButton(){const e=new V(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:P.cancel}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}}en.defaultOffset=15;function jx(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const e=new L(S.window);return e.top+=n.top,e.height-=n.top,e.bottom-=n.bottom,e.height-=n.bottom,e.left+=n.left,e.right-=n.right,e.width-=n.left+n.right,e}/**
|
|
689
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
690
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
691
|
-
*/class kt extends w{static get pluginName(){return"Dialog"}constructor(e){super(e);const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set("id",null),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}_initShowHideListeners(){this.on("show",(e,t)=>{this._show(t)}),this.on("show",(e,t)=>{t.onShow&&t.onShow(this)},{priority:"low"}),this.on("hide",()=>{kt._visibleDialogPlugin&&kt._visibleDialogPlugin._hide()}),this.on("hide",()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)},{priority:"low"})}_initFocusToggler(){const e=this.editor;e.keystrokes.set("Ctrl+F6",(t,i)=>{!this.isOpen||this.view.isModal||(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),i())})}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",()=>{if(!this.view)return;const t=e.document.differ.getChangedRoots();for(const i of t)i.state&&this.view.updatePosition()})}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:i,hasCloseButton:s=!0,content:o,actionButtons:r,className:a,isModal:l,position:c,onHide:u}){const d=this.editor;this.view=new en(d.locale,{getCurrentDomRoot:()=>d.editing.view.getDomRoot(d.model.document.selection.anchor.root.rootName),getViewportOffset:()=>d.ui.viewportOffset});const h=this.view;h.on("close",()=>{this.hide()}),d.ui.view.body.add(h),d.ui.focusTracker.add(h.element),d.keystrokes.listenTo(h.element),c||(c=l?Xe.SCREEN_CENTER:Xe.EDITOR_CENTER),h.set({position:c,_isVisible:!0,className:a,isModal:l}),h.setupParts({icon:t,title:i,hasCloseButton:s,content:o,actionButtons:r}),this.id=e,u&&(this._onHide=u),this.isOpen=!0,kt._visibleDialogPlugin=this}hide(){kt._visibleDialogPlugin&&kt._visibleDialogPlugin.fire(`hide:${kt._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;const e=this.editor,t=this.view;t.contentView&&t.contentView.reset(),e.ui.view.body.remove(t),e.ui.focusTracker.remove(t.element),e.keystrokes.stopListening(t.element),t.destroy(),e.editing.view.focus(),this.id=null,this.isOpen=!1,kt._visibleDialogPlugin=null}}/**
|
|
692
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
693
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
694
|
-
*/const zu=ln("px"),Uu=S.document.body,Gx={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class ke extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",i=>`ck-balloon-panel_${i}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",zu),left:t.to("left",zu)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=ke.defaultPositions,i=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast,t.viewportStickyNorth],limiter:Uu,fitInViewport:!0},e),s=ke._getOptimalPosition(i)||Gx,o=parseInt(s.left),r=parseInt(s.top),a=s.name,l=s.config||{},{withArrow:c=!0}=l;this.top=r,this.left=o,this.position=a,this.withArrow=c}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=wa(e.target),i=e.limiter?wa(e.limiter):Uu;this.listenTo(S.document,"scroll",(s,o)=>{const r=o.target,a=t&&r.contains(t),l=i&&r.contains(i);(a||l||!t||!i)&&this.attachTo(e)},{useCapture:!0}),this.listenTo(S.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(S.document,"scroll"),this.stopListening(S.window,"resize")}}ke.arrowSideOffset=25;ke.arrowHeightOffset=10;ke.stickyVerticalOffset=20;ke._getOptimalPosition=qo;ke.defaultPositions=Fg();function wa(n){return ui(n)?n:Wo(n)?n.commonAncestorContainer:typeof n=="function"?wa(n()):null}function Fg(n={}){const{sideOffset:e=ke.arrowSideOffset,heightOffset:t=ke.arrowHeightOffset,stickyVerticalOffset:i=ke.stickyVerticalOffset,config:s}=n;return{northWestArrowSouthWest:(a,l)=>({top:o(a,l),left:a.left-e,name:"arrow_sw",...s&&{config:s}}),northWestArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.left-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northWestArrowSouth:(a,l)=>({top:o(a,l),left:a.left-l.width/2,name:"arrow_s",...s&&{config:s}}),northWestArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.left-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northWestArrowSouthEast:(a,l)=>({top:o(a,l),left:a.left-l.width+e,name:"arrow_se",...s&&{config:s}}),northArrowSouthWest:(a,l)=>({top:o(a,l),left:a.left+a.width/2-e,name:"arrow_sw",...s&&{config:s}}),northArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northArrowSouth:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width/2,name:"arrow_s",...s&&{config:s}}),northArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northArrowSouthEast:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width+e,name:"arrow_se",...s&&{config:s}}),northEastArrowSouthWest:(a,l)=>({top:o(a,l),left:a.right-e,name:"arrow_sw",...s&&{config:s}}),northEastArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.right-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northEastArrowSouth:(a,l)=>({top:o(a,l),left:a.right-l.width/2,name:"arrow_s",...s&&{config:s}}),northEastArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.right-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northEastArrowSouthEast:(a,l)=>({top:o(a,l),left:a.right-l.width+e,name:"arrow_se",...s&&{config:s}}),southWestArrowNorthWest:a=>({top:r(a),left:a.left-e,name:"arrow_nw",...s&&{config:s}}),southWestArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.left-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southWestArrowNorth:(a,l)=>({top:r(a),left:a.left-l.width/2,name:"arrow_n",...s&&{config:s}}),southWestArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.left-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southWestArrowNorthEast:(a,l)=>({top:r(a),left:a.left-l.width+e,name:"arrow_ne",...s&&{config:s}}),southArrowNorthWest:a=>({top:r(a),left:a.left+a.width/2-e,name:"arrow_nw",...s&&{config:s}}),southArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southArrowNorth:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width/2,name:"arrow_n",...s&&{config:s}}),southArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southArrowNorthEast:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width+e,name:"arrow_ne",...s&&{config:s}}),southEastArrowNorthWest:a=>({top:r(a),left:a.right-e,name:"arrow_nw",...s&&{config:s}}),southEastArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.right-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southEastArrowNorth:(a,l)=>({top:r(a),left:a.right-l.width/2,name:"arrow_n",...s&&{config:s}}),southEastArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.right-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southEastArrowNorthEast:(a,l)=>({top:r(a),left:a.right-l.width+e,name:"arrow_ne",...s&&{config:s}}),westArrowEast:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.left-l.width-t,name:"arrow_e",...s&&{config:s}}),eastArrowWest:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.right+t,name:"arrow_w",...s&&{config:s}}),viewportStickyNorth:(a,l,c,u)=>{const d=u||c;return!a.getIntersection(d)||d.height-a.height>i?null:{top:d.top+i,left:a.left+a.width/2-l.width/2,name:"arrowless",config:{withArrow:!1,...s}}}};function o(a,l){return a.top-l.height-t}function r(a){return a.bottom+t}}/**
|
|
695
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
696
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
697
|
-
*/const Wu="ck-tooltip";class we extends qe(){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,this._mutationObserver=null,we._editors.add(e),we._instance)return we._instance;we._instance=this,this.tooltipTextView=new T(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new ke(e.locale),this.balloonPanelView.class=Wu,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=Kx(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=ci(this._pinTooltip,600),this._unpinTooltipDebounced=ci(this._unpinTooltip,400),this.listenTo(S.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(S.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(S.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(S.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(S.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(S.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;we._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),we._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),we._instance=null)}static getPositioningFunctions(e){const t=we.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onKeyDown(e,t){t.key==="Escape"&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const i=Ar(t);if(!i){e.name==="focus"&&this._unpinTooltip();return}i!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(i,qu(i)))}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if(e.name==="mouseleave"){if(!ui(t))return;const s=this.balloonPanelView.element,o=s&&(s===i||s.contains(i)),r=!o&&t===s;if(o){this._unpinTooltipDebounced.cancel();return}if(!r&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const a=Ar(t),l=Ar(i);(r||a&&a!==l)&&this._unpinTooltipDebounced()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:i,cssClass:s}){this._unpinTooltip();const o=J(we._editors.values()).ui.view.body;o.has(this.balloonPanelView)||o.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.pin({target:e,positions:we.getPositioningFunctions(i)}),this._resizeObserver=new ee(e,()=>{di(e)||this._unpinTooltip()}),this._mutationObserver.attach(e),this.balloonPanelView.class=[Wu,s].filter(r=>r).join(" ");for(const r of we._editors)this.listenTo(r.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of we._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._resizeObserver&&this._resizeObserver.destroy(),this._mutationObserver.detach()}_updateTooltipPosition(){const e=qu(this._currentElementWithTooltip);if(!di(this._currentElementWithTooltip)||!e.text){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:we.getPositioningFunctions(e.position)})}}we.defaultBalloonPositions=Fg({heightOffset:5,sideOffset:13});we._editors=new Set;we._instance=null;function Ar(n){return ui(n)?n.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function qu(n){return{text:n.dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}}function Kx(n){const e=new MutationObserver(()=>{n()});return{attach(t){e.observe(t,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){e.disconnect()}}}const Zx=`<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></svg>
|
|
698
|
-
`;/**
|
|
699
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
700
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
701
|
-
*/const Jx=53,Yx=10,Qx=50,Xx=350,eI="Powered by";class tI extends qe(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=qn(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor,t=!!e.config.get("ui.poweredBy.forceVisible");/* istanbul ignore next -- @preserve */!t&&U2(e.config.get("licenseKey"))==="VALID"||e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(i,s,o)=>{this._updateLastFocusedEditableElement(),o?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(i,s,o)=>{this._updateLastFocusedEditableElement(),o&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new ke,i=Ng(e),s=new iI(e.locale,i.label);t.content.add(s),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=nI(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i){this._lastFocusedEditableElement=null;return}const s=Array.from(e.ui.getEditableElementsNames()).map(o=>e.ui.getEditableElement(o));s.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=s[0]}}class iI extends T{constructor(e,t){super(e);const i=new lt,s=this.bindTemplate;i.set({content:Zx,isColorInherited:!1}),i.extendTemplate({attributes:{style:{width:Jx+"px",height:Yx+"px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],i],on:{dragstart:s.to(o=>o.preventDefault())}}]})}}function nI(n,e){const t=Ng(n),i=t.side==="right"?sI(e,t):oI(e,t);return{target:e,positions:[i]}}function sI(n,e){return Dg(n,e,(t,i)=>t.left+t.width-i.width-e.horizontalOffset)}function oI(n,e){return Dg(n,e,t=>t.left+e.horizontalOffset)}function Dg(n,e,t){return(i,s)=>{const o=new L(n);if(o.width<Xx||o.height<Qx)return null;let r;e.position==="inside"?r=o.bottom-s.height:r=o.bottom-s.height/2,r-=e.verticalOffset;const a=t(o,s),c=i.clone().moveTo(a,r).getIntersection(s.clone().moveTo(a,r)).getVisible();return!c||c.getArea()<s.getArea()?null:{top:r,left:a,name:`position_${e.position}-side_${e.side}`,config:{withArrow:!1}}}}function Ng(n){const e=n.config.get("ui.poweredBy"),t=e&&e.position||"border";return{position:t,label:eI,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:n.locale.contentLanguageDirection==="ltr"?"right":"left",...e}}/**
|
|
702
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
703
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
704
|
-
*/const $g={POLITE:"polite",ASSERTIVE:"assertive"};class rI{constructor(e){this.editor=e}announce(e,t,i=$g.POLITE){const s=this.editor;this.view||(this.view=new aI(s.locale),s.ui.view.body.add(this.view));let o=this.view.regionViews.find(r=>r.regionName===e);o||(o=new lI(this.view.locale),this.view.regionViews.add(o)),o.set({regionName:e,text:t,politeness:i})}}class aI extends T{constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class lI extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("regionName",""),this.set("text",""),this.set("politeness",$g.POLITE),this.setTemplate({tag:"div",attributes:{role:"region","data-region":t.to("regionName"),"aria-live":t.to("politeness")},children:[{text:t.to("text")}]})}}/**
|
|
705
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
706
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
707
|
-
*/class cI extends W(){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[];const t=e.editing.view;this.editor=e,this.componentFactory=new zx(e),this.focusTracker=new te,this.tooltipManager=new we(e),this.poweredBy=new tI(e),this.ariaLiveAnnouncer=new rI(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",()=>{this.isReady=!0}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?i():this.once("ready",i)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:i}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let i,s;e.keystrokes.set("Alt+F10",(o,r)=>{const a=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(a)&&!Array.from(t.domRoots.values()).includes(a)&&(i=a);const l=this._getCurrentFocusedToolbarDefinition();(!l||!s)&&(s=this._getFocusableCandidateToolbarDefinitions());for(let c=0;c<s.length;c++){const u=s.shift();if(s.push(u),u!==l&&this._focusFocusableCandidateToolbar(u)){l&&l.options.afterBlur&&l.options.afterBlur();break}}r()}),e.keystrokes.set("Esc",(o,r)=>{const a=this._getCurrentFocusedToolbarDefinition();a&&(i?(i.focus(),i=null):e.editing.view.focus(),a.options.afterBlur&&a.options.afterBlur(),r())})}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:i,options:s}=t;(di(i.element)||s.beforeFocus)&&e.push(t)}return e.sort((t,i)=>ju(t)-ju(i)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:i}}=e;return i&&i(),di(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){const i={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=i.top,t.viewportOffset.bottom+=i.bottom,t.viewportOffset.left+=i.left,t.viewportOffset.right+=i.right}}function ju(n){const{toolbarView:e,options:t}=n;let i=10;return di(e.element)&&i--,t.isContextual&&i--,i}/**
|
|
708
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
709
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
710
|
-
*/class uI extends T{constructor(e){super(e),this.body=new SS(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}/**
|
|
711
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
712
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
713
|
-
*/class dI extends uI{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(){const e=this.t,t=new un;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}/**
|
|
714
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
715
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
716
|
-
*/class hI extends T{constructor(e,t,i){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;e.isRenderingInProgress?i(this):t(this);function t(s){e.change(o=>{const r=e.document.getRoot(s.name);o.addClass(s.isFocused?"ck-focused":"ck-blurred",r),o.removeClass(s.isFocused?"ck-blurred":"ck-focused",r)})}function i(s){e.once("change:isRenderingInProgress",(o,r,a)=>{a?i(s):t(s)})}}}/**
|
|
717
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
718
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
719
|
-
*/class fI extends hI{constructor(e,t,i,s={}){super(e,t,i);const o=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=s.label||(()=>o("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change(t=>{const i=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),i)})}}/**
|
|
720
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
721
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
722
|
-
*/class Gu extends wm{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}/**
|
|
723
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
724
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
725
|
-
*/class ki extends W(){constructor(e,t){super(),t&&df(this,t),e&&this.set(e)}}/**
|
|
726
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
727
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
728
|
-
*/const Ms=ln("px");class ko extends w{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,s=t.document.selection.editableElement;return s?t.domConverter.mapViewToDom(s.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new g("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t)){this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,(!this._visibleStack||e.singleViewMode)&&this.showStack(t);return}const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new g("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new g("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new ke(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(i=>i[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new mI(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(i,s)=>!s&&i>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(i,s)=>{if(s<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,s])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new gI(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,i)=>!i&&t>=2?Math.min(t-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:s=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),s&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class mI extends T{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new te,this.buttonPrevView=this._createButtonView(t("Previous"),P.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),P.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",s=>s?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new V(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class gI extends T{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",s=>s?"":"ck-hidden")],style:{top:i.to("top",Ms),left:i.to("left",Ms),width:i.to("width",Ms),height:i.to("height",Ms)}},children:this.content}),this.on("change:numberOfPanels",(s,o,r,a)=>{r>a?this._addPanels(r-a):this._removePanels(a-r),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new T;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:s}=new L(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:s})}}}/**
|
|
729
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
730
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
731
|
-
*/const Ri=ln("px");class pI extends T{constructor(e){super(e);const 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 Le({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",i=>i?"block":"none"),height:t.to("isSticky",i=>i?Ri(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new Le({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?Ri(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",i=>i&&Ri(i)),bottom:t.to("_stickyBottomOffset",i=>i&&Ri(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(S.document,"scroll",()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky()})}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive){this._unstick();return}const e=new L(this.limiterElement);let t=e.getVisible();if(t){const i=new L(S.window);i.top+=this.viewportTopOffset,i.height-=this.viewportTopOffset,t=t.getIntersection(i)}if(t&&e.top<t.top){const i=t.top;if(i+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const s=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-s>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(s):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(i):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=Ri(-S.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=Ri(-S.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new L(this.contentPanelElement)}}/**
|
|
732
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
733
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
734
|
-
*/class wI extends dn{constructor(e,t){const i=e.t,s=Object.assign({},{showResetButton:!0,showIcon:!0,creator:ps},t);super(e,s.creator),this.label=t.label,this._viewConfig=s,this._viewConfig.showIcon&&(this.iconView=new lt,this.iconView.content=P.loupe,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new V(e),this.resetButtonView.set({label:i("Clear"),icon:P.cancel,class:"ck-search__reset",isVisible:!1,tooltip:!0}),this.resetButtonView.on("execute",()=>{this.reset(),this.focus(),this.fire("reset")}),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",o=>!o),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}))}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=!1)}}/**
|
|
735
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
736
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
737
|
-
*/class bI extends T{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",e.if("isVisible","ck-hidden",t=>!t)],tabindex:-1},children:[{tag:"span",children:[{text:[e.to("primaryText")]}]},{tag:"span",children:[{text:[e.to("secondaryText")]}]}]})}focus(){this.element.focus()}}/**
|
|
738
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
739
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
740
|
-
*/class _I extends T{constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new te,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new Ae({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}/**
|
|
741
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
742
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
743
|
-
*/class vI extends T{constructor(e,t){super(e),this._config=t,this.filteredView=t.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new te,this.keystrokes=new oe,this.resultsView=new _I(e),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set("isEnabled",!0),this.set("resultsCount",0),this.set("totalItemsCount",0),t.infoView&&t.infoView.instance?this.infoView=t.infoView.instance:(this.infoView=new bI,this._enableDefaultInfoViewBehavior(),this.on("render",()=>{this.search("")})),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new Ae({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",(i,{resultsCount:s,totalItemsCount:o})=>{this.resultsCount=s,this.totalItemsCount=o}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",t.class||null],tabindex:"-1"},children:this.children})}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const e=t=>t.stopPropagation();for(const t of this.focusableChildren)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}focus(){this.queryView.focus()}reset(){this.queryView.reset(),this.search("")}search(e){const t=e?new RegExp(Kk(e),"ig"):null,i=this.filteredView.filter(t);this.fire("search",{query:e,...i})}_createSearchTextQueryView(){const e=new wI(this.locale,this._config.queryView);return this.listenTo(e.fieldView,"input",()=>{this.search(e.fieldView.element.value)}),e.on("reset",()=>this.reset()),e.bind("isEnabled").to(this),e}_enableDefaultInfoViewBehavior(){const e=this.locale.t,t=this.infoView;this.on("search",(s,o)=>{if(o.resultsCount)t.set({isVisible:!1});else{const r=this._config.infoView&&this._config.infoView.text;let a,l;o.totalItemsCount?r&&r.notFound?(a=r.notFound.primary,l=r.notFound.secondary):(a=e("No results found"),l=""):r&&r.noSearchableItems?(a=r.noSearchableItems.primary,l=r.noSearchableItems.secondary):(a=e("No searchable items"),l=""),t.set({primaryText:i(a,o),secondaryText:i(l,o),isVisible:!0})}});function i(s,{query:o,resultsCount:r,totalItemsCount:a}){return typeof s=="function"?s(o,r,a):s}}}/**
|
|
744
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
745
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
746
|
-
*/class ts extends vI{constructor(e,t){super(e,t),this._config=t;const i=ln("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const s=this.resultsView.bindTemplate;this.resultsView.set("isVisible",!1),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[s.if("isVisible","ck-hidden",o=>!o),s.to("_position",o=>`ck-search__results_${o}`)],style:{width:s.to("_width",i)}}}),this.focusTracker.on("change:isFocused",(o,r,a)=>{this._updateResultsVisibility(),a?this.resultsView.element.scrollTop=0:t.resetOnBlur&&this.queryView.reset()}),this.on("search",()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition()}),this.keystrokes.set("esc",(o,r)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=!1,r())}),this.listenTo(S.document,"scroll",()=>{this._updateResultsViewWidthAndPosition()}),this.on("change:isEnabled",()=>{this._updateResultsVisibility()}),this.filteredView.on("execute",(o,{value:r})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=r,this.resultsView.isVisible=!1}),this.resultsView.on("change:isVisible",()=>{this._updateResultsViewWidthAndPosition()})}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new L(this.queryView.fieldView.element).width;const e=ts._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:ts.defaultResultsPositions});this.resultsView._position=e?e.name:"s"}_updateResultsVisibility(){const e=typeof this._config.queryMinChars>"u"?0:this._config.queryMinChars,t=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&t>=e}}ts.defaultResultsPositions=[n=>({top:n.bottom,left:n.left,name:"s"}),(n,e)=>({top:n.top-e.height,left:n.left,name:"n"})];ts._getOptimalPosition=qo;/**
|
|
747
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
748
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
749
|
-
*/class yI extends V{constructor(e){super(e);const 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(){const e=new lt;return e.content=Zo,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}/**
|
|
750
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
751
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
752
|
-
*/class Ci extends Xi{constructor(e,t){super(e);const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:i.to("mouseenter")}}),this.delegate("mouseenter").to(t)}}/**
|
|
753
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
754
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
755
|
-
*/const Ls=5,vn={toggleMenusAndFocusItemsOnHover(n){n.on("menu:mouseenter",e=>{if(n.isOpen){for(const t of n.menus){const i=e.path[0],s=i instanceof Ci&&i.children.first===t;t.isOpen=(e.path.includes(t)||s)&&t.isEnabled}e.source.focus()}})},focusCycleMenusOnArrows(n){const e=n.locale.uiLanguageDirection==="rtl";n.on("menu:arrowright",i=>{t(i.source,e?-1:1)}),n.on("menu:arrowleft",i=>{t(i.source,e?1:-1)});function t(i,s){const o=n.children.getIndex(i),r=i.isOpen,a=n.children.length,l=n.children.get((o+a+s)%a);i.isOpen=!1,r&&(l.isOpen=!0),l.buttonView.focus()}},closeMenusWhenTheBarCloses(n){n.on("change:isOpen",()=>{n.isOpen||n.menus.forEach(e=>{e.isOpen=!1})})},closeMenuWhenAnotherOnTheSameLevelOpens(n){n.on("menu:change:isOpen",(e,t,i)=>{i&&n.menus.filter(s=>e.source.parentMenuView===s.parentMenuView&&e.source!==s&&s.isOpen).forEach(s=>{s.isOpen=!1})})},closeOnClickOutside(n){Mo({emitter:n,activator:()=>n.isOpen,callback:()=>n.close(),contextElements:()=>n.children.map(e=>e.element)})}},Gt={openAndFocusPanelOnArrowDownKey(n){n.keystrokes.set("arrowdown",(e,t)=>{n.focusTracker.focusedElement===n.buttonView.element&&(n.isOpen||(n.isOpen=!0),n.panelView.focus(),t())})},openOnArrowRightKey(n){const e=n.locale.uiLanguageDirection==="rtl"?"arrowleft":"arrowright";n.keystrokes.set(e,(t,i)=>{n.focusTracker.focusedElement!==n.buttonView.element||!n.isEnabled||(n.isOpen||(n.isOpen=!0),n.panelView.focus(),i())})},openOnButtonClick(n){n.buttonView.on("execute",()=>{n.isOpen=!0,n.panelView.focus()})},toggleOnButtonClick(n){n.buttonView.on("execute",()=>{n.isOpen=!n.isOpen,n.isOpen&&n.panelView.focus()})},closeOnArrowLeftKey(n){const e=n.locale.uiLanguageDirection==="rtl"?"arrowright":"arrowleft";n.keystrokes.set(e,(t,i)=>{n.isOpen&&(n.isOpen=!1,n.focus(),i())})},closeOnEscKey(n){n.keystrokes.set("esc",(e,t)=>{n.isOpen&&(n.isOpen=!1,n.focus(),t())})},closeOnParentClose(n){n.parentMenuView.on("change:isOpen",(e,t,i)=>{!i&&e.source===n.parentMenuView&&(n.isOpen=!1)})}},kI={southEast:n=>({top:n.bottom,left:n.left,name:"se"}),southWest:(n,e)=>({top:n.bottom,left:n.left-e.width+n.width,name:"sw"}),northEast:(n,e)=>({top:n.top-e.height,left:n.left,name:"ne"}),northWest:(n,e)=>({top:n.top-e.height,left:n.left-e.width+n.width,name:"nw"}),eastSouth:n=>({top:n.top,left:n.right-Ls,name:"es"}),eastNorth:(n,e)=>({top:n.top-e.height,left:n.right-Ls,name:"en"}),westSouth:(n,e)=>({top:n.top,left:n.left-e.width+Ls,name:"ws"}),westNorth:(n,e)=>({top:n.top-e.height,left:n.left-e.width+Ls,name:"wn"})},CI=[{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:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:uploadImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:comment"]},{groupId:"insertMinorWidgets",items:["menuBar:insertTemplate","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{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:todoList"]},{groupId:"indent",items:["menuBar:alignment","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"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function EI(n){let e;return!("items"in n)||!n.items?e={items:Ye(CI),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...n}:e={items:n.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...n},e}function TI({normalizedConfig:n,locale:e,componentFactory:t}){const i=Ye(n);return AI(n,i),SI(n,i),xI(n,i,t),Hg(n,i),II(i,e),i}function AI(n,e){const t=e.removeItems,i=[];e.items=e.items.filter(({menuId:s})=>t.includes(s)?(i.push(s),!1):!0),fn(e.items,s=>{s.groups=s.groups.filter(({groupId:o})=>t.includes(o)?(i.push(o),!1):!0);for(const o of s.groups)o.items=o.items.filter(r=>{const a=zg(r);return t.includes(a)?(i.push(a),!1):!0})});for(const s of t)i.includes(s)||D("menu-bar-item-could-not-be-removed",{menuBarConfig:n,itemName:s})}function SI(n,e){const t=e.addItems,i=[];for(const s of t){const o=VI(s.position),r=BI(s.position);if(PI(s))if(!r)o==="start"?(e.items.unshift(s.menu),i.push(s)):o==="end"&&(e.items.push(s.menu),i.push(s));else{const a=e.items.findIndex(l=>l.menuId===r);a!=-1?o==="before"?(e.items.splice(a,0,s.menu),i.push(s)):o==="after"&&(e.items.splice(a+1,0,s.menu),i.push(s)):Ku(e,s.menu,r,o)&&i.push(s)}else RI(s)?fn(e.items,a=>{if(a.menuId===r)o==="start"?(a.groups.unshift(s.group),i.push(s)):o==="end"&&(a.groups.push(s.group),i.push(s));else{const l=a.groups.findIndex(c=>c.groupId===r);l!==-1&&(o==="before"?(a.groups.splice(l,0,s.group),i.push(s)):o==="after"&&(a.groups.splice(l+1,0,s.group),i.push(s)))}}):Ku(e,s.item,r,o)&&i.push(s)}for(const s of t)i.includes(s)||D("menu-bar-item-could-not-be-added",{menuBarConfig:n,addedItemConfig:s})}function Ku(n,e,t,i){let s=!1;return fn(n.items,o=>{for(const{groupId:r,items:a}of o.groups){if(s)return;if(r===t)i==="start"?(a.unshift(e),s=!0):i==="end"&&(a.push(e),s=!0);else{const l=a.findIndex(c=>zg(c)===t);l!==-1&&(i==="before"?(a.splice(l,0,e),s=!0):i==="after"&&(a.splice(l+1,0,e),s=!0))}}}),s}function xI(n,e,t){fn(e.items,i=>{for(const s of i.groups)s.items=s.items.filter(o=>{const r=typeof o=="string"&&!t.has(o);return r&&!e.isUsingDefaultConfig&&D("menu-bar-item-unavailable",{menuBarConfig:n,parentMenuConfig:Ye(i),componentName:o}),!r})})}function Hg(n,e){const t=e.isUsingDefaultConfig;let i=!1;if(e.items=e.items.filter(s=>s.groups.length?!0:(Sr(n,s,t),!1)),!e.items.length){Sr(n,n,t);return}fn(e.items,s=>{s.groups=s.groups.filter(o=>o.items.length?!0:(i=!0,!1));for(const o of s.groups)o.items=o.items.filter(r=>Ug(r)&&!r.groups.length?(Sr(n,r,t),i=!0,!1):!0)}),i&&Hg(n,e)}function Sr(n,e,t){t||D("menu-bar-menu-empty",{menuBarConfig:n,emptyMenuConfig:e})}function II(n,e){const t=e.t,i={File:t({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:t({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:t({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:t({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:t({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:t({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:t({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:t({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:t({string:"Font",id:"MENU_BAR_MENU_FONT"})};fn(n.items,s=>{s.label in i&&(s.label=i[s.label])})}function fn(n,e){if(Array.isArray(n))for(const i of n)t(i);function t(i){e(i);for(const s of i.groups)for(const o of s.items)Ug(o)&&t(o)}}function PI(n){return typeof n=="object"&&"menu"in n}function RI(n){return typeof n=="object"&&"group"in n}function VI(n){return n.startsWith("start")?"start":n.startsWith("end")?"end":n.startsWith("after")?"after":"before"}function BI(n){const e=n.match(/^[^:]+:(.+)/);return e?e[1]:null}function zg(n){return typeof n=="string"?n:n.menuId}function Ug(n){return typeof n=="object"&&"menuId"in n}/**
|
|
756
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
757
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
758
|
-
*/class MI extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-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())}}/**
|
|
759
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
760
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
761
|
-
*/class Oe extends T{constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new yI(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new MI(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new oe,this.focusTracker=new te,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",t.to("class"),t.if("isEnabled","ck-disabled",i=>!i),t.if("parentMenuView","ck-menu-bar__menu_top-level",i=>!i)]},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),Gt.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(Gt.openOnButtonClick(this),Gt.openOnArrowRightKey(this),Gt.closeOnArrowLeftKey(this),Gt.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),Gt.openAndFocusPanelOnArrowDownKey(this),Gt.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",(e,t)=>{this.fire("arrowright"),t()}),this.keystrokes.set("arrowleft",(e,t)=>{this.fire("arrowleft"),t()})}_repositionPanelOnOpen(){this.on("change:isOpen",(e,t,i)=>{if(!i)return;const s=Oe._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=s?s.name:this._panelPositions[0].name})}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:i,northWest:s,westSouth:o,eastSouth:r,westNorth:a,eastNorth:l}=kI;return this.locale.uiLanguageDirection==="ltr"?this.parentMenuView?[r,l,o,a]:[e,t,i,s]:this.parentMenuView?[o,a,r,l]:[t,e,s,i]}}Oe._getOptimalPosition=qo;/**
|
|
762
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
763
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
764
|
-
*/class hi extends kl{constructor(e){super(e),this.role="menu"}}/**
|
|
765
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
766
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
767
|
-
*/class he extends V{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}/**
|
|
768
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
769
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
770
|
-
*/class Wg extends gg{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}/**
|
|
771
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
772
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
773
|
-
*/const Zu=["mouseenter","arrowleft","arrowright","change:isOpen"];class LI extends T{constructor(e){super(e),this.menus=[];const t=e.t;this.set("isOpen",!1),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar"],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t){const i=this.locale,o=TI({normalizedConfig:e,locale:i,componentFactory:t}).items.map(r=>this._createMenu({componentFactory:t,menuDefinition:r}));this.children.addMany(o)}render(){super.render(),vn.toggleMenusAndFocusItemsOnHover(this),vn.closeMenusWhenTheBarCloses(this),vn.closeMenuWhenAnotherOnTheSameLevelOpens(this),vn.focusCycleMenusOnArrows(this),vn.closeOnClickOutside(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}registerMenu(e,t=null){t?(e.delegate(...Zu).to(t),e.parentMenuView=t):e.delegate(...Zu).to(this,i=>"menu:"+i),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:i}){const s=this.locale,o=new Oe(s);return this.registerMenu(o,i),o.buttonView.set({label:t.label}),o.once("change:isOpen",()=>{const r=new hi(s);r.ariaLabel=t.label,o.panelView.children.add(r),r.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:o,componentFactory:e}))}),o}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:i}){const s=this.locale,o=[];for(const r of e.groups){for(const a of r.items){const l=new Ci(s,t);if(Q(a))l.children.add(this._createMenu({componentFactory:i,menuDefinition:a,parentMenuView:t}));else{const c=this._createMenuItemContentFromFactory({componentName:a,componentFactory:i,parentMenuView:t});if(!c)continue;l.children.add(c)}o.push(l)}r!==e.groups[e.groups.length-1]&&o.push(new yl(s))}return o}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:i}){const s=i.create(e);return s instanceof Oe||s instanceof he||s instanceof Wg?(this._registerMenuTree(s,t),s.on("execute",()=>{this.close()}),s):(D("menu-bar-component-unsupported",{componentName:e,componentView:s}),null)}_registerMenuTree(e,t){if(!(e instanceof Oe)){e.delegate("mouseenter").to(t);return}this.registerMenu(e,t);const i=e.panelView.children.filter(o=>o instanceof hi)[0];if(!i){e.delegate("mouseenter").to(t);return}const s=i.items.filter(o=>o instanceof Xi);for(const o of s)this._registerMenuTree(o.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(o=>o.isOpen)},0)})}}/**
|
|
774
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
775
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
776
|
-
*/class OI extends cI{constructor(e,t){super(e),this.view=t,this._toolbarConfig=Ig(e.config.get("toolbar")),this._menuBarConfig=EI(e.config.get("menuBar")||{}),this._elementReplacer=new em,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){const t=this.editor,i=this.view,s=t.editing.view,o=i.editable,r=s.document.getRoot();o.name=r.rootName,i.render();const a=o.element;this.setEditableElement(o.name,a),i.editable.bind("isFocused").to(this.focusTracker),s.attachDomRoot(a),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this._initMenuBar(),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({top:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initMenuBar(){const e=this.view;e.menuBarView&&(this._setupMenuBarBehaviors(e.menuBarView.element),e.menuBarView.fillFromConfig(this._menuBarConfig,this.componentFactory))}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),s=e.sourceElement;let o;const r=e.config.get("placeholder");r&&(o=typeof r=="string"?r:r[this.view.editable.name]),!o&&s&&s.tagName.toLowerCase()==="textarea"&&(o=s.getAttribute("placeholder")),o&&(i.placeholder=o),bm({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,i){const s=this.view.stickyPanel;if(s.isSticky){const o=new L(s.element).height;t.viewportOffset.top+=o}else{const o=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(s,"change:isSticky",o),setTimeout(()=>{this.stopListening(s,"change:isSticky",o)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",()=>{const i=t.view;i.on("moveTo",(s,o)=>{if(!e.isSticky||i.wasMoved)return;const r=new L(e.contentPanelElement);o[1]<r.bottom+en.defaultOffset&&(o[1]=r.bottom+en.defaultOffset)},{priority:"high"})},{priority:"low"})}_setupMenuBarBehaviors(e){const t=this.editor;this.focusTracker.add(e),t.keystrokes.listenTo(e),t.keystrokes.set("Esc",(i,s)=>{e.contains(this.focusTracker.focusedElement)&&(t.editing.view.focus(),s())}),t.keystrokes.set("Alt+F9",(i,s)=>{e.contains(this.focusTracker.focusedElement)||(this.view.menuBarView.focus(),s())})}}/**
|
|
777
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
778
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
779
|
-
*/class FI extends dI{constructor(e,t,i={}){super(e),this.stickyPanel=new pI(e),this.toolbar=new vl(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new LI(e)),this.editable=new fI(e,t)}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)}}/**
|
|
780
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
781
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
782
|
-
*/class qg{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const i="error"in t?t.error:t.reason;i instanceof Error&&this._handleError(i,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(i=>i!==t)}_fire(e,...t){const i=this._listeners[e]||[];for(const s of i)s.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const i=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:i}),i?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&e.context!==void 0&&e.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(e)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;const e=this.crashes[this.crashes.length-1].date,t=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(e-t)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}/**
|
|
783
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
784
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
785
|
-
*/function ba(n,e=new Set){const t=[n],i=new Set;let s=0;for(;t.length>s;){const o=t[s++];if(!(i.has(o)||!DI(o)||e.has(o)))if(i.add(o),Symbol.iterator in o)try{for(const r of o)t.push(r)}catch{}else for(const r in o)r!=="defaultValue"&&t.push(o[r])}return i}function DI(n){const e=Object.prototype.toString.call(n),t=typeof n;return!(t==="number"||t==="boolean"||t==="string"||t==="symbol"||t==="function"||e==="[object Date]"||e==="[object RegExp]"||e==="[object Module]"||n===void 0||n===null||n._watchdogExcluded||n instanceof EventTarget||n instanceof Event)}/**
|
|
786
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
787
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
788
|
-
*/function jg(n,e,t=new Set){if(n===e&&NI(n))return!0;const i=ba(n,t),s=ba(e,t);for(const o of i)if(s.has(o))return!0;return!1}function NI(n){return typeof n=="object"&&n!==null}/**
|
|
789
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
790
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
791
|
-
*/class Gg extends qg{constructor(e,t={}){super(t),this._editor=null,this._lifecyclePromise=null,this._initUsingData=!0,this._editables={},this._throttledSave=qn(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(i,s)=>e.create(i,s)),this._destructor=i=>i.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{const e={},t=[],i=this._config.rootsAttributes||{},s={};for(const[r,a]of Object.entries(this._data.roots))a.isLoaded?(e[r]="",s[r]=i[r]||{}):t.push(r);const o={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:s,_watchdogInitialData:this._data};return delete o.initialData,o.extraPlugins.push($I),this._initUsingData?this.create(e,o,o.context):ui(this._elementOrData)?this.create(this._elementOrData,o,o.context):this.create(this._editables,o,o.context)}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,i){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData=typeof e=="string"||Object.keys(e).length>0&&typeof Object.values(e)[0]=="string",this._config=this._cloneEditorConfiguration(t)||{},this._config.context=i,this._creator(e,this._config))).then(s=>{this._editor=s,s.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=s.model.document.version,this._data=this._getData(),this._initUsingData||(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();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(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(){const e=this._editor,t=e.model.document.roots.filter(a=>a.isAttached()&&a.rootName!="$graveyard"),{plugins:i}=e,s=i.has("CommentsRepository")&&i.get("CommentsRepository"),o=i.has("TrackChanges")&&i.get("TrackChanges"),r={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(a=>{r.roots[a.rootName]={content:JSON.stringify(Array.from(a.getChildren())),attributes:JSON.stringify(Array.from(a.getAttributes())),isLoaded:a._isLoaded}});for(const a of e.model.markers)a._affectsData&&(r.markers[a.name]={rangeJSON:a.getRange().toJSON(),usingOperation:a._managedUsingOperations,affectsData:a._affectsData});return s&&(r.commentThreads=JSON.stringify(s.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),o&&(r.suggestions=JSON.stringify(o.getSuggestions({toJSON:!0,skipNotAttached:!0}))),r}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const i=this.editor.ui.getEditableElement(t);i&&(e[t]=i)}return e}_isErrorComingFromThisItem(e){return jg(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return tl(e,(t,i)=>{if(ui(t)||i==="context")return t})}}class $I{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){const i=e.createElement(t.name,t.attributes);if(t.children)for(const s of t.children)i._appendChild(this._createNode(e,s));return i}else return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach(([i,{content:s,attributes:o}])=>{const r=JSON.parse(s),a=JSON.parse(o),l=t.model.document.getRoot(i);for(const[c,u]of a)e.setAttribute(c,u,l);for(const c of r){const u=this._createNode(e,c);e.insert(u,l,"end")}}),Object.entries(this._data.markers).forEach(([i,s])=>{const{document:o}=t.model,{rangeJSON:{start:r,end:a},...l}=s,c=o.getRoot(r.root),u=e.createPositionFromPath(c,r.path,r.stickiness),d=e.createPositionFromPath(c,a.path,a.stickiness),h=e.createRange(u,d);e.addMarker(i,{range:h,...l})})}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach(i=>{const s=this.editor.config.get("collaboration.channelId"),o=this.editor.plugins.get("CommentsRepository");o.hasCommentThread(i.threadId)&&o.getCommentThread(i.threadId).remove(),o.addCommentThread({channelId:s,...i})}),t.forEach(i=>{const s=this.editor.plugins.get("TrackChangesEditing");if(s.hasSuggestion(i.id)){const o=s.getSuggestion(i.id);o.attributes=i.attributes}else s.addSuggestionData(i)})}}/**
|
|
792
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
793
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
794
|
-
*/const Fn=Symbol("MainQueueId");class HI extends qg{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new zI,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(Fn,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=Ju(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 Gg(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",(o,{error:r,causesRestart:a})=>{this._fire("itemError",{itemId:i.id,error:r}),a&&this._actionQueues.enqueue(i.id,()=>new Promise(l=>{const c=()=>{s.off("restart",c),this._fire("itemRestart",{itemId:i.id}),l()};s.on("restart",c)}))}),s.create(i.sourceElementOrData,i.config,this._context);throw new Error(`Not supported item type: '${i.type}'.`)})))}remove(e){const t=Ju(e);return Promise.all(t.map(i=>this._actionQueues.enqueue(i,()=>{const s=this._getWatchdog(i);return this._watchdogs.delete(i),s.destroy()})))}destroy(){return this._actionQueues.enqueue(Fn,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Fn,()=>(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=ba(this._context),Promise.all(Array.from(this._watchdogs.values()).map(t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(t=>t.destroy())).then(()=>this._destructor(e))})}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return jg(this._context,e.context)}}class zI{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const i=e===Fn;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const o=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(Fn),this._queues.get(e)])).then(t),r=o.catch(()=>{});return this._queues.set(e,r),o.finally(()=>{this._activeActions--,this._queues.get(e)===r&&this._activeActions===0&&this._onEmptyCallbacks.forEach(a=>a())})}}function Ju(n){return Array.isArray(n)?n:[n]}/**
|
|
795
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
796
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
797
|
-
*/class Qo extends ha(tA){constructor(e,t={}){if(!io(e)&&t.initialData!==void 0)throw new g("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",UI(e)),io(e)&&(this.sourceElement=e),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),s=this.config.get("menuBar"),o=new FI(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i,useMenuBar:s.isVisible});this.ui=new OI(this,o),iA(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(i=>{const s=new this(e,t);i(s.initPlugins().then(()=>s.ui.init(io(e)?e:null)).then(()=>s.data.init(s.config.get("initialData"))).then(()=>s.fire("ready")).then(()=>s))})}}Qo.Context=pm;Qo.EditorWatchdog=Gg;Qo.ContextWatchdog=HI;function UI(n){return io(n)?p2(n):n}function io(n){return ui(n)}/**
|
|
798
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
799
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
800
|
-
*/const El=["left","right","center","justify"];function Kg(n){return El.includes(n)}function Zg(n,e){return e.contentLanguageDirection=="rtl"?n==="right":n==="left"}function Jg(n){const e=n.map(i=>{let s;return typeof i=="string"?s={name:i}:s=i,s}).filter(i=>{const s=El.includes(i.name);return s||D("alignment-config-name-not-recognized",{option:i}),s}),t=e.filter(i=>!!i.className).length;if(t&&t<e.length)throw new g("alignment-config-classnames-are-missing",{configuredOptions:n});return e.forEach((i,s,o)=>{const r=o.slice(s+1);if(r.some(l=>l.name==i.name))throw new g("alignment-config-name-already-defined",{option:i,configuredOptions:n});if(i.className&&r.some(c=>c.className==i.className))throw new g("alignment-config-classname-already-defined",{option:i,configuredOptions:n})}),e}/**
|
|
801
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
802
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
803
|
-
*/const Tl="alignment";class WI extends R{refresh(){const t=this.editor.locale,i=J(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!i&&this._canBeAligned(i),this.isEnabled&&i.hasAttribute("alignment")?this.value=i.getAttribute("alignment"):this.value=t.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const t=this.editor,i=t.locale,s=t.model,o=s.document,r=e.value;s.change(a=>{const l=Array.from(o.selection.getSelectedBlocks()).filter(d=>this._canBeAligned(d)),c=l[0].getAttribute("alignment");Zg(r,i)||c===r||!r?qI(l,a):jI(l,a,r)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,Tl)}}function qI(n,e){for(const t of n)e.removeAttribute(Tl,t)}function jI(n,e,t){for(const i of n)e.setAttribute(Tl,t,i)}/**
|
|
804
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
805
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
806
|
-
*/class GI extends w{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:El.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,i=e.model.schema,o=Jg(e.config.get("alignment.options")).filter(c=>Kg(c.name)&&!Zg(c.name,t)),r=o.some(c=>!!c.className);i.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),r?e.conversion.attributeToAttribute(YI(o)):e.conversion.for("downcast").attributeToAttribute(KI(o));const a=ZI(o);for(const c of a)e.conversion.for("upcast").attributeToAttribute(c);const l=JI(o);for(const c of l)e.conversion.for("upcast").attributeToAttribute(c);e.commands.add("alignment",new WI(e))}}function KI(n){const e={};for(const{name:i}of n)e[i]={key:"style",value:{"text-align":i}};return{model:{key:"alignment",values:n.map(i=>i.name)},view:e}}function ZI(n){const e=[];for(const{name:t}of n)e.push({view:{key:"style",value:{"text-align":t}},model:{key:"alignment",value:t}});return e}function JI(n){const e=[];for(const{name:t}of n)e.push({view:{key:"align",value:t},model:{key:"alignment",value:t}});return e}function YI(n){const e={};for(const i of n)e[i.name]={key:"class",value:i.className};return{model:{key:"alignment",values:n.map(i=>i.name)},view:e}}/**
|
|
807
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
808
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
809
|
-
*/const yn=new Map([["left",P.alignLeft],["right",P.alignRight],["center",P.alignCenter],["justify",P.alignJustify]]);class QI extends w{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=this.editor,t=Jg(e.config.get("alignment.options"));t.map(i=>i.name).filter(Kg).forEach(i=>this._addButton(i)),this._addToolbarDropdown(t),this._addMenuBarMenu(t)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,i=>this._createButton(i,e))}_createButton(e,t,i={}){const s=this.editor,o=s.commands.get("alignment"),r=new V(e);return r.set({label:this.localizedOptionTitles[t],icon:yn.get(t),tooltip:!0,isToggleable:!0,...i}),r.bind("isEnabled").to(o),r.bind("isOn").to(o,"value",a=>a===t),this.listenTo(r,"execute",()=>{s.execute("alignment",{value:t}),s.editing.view.focus()}),r}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",s=>{const o=ge(s),r=s.uiLanguageDirection==="rtl"?"w":"e",a=s.t;Jo(o,()=>e.map(u=>this._createButton(s,u.name,{tooltipPosition:r})),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:a("Text alignment toolbar")}),o.buttonView.set({label:a("Text alignment"),tooltip:!0}),o.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const l=s.contentLanguageDirection==="rtl"?yn.get("right"):yn.get("left"),c=t.commands.get("alignment");return o.buttonView.bind("icon").to(c,"value",u=>yn.get(u)||l),o.bind("isEnabled").to(c,"isEnabled"),this.listenTo(o,"execute",()=>{t.editing.view.focus()}),o})}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",i=>{const s=t.commands.get("alignment"),o=i.t,r=new Oe(i),a=new hi(i);r.bind("isEnabled").to(s),a.set({ariaLabel:o("Text alignment"),role:"menu"}),r.buttonView.set({label:o("Text alignment")});for(const l of e){const c=new Ci(i,r),u=new he(i);u.extendTemplate({attributes:{"aria-checked":u.bindTemplate.to("isOn")}}),u.delegate("execute").to(r),u.set({label:this.localizedOptionTitles[l.name],icon:yn.get(l.name)}),u.on("execute",()=>{t.execute("alignment",{value:l.name}),t.editing.view.focus()}),u.bind("isOn").to(s,"value",d=>d===l.name),u.bind("isEnabled").to(s,"isEnabled"),c.children.add(u),a.items.add(c)}return r.panelView.children.add(a),r})}}/**
|
|
810
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
811
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
812
|
-
*/class XI extends w{static get requires(){return[GI,QI]}static get pluginName(){return"Alignment"}}/**
|
|
813
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
814
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
815
|
-
*/class Yg{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(i,s)=>{s.isLocal&&s.isUndoable&&s!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}}/**
|
|
816
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
817
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
818
|
-
*/class eP extends R{constructor(e,t){super(e),this._buffer=new Yg(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,s=e.text||"",o=s.length;let r=i.selection;if(e.selection?r=e.selection:e.range&&(r=t.createSelection(e.range)),!t.canEditAt(r))return;const a=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const c=Array.from(i.selection.getAttributes());t.deleteContent(r),s&&t.insertContent(l.createText(s,c),r),a?l.setSelection(a):r.is("documentSelection")||l.setSelection(r),this._buffer.unlock(),this._buffer.input(o)})}}/**
|
|
819
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
820
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
821
|
-
*/const Yu=["insertText","insertReplacementText"];class tP extends wt{constructor(e){super(e),this.focusObserver=e.getObserver(wo),M.isAndroid&&Yu.push("insertCompositionText");const t=e.document;t.on("beforeinput",(i,s)=>{if(!this.isEnabled)return;const{data:o,targetRanges:r,inputType:a,domEvent:l}=s;if(!Yu.includes(a))return;this.focusObserver.flush();const c=new xt(t,"insertText");t.fire(c,new Ji(e,l,{text:o,selection:e.createSelection(r)})),c.stop.called&&i.stop()}),t.on("compositionend",(i,{data:s,domEvent:o})=>{!this.isEnabled||M.isAndroid||s&&t.fire("insertText",new Ji(e,o,{text:s,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}/**
|
|
822
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
823
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
824
|
-
*/class Qg extends w{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,s=t.document.selection;i.addObserver(tP);const o=new eP(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",o),e.commands.add("input",o),this.listenTo(i.document,"insertText",(r,a)=>{i.document.isComposing||a.preventDefault();const{text:l,selection:c,resultRange:u}=a,d=Array.from(c.getRanges()).map(m=>e.editing.mapper.toModelRange(m));let h=l;if(M.isAndroid){const m=Array.from(d[0].getItems()).reduce((p,_)=>p+(_.is("$textProxy")?_.data:""),"");m&&(m.length<=h.length?h.startsWith(m)&&(h=h.substring(m.length),d[0].start=d[0].start.getShiftedBy(m.length)):m.startsWith(h)&&(d[0].start=d[0].start.getShiftedBy(h.length),h=""))}const f={text:h,selection:t.createSelection(d)};u&&(f.resultRange=e.editing.mapper.toModelRange(u)),e.execute("insertText",f),i.scrollToTheSelection()}),M.isAndroid?this.listenTo(i.document,"keydown",(r,a)=>{s.isCollapsed||a.keyCode!=229||!i.document.isComposing||Qu(t,o)}):this.listenTo(i.document,"compositionstart",()=>{s.isCollapsed||Qu(t,o)})}}function Qu(n,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),n.enqueueChange(t.batch,()=>{n.deleteContent(n.document.selection)}),t.unlock()}/**
|
|
825
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
826
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
827
|
-
*/class Xu extends R{constructor(e,t){super(e),this.direction=t,this._buffer=new Yg(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const o=s.createSelection(e.selection||i.selection);if(!t.canEditAt(o))return;const r=e.sequence||1,a=o.isCollapsed;if(o.isCollapsed&&t.modifySelection(o,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(o,r)){this.editor.execute("paragraph",{selection:o});return}if(o.isCollapsed)return;let l=0;o.getFirstRange().getMinimalFlatRanges().forEach(c=>{l+=ta(c.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(o,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),s.setSelection(o),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,o=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(o))||!t.schema.checkChild(o,"paragraph"))return!1;const a=o.getChild(0);return!(a&&a.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,o=t.schema.getLimitElement(s),r=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(r,o),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),o=i.schema.getLimitElement(s),r=o.getChild(0);return!(s.parent!=r||!e.containsEntireContent(r)||!i.schema.checkChild(o,"paragraph")||r.name=="paragraph")}}/**
|
|
828
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
829
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
830
|
-
*/const iP="character",ed="word",nP="codePoint",Ft="selection",zi="backward",xn="forward",Xg={deleteContent:{unit:Ft,direction:zi},deleteContentBackward:{unit:nP,direction:zi},deleteWordBackward:{unit:ed,direction:zi},deleteHardLineBackward:{unit:Ft,direction:zi},deleteSoftLineBackward:{unit:Ft,direction:zi},deleteContentForward:{unit:iP,direction:xn},deleteWordForward:{unit:ed,direction:xn},deleteHardLineForward:{unit:Ft,direction:xn},deleteSoftLineForward:{unit:Ft,direction:xn}};class sP extends wt{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",()=>{i++}),t.on("keyup",()=>{i=0}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:a,inputType:l}=o,c=Xg[l];if(!c)return;const u={direction:c.direction,unit:c.unit,sequence:i};u.unit==Ft&&(u.selectionToRemove=e.createSelection(r[0])),l==="deleteContentBackward"&&(M.isAndroid&&(u.sequence=1),rP(r)&&(u.unit=Ft,u.selectionToRemove=e.createSelection(r)));const d=new cn(t,"delete",r[0]);t.fire(d,new Ji(e,a,u)),d.stop.called&&s.stop()}),M.isBlink&&oP(this)}observe(){}stopObserving(){}}function oP(n){const e=n.view,t=e.document;let i=null,s=!1;t.on("keydown",(a,{keyCode:l})=>{i=l,s=!1}),t.on("keyup",(a,{keyCode:l,domEvent:c})=>{const u=t.selection,d=n.isEnabled&&l==i&&o(l)&&!u.isCollapsed&&!s;if(i=null,d){const h=u.getFirstRange(),f=new cn(t,"delete",h),m={unit:Ft,direction:r(l),selectionToRemove:u};t.fire(f,new Ji(e,c,m))}}),t.on("beforeinput",(a,{inputType:l})=>{const c=Xg[l];o(i)&&c&&c.direction==r(i)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(a,{inputType:l,data:c})=>{i==N.delete&&l=="insertText"&&c==""&&a.stop()},{priority:"high"});function o(a){return a==N.backspace||a==N.delete}function r(a){return a==N.backspace?zi:xn}}function rP(n){if(n.length!=1||n[0].isCollapsed)return!1;const e=n[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:i}of e){if(!i.parent.is("$text"))t++;else{const s=i.parent.data,o=i.offset;if(al(s,o)||ll(s,o)||mm(s,o))continue;t++}if(t>1)return!0}return!1}/**
|
|
831
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
832
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
833
|
-
*/class It extends w{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,s=e.model.document;t.addObserver(sP),this._undoOnBackspace=!1;const o=new Xu(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new Xu(e,"backward")),this.listenTo(i,"delete",(r,a)=>{i.isComposing||a.preventDefault();const{direction:l,sequence:c,selectionToRemove:u,unit:d}=a,h=l==="forward"?"deleteForward":"delete",f={sequence:c};if(d=="selection"){const m=Array.from(u.getRanges()).map(p=>e.editing.mapper.toModelRange(p));f.selection=e.model.createSelection(m)}else f.unit=d;e.execute(h,f),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(r,a)=>{this._undoOnBackspace&&a.direction=="backward"&&a.sequence==1&&a.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),a.preventDefault(),r.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}/**
|
|
834
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
835
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
836
|
-
*/class ep extends w{static get requires(){return[Qg,It]}static get pluginName(){return"Typing"}}/**
|
|
837
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
838
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
839
|
-
*/function tp(n,e){let t=n.start;return{text:Array.from(n.getWalker({ignoreElementEnd:!1})).reduce((s,{item:o})=>o.is("$text")||o.is("$textProxy")?s+o.data:(t=e.createPositionAfter(o),""),""),range:e.createRange(t,n.end)}}/**
|
|
840
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
841
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
842
|
-
*/class aP extends W(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",(i,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(i,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,o=i.document.selection,r=i.createRange(i.createPositionAt(o.focus.parent,0),o.focus),{text:a,range:l}=tp(r,i),c=this.testCallback(a);if(!c&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!c,c){const u=Object.assign(t,{text:a,range:l});typeof c=="object"&&Object.assign(u,c),this.fire(`matched:${e}`,u)}}}/**
|
|
843
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
844
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
845
|
-
*/class Co extends w{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this._isNextGravityRestorationSkipped=!1,this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,s=e.locale,o=t.document.selection;this.listenTo(i.document,"arrowKey",(r,a)=>{if(!o.isCollapsed||a.shiftKey||a.altKey||a.ctrlKey)return;const l=a.keyCode==N.arrowright,c=a.keyCode==N.arrowleft;if(!l&&!c)return;const u=s.contentLanguageDirection;let d=!1;u==="ltr"&&l||u==="rtl"&&c?d=this._handleForwardMovement(a):d=this._handleBackwardMovement(a),d===!0&&r.stop()},{context:"$text",priority:"highest"}),this.listenTo(o,"change:range",(r,a)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!a.directChange&&je(o.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model,s=i.document.selection,o=s.getFirstPosition();return this._isGravityOverridden||o.isAtStart&&_t(s,t)?!1:je(o,t)?(Cn(e),_t(s,t)&&je(o,t,!0)?kn(i,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,s=i.document.selection,o=s.getFirstPosition();return this._isGravityOverridden?(Cn(e),this._restoreGravity(),je(o,t,!0)?kn(i,t):Os(i,t,o),!0):o.isAtStart?_t(s,t)?(Cn(e),Os(i,t,o),!0):!1:!_t(s,t)&&je(o,t,!0)?(Cn(e),Os(i,t,o),!0):td(o,t)?o.isAtEnd&&!_t(s,t)&&je(o,t)?(Cn(e),Os(i,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(Ko);let o=!1;this.listenTo(s,"mousedown",()=>{o=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!o||(o=!1,!i.isCollapsed)||!_t(i,r))return;const a=i.getFirstPosition();je(a,r)&&(a.isAtStart||je(a,r,!0)?kn(t,r):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection,s=this.attributes;this.listenTo(t,"insertContent",()=>{const o=i.getFirstPosition();_t(i,s)&&je(o,s)&&kn(t,s)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view;let o=!1,r=!1;this.listenTo(s.document,"delete",(a,l)=>{o=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!o)return;const a=i.getFirstPosition();r=_t(i,this.attributes)&&!td(a,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{o&&(o=!1,!r&&e.model.enqueueChange(()=>{const a=i.getFirstPosition();_t(i,this.attributes)&&je(a,this.attributes)&&(a.isAtStart||je(a,this.attributes,!0)?kn(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 _t(n,e){for(const t of e)if(n.hasAttribute(t))return!0;return!1}function Os(n,e,t){const i=t.nodeBefore;n.change(s=>{if(i){const o=[],r=n.schema.isObject(i)&&n.schema.isInline(i);for(const[a,l]of i.getAttributes())n.schema.checkAttribute("$text",a)&&(!r||n.schema.getAttributeProperties(a).copyFromObject!==!1)&&o.push([a,l]);s.setSelectionAttribute(o)}else s.removeSelectionAttribute(e)})}function kn(n,e){n.change(t=>{t.removeSelectionAttribute(e)})}function Cn(n){n.preventDefault()}function td(n,e){const t=n.getShiftedBy(-1);return je(t,e)}function je(n,e,t=!1){const{nodeBefore:i,nodeAfter:s}=n;for(const o of e){const r=i?i.getAttribute(o):void 0,a=s?s.getAttribute(o):void 0;if(!(t&&(r===void 0||a===void 0))&&a!==r)return!0}return!1}/**
|
|
846
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
847
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
848
|
-
*/function ws(n,e,t,i){return i.createRange(_a(n,e,t,!0,i),_a(n,e,t,!1,i))}function _a(n,e,t,i,s){let o=n.textNode||(i?n.nodeBefore:n.nodeAfter),r=null;for(;o&&o.getAttribute(e)==t;)r=o,o=i?o.previousSibling:o.nextSibling;return r?s.createPositionAt(r,i?"before":"after"):n}/**
|
|
849
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
850
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
851
|
-
*/function ip(n,e,t,i){const s=n.editing.view,o=new Set;s.document.registerPostFixer(r=>{const a=n.model.document.selection;let l=!1;if(a.hasAttribute(e)){const c=ws(a.getFirstPosition(),e,a.getAttribute(e),n.model),u=n.editing.mapper.toViewRange(c);for(const d of u.getItems())d.is("element",t)&&!d.hasClass(i)&&(r.addClass(i,d),o.add(d),l=!0)}return l}),n.conversion.for("editingDowncast").add(r=>{r.on("insert",a,{priority:"highest"}),r.on("remove",a,{priority:"highest"}),r.on("attribute",a,{priority:"highest"}),r.on("selection",a,{priority:"highest"});function a(){s.change(l=>{for(const c of o.values())l.removeClass(i,c),o.delete(c)})}})}/**
|
|
852
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
853
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
854
|
-
*/function Bt(n,e,t,i){let s,o=null;typeof i=="function"?s=i:(o=n.commands.get(i),s=()=>{n.execute(i)}),n.model.document.on("change:data",(r,a)=>{if(o&&!o.isEnabled||!e.isEnabled)return;const l=J(n.model.document.selection.getRanges());if(!l.isCollapsed||a.isUndo||!a.isLocal)return;const c=Array.from(n.model.document.differ.getChanges()),u=c[0];if(c.length!=1||u.type!=="insert"||u.name!="$text"||u.length!=1)return;const d=u.position.parent;if(d.is("element","codeBlock")||d.is("element","listItem")&&typeof i!="function"&&!["numberedList","bulletedList","todoList"].includes(i)||o&&o.value===!0)return;const h=d.getChild(0),f=n.model.createRangeOn(h);if(!f.containsRange(l)&&!l.end.isEqual(f.end))return;const m=t.exec(h.data.substr(0,l.end.offset));m&&n.model.enqueueChange(p=>{const _=p.createPositionAt(d,0),k=p.createPositionAt(d,m[0].length),A=new He(_,k);if(s({match:m})!==!1){p.remove(A);const U=n.model.document.selection.getFirstRange(),Y=p.createRangeIn(d);d.isEmpty&&!Y.isEqual(U)&&!Y.containsRange(U,!0)&&p.remove(d)}A.detach(),n.model.enqueueChange(()=>{n.plugins.get("Delete").requestUndoOnBackspace()})})})}/**
|
|
855
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
856
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
857
|
-
*/function Vi(n,e,t,i){let s,o;t instanceof RegExp?s=t:o=t,o=o||(r=>{let a;const l=[],c=[];for(;(a=s.exec(r))!==null&&!(a&&a.length<4);){let{index:u,"1":d,"2":h,"3":f}=a;const m=d+h+f;u+=a[0].length-m.length;const p=[u,u+d.length],_=[u+d.length+h.length,u+d.length+h.length+f.length];l.push(p),l.push(_),c.push([u+d.length,u+d.length+h.length])}return{remove:l,format:c}}),n.model.document.on("change:data",(r,a)=>{if(a.isUndo||!a.isLocal||!e.isEnabled)return;const l=n.model,c=l.document.selection;if(!c.isCollapsed)return;const u=Array.from(l.document.differ.getChanges()),d=u[0];if(u.length!=1||d.type!=="insert"||d.name!="$text"||d.length!=1)return;const h=c.focus,f=h.parent,{text:m,range:p}=lP(l.createRange(l.createPositionAt(f,0),h),l),_=o(m),k=id(p.start,_.format,l),A=id(p.start,_.remove,l);k.length&&A.length&&l.enqueueChange(F=>{if(i(F,k)!==!1){for(const Y of A.reverse())F.remove(Y);l.enqueueChange(()=>{n.plugins.get("Delete").requestUndoOnBackspace()})}})})}function id(n,e,t){return e.filter(i=>i[0]!==void 0&&i[1]!==void 0).map(i=>t.createRange(n.getShiftedBy(i[0]),n.getShiftedBy(i[1])))}function lP(n,e){let t=n.start;return{text:Array.from(n.getItems()).reduce((s,o)=>!(o.is("$text")||o.is("$textProxy"))||o.getAttribute("code")?(t=e.createPositionAfter(o),""):s+o.data,""),range:e.createRange(t,n.end)}}/**
|
|
858
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
859
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
860
|
-
*/class cP extends w{static get requires(){return[It]}static get pluginName(){return"Autoformat"}afterInit(){const e=this.editor,t=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Revert autoformatting action"),keystroke:"Backspace"}]})}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&Bt(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&Bt(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&Bt(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&Bt(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const t=Fs(this.editor,"bold");Vi(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),Vi(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(e.get("italic")){const t=Fs(this.editor,"italic");Vi(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),Vi(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(e.get("code")){const t=Fs(this.editor,"code");Vi(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(e.get("strikethrough")){const t=Fs(this.editor,"strikethrough");Vi(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(t=>t.match(/^heading[1-6]$/)).forEach(t=>{const i=t[7],s=new RegExp(`^(#{${i}})\\s$`);Bt(this.editor,this,s,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&Bt(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&Bt(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&Bt(this.editor,this,/^---$/,"horizontalLine")}}function Fs(n,e){return(t,i)=>{if(!n.commands.get(e).isEnabled)return!1;const o=n.model.schema.getValidRanges(i,e);for(const r of o)t.setAttribute(e,!0,r);t.removeSelectionAttribute(e)}}/**
|
|
861
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
862
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
863
|
-
*/class bs extends R{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,s=t.document.selection,o=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{if(s.isCollapsed)o?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{const a=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const l of a)o?r.setAttribute(this.attributeKey,o,l):r.removeAttribute(this.attributeKey,l)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const s of i.getRanges())for(const o of s.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}}/**
|
|
864
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
865
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
866
|
-
*/const Bi="bold";class uP extends w{static get pluginName(){return"BoldEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Bi}),e.model.schema.setAttributeProperties(Bi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Bi,view:"strong",upcastAlso:["b",i=>{const s=i.getStyle("font-weight");return s&&(s=="bold"||Number(s)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Bi,new bs(e,Bi)),e.keystrokes.set("CTRL+B",Bi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}/**
|
|
867
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
868
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
869
|
-
*/function _s({editor:n,commandName:e,plugin:t,icon:i,label:s,keystroke:o}){return r=>{const a=n.commands.get(e),l=new r(n.locale);return l.set({label:s,icon:i,keystroke:o,isToggleable:!0}),l.bind("isEnabled").to(a,"isEnabled"),t.listenTo(l,"execute",()=>{n.execute(e),n.editing.view.focus()}),l}}/**
|
|
870
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
871
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
872
|
-
*/const Ds="bold";class dP extends w{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.locale.t,i=e.commands.get(Ds),s=_s({editor:e,commandName:Ds,plugin:this,icon:P.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(Ds,()=>{const o=s(V);return o.set({tooltip:!0}),o.bind("isOn").to(i,"value"),o}),e.ui.componentFactory.add("menuBar:"+Ds,()=>s(he))}}/**
|
|
873
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
874
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
875
|
-
*/class hP extends w{static get requires(){return[uP,dP]}static get pluginName(){return"Bold"}}/**
|
|
876
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
877
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
878
|
-
*/const Kt="code",fP="ck-code_selected";class mP extends w{static get pluginName(){return"CodeEditing"}static get requires(){return[Co]}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Kt}),e.model.schema.setAttributeProperties(Kt,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:Kt,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(Kt,new bs(e,Kt)),e.plugins.get(Co).registerAttribute(Kt),ip(e,Kt,"code",fP),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const gP='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>';/**
|
|
879
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
880
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
881
|
-
*/const Ns="code";class pP extends w{static get pluginName(){return"CodeUI"}init(){const e=this.editor,t=e.locale.t,i=_s({editor:e,commandName:Ns,plugin:this,icon:gP,label:t("Code")});e.ui.componentFactory.add(Ns,()=>{const s=i(V),o=e.commands.get(Ns);return s.set({tooltip:!0}),s.bind("isOn").to(o,"value"),s}),e.ui.componentFactory.add("menuBar:"+Ns,()=>i(he))}}/**
|
|
882
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
883
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
884
|
-
*/class wP extends w{static get requires(){return[mP,pP]}static get pluginName(){return"Code"}}/**
|
|
885
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
886
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
887
|
-
*/const Mi="italic";class bP extends w{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Mi}),e.model.schema.setAttributeProperties(Mi,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Mi,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Mi,new bs(e,Mi)),e.keystrokes.set("CTRL+I",Mi),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}const _P='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>';/**
|
|
888
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
889
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
890
|
-
*/const $s="italic";class vP extends w{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.commands.get($s),i=e.locale.t,s=_s({editor:e,commandName:$s,plugin:this,icon:_P,keystroke:"CTRL+I",label:i("Italic")});e.ui.componentFactory.add($s,()=>{const o=s(V);return o.set({tooltip:!0}),o.bind("isOn").to(t,"value"),o}),e.ui.componentFactory.add("menuBar:"+$s,()=>s(he))}}/**
|
|
891
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
892
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
893
|
-
*/class yP extends w{static get requires(){return[bP,vP]}static get pluginName(){return"Italic"}}/**
|
|
894
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
895
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
896
|
-
*/const En="strikethrough";class kP extends w{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:En}),e.model.schema.setAttributeProperties(En,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:En,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(En,new bs(e,En)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const CP='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>';/**
|
|
897
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
898
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
899
|
-
*/const Hs="strikethrough";class EP extends w{static get pluginName(){return"StrikethroughUI"}init(){const e=this.editor,t=e.locale.t,i=_s({editor:e,commandName:Hs,plugin:this,icon:CP,keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(Hs,()=>{const s=i(V),o=e.commands.get(Hs);return s.set({tooltip:!0}),s.bind("isOn").to(o,"value"),s}),e.ui.componentFactory.add("menuBar:"+Hs,()=>i(he))}}/**
|
|
900
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
901
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
902
|
-
*/class TP extends w{static get requires(){return[kP,EP]}static get pluginName(){return"Strikethrough"}}/**
|
|
903
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
904
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
905
|
-
*/const Tn="underline";class AP extends w{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Tn}),e.model.schema.setAttributeProperties(Tn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Tn,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(Tn,new bs(e,Tn)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}const SP='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>';/**
|
|
906
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
907
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
908
|
-
*/const zs="underline";class xP extends w{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.commands.get(zs),i=e.locale.t,s=_s({editor:e,commandName:zs,plugin:this,icon:SP,label:i("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(zs,()=>{const o=s(V);return o.set({tooltip:!0}),o.bind("isOn").to(t,"value"),o}),e.ui.componentFactory.add("menuBar:"+zs,()=>s(he))}}/**
|
|
909
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
910
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
911
|
-
*/class IP extends w{static get requires(){return[AP,xP]}static get pluginName(){return"Underline"}}/**
|
|
912
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
913
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
914
|
-
*/function*np(n,e){for(const t of e)t&&n.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}/**
|
|
915
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
916
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
917
|
-
*/class PP extends R{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,i=t.document.selection,s=t.schema,o=i.isCollapsed,r=i.getFirstRange(),a=r.start.parent,l=r.end.parent;if(s.isLimit(a)||s.isLimit(l))return!o&&a==l&&t.deleteContent(i),!1;if(o){const c=np(e.model.schema,i.getAttributes());return nd(e,r.start),e.setSelectionAttribute(c),!0}else{const c=!(r.start.isAtStart&&r.end.isAtEnd),u=a==l;if(t.deleteContent(i,{leaveUnmerged:c}),c){if(u)return nd(e,i.focus),!0;e.setSelection(l,0)}}return!1}}function nd(n,e){n.split(e),n.setSelection(e.parent.nextSibling,0)}/**
|
|
918
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
919
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
920
|
-
*/const RP={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class sp extends wt{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",(s,o)=>{i=o.shiftKey}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;let r=o.inputType;M.isSafari&&i&&r=="insertParagraph"&&(r="insertLineBreak");const a=o.domEvent,l=RP[r];if(!l)return;const c=new cn(t,"enter",o.targetRanges[0]);t.fire(c,new Ji(e,a,{isSoft:l.isSoft})),c.stop.called&&s.stop()})}observe(){}stopObserving(){}}/**
|
|
921
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
922
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
923
|
-
*/class vs extends w{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document,s=this.editor.t;t.addObserver(sp),e.commands.add("enter",new PP(e)),this.listenTo(i,"enter",(o,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"}]})}}/**
|
|
924
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
925
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
926
|
-
*/class VP extends R{execute(){const e=this.editor.model,t=e.document;e.change(i=>{MP(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=BP(e.schema,t.selection)}}function BP(n,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!n.checkChild(t,"softBreak"))return!1;const i=e.getFirstRange(),s=i.start.parent,o=i.end.parent;return!((va(s,n)||va(o,n))&&s!==o)}function MP(n,e,t){const i=t.isCollapsed,s=t.getFirstRange(),o=s.start.parent,r=s.end.parent,a=o==r;if(i){const l=np(n.schema,t.getAttributes());sd(n,e,s.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(l)}else{const l=!(s.start.isAtStart&&s.end.isAtEnd);n.deleteContent(t,{leaveUnmerged:l}),a?sd(n,e,t.focus):l&&e.setSelection(r,0)}}function sd(n,e,t){const i=e.createElement("softBreak");n.insertContent(i,t),e.setSelection(i,"after")}function va(n,e){return n.is("rootElement")?!1:e.isLimit(n)||va(n.parent,e)}/**
|
|
927
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
928
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
929
|
-
*/class op extends w{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,s=e.editing.view,o=s.document,r=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(a,{writer:l})=>l.createEmptyElement("br")}),s.addObserver(sp),e.commands.add("shiftEnter",new VP(e)),this.listenTo(o,"enter",(a,l)=>{o.isComposing||l.preventDefault(),l.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"}]})}}/**
|
|
930
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
931
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
932
|
-
*/class LP extends R{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,s=t.document.selection,o=Array.from(s.getSelectedBlocks()),r=e.forceValue===void 0?!this.value:e.forceValue;t.change(a=>{if(!r)this._removeQuote(a,o.filter(Us));else{const l=o.filter(c=>Us(c)||rd(i,c));this._applyQuote(a,l)}})}_getValue(){const e=this.editor.model.document.selection,t=J(e.getSelectedBlocks());return!!(t&&Us(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=J(e.getSelectedBlocks());return i?rd(t,i):!1}_removeQuote(e,t){od(e,t).reverse().forEach(i=>{if(i.start.isAtStart&&i.end.isAtEnd){e.unwrap(i.start.parent);return}if(i.start.isAtStart){const o=e.createPositionBefore(i.start.parent);e.move(i,o);return}i.end.isAtEnd||e.split(i.end);const s=e.createPositionAfter(i.end.parent);e.move(i,s)})}_applyQuote(e,t){const i=[];od(e,t).reverse().forEach(s=>{let o=Us(s.start);o||(o=e.createElement("blockQuote"),e.wrap(s,o)),i.push(o)}),i.reverse().reduce((s,o)=>s.nextSibling==o?(e.merge(e.createPositionAfter(s)),s):o)}}function Us(n){return n.parent.name=="blockQuote"?n.parent:null}function od(n,e){let t,i=0;const s=[];for(;i<e.length;){const o=e[i],r=e[i+1];t||(t=n.createPositionBefore(o)),(!r||o.nextSibling!=r)&&(s.push(n.createRange(t,n.createPositionAfter(o))),t=null),i++}return s}function rd(n,e){const t=n.checkChild(e.parent,"blockQuote"),i=n.checkChild(["$root","blockQuote"],e);return t&&i}/**
|
|
933
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
934
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
935
|
-
*/class OP extends w{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[vs,It]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new LP(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(r=>{const a=e.model.document.differ.getChanges();for(const l of a)if(l.type=="insert"){const c=l.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(l.position,c))return r.unwrap(c),!0;if(c.is("element")){const u=r.createRangeIn(c);for(const d of u.getItems())if(d.is("element","blockQuote")&&!t.checkChild(r.createPositionBefore(d),d))return r.unwrap(d),!0}}else if(l.type=="remove"){const c=l.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0}return!1});const i=this.editor.editing.view.document,s=e.model.document.selection,o=e.commands.get("blockQuote");this.listenTo(i,"enter",(r,a)=>{if(!s.isCollapsed||!o.value)return;s.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),r.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(r,a)=>{if(a.direction!="backward"||!s.isCollapsed||!o.value)return;const l=s.getLastPosition().parent;l.isEmpty&&!l.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),r.stop())},{context:"blockquote"})}}/**
|
|
936
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
937
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
938
|
-
*/class FP extends w{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.commands.get("blockQuote");e.ui.componentFactory.add("blockQuote",()=>{const i=this._createButton(V);return i.set({tooltip:!0}),i.bind("isOn").to(t,"value"),i}),e.ui.componentFactory.add("menuBar:blockQuote",()=>this._createButton(he))}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("blockQuote"),o=new e(t.locale),r=i.t;return o.set({label:r("Block quote"),icon:P.quote,isToggleable:!0}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),o}}/**
|
|
939
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
940
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
941
|
-
*/class DP extends w{static get requires(){return[OP,FP]}static get pluginName(){return"BlockQuote"}}/**
|
|
942
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
943
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
944
|
-
*/class is extends zt{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"});function i(s){return(o,r)=>{r.preventDefault();const a=r.dropRange?[r.dropRange]:null,l=new xt(t,s);t.fire(l,{dataTransfer:r.dataTransfer,method:o.name,targetRanges:a,target:r.target,domEvent:r.domEvent}),l.stop.called&&r.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,i=e.type=="drop"||e.type=="paste",s={dataTransfer:new Bm(t,{cacheFiles:i})};(e.type=="drop"||e.type=="dragover")&&(s.dropRange=NP(this.view,e)),this.fire(e.type,e,s)}}function NP(n,e){const t=e.target.ownerDocument,i=e.clientX,s=e.clientY;let o;return t.caretRangeFromPoint&&t.caretRangeFromPoint(i,s)?o=t.caretRangeFromPoint(i,s):e.rangeParent&&(o=t.createRange(),o.setStart(e.rangeParent,e.rangeOffset),o.collapse(!0)),o?n.domConverter.domRangeToView(o):null}/**
|
|
945
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
946
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
947
|
-
*/function $P(n){return n=n.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," "),(n.includes("</p><p>")||n.includes("<br>"))&&(n=`<p>${n}</p>`),n}/**
|
|
948
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
949
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
950
|
-
*/function HP(n){return n.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}/**
|
|
951
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
952
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
953
|
-
*/const ad=["figcaption","li"],ld=["ol","ul"];function rp(n){if(n.is("$text")||n.is("$textProxy"))return n.data;if(n.is("element","img")&&n.hasAttribute("alt"))return n.getAttribute("alt");if(n.is("element","br"))return`
|
|
954
|
-
`;let e="",t=null;for(const i of n.getChildren())e+=zP(i,t)+rp(i),t=i;return e}function zP(n,e){return e?n.is("element","li")&&!n.isEmpty&&n.getChild(0).is("containerElement")||ld.includes(n.name)&&ld.includes(e.name)?`
|
|
955
|
-
|
|
956
|
-
`:!n.is("containerElement")&&!e.is("containerElement")?"":ad.includes(n.name)||ad.includes(e.name)?`
|
|
957
|
-
`:`
|
|
958
|
-
|
|
959
|
-
`:""}/**
|
|
960
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
961
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
962
|
-
*/class Dn extends w{constructor(){super(...arguments),this._markersToCopy=new Map}static get pluginName(){return"ClipboardMarkersUtils"}_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=>{const o=s.model.document.selection;s.setSelection(t);const r=this._insertFakeMarkersIntoSelection(s,s.model.document.selection,e),a=i(s),l=this._removeFakeMarkersInsideElement(s,a);for(const[c,u]of Object.entries(r)){l[c]||(l[c]=s.createRangeIn(a));for(const d of u)s.remove(d)}a.markers.clear();for(const[c,u]of Object.entries(l))a.markers.set(c,u);return s.setSelection(o),a})}_pasteMarkersIntoTransformedElement(e,t){const i=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(s=>{const o=this._insertFakeMarkersElements(s,i),r=t(s),a=this._removeFakeMarkersInsideElement(s,r);for(const l of Object.values(o).flat())s.remove(l);for(const[l,c]of Object.entries(a))s.model.markers.has(l)||s.addMarker(l,{usingOperation:!0,affectsData:!0,range:c});return r})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const i of t)e.markers.set(i.name,i.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,i={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const s=this._markersToCopy.get(e);this._markersToCopy.set(e,i),t(),s?this._markersToCopy.set(e,s):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const i=this._getMarkerClipboardConfig(e);if(!i)return!1;if(!t)return!0;const{allowedActions:s}=i;return s==="all"||s.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,i){const s=this._getCopyableMarkersFromSelection(e,t,i);return this._insertFakeMarkersElements(e,s)}_getCopyableMarkersFromSelection(e,t,i){const s=Array.from(t.getRanges()),o=new Set(s.flatMap(a=>Array.from(e.model.markers.getMarkersIntersectingRange(a)))),r=a=>{if(!this._isMarkerCopyable(a.name,i))return!1;const{copyPartiallySelected:c}=this._getMarkerClipboardConfig(a.name);if(!c){const u=a.getRange();return s.some(d=>d.containsRange(u,!0))}return!0};return Array.from(o).filter(r).map(a=>({name:i==="dragstart"?this._getUniqueMarkerName(a.name):a.name,range:a.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:i}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([o,r])=>{if(!this._hasMarkerConfiguration(o))return[{name:o,range:r}];if(this._isMarkerCopyable(o,t)){const a=this._getMarkerClipboardConfig(o),l=i.markers.has(o)&&i.markers.get(o).getRange().root.rootName==="$graveyard";return(a.duplicateOnPaste||l)&&(o=this._getUniqueMarkerName(o)),[{name:o,range:r}]}return[]})}_insertFakeMarkersElements(e,t){const i={},s=t.flatMap(o=>{const{start:r,end:a}=o.range;return[{position:r,marker:o,type:"start"},{position:a,marker:o,type:"end"}]}).sort(({position:o},{position:r})=>o.isBefore(r)?1:-1);for(const{position:o,marker:r,type:a}of s){const l=e.createElement("$marker",{"data-name":r.name,"data-type":a});i[r.name]||(i[r.name]=[]),i[r.name].push(l),e.insert(l,o)}return i}_removeFakeMarkersInsideElement(e,t){const s=this._getAllFakeMarkersFromElement(e,t).reduce((o,r)=>{const a=r.markerElement&&e.createPositionBefore(r.markerElement);let l=o[r.name],c=!1;return l&&l.start&&l.end&&(this._getMarkerClipboardConfig(r.name).duplicateOnPaste?o[this._getUniqueMarkerName(r.name)]=o[r.name]:c=!0,l=null),c||(o[r.name]={...l,[r.type]:a}),r.markerElement&&e.remove(r.markerElement),o},{});return Qk(s,o=>new b(o.start||e.createPositionFromPath(t,[0]),o.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const i=Array.from(e.createRangeIn(t)).flatMap(({item:r})=>{if(!r.is("element","$marker"))return[];const a=r.getAttribute("data-name"),l=r.getAttribute("data-type");return[{markerElement:r,name:a,type:l}]}),s=[],o=[];for(const r of i)r.type==="end"&&(i.some(l=>l.name===r.name&&l.type==="start")||s.push({markerElement:null,name:r.name,type:"start"})),r.type==="start"&&(i.some(l=>l.name===r.name&&l.type==="end")||o.unshift({markerElement:null,name:r.name,type:"end"}));return[...s,...i,...o]}_getUniqueMarkerName(e){const t=e.split(":"),i=Ke().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${i}`:`${t.join(":")}:${i}`}}/**
|
|
963
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
964
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
965
|
-
*/class rt extends w{static get pluginName(){return"ClipboardPipeline"}static get requires(){return[Dn]}init(){this.editor.editing.view.addObserver(is),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,i){const s=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:i==="cut"},()=>{const o=s._copySelectedFragmentWithMarkers(i,t);this.fire("outputTransformation",{dataTransfer:e,content:o,method:i})})}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,o=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(s,"clipboardInput",(r,a)=>{a.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&r.stop()},{priority:"highest"}),this.listenTo(s,"clipboardInput",(r,a)=>{const l=a.dataTransfer;let c;if(a.content)c=a.content;else{let d="";l.getData("text/html")?d=HP(l.getData("text/html")):l.getData("text/plain")&&(d=$P(l.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(d)}const u=new xt(this,"inputTransformation");this.fire(u,{content:c,dataTransfer:l,targetRanges:a.targetRanges,method:a.method}),u.stop.called&&r.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(r,a)=>{if(a.content.isEmpty)return;const c=this.editor.data.toModel(a.content,"$clipboardHolder");c.childCount!=0&&(r.stop(),t.change(()=>{this.fire("contentInsertion",{content:c,method:a.method,dataTransfer:a.dataTransfer,targetRanges:a.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(r,a)=>{a.resultRange=o._pasteFragmentWithMarkers(a.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,s=e.editing.view.document,o=(r,a)=>{const l=a.dataTransfer;a.preventDefault(),this._fireOutputTransformationEvent(l,t.selection,r.name)};this.listenTo(s,"copy",o,{priority:"low"}),this.listenTo(s,"cut",(r,a)=>{e.model.canEditAt(e.model.document.selection)?o(r,a):a.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(r,a)=>{const l=e.data.toView(a.content);s.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:l,method:a.method})},{priority:"low"}),this.listenTo(s,"clipboardOutput",(r,a)=>{a.content.isEmpty||(a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content)),a.dataTransfer.setData("text/plain",rp(a.content))),a.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}/**
|
|
966
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
967
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
968
|
-
*/class UP extends Z(){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,s=i[0];this._insertDescriptor(e);const o=i[0];s!==o&&!xr(s,o)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:o,writer:t})}remove(e,t){const i=this._stack,s=i[0];this._removeDescriptor(e);const o=i[0];s!==o&&!xr(s,o)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(o=>o.id===e.id);if(xr(e,t[i]))return;i>-1&&t.splice(i,1);let s=0;for(;t[s]&&WP(t[s],e);)s++;t.splice(s,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(s=>s.id===e);i>-1&&t.splice(i,1)}}function xr(n,e){return n&&e&&n.priority==e.priority&&Eo(n.classes)==Eo(e.classes)}function WP(n,e){return n.priority>e.priority?!0:n.priority<e.priority?!1:Eo(n.classes)>Eo(e.classes)}function Eo(n){return Array.isArray(n)?n.sort().join(","):n}const qP='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>';/**
|
|
969
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
970
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
971
|
-
*/const jP="ck-widget",cd="ck-widget_selected";function ce(n){return n.is("element")?!!n.getCustomProperty("widget"):!1}function mn(n,e,t={}){if(!n.is("containerElement"))throw new g("widget-to-widget-wrong-element-type",null,{element:n});return e.setAttribute("contenteditable","false",n),e.addClass(jP,n),e.setCustomProperty("widget",!0,n),n.getFillerOffset=YP,e.setCustomProperty("widgetLabel",[],n),t.label&&ZP(n,t.label),t.hasSelectionHandle&&QP(n,e),ap(n,e),n}function GP(n,e,t){if(e.classes&&t.addClass(z(e.classes),n),e.attributes)for(const i in e.attributes)t.setAttribute(i,e.attributes[i],n)}function KP(n,e,t){if(e.classes&&t.removeClass(z(e.classes),n),e.attributes)for(const i in e.attributes)t.removeAttribute(i,n)}function ap(n,e,t=GP,i=KP){const s=new UP;s.on("change:top",(a,l)=>{l.oldDescriptor&&i(n,l.oldDescriptor,l.writer),l.newDescriptor&&t(n,l.newDescriptor,l.writer)});const o=(a,l,c)=>s.add(l,c),r=(a,l,c)=>s.remove(l,c);e.setCustomProperty("addHighlight",o,n),e.setCustomProperty("removeHighlight",r,n)}function ZP(n,e){n.getCustomProperty("widgetLabel").push(e)}function JP(n){return n.getCustomProperty("widgetLabel").reduce((t,i)=>typeof i=="function"?t?t+". "+i():i():t?t+". "+i:i,"")}function lp(n,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],n),e.setAttribute("role","textbox",n),e.setAttribute("tabindex","-1",n),t.label&&e.setAttribute("aria-label",t.label,n),e.setAttribute("contenteditable",n.isReadOnly?"false":"true",n),n.on("change:isReadOnly",(i,s,o)=>{e.setAttribute("contenteditable",o?"false":"true",n)}),n.on("change:isFocused",(i,s,o)=>{o?e.addClass("ck-editor__nested-editable_focused",n):e.removeClass("ck-editor__nested-editable_focused",n)}),ap(n,e),n}function Al(n,e){const t=n.getSelectedElement();if(t){const i=Lt(n);if(i)return e.createRange(e.createPositionAt(t,i))}return e.schema.findOptimalInsertionRange(n)}function YP(){return null}function QP(n,e){const t=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(i){const s=this.toDomElement(i),o=new lt;return o.set("content",qP),o.render(),s.appendChild(o.element),s});e.insert(e.createPositionAt(n,0),t),e.addClass(["ck-widget_with-selection-handle"],n)}/**
|
|
972
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
973
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
974
|
-
*/const yt="widget-type-around";function Zt(n,e,t){return!!n&&ce(n)&&!t.isInline(e)}function XP(n){return n.closest(".ck-widget__type-around__button")}function e3(n){return n.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function t3(n,e){const t=n.closest(".ck-widget");return e.mapDomToView(t)}function Lt(n){return n.getAttribute(yt)}const i3='<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>';/**
|
|
975
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
976
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
977
|
-
*/const cp=["before","after"],n3=new DOMParser().parseFromString(i3,"image/svg+xml").firstChild,ud="ck-widget__type-around_disabled";class s3 extends w{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[vs,It]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,s,o)=>{t.change(r=>{for(const a of t.document.roots)o?r.removeClass(ud,a):r.addClass(ud,a)}),o||e.model.change(r=>{r.removeSelectionAttribute(yt)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,s=i.editing.view,o=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:o}),s.focus(),s.scrollToTheSelection()}_listenToIfEnabled(e,t,i,s){this.listenTo(e,t,(...o)=>{this.isEnabled&&i(...o)},s)}_insertParagraphAccordingToFakeCaretPosition(){const i=this.editor.model.document.selection,s=Lt(i);if(!s)return!1;const o=i.getSelectedElement();return this._insertParagraph(o,s),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,s={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(o,r,a)=>{const l=a.mapper.toViewElement(r.item);l&&Zt(l,r.item,t)&&(o3(a.writer,s,l),l.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,s=t.schema,o=e.editing.view;this._listenToIfEnabled(o.document,"arrowKey",(a,l)=>{this._handleArrowKeyPress(a,l)},{context:[ce,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(a,l)=>{l.directChange&&e.model.change(c=>{c.removeSelectionAttribute(yt)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const a=i.getSelectedElement();if(a){const l=e.editing.mapper.toViewElement(a);if(Zt(l,a,s))return}e.model.change(l=>{l.removeSelectionAttribute(yt)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(a,l,c)=>{const u=c.writer;if(this._currentFakeCaretModelElement){const m=c.mapper.toViewElement(this._currentFakeCaretModelElement);m&&(u.removeClass(cp.map(r),m),this._currentFakeCaretModelElement=null)}const d=l.selection.getSelectedElement();if(!d)return;const h=c.mapper.toViewElement(d);if(!Zt(h,d,s))return;const f=Lt(l.selection);f&&(u.addClass(r(f),h),this._currentFakeCaretModelElement=d)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(a,l,c)=>{c||e.model.change(u=>{u.removeSelectionAttribute(yt)})});function r(a){return`ck-widget_type-around_show-fake-caret_${a}`}}_handleArrowKeyPress(e,t){const i=this.editor,s=i.model,o=s.document.selection,r=s.schema,a=i.editing.view,l=t.keyCode,c=P2(l,i.locale.contentLanguageDirection),u=a.document.selection.getSelectedElement(),d=i.editing.mapper.toModelElement(u);let h;Zt(u,d,r)?h=this._handleArrowKeyPressOnSelectedWidget(c):o.isCollapsed?h=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(h=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),h&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const i=this.editor.model,s=i.document.selection,o=Lt(s);return i.change(r=>{if(o){if(!(o===(e?"after":"before")))return r.removeSelectionAttribute(yt),!0}else return r.setSelectionAttribute(yt,e?"after":"before"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,s=i.schema,o=t.plugins.get("Widget"),r=o._getObjectElementNextToSelection(e),a=t.editing.mapper.toViewElement(r);return Zt(a,r,s)?(i.change(l=>{o._setSelectionOverElement(r),l.setSelectionAttribute(yt,e?"before":"after")}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,s=i.schema,o=t.editing.mapper,r=i.document.selection,a=e?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter,l=o.toViewElement(a);return Zt(l,a,s)?(i.change(c=>{c.setSelection(a,"on"),c.setSelectionAttribute(yt,e?"after":"before")}),!0):!1}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,s)=>{const o=XP(s.domTarget);if(!o)return;const r=e3(o),a=t3(o,t.domConverter),l=e.editing.mapper.toModelElement(a);this._insertParagraph(l,r),s.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(s,o)=>{if(s.eventPhase!="atTarget")return;const r=t.getSelectedElement(),a=e.editing.mapper.toViewElement(r),l=e.model.schema;let c;this._insertParagraphAccordingToFakeCaretPosition()?c=!0:Zt(a,r,l)&&(this._insertParagraph(r,o.isSoft?"before":"after"),c=!0),c&&(o.preventDefault(),s.stop())},{context:ce})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",(i,s)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(s.selection=t.selection)},{priority:"high"}),M.isAndroid?this._listenToIfEnabled(t,"keydown",(i,s)=>{s.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(t,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,s=i.schema;this._listenToIfEnabled(t.document,"delete",(o,r)=>{if(o.eventPhase!="atTarget")return;const a=Lt(i.document.selection);if(!a)return;const l=r.direction,c=i.document.selection.getSelectedElement(),u=a==="before",d=l=="forward";if(u===d)e.execute("delete",{selection:i.createSelection(c,"on")});else{const f=s.getNearestSelectionRange(i.createPositionAt(c,a),l);if(f)if(!f.isCollapsed)i.change(m=>{m.setSelection(f),e.execute(d?"deleteForward":"delete")});else{const m=i.createSelection(f.start);if(i.modifySelection(m,{direction:l}),!m.focus.isEqual(f.start))i.change(p=>{p.setSelection(f),e.execute(d?"deleteForward":"delete")});else{const p=l3(s,f.start.parent);i.deleteContent(i.createSelection(p,"on"),{doNotAutoparagraph:!0})}}}r.preventDefault(),o.stop()},{context:ce})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(s,[o,r])=>{if(r&&!r.is("documentSelection"))return;const a=Lt(i);if(a)return s.stop(),t.change(l=>{const c=i.getSelectedElement(),u=t.createPositionAt(c,a),d=l.createSelection(u),h=t.insertContent(o,d);return l.setSelection(d),h})},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,i=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(s,o)=>{const[,r,a={}]=o;if(r&&!r.is("documentSelection"))return;const l=Lt(i);l&&(a.findOptimalPosition=l,o[3]=a)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,i=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(s,[o])=>{if(o&&!o.is("documentSelection"))return;Lt(i)&&s.stop()},{priority:"high"})}}function o3(n,e,t){const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(s){const o=this.toDomElement(s);return r3(o,e),a3(o),o});n.insert(n.createPositionAt(t,"end"),i)}function r3(n,e){for(const t of cp){const i=new Le({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${t}`],title:e[t],"aria-hidden":"true"},children:[n.ownerDocument.importNode(n3,!0)]});n.appendChild(i.render())}}function a3(n){const e=new Le({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});n.appendChild(e.render())}function l3(n,e){let t=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||n.isLimit(i))break;t=i}return t}/**
|
|
978
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
979
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
980
|
-
*/function c3(n){const e=n.model;return(t,i)=>{const s=i.keyCode==N.arrowup,o=i.keyCode==N.arrowdown,r=i.shiftKey,a=e.document.selection;if(!s&&!o)return;const l=o;if(r&&h3(a,l))return;const c=u3(n,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(r)return}(c.isCollapsed||d3(n,c,l))&&(e.change(u=>{const d=l?c.end:c.start;if(r){const h=e.createSelection(a.anchor);h.setFocus(d),u.setSelection(h)}else u.setSelection(d)}),t.stop(),i.preventDefault(),i.stopPropagation())}}}function u3(n,e,t){const i=n.model;if(t){const s=e.isCollapsed?e.focus:e.getLastPosition(),o=dd(i,s,"forward");if(!o)return null;const r=i.createRange(s,o),a=hd(i.schema,r,"backward");return a?i.createRange(s,a):null}else{const s=e.isCollapsed?e.focus:e.getFirstPosition(),o=dd(i,s,"backward");if(!o)return null;const r=i.createRange(o,s),a=hd(i.schema,r,"forward");return a?i.createRange(a,s):null}}function dd(n,e,t){const i=n.schema,s=n.createRangeIn(e.root),o=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:r,item:a,type:l}of s.getWalker({startPosition:e,direction:t})){if(i.isLimit(a)&&!i.isInline(a))return r;if(l==o&&i.isBlock(a))return null}return null}function hd(n,e,t){const i=t=="backward"?e.end:e.start;if(n.checkChild(i,"$text"))return i;for(const{nextPosition:s}of e.getWalker({direction:t}))if(n.checkChild(s,"$text"))return s;return null}function d3(n,e,t){const i=n.model,s=n.view.domConverter;if(t){const c=i.createSelection(e.start);i.modifySelection(c),!c.focus.isAtEnd&&!e.start.isEqual(c.focus)&&(e=i.createRange(c.focus,e.end))}const o=n.mapper.toViewRange(e),r=s.viewRangeToDom(o),a=L.getDomRangeRects(r);let l;for(const c of a){if(l===void 0){l=Math.round(c.bottom);continue}if(Math.round(c.top)>=l)return!1;l=Math.max(l,Math.round(c.bottom))}return!0}function h3(n,e){return!n.isCollapsed&&n.isBackward==e}/**
|
|
981
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
982
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
983
|
-
*/class Ei extends w{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[s3,It]}init(){const e=this.editor,t=e.editing.view,i=t.document,s=e.t;this.editor.editing.downcastDispatcher.on("selection",(o,r,a)=>{const l=a.writer,c=r.selection;if(c.isCollapsed)return;const u=c.getSelectedElement();if(!u)return;const d=e.editing.mapper.toViewElement(u);ce(d)&&a.consumable.consume(c,"selection")&&l.setSelection(l.createRangeOn(d),{fake:!0,label:JP(d)})}),this.editor.editing.downcastDispatcher.on("selection",(o,r,a)=>{this._clearPreviouslySelectedWidgets(a.writer);const l=a.writer,c=l.document.selection;let u=null;for(const d of c.getRanges())for(const h of d){const f=h.item;ce(f)&&!m3(f,u)&&(l.addClass(cd,f),this._previouslySelected.add(f),u=f)}},{priority:"low"}),t.addObserver(Ko),this.listenTo(i,"mousedown",(...o)=>this._onMousedown(...o)),this.listenTo(i,"arrowKey",(...o)=>{this._handleSelectionChangeOnArrowKeyPress(...o)},{context:[ce,"$text"]}),this.listenTo(i,"arrowKey",(...o)=>{this._preventDefaultOnArrowKeyPress(...o)},{context:"$root"}),this.listenTo(i,"arrowKey",c3(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(o,r)=>{this._handleDelete(r.direction=="forward")&&(r.preventDefault(),o.stop())},{context:"$root"}),this.listenTo(i,"tab",(o,r)=>{o.eventPhase=="atTarget"&&(r.shiftKey||this._selectFirstNestedEditable()&&(r.preventDefault(),o.stop()))},{context:ce,priority:"low"}),this.listenTo(i,"tab",(o,r)=>{r.shiftKey&&this._selectAncestorWidget()&&(r.preventDefault(),o.stop())},{priority:"low"}),this.listenTo(i,"keydown",(o,r)=>{r.keystroke==N.esc&&this._selectAncestorWidget()&&(r.preventDefault(),o.stop())},{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("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){const i=this.editor,s=i.editing.view,o=s.document;let r=t.target;if(t.domEvent.detail>=3){this._selectBlockContent(r)&&t.preventDefault();return}if(f3(r)||!ce(r)&&(r=r.findAncestor(ce),!r))return;M.isAndroid&&t.preventDefault(),o.isFocused||s.focus();const a=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(a)}_selectBlockContent(e){const t=this.editor,i=t.model,s=t.editing.mapper,o=i.schema,r=s.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),a=g3(s.toModelElement(r),i.schema);return a?(i.change(l=>{const c=o.isLimit(a)?null:p3(l.createPositionAfter(a),o),u=l.createPositionAt(a,0),d=c?l.createPositionAt(c,0):l.createPositionAt(a,"end");l.setSelection(l.createRange(u,d))}),!0):!1}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,s=this.editor.model,o=s.schema,r=s.document.selection,a=r.getSelectedElement(),l=ol(i,this.editor.locale.contentLanguageDirection),c=l=="down"||l=="right",u=l=="up"||l=="down";if(a&&o.isObject(a)){const h=c?r.getLastPosition():r.getFirstPosition(),f=o.getNearestSelectionRange(h,c?"forward":"backward");f&&(s.change(m=>{m.setSelection(f)}),t.preventDefault(),e.stop());return}if(!r.isCollapsed&&!t.shiftKey){const h=r.getFirstPosition(),f=r.getLastPosition(),m=h.nodeAfter,p=f.nodeBefore;(m&&o.isObject(m)||p&&o.isObject(p))&&(s.change(_=>{_.setSelection(c?f:h)}),t.preventDefault(),e.stop());return}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&u)return;this._setSelectionOverElement(d),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,s=i.schema,o=i.document.selection.getSelectedElement();o&&s.isObject(o)&&(t.preventDefault(),e.stop())}_handleDelete(e){const i=this.editor.model.document.selection;if(!this.editor.model.canEditAt(i)||!i.isCollapsed)return;const s=this._getObjectElementNextToSelection(e);if(s)return this.editor.model.change(o=>{let r=i.anchor.parent;for(;r.isEmpty;){const a=r;r=a.parent,o.remove(a)}this._setSelectionOverElement(s)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,s=t.document.selection,o=t.createSelection(s);if(t.modifySelection(o,{direction:e?"forward":"backward"}),o.isEqual(s))return null;const r=e?o.focus.nodeBefore:o.focus.nodeAfter;return r&&i.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(cd,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,i=this.editor.editing.view.document;for(const s of i.selection.getFirstRange().getItems())if(s.is("editableElement")){const o=e.editing.mapper.toModelElement(s);/* istanbul ignore next -- @preserve */if(!o)continue;const r=e.model.createPositionAt(o,0),a=e.model.schema.getNearestSelectionRange(r,"forward");return e.model.change(l=>{l.setSelection(a)}),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,s=e.editing.view.document.selection.getFirstPosition().parent,r=(s.is("$text")?s.parent:s).findAncestor(ce);if(!r)return!1;const a=t.toModelElement(r);/* istanbul ignore next -- @preserve */return a?(e.model.change(l=>{l.setSelection(a,"on")}),!0):!1}}function f3(n){let e=n;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(ce(e))return!1;e=e.parent}return!1}function m3(n,e){return e?Array.from(n.getAncestors()).includes(e):!1}function g3(n,e){for(const t of n.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(t,"$text"))return t;if(e.isLimit(t)&&!e.isObject(t))break}return null}function p3(n,e){const t=new Tt({startPosition:n});for(const{item:i}of t){if(e.isLimit(i)||!i.is("element"))return null;if(e.checkChild(i,"$text"))return i}return null}/**
|
|
984
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
985
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
986
|
-
*/class To extends w{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[ko]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",i=>{w3(e.editing.view.document.selection)&&i.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:s,balloonClassName:o="ck-toolbar-container"}){if(!i.length){D("widget-toolbar-no-items",{toolbarId:e});return}const r=this.editor,a=r.t,l=new vl(r.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new g("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:s,balloonClassName:o,itemsConfig:i,initialized:!1};r.ui.addToolbar(l,{isContextual:!0,beforeFocus:()=>{const u=s(r.editing.view.document.selection);u&&this._showToolbar(c,u)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(e,c)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const s of this._toolbarDefinitions.values()){const o=s.getRelatedElement(this.editor.editing.view.document.selection);if(!this.isEnabled||!o)this._isToolbarInBalloon(s)&&this._hideToolbar(s);else if(!this.editor.ui.focusTracker.isFocused)this._isToolbarVisible(s)&&this._hideToolbar(s);else{const r=o.getAncestors().length;r>e&&(e=r,t=o,i=s)}}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?fd(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:up(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const i of this._toolbarDefinitions.values())if(this._isToolbarVisible(i)){const s=i.getRelatedElement(this.editor.editing.view.document.selection);fd(this.editor,s)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function fd(n,e){const t=n.plugins.get("ContextualBalloon"),i=up(n,e);t.updatePosition(i)}function up(n,e){const t=n.editing.view,i=ke.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}function w3(n){const e=n.getSelectedElement();return!!(e&&ce(e))}/**
|
|
987
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
988
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
989
|
-
*/class b3 extends W(){constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,i){const s=new L(t);this.activeHandlePosition=k3(e),this._referenceCoordinates=v3(t,C3(this.activeHandlePosition)),this._originalWidth=s.width,this._originalHeight=s.height,this._aspectRatio=s.width/s.height;const o=i.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=_3(i,s)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}function _3(n,e){const t=n.parentElement;let i=parseFloat(t.ownerDocument.defaultView.getComputedStyle(t).width);const s=5;let o=0,r=t;for(;isNaN(i);){if(r=r.parentElement,++o>s)return 0;i=parseFloat(t.ownerDocument.defaultView.getComputedStyle(r).width)}return e.width/i*100}function v3(n,e){const t=new L(n),i=e.split("-"),s={x:i[1]=="right"?t.right:t.left,y:i[0]=="bottom"?t.bottom:t.top};return s.x+=n.ownerDocument.defaultView.scrollX,s.y+=n.ownerDocument.defaultView.scrollY,s}function y3(n){return`ck-widget__resizer__handle-${n}`}function k3(n){const e=["top-left","top-right","bottom-right","bottom-left"];for(const t of e)if(n.classList.contains(y3(t)))return t}function C3(n){const e=n.split("-"),t={top:"bottom",bottom:"top",left:"right",right:"left"};return`${t[e[0]]}-${t[e[1]]}`}/**
|
|
990
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
991
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
992
|
-
*/class E3 extends T{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",t=>t?`ck-orientation-${t}`:"")],style:{display:e.if("_isVisible","none",t=>!t)}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",(i,s)=>i!==null&&s!==null),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(i,s,o)=>e.unit==="px"?`${i}×${s}`:`${o}%`),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",(i,s,o)=>s<50||o<50?"above-center":i)}_dismiss(){this.unbind(),this._isVisible=!1}}/**
|
|
993
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
994
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
995
|
-
*/class md extends W(){constructor(e){super(),this._viewResizerWrapper=null,this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",(t,i)=>t&&i),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",t=>{!this.state.proposedWidth&&!this.state.proposedWidthPercents&&(this._cleanup(),t.stop())},{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change(t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)})}hide(){this._options.editor.editing.view.change(t=>{t.addClass("ck-hidden",this._viewResizerWrapper)})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(s=>{const o=s.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},function(r){const a=this.toDomElement(r);return e._appendHandles(a),e._appendSizeUI(a),a});s.insert(s.createPositionAt(t,"end"),o),s.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=o,this.isVisible||this.hide()}),this.on("change:isVisible",()=>{this.isVisible?(this.show(),this.redraw()):this.hide()})}begin(e){this._state=new b3(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(c=>{const u=this._options.unit||"%",d=(u==="%"?t.widthPercents:t.width)+u;c.setStyle("width",d,this._options.viewElement)});const s=this._getHandleHost(),o=new L(s),r=Math.round(o.width),a=Math.round(o.height),l=new L(s);t.width=Math.round(l.width),t.height=Math.round(l.height),this.redraw(o),this.state.update({...t,handleHostWidth:r,handleHostHeight:a})}commit(){const e=this._options.unit||"%",t=(e==="%"?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!S3(t))return;const i=t.parentElement,s=this._getHandleHost(),o=this._viewResizerWrapper,r=[o.getStyle("width"),o.getStyle("height"),o.getStyle("left"),o.getStyle("top")];let a;if(i.isSameNode(s)){const l=e||new L(s);a=[l.width+"px",l.height+"px",void 0,void 0]}else a=[s.offsetWidth+"px",s.offsetHeight+"px",s.offsetLeft+"px",s.offsetTop+"px"];Te(r,a)!=="same"&&this._options.editor.editing.view.change(l=>{l.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},o)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change(t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,i=A3(e),s=this._options.isCentered?this._options.isCentered(this):!0,o={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(o.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),s&&(o.x*=2);let r=Math.abs(t.originalWidth+o.x),a=Math.abs(t.originalHeight+o.y);return(r/t.aspectRatio>a?"width":"height")=="width"?a=r/t.aspectRatio:r=a*t.aspectRatio,{width:Math.round(r),height:Math.round(a),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*r*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)e.appendChild(new Le({tag:"div",attributes:{class:`ck-widget__resizer__handle ${T3(i)}`}}).render())}_appendSizeUI(e){this._sizeView=new E3,this._sizeView.render(),e.appendChild(this._sizeView.element)}}function T3(n){return`ck-widget__resizer__handle-${n}`}function A3(n){return{x:n.pageX,y:n.pageY}}function S3(n){return n&&n.ownerDocument&&n.ownerDocument.contains(n)}/**
|
|
996
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
997
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
998
|
-
*/class Ir extends w{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=S.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(Ko),this._observer=new(qe()),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=qn(()=>this.redrawSelectedResizer(),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[s,o]of this._resizers)s.isAttached()||(this._resizers.delete(s),o.destroy())},{priority:"lowest"}),this._observer.listenTo(S.window,"resize",this._redrawSelectedResizerThrottled);const i=this.editor.editing.view.document.selection;i.on("change",()=>{const s=i.getSelectedElement(),o=this.getResizerByViewElement(s)||null;o?this.select(o):this.deselect()})}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new md(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const r=i.get("WidgetToolbarRepository");t.on("begin",()=>{r.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{r.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{r.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;md.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i)||null,this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}/**
|
|
999
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1000
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1001
|
-
*//* istanbul ignore file -- @preserve */const Pr=ln("px");class x3 extends T{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>Pr(t)),top:e.to("top",t=>Pr(t)),width:e.to("width",t=>Pr(t))}}})}}/**
|
|
1002
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1003
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1004
|
-
*/class Ws extends w{constructor(){super(...arguments),this.removeDropMarkerDelayed=rl(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=qn(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=qn(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new x3,this._domEmitter=new(qe()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,s,o,r){this.removeDropMarkerDelayed.cancel();const a=gd(this.editor,e,t,i,s,o,r);/* istanbul ignore next -- @preserve */if(a){if(r&&r.containsRange(a))return this.removeDropMarker();this._updateDropMarkerThrottled(a)}}getFinalDropRange(e,t,i,s,o,r){const a=gd(this.editor,e,t,i,s,o,r);return this.removeDropMarker(),a}removeDropMarker(){const 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(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(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){const i=this.toDomElement(t);return i.append("",t.createElement("span"),""),i})}_updateDropTargetLine(e){const t=this.editor.editing,i=e.start.nodeBefore,s=e.start.nodeAfter,o=e.start.parent,r=i?t.mapper.toViewElement(i):null,a=r?t.view.domConverter.mapViewToDom(r):null,l=s?t.mapper.toViewElement(s):null,c=l?t.view.domConverter.mapViewToDom(l):null,u=t.mapper.toViewElement(o);if(!u)return;const d=t.view.domConverter.mapViewToDom(u),h=this._getScrollableRect(u),{scrollX:f,scrollY:m}=S.window,p=a?new L(a):null,_=c?new L(c):null,k=new L(d).excludeScrollbarsAndBorders(),A=p?p.bottom:k.top,F=_?_.top:k.bottom,U=S.window.getComputedStyle(d),Y=A<=F?(A+F)/2:F;if(h.top<Y&&Y<h.bottom){const x=k.left+parseFloat(U.paddingLeft),v=k.right-parseFloat(U.paddingRight),C=Math.max(x+f,h.left),B=Math.min(v+f,h.right);this._dropTargetLineView.set({isVisible:!0,left:C,top:Y+m,width:B-C})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let i;if(this._scrollables.has(t))i=this._scrollables.get(t).domElement;else{const s=this.editor.editing.view.domConverter.mapViewToDom(e);i=P3(s),this._domEmitter.listenTo(i,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const o=new ee(i,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:i,resizeObserver:o})}return new L(i).excludeScrollbarsAndBorders()}}function gd(n,e,t,i,s,o,r){const a=n.model,l=n.editing.mapper;let u=pd(n,e);for(;u;){if(!o){if(a.schema.checkChild(u,"$text")){if(t){const d=t[0].start,h=l.toModelPosition(d);if(!r||Array.from(r.getItems()).every(m=>a.schema.checkChild(h,m))){if(a.schema.checkChild(h,"$text"))return a.createRange(h);if(d)return qs(n,pd(n,d.parent),i,s)}}}else if(a.schema.isInline(u))return qs(n,u,i,s)}if(a.schema.isBlock(u))return qs(n,u,i,s);if(a.schema.checkChild(u,"$block")){const d=Array.from(u.getChildren()).filter(m=>m.is("element")&&!I3(n,m));let h=0,f=d.length;if(f==0)return a.createRange(a.createPositionAt(u,"end"));for(;h<f-1;){const m=Math.floor((h+f)/2);dp(n,d[m],i,s)=="before"?f=m:h=m}return qs(n,d[h],i,s)}u=u.parent}return null}function I3(n,e){const t=n.editing.mapper,i=n.editing.view.domConverter,s=t.toViewElement(e);if(!s)return!0;const o=i.mapViewToDom(s);return S.window.getComputedStyle(o).float!="none"}function qs(n,e,t,i){const s=n.model;return s.createRange(s.createPositionAt(e,dp(n,e,t,i)))}function dp(n,e,t,i){const s=n.editing.mapper,o=n.editing.view.domConverter,r=s.toViewElement(e),a=o.mapViewToDom(r),l=new L(a);return n.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":i<(l.top+l.bottom)/2?"before":"after"}function pd(n,e){const t=n.editing.mapper,i=n.editing.view,s=t.toModelElement(e);if(s)return s;const o=i.createPositionBefore(e),r=t.findMappedViewAncestor(o);return t.toModelElement(r)}function P3(n){let e=n;do{e=e.parentElement;const t=S.window.getComputedStyle(e).overflowY;if(t=="auto"||t=="scroll")break}while(e.tagName!="BODY");return e}/**
|
|
1005
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1006
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1007
|
-
*/class R3 extends w{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(qe())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,i,s)=>{s?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),M.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const i=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(i,"dragstart",(s,o)=>this._handleBlockDragStart(o)),this._domEmitter.listenTo(S.document,"dragover",(s,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(S.document,"drop",(s,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(S.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&i.setAttribute("draggable","true"),this.on("change:isEnabled",(s,o,r)=>{i.setAttribute("draggable",r?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,s=this.editor.editing.view,o=Array.from(i.getSelectedBlocks()),r=t.createRange(t.createPositionBefore(o[0]),t.createPositionAfter(o[o.length-1]));t.change(a=>a.setSelection(r)),this._isBlockDragging=!0,s.focus(),s.getObserver(is).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),i=e.clientY,s=document.elementFromPoint(t,i),o=this.editor.editing.view;!s||!s.closest(".ck-editor__editable")||o.getObserver(is).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:s,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}/**
|
|
1008
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1009
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1010
|
-
*/class V3 extends w{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=rl(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(qe())}static get pluginName(){return"DragDrop"}static get requires(){return[rt,Ei,Ws,R3]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(is),t.addObserver(Ko),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(i,s,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(i,s,o)=>{o||this._finalizeDragging(!1)}),M.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(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,o=e.plugins.get(Ws);this.listenTo(s,"dragstart",(r,a)=>{if(a.target&&a.target.is("editableElement")){a.preventDefault();return}if(this._prepareDraggedRange(a.target),!this._draggedRange){a.preventDefault();return}this._draggingUid=Ke(),a.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",a.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(a.dataTransfer,l,"dragstart");const{dataTransfer:u,domTarget:d,domEvent:h}=a,{clientX:f}=h;this._updatePreview({dataTransfer:u,domTarget:d,clientX:f}),a.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(s,"dragend",(r,a)=>{this._finalizeDragging(!a.dataTransfer.isCanceled&&a.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(S.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(s,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(s,"dragleave",()=>{o.removeDropMarkerDelayed()}),this.listenTo(s,"dragging",(r,a)=>{if(!this.isEnabled){a.dataTransfer.dropEffect="none";return}const{clientX:l,clientY:c}=a.domEvent;o.updateDropMarker(a.target,a.targetRanges,l,c,this._blockMode,this._draggedRange),this._draggedRange||(a.dataTransfer.dropEffect="copy"),M.isGecko||(a.dataTransfer.effectAllowed=="copy"?a.dataTransfer.dropEffect="copy":["all","copyMove"].includes(a.dataTransfer.effectAllowed)&&(a.dataTransfer.dropEffect="move")),r.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,i=e.editing.view.document,s=e.plugins.get(Ws);this.listenTo(i,"clipboardInput",(o,r)=>{if(r.method!="drop")return;const{clientX:a,clientY:l}=r.domEvent,c=s.getFinalDropRange(r.target,r.targetRanges,a,l,this._blockMode,this._draggedRange);if(!c){this._finalizeDragging(!1),o.stop();return}if(this._draggedRange&&this._draggingUid!=r.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),wd(r.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(c,!0)){this._finalizeDragging(!1),o.stop();return}r.targetRanges=[e.editing.mapper.toViewRange(c)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(rt);e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const s=i.targetRanges.map(o=>this.editor.editing.mapper.toModelRange(o));this.editor.model.change(o=>o.setSelection(s))},{priority:"high"}),e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const s=wd(i.dataTransfer)=="move",o=!i.resultRange||!i.resultRange.isCollapsed;this._finalizeDragging(o&&s)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(s,o)=>{if(M.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=bd(o.target);if(M.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const a=i.selection.getSelectedElement();(!a||!ce(a))&&(r=i.selection.editableElement)}r&&(t.change(a=>{a.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(i,"mouseup",()=>{M.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,i=t.model;t.plugins.get(Ws).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(o=>{const r=i.createSelection(this._draggedRange);i.deleteContent(r,{doNotAutoparagraph:!0});const a=r.getFirstPosition().parent;a.isEmpty&&!i.schema.checkChild(a,"$text")&&i.schema.checkChild(a,"paragraph")&&o.insertElement("paragraph",a,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,i=t.model,s=i.document.selection,o=e?bd(e):null;if(o){const c=t.editing.mapper.toModelElement(o);this._draggedRange=He.fromRange(i.createRangeOn(c)),this._blockMode=i.schema.isBlock(c),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(s.isCollapsed&&!s.getFirstPosition().parent.isEmpty)return;const r=Array.from(s.getSelectedBlocks()),a=s.getFirstRange();if(r.length==0){this._draggedRange=He.fromRange(a);return}const l=hp(i,r);if(r.length>1)this._draggedRange=He.fromRange(l),this._blockMode=!0;else if(r.length==1){const c=a.start.isTouching(l.start)&&a.end.isTouching(l.end);this._draggedRange=He.fromRange(c?l:a),this._blockMode=c}i.change(c=>c.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){const s=this.editor.editing.view,o=s.document.selection.editableElement,r=s.domConverter.mapViewToDom(o),a=S.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Fe(S.document,"div",{style:"position: fixed; left: -999999px;"}),S.document.body.appendChild(this._previewContainer));const l=new L(r);if(r.contains(t))return;const c=parseFloat(a.paddingLeft),u=Fe(S.document,"div");u.className="ck ck-content",u.style.width=a.width,u.style.paddingLeft=`${l.left-i+c}px`,M.isiOS&&(u.style.backgroundColor="white"),u.innerHTML=e.getData("text/html"),e.setDragImage(u,0,0),this._previewContainer.appendChild(u)}}function wd(n){return M.isGecko?n.dropEffect:["all","copyMove"].includes(n.effectAllowed)?"move":"copy"}function bd(n){if(n.is("editableElement"))return null;if(n.hasClass("ck-widget__selection-handle"))return n.findAncestor(ce);if(ce(n))return n;const e=n.findAncestor(t=>ce(t)||t.is("editableElement"));return ce(e)?e:null}function hp(n,e){const t=e[0],i=e[e.length-1],s=t.getCommonAncestor(i),o=n.createPositionBefore(t),r=n.createPositionAfter(i);if(s&&s.is("element")&&!n.schema.isLimit(s)){const a=n.createRangeOn(s),l=o.isTouching(a.start),c=r.isTouching(a.end);if(l&&c)return hp(n,[s])}return n.createRange(o,r)}/**
|
|
1011
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1012
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1013
|
-
*/class B3 extends w{static get pluginName(){return"PastePlainText"}static get requires(){return[rt]}init(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,o=t.document.selection;let r=!1;i.addObserver(is),this.listenTo(s,"keydown",(a,l)=>{r=l.shiftKey}),e.plugins.get(rt).on("contentInsertion",(a,l)=>{!r&&!M3(l.content,t.schema)||t.change(c=>{const u=Array.from(o.getAttributes()).filter(([h])=>t.schema.getAttributeProperties(h).isFormatting);o.isCollapsed||t.deleteContent(o,{doNotAutoparagraph:!0}),u.push(...o.getAttributes());const d=c.createRangeIn(l.content);for(const h of d.getItems())h.is("$textProxy")&&c.setAttributes(u,h)})})}}function M3(n,e){if(n.childCount>1)return!1;const t=n.getChild(0);return e.isObject(t)?!1:Array.from(t.getAttributeKeys()).length==0}/**
|
|
1014
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1015
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1016
|
-
*/class fp extends w{static get pluginName(){return"Clipboard"}static get requires(){return[Dn,rt,V3,B3]}init(){const 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"}]})}}/**
|
|
1017
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1018
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1019
|
-
*/class L3 extends R{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!_d(e.schema,i))do if(i=i.parent,!i)return;while(!_d(e.schema,i));e.change(s=>{s.setSelection(i,"in")})}}function _d(n,e){return n.isLimit(e)&&(n.checkChild(e,"$text")||n.checkChild(e,"paragraph"))}/**
|
|
1020
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1021
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1022
|
-
*/const O3=hs("Ctrl+A");class F3 extends w{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.t,s=e.editing.view.document;e.commands.add("selectAll",new L3(e)),this.listenTo(s,"keydown",(o,r)=>{Zi(r)===O3&&(e.execute("selectAll"),r.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}const D3='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>';/**
|
|
1023
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1024
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1025
|
-
*/class N3 extends w{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const t=this._createButton(V);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(he))}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("selectAll"),o=new e(t.locale),r=i.t;return o.set({label:r("Select all"),icon:D3,keystroke:"Ctrl+A"}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),o}}/**
|
|
1026
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1027
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1028
|
-
*/class $3 extends w{static get requires(){return[F3,N3]}static get pluginName(){return"SelectAll"}}/**
|
|
1029
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1030
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1031
|
-
*/class mp extends R{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,i)=>{i[1]={...i[1]};const s=i[1];s.batchType||(s.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,i)=>{i[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const s=this.editor.model,o=s.document,r=[],a=e.map(c=>c.getTransformedByOperations(i)),l=a.flat();for(const c of a){const u=c.filter(d=>d.root!=o.graveyard).filter(d=>!z3(d,l));u.length&&(H3(u),r.push(u[0]))}r.length&&s.change(c=>{c.setSelection(r,{backward:t})})}_undo(e,t){const i=this.editor.model,s=i.document;this._createdBatches.add(t);const o=e.operations.slice().filter(r=>r.isDocumentOperation);o.reverse();for(const r of o){const a=r.baseVersion+1,l=Array.from(s.history.getOperations(a)),u=FE([r.getReversed()],l,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let d of u){const h=d.affectedSelectable;h&&!i.canEditAt(h)&&(d=new me(d.baseVersion)),t.addOperation(d),i.applyOperation(d),s.history.setOperationAsUndone(r,d)}}}}function H3(n){n.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;e<n.length;e++){const i=n[e-1].getJoined(n[e],!0);i&&(e--,n.splice(e,2,i))}}function z3(n,e){return e.some(t=>t!==n&&t.containsRange(n,!0))}/**
|
|
1032
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1033
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1034
|
-
*/class U3 extends mp{execute(e=null){const t=e?this._stack.findIndex(o=>o.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>{this._undo(i.batch,s);const o=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,o)}),this.fire("revert",i.batch,s),this.refresh()}}/**
|
|
1035
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1036
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1037
|
-
*/class W3 extends mp{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const s=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(s);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}/**
|
|
1038
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1039
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1040
|
-
*/class q3 extends w{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor,t=e.t;this._undoCommand=new U3(e),this._redoCommand=new W3(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(i,s)=>{const o=s[0];if(!o.isDocumentOperation)return;const r=o.batch,a=this._redoCommand.createdBatches.has(r),l=this._undoCommand.createdBatches.has(r);this._batchRegistry.has(r)||(this._batchRegistry.add(r),r.isUndoable&&(a?this._undoCommand.addBatch(r):l||(this._undoCommand.addBatch(r),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(i,s,o)=>{this._redoCommand.addBatch(o)}),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"]]}]})}}/**
|
|
1041
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1042
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1043
|
-
*/class j3 extends w{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?P.undo:P.redo,o=t.uiLanguageDirection=="ltr"?P.redo:P.undo;this._addButtonsToFactory("undo",i("Undo"),"CTRL+Z",s),this._addButtonsToFactory("redo",i("Redo"),"CTRL+Y",o)}_addButtonsToFactory(e,t,i,s){const o=this.editor;o.ui.componentFactory.add(e,()=>{const r=this._createButton(V,e,t,i,s);return r.set({tooltip:!0}),r}),o.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(he,e,t,i,s))}_createButton(e,t,i,s,o){const r=this.editor,a=r.locale,l=r.commands.get(t),c=new e(a);return c.set({label:i,icon:o,keystroke:s}),c.bind("isEnabled").to(l,"isEnabled"),this.listenTo(c,"execute",()=>{r.execute(t),r.editing.view.focus()}),c}}/**
|
|
1044
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1045
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1046
|
-
*/class gp extends w{static get requires(){return[q3,j3]}static get pluginName(){return"Undo"}}/**
|
|
1047
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1048
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1049
|
-
*/class G3 extends w{static get requires(){return[AS,fp,vs,$3,op,ep,gp]}static get pluginName(){return"Essentials"}}/**
|
|
1050
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1051
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1052
|
-
*/class K3 extends R{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document,i=J(t.selection.getSelectedBlocks());this.value=!!i&&i.is("element","paragraph"),this.isEnabled=!!i&&vd(i,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,s=e.selection||i.selection;t.canEditAt(s)&&t.change(o=>{const r=s.getSelectedBlocks();for(const a of r)!a.is("element","paragraph")&&vd(a,t.schema)&&o.rename(a,"paragraph")})}}function vd(n,e){return e.checkChild(n.parent,"paragraph")&&!e.isObject(n)}/**
|
|
1053
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1054
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1055
|
-
*/class Z3 extends R{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let s=e.position;t.canEditAt(s)&&t.change(o=>{if(s=this._findPositionToInsertParagraph(s,o),!s)return;const r=o.createElement("paragraph");i&&t.schema.setAllowedAttributes(r,i,o),t.insertContent(r,s),o.setSelection(r,"in")})}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const s=i.schema.findAllowedParent(e,"paragraph");if(!s)return null;const o=e.parent,r=i.schema.checkChild(o,"$text");return o.isEmpty||r&&e.isAtEnd?i.createPositionAfter(o):!o.isEmpty&&r&&e.isAtStart?i.createPositionBefore(o):t.split(e,s).position}}/**
|
|
1056
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1057
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1058
|
-
*/class ys extends w{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new K3(e)),e.commands.add("insertParagraph",new Z3(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(i,{writer:s})=>!ys.paragraphLikeElements.has(i.name)||i.isEmpty?null:s.createElement("paragraph"),view:/.+/,converterPriority:"low"})}}ys.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);/**
|
|
1059
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1060
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1061
|
-
*/class J3 extends R{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=J(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>yd(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,s=e.value;t.change(o=>{const r=Array.from(i.selection.getSelectedBlocks()).filter(a=>yd(a,s,t.schema));for(const a of r)a.is("element",s)||o.rename(a,s)})}}function yd(n,e,t){return t.checkChild(n.parent,e)&&!t.isObject(n)}/**
|
|
1062
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1063
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1064
|
-
*/const kd="paragraph";class Y3 extends w{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[ys]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),i.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new J3(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,o)=>{const r=e.model.document.selection.getFirstPosition().parent;i.some(l=>r.is("element",l.model))&&!r.is("element",kd)&&r.childCount===0&&o.writer.rename(r,kd)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:$e.low+1})}}/**
|
|
1065
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1066
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1067
|
-
*/function Q3(n){const e=n.t,t={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return n.config.get("heading.options").map(i=>{const s=t[i.title];return s&&s!=i.title&&(i.title=s),i})}/**
|
|
1068
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1069
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1070
|
-
*/class X3 extends w{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=Q3(e),s=t("Choose heading"),o=t("Heading");e.ui.componentFactory.add("heading",r=>{const a={},l=new Ce,c=e.commands.get("heading"),u=e.commands.get("paragraph"),d=[c];for(const f of i){const m={type:"button",model:new ki({label:f.title,class:f.class,role:"menuitemradio",withText:!0})};f.model==="paragraph"?(m.model.bind("isOn").to(u,"value"),m.model.set("commandName","paragraph"),d.push(u)):(m.model.bind("isOn").to(c,"value",p=>p===f.model),m.model.set({commandName:"heading",commandValue:f.model})),l.add(m),a[f.model]=f.title}const h=ge(r);return yi(h,l,{ariaLabel:o,role:"menu"}),h.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),h.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),h.bind("isEnabled").toMany(d,"isEnabled",(...f)=>f.some(m=>m)),h.buttonView.bind("label").to(c,"value",u,"value",(f,m)=>{const p=m?"paragraph":f;return typeof p=="boolean"||!a[p]?s:a[p]}),h.buttonView.bind("ariaLabel").to(c,"value",u,"value",(f,m)=>{const p=m?"paragraph":f;return typeof p=="boolean"||!a[p]?o:`${a[p]}, ${o}`}),this.listenTo(h,"execute",f=>{const{commandName:m,commandValue:p}=f.source;e.execute(m,p?{value:p}:void 0),e.editing.view.focus()}),h}),e.ui.componentFactory.add("menuBar:heading",r=>{const a=new Oe(r),l=e.commands.get("heading"),c=e.commands.get("paragraph"),u=[l],d=new hi(r);a.set({class:"ck-heading-dropdown"}),d.set({ariaLabel:t("Heading"),role:"menu"}),a.buttonView.set({label:t("Heading")}),a.panelView.children.add(d);for(const h of i){const f=new Ci(r,a),m=new he(r);f.children.add(m),d.items.add(f),m.set({label:h.title,role:"menuitemradio",class:h.class}),m.bind("ariaChecked").to(m,"isOn"),m.delegate("execute").to(a),m.on("execute",()=>{const p=h.model==="paragraph"?"paragraph":"heading";e.execute(p,{value:h.model}),e.editing.view.focus()}),h.model==="paragraph"?(m.bind("isOn").to(c,"value"),u.push(c)):m.bind("isOn").to(l,"value",p=>p===h.model)}return a.bind("isEnabled").toMany(u,"isEnabled",(...h)=>h.some(f=>f)),a})}}/**
|
|
1071
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1072
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1073
|
-
*/class e4 extends w{static get requires(){return[Y3,X3]}static get pluginName(){return"Heading"}}/**
|
|
1074
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1075
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1076
|
-
*/function t4(n){return n.createContainerElement("span",{class:"image-inline"},n.createEmptyElement("img"))}function Cd(n){return n.createContainerElement("figure",{class:"image"},[n.createEmptyElement("img"),n.createSlot("children")])}function pp(n,e){const t=n.plugins.get("ImageUtils"),i=n.plugins.has("ImageInlineEditing")&&n.plugins.has("ImageBlockEditing");return o=>t.isInlineImageView(o)?i&&(o.getStyle("display")=="block"||o.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:s(o):null;function s(o){const r={name:!0};return o.hasAttribute("src")&&(r.attributes=["src"]),r}}function Sl(n,e){const t=J(e.getSelectedBlocks());return!t||n.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function Ao(n){return n&&n.endsWith("px")?parseInt(n):null}function So(n){const e=Ao(n.getStyle("width")),t=Ao(n.getStyle("height"));return!!(e&&t)}/**
|
|
1077
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1078
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1079
|
-
*/const i4=/^(image|image-inline)$/;class Se extends w{constructor(){super(...arguments),this._domEmitter=new(qe())}static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null,s={}){const o=this.editor,r=o.model,a=r.document.selection,l=wp(o,t||a,i);e={...Object.fromEntries(a.getAttributes()),...e};for(const c in e)r.schema.checkAttribute(l,c)||delete e[c];return r.change(c=>{const{setImageSizes:u=!0}=s,d=c.createElement(l,e);return r.insertObject(d,t,null,{setSelection:"on",findOptimalPosition:!t&&l!="imageInline"?"auto":void 0}),d.parent?(u&&this.setImageNaturalSizeAttributes(d),d):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(i=>{const s=new S.window.Image;this._domEmitter.listenTo(s,"load",()=>{!e.getAttribute("width")&&!e.getAttribute("height")&&this.editor.model.enqueueChange(i.batch,o=>{o.setAttribute("width",s.naturalWidth,e),o.setAttribute("height",s.naturalHeight,e)}),this._domEmitter.stopListening(s,"load")}),s.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let s=t.parent;for(;s;){if(s.is("element")&&this.isImageWidget(s))return s;s=s.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:i4})}isImageAllowed(){const t=this.editor.model.document.selection;return n4(this.editor,t)&&s4(t)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),mn(e,t,{label:()=>{const r=this.findViewImgElement(e).getAttribute("alt");return r?`${r} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&ce(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function n4(n,e){if(wp(n,e,null)=="imageBlock"){const i=o4(e,n.model);if(n.model.schema.checkChild(i,"imageBlock"))return!0}else if(n.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}function s4(n){return[...n.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function o4(n,e){const i=Al(n,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function wp(n,e,t){const i=n.model.schema,s=n.config.get("image.insert.type");return n.plugins.has("ImageBlockEditing")?n.plugins.has("ImageInlineEditing")?t||(s==="inline"?"imageInline":s!=="auto"?"imageBlock":e.is("selection")?Sl(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}/**
|
|
1080
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1081
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1082
|
-
*/class r4 extends R{refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled&&i.hasAttribute("alt")?this.value=i.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),s=t.model,o=i.getClosestSelectedImageElement(s.document.selection);s.change(r=>{r.setAttribute("alt",e.newValue,o)})}}/**
|
|
1083
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1084
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1085
|
-
*/class a4 extends w{static get requires(){return[Se]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new r4(this.editor))}}/**
|
|
1086
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1087
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1088
|
-
*/class l4 extends T{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new te,this.keystrokes=new oe,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),P.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),P.cancel,"ck-button-cancel","cancel"),this._focusables=new xe,this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Lo({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,s){const o=new V(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),s&&o.delegate("execute").to(this,s),o}_createLabeledInputView(){const e=this.locale.t,t=new dn(this.locale,ps);return t.label=e("Text alternative"),t}}/**
|
|
1089
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1090
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1091
|
-
*/function c4(n){const e=n.plugins.get("ContextualBalloon");if(n.plugins.get("ImageUtils").getClosestSelectedImageWidget(n.editing.view.document.selection)){const i=bp(n);e.updatePosition(i)}}function bp(n){const e=n.editing.view,t=ke.defaultPositions,i=n.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}/**
|
|
1092
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1093
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1094
|
-
*/class u4 extends w{static get requires(){return[ko]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const s=e.commands.get("imageTextAlternative"),o=new V(i);return o.set({label:t("Change image text alternative"),icon:P.textAlternative,tooltip:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>!!r),this.listenTo(o,"execute",()=>{this._showForm()}),o})}_createForm(){const e=this.editor,i=e.editing.view.document,s=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(za(l4))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(o,r)=>{this._hideForm(!0),r()}),this.listenTo(e.ui,"update",()=>{s.getClosestSelectedImageWidget(i.selection)?this._isVisible&&c4(e):this._hideForm(!0)}),Mo({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:bp(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}/**
|
|
1095
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1096
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1097
|
-
*/class _p extends w{static get requires(){return[a4,u4]}static get pluginName(){return"ImageTextAlternative"}}/**
|
|
1098
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1099
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1100
|
-
*/function d4(n){const e=(t,i,s)=>{if(!s.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const o=n.findViewImgElement(i.viewItem);if(!o||!s.consumable.test(o,{name:!0}))return;s.consumable.consume(i.viewItem,{name:!0,classes:"image"});const r=s.convertItem(o,i.modelCursor),a=J(r.modelRange.getItems());if(!a){s.consumable.revert(i.viewItem,{name:!0,classes:"image"});return}s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i)};return t=>{t.on("element:figure",e)}}function vp(n,e){const t=(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const r=o.writer,a=o.mapper.toViewElement(s.item),l=n.findViewImgElement(a);s.attributeNewValue===null?(r.removeAttribute("srcset",l),r.removeAttribute("sizes",l)):s.attributeNewValue&&(r.setAttribute("srcset",s.attributeNewValue,l),r.setAttribute("sizes","100vw",l))};return i=>{i.on(`attribute:srcset:${e}`,t)}}function xo(n,e,t){const i=(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const a=r.writer,l=r.mapper.toViewElement(o.item),c=n.findViewImgElement(l);a.setAttribute(o.attributeKey,o.attributeNewValue||"",c)};return s=>{s.on(`attribute:${t}:${e}`,i)}}/**
|
|
1101
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1102
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1103
|
-
*/class xl extends wt{observe(e){this.listenTo(e,"load",(t,i)=>{const s=i.target;this.checkShouldIgnoreEventFromTarget(s)||s.tagName=="IMG"&&this._fireEvents(i)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}/**
|
|
1104
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1105
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1106
|
-
*/class h4 extends R{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&D("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&D("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=z(e.source),i=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach((r,a)=>{const l=i.getSelectedElement();if(typeof r=="string"&&(r={src:r}),a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);s.insertImage({...r,...o},c)}else s.insertImage({...r,...o})})}}/**
|
|
1107
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1108
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1109
|
-
*/class f4 extends R{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(i),this.value=this.isEnabled?i.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change(s=>{s.setAttribute("src",e.source,t),this.cleanupImage(s,t),i.setImageNaturalSizeAttributes(t)})}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}/**
|
|
1110
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1111
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1112
|
-
*/class yp extends w{static get requires(){return[Se]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(xl),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new h4(e),s=new f4(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",s),e.commands.add("imageInsert",i)}}/**
|
|
1113
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1114
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1115
|
-
*/class kp extends w{static get requires(){return[Se]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),s=e==="imageBlock"?"figure":"img";t.conversion.for("upcast").attributeToAttribute({view:{name:s,styles:{width:/.+/}},model:{key:"width",value:r=>So(r)?Ao(r.getStyle("width")):null}}).attributeToAttribute({view:{name:s,key:"width"},model:"width"}).attributeToAttribute({view:{name:s,styles:{height:/.+/}},model:{key:"height",value:r=>So(r)?Ao(r.getStyle("height")):null}}).attributeToAttribute({view:{name:s,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(r=>{o(r,"width","width",!0),o(r,"height","height",!0)}),t.conversion.for("dataDowncast").add(r=>{o(r,"width","width",!1),o(r,"height","height",!1)});function o(r,a,l,c){r.on(`attribute:${a}:${e}`,(u,d,h)=>{if(!h.consumable.consume(d.item,u.name))return;const f=h.writer,m=h.mapper.toViewElement(d.item),p=i.findViewImgElement(m);if(d.attributeNewValue!==null?f.setAttribute(l,d.attributeNewValue,p):f.removeAttribute(l,p),d.item.hasAttribute("sources"))return;const _=d.item.hasAttribute("resizedWidth");if(e==="imageInline"&&!_&&!c)return;const k=d.item.getAttribute("width"),A=d.item.getAttribute("height");k&&A&&f.setStyle("aspect-ratio",`${k}/${A}`,p)})}}}/**
|
|
1116
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1117
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1118
|
-
*/class Cp extends R{constructor(e,t){super(e),this._modelElementName=t}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(i):this.isEnabled=t.isBlockImage(i)}execute(e={}){const t=this.editor,i=this.editor.model,s=t.plugins.get("ImageUtils"),o=s.getClosestSelectedImageElement(i.document.selection),r=Object.fromEntries(o.getAttributes());return!r.src&&!r.uploadId?null:i.change(a=>{const{setImageSizes:l=!0}=e,c=Array.from(i.markers).filter(h=>h.getRange().containsItem(o)),u=s.insertImage(r,i.createSelection(o,"on"),this._modelElementName,{setImageSizes:l});if(!u)return null;const d=a.createRangeOn(u);for(const h of c){const f=h.getRange(),m=f.root.rootName!="$graveyard"?f.getJoined(d,!0):d;a.updateMarker(h,{range:m})}return{oldElement:o,newElement:u}})}}/**
|
|
1119
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1120
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1121
|
-
*/class Ep extends w{static get requires(){return[Se]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add(s=>{s.on("attribute:placeholder",(o,r,a)=>{if(!a.consumable.test(r.item,o.name)||!r.item.is("element","imageBlock")&&!r.item.is("element","imageInline"))return;a.consumable.consume(r.item,o.name);const l=a.writer,c=a.mapper.toViewElement(r.item),u=i.findViewImgElement(c);r.attributeNewValue?(l.addClass("image_placeholder",u),l.setStyle("background-image",`url(${r.attributeNewValue})`,u),l.setCustomProperty("editingPipeline:doNotReuseOnce",!0,u)):(l.removeClass("image_placeholder",u),l.removeStyle("background-image",u))})})}_setupLoadListener(){const e=this.editor,t=e.model,i=e.editing,s=i.view,o=e.plugins.get("ImageUtils");s.addObserver(xl),this.listenTo(s.document,"imageLoaded",(r,a)=>{const l=s.domConverter.mapDomToView(a.target);if(!l)return;const c=o.getImageWidgetFromImageView(l);if(!c)return;const u=i.mapper.toModelElement(c);!u||!u.hasAttribute("placeholder")||t.enqueueChange({isUndoable:!1},d=>{d.removeAttribute("placeholder",u)})})}}/**
|
|
1122
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1123
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1124
|
-
*/class Tp extends w{static get requires(){return[yp,kp,Se,Ep,rt]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new Cp(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,s=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>Cd(r)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>s.toImageWidget(Cd(r),r,t("image widget"))}),i.for("downcast").add(xo(s,"imageBlock","src")).add(xo(s,"imageBlock","alt")).add(vp(s,"imageBlock")),i.for("upcast").elementToElement({view:pp(e,"imageBlock"),model:(o,{writer:r})=>r.createElement("imageBlock",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)}).add(d4(s))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isInlineImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(Sl(t.schema,u)==="imageBlock"){const d=new vi(i.document),h=l.map(f=>d.createElement("figure",{class:"image"},f));a.content=d.createDocumentFragment(h)}}),this.listenTo(o,"contentInsertion",(r,a)=>{a.method==="paste"&&t.change(l=>{const c=l.createRangeIn(a.content);for(const u of c.getItems())u.is("element","imageBlock")&&s.setImageNaturalSizeAttributes(u)})})}}/**
|
|
1125
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1126
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1127
|
-
*/class m4 extends T{constructor(e,t=[]){super(e),this.focusTracker=new te,this.keystrokes=new oe,this._focusables=new xe,this.children=this.createCollection(),this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const i of t)this.children.add(i),this._focusables.add(i),i instanceof pg&&this._focusables.addMany(i.children);if(this._focusables.length>1)for(const i of this._focusables)g4(i)&&(i.focusCycler.on("forwardCycle",s=>{this._focusCycler.focusNext(),s.stop()}),i.focusCycler.on("backwardCycle",s=>{this._focusCycler.focusPrevious(),s.stop()}));this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),Lo({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}function g4(n){return"focusCycler"in n}/**
|
|
1128
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1129
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1130
|
-
*/class Ap extends w{static get pluginName(){return"ImageInsertUI"}static get requires(){return[Se]}constructor(e){super(e),this._integrations=new Map,e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=i.isImage(t.getSelectedElement())});const s=o=>this._createToolbarComponent(o);e.ui.componentFactory.add("insertImage",s),e.ui.componentFactory.add("imageInsert",s)}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:s,requiresForm:o}){this._integrations.has(e)&&D("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,formViewCreator:s,requiresForm:!!o})}_createToolbarComponent(e){const t=this.editor,i=e.t,s=this._prepareIntegrations();if(!s.length)return null;let o;const r=s[0];if(s.length==1){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const c=r.buttonViewCreator(!1);o=new hn(e,c),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",u=>i(u?"Replace image":"Insert image"))}const a=this.dropdownView=ge(e,o),l=s.map(({observable:c})=>typeof c=="function"?c():c);return a.bind("isEnabled").toMany(l,"isEnabled",(...c)=>c.some(u=>u)),a.once("change:isOpen",()=>{const c=s.map(({formViewCreator:d})=>d(s.length==1)),u=new m4(t.locale,c);a.panelView.children.add(u)}),a}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),i=[];if(!t.length)return D("image-insert-integrations-not-specified"),i;for(const s of t){if(!this._integrations.has(s)){["upload","assetManager","url"].includes(s)||D("image-insert-unknown-integration",{item:s});continue}i.push(this._integrations.get(s))}return i.length||D("image-insert-integrations-not-registered"),i}}/**
|
|
1131
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1132
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1133
|
-
*/class p4 extends w{static get requires(){return[Tp,Ei,_p,Ap]}static get pluginName(){return"ImageBlock"}}/**
|
|
1134
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1135
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1136
|
-
*/class w4 extends w{static get requires(){return[yp,kp,Se,Ep,rt]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((i,s)=>{if(i.endsWith("caption")&&s.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new Cp(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,s=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(o,{writer:r})=>r.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(o,{writer:r})=>s.toImageWidget(t4(r),r,t("image widget"))}),i.for("downcast").add(xo(s,"imageInline","src")).add(xo(s,"imageInline","alt")).add(vp(s,"imageInline")),i.for("upcast").elementToElement({view:pp(e,"imageInline"),model:(o,{writer:r})=>r.createElement("imageInline",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isBlockImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(Sl(t.schema,u)==="imageInline"){const d=new vi(i.document),h=l.map(f=>f.childCount===1?(Array.from(f.getAttributes()).forEach(m=>d.setAttribute(...m,s.findViewImgElement(f))),f.getChild(0)):f);a.content=d.createDocumentFragment(h)}}),this.listenTo(o,"contentInsertion",(r,a)=>{a.method==="paste"&&t.change(l=>{const c=l.createRangeIn(a.content);for(const u of c.getItems())u.is("element","imageInline")&&s.setImageNaturalSizeAttributes(u)})})}}/**
|
|
1137
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1138
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1139
|
-
*/class b4 extends w{static get requires(){return[w4,Ei,_p,Ap]}static get pluginName(){return"ImageInline"}}/**
|
|
1140
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1141
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1142
|
-
*/class _4 extends w{static get requires(){return[p4,b4]}static get pluginName(){return"Image"}}/**
|
|
1143
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1144
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1145
|
-
*/class Sp extends w{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[Se]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return e.name=="figcaption"&&t.isBlockImageView(e.parent)?{name:!0}:null}}/**
|
|
1146
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1147
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1148
|
-
*/class v4 extends R{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(Tp)){this.isEnabled=!1,this.value=!1;return}const s=e.model.document.selection,o=s.getSelectedElement();if(!o){const r=t.getCaptionFromModelSelection(s);this.isEnabled=!!r,this.value=!!r;return}this.isEnabled=i.isImage(o),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(i=>{this.value?this._hideImageCaption(i):this._showImageCaption(i,t)})}_showImageCaption(e,t){const s=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing"),r=this.editor.plugins.get("ImageUtils");let a=s.getSelectedElement();const l=o._getSavedCaption(a);r.isInlineImage(a)&&(this.editor.execute("imageTypeBlock"),a=s.getSelectedElement());const c=l||e.createElement("caption");e.append(c,a),t&&e.setSelection(c,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,s=t.plugins.get("ImageCaptionEditing"),o=t.plugins.get("ImageCaptionUtils");let r=i.getSelectedElement(),a;r?a=o.getCaptionFromImageModelElement(r):(a=o.getCaptionFromModelSelection(i),r=a.parent),s._saveCaption(r,a),e.setSelection(r,"on"),e.remove(a)}}/**
|
|
1149
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1150
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1151
|
-
*/class y4 extends w{static get requires(){return[Se,Sp]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new v4(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:r=>s.matchImageCaptionViewElement(r),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(r,{writer:a})=>i.isBlockImage(r.parent)?a.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(r,{writer:a})=>{if(!i.isBlockImage(r.parent))return null;const l=a.createEditableElement("figcaption");a.setCustomProperty("imageCaption",!0,l),l.placeholder=o("Enter image caption"),bm({view:t,element:l,keepOnFocus:!0});const c=r.parent.getAttribute("alt"),u=c?o("Caption for image: %0",[c]):o("Caption for the image");return lp(l,a,{label:u})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),s=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),r=a=>{if(!a.return)return;const{oldElement:l,newElement:c}=a.return;/* istanbul ignore if: paranoid check -- @preserve */if(!l)return;if(t.isBlockImage(l)){const d=i.getCaptionFromImageModelElement(l);if(d){this._saveCaption(c,d);return}}const u=this._getSavedCaption(l);u&&this._saveCaption(c,u)};s&&this.listenTo(s,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?q.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const o=t.document.differ.getChanges();for(const r of o){if(r.attributeKey!=="alt")continue;const a=r.range.start.nodeAfter;if(i.isBlockImage(a)){const l=s.getCaptionFromImageModelElement(a);if(!l)return;e.editing.reconvertItem(l)}}})}}/**
|
|
1152
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1153
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1154
|
-
*/class k4 extends w{static get requires(){return[Sp]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),s=e.t;e.ui.componentFactory.add("toggleImageCaption",o=>{const r=e.commands.get("toggleImageCaption"),a=new V(o);return a.set({icon:P.caption,tooltip:!0,isToggleable:!0}),a.bind("isOn","isEnabled").to(r,"value","isEnabled"),a.bind("label").to(r,"value",l=>s(l?"Toggle caption off":"Toggle caption on")),this.listenTo(a,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const l=i.getCaptionFromModelSelection(e.model.document.selection);if(l){const c=e.editing.mapper.toViewElement(l);t.scrollToTheSelection(),t.change(u=>{u.addClass("image__caption_highlighted",c)})}e.editing.view.focus()}),a})}}/**
|
|
1155
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1156
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1157
|
-
*/class C4 extends w{static get requires(){return[y4,k4]}static get pluginName(){return"ImageCaption"}}/**
|
|
1158
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1159
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1160
|
-
*/function xp(n){const e=n.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function E4(n){return new Promise((e,t)=>{const i=n.getAttribute("src");fetch(i).then(s=>s.blob()).then(s=>{const o=Ip(s,i),a=`image.${o.replace("image/","")}`,l=new File([s],a,{type:o});e(l)}).catch(s=>s&&s.name==="TypeError"?A4(i).then(e).catch(t):t(s))})}function T4(n,e){return!n.isInlineImageView(e)||!e.getAttribute("src")?!1:!!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!e.getAttribute("src").match(/^blob:/g)}function Ip(n,e){return n.type?n.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function A4(n){return S4(n).then(e=>{const t=Ip(e,n),s=`image.${t.replace("image/","")}`;return new File([e],s,{type:t})})}function S4(n){return new Promise((e,t)=>{const i=S.document.createElement("img");i.addEventListener("load",()=>{const s=S.document.createElement("canvas");s.width=i.width,s.height=i.height,s.getContext("2d").drawImage(i,0,0),s.toBlob(r=>r?e(r):t())}),i.addEventListener("error",()=>t()),i.src=n})}/**
|
|
1161
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1162
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1163
|
-
*/class x4 extends w{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=()=>{const s=this._createButton(gg);return s.set({label:t("Upload image from computer"),tooltip:!0}),s};if(e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i),e.ui.componentFactory.add("menuBar:uploadImage",()=>{const s=this._createButton(Wg);return s.label=t("Image from computer"),s}),e.plugins.has("ImageInsertUI")){const s=e.plugins.get("ImageInsertUI");s.registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>{const o=e.ui.componentFactory.create("uploadImage");return o.bind("label").to(s,"isImageSelected",r=>t(r?"Replace image from computer":"Upload image from computer")),o},formViewCreator:()=>{const o=e.ui.componentFactory.create("uploadImage");return o.withText=!0,o.bind("label").to(s,"isImageSelected",r=>t(r?"Replace from computer":"Upload from computer")),o.on("execute",()=>{s.dropdownView.isOpen=!1}),o}})}}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("uploadImage"),o=t.config.get("image.upload.types"),r=xp(o),a=new e(t.locale),l=i.t;return a.set({acceptedType:o.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:l("Upload image from computer"),icon:P.imageUpload}),a.bind("isEnabled").to(s),a.on("done",(c,u)=>{const d=Array.from(u).filter(h=>r.test(h.type));d.length&&(t.execute("uploadImage",{file:d}),t.editing.view.focus())}),a}}/**
|
|
1164
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1165
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1166
|
-
*/class I4 extends W(){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,s)=>{t.onload=()=>{const o=t.result;this._data=o,i(o)},t.onerror=()=>{s("error")},t.onabort=()=>{s("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}/**
|
|
1167
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1168
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1169
|
-
*/class oi extends w{constructor(){super(...arguments),this.loaders=new Ce,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[_o]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return D("filerepository-no-upload-adapter"),null;const t=new Ed(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(i=>{this._loadersMap.set(i,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let i=0;for(const s of this.loaders)i+=s.uploaded;this.uploaded=i}),t.on("change:uploadTotal",()=>{let i=0;for(const s of this.loaders)s.uploadTotal&&(i+=s.uploadTotal);this.uploadTotal=i}),t}destroyLoader(e){const t=e instanceof Ed?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((i,s)=>{i===t&&this._loadersMap.delete(s)})}_updatePendingAction(){const e=this.editor.plugins.get(_o);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=s=>`${t("Upload in progress")} ${parseInt(s)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}class Ed extends W(){constructor(e,t){super(),this.id=Ke(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new I4,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(i,s)=>s?i/s*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new g("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new g("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,s)=>{t.rejecter=s,t.isFulfilled=!1,e.then(o=>{t.isFulfilled=!0,i(o)}).catch(o=>{t.isFulfilled=!0,s(o)})}),t}}/**
|
|
1170
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1171
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1172
|
-
*/class P4 extends w{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.uploadStatusChange=(t,i,s)=>{const o=this.editor,r=i.item,a=r.getAttribute("uploadId");if(!s.consumable.consume(i.item,t.name))return;const l=o.plugins.get("ImageUtils"),c=o.plugins.get(oi),u=a?i.attributeNewValue:null,d=this.placeholder,h=o.editing.mapper.toViewElement(r),f=s.writer;if(u=="reading"){Td(h,f),Ad(l,d,h,f);return}if(u=="uploading"){const m=c.loaders.get(a);Td(h,f),m?(Sd(h,f),V4(h,f,m,o.editing.view),F4(l,h,f,m)):Ad(l,d,h,f);return}u=="complete"&&c.loaders.get(a)&&M4(h,f,o.editing.view),B4(h,f),Sd(h,f),R4(h,f)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function Td(n,e){n.hasClass("ck-appear")||e.addClass("ck-appear",n)}function R4(n,e){e.removeClass("ck-appear",n)}function Ad(n,e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);const s=n.findViewImgElement(t);s.getAttribute("src")!==e&&i.setAttribute("src",e,s),Pp(t,"placeholder")||i.insert(i.createPositionAfter(s),O4(i))}function Sd(n,e){n.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",n),Rp(n,e,"placeholder")}function V4(n,e,t,i){const s=L4(e);e.insert(e.createPositionAt(n,"end"),s),t.on("change:uploadedPercent",(o,r,a)=>{i.change(l=>{l.setStyle("width",a+"%",s)})})}function B4(n,e){Rp(n,e,"progressBar")}function M4(n,e,t){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(n,"end"),i),setTimeout(()=>{t.change(s=>s.remove(s.createRangeOn(i)))},3e3)}function L4(n){const e=n.createUIElement("div",{class:"ck-progress-bar"});return n.setCustomProperty("progressBar",!0,e),e}function O4(n){const e=n.createUIElement("div",{class:"ck-upload-placeholder-loader"});return n.setCustomProperty("placeholder",!0,e),e}function Pp(n,e){for(const t of n.getChildren())if(t.getCustomProperty(e))return t}function Rp(n,e,t){const i=Pp(n,t);i&&e.remove(e.createRangeOn(i))}function F4(n,e,t,i){if(i.data){const s=n.findViewImgElement(e);t.setAttribute("src",i.data,s)}}/**
|
|
1173
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1174
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1175
|
-
*/class D4 extends R{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=z(e.file),i=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach((r,a)=>{const l=i.getSelectedElement();if(a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);this._uploadImage(r,o,c)}else this._uploadImage(r,o)})}_uploadImage(e,t,i){const s=this.editor,r=s.plugins.get(oi).createLoader(e),a=s.plugins.get("ImageUtils");r&&a.insertImage({...t,uploadId:r.id},i)}}/**
|
|
1176
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1177
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1178
|
-
*/class N4 extends w{static get requires(){return[oi,Gu,rt,Se]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,s=e.plugins.get(oi),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),a=xp(e.config.get("image.upload.types")),l=new D4(e);e.commands.add("uploadImage",l),e.commands.add("imageUpload",l),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(c,u)=>{if($4(u.dataTransfer))return;const d=Array.from(u.dataTransfer.files).filter(h=>h?a.test(h.type):!1);d.length&&(c.stop(),e.model.change(h=>{u.targetRanges&&h.setSelection(u.targetRanges.map(f=>e.editing.mapper.toModelRange(f))),e.execute("uploadImage",{file:d})}))}),this.listenTo(r,"inputTransformation",(c,u)=>{const d=Array.from(e.editing.view.createRangeIn(u.content)).map(f=>f.item).filter(f=>T4(o,f)&&!f.getAttribute("uploadProcessed")).map(f=>({promise:E4(f),imageElement:f}));if(!d.length)return;const h=new vi(e.editing.view.document);for(const f of d){h.setAttribute("uploadProcessed",!0,f.imageElement);const m=s.createLoader(f.promise);m&&(h.setAttribute("src","",f.imageElement),h.setAttribute("uploadId",m.id,f.imageElement))}}),e.editing.view.document.on("dragover",(c,u)=>{u.preventDefault()}),t.on("change",()=>{const c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),u=new Set;for(const d of c)if(d.type=="insert"&&d.name!="$text"){const h=d.position.nodeAfter,f=d.position.root.rootName=="$graveyard";for(const m of H4(e,h)){const p=m.getAttribute("uploadId");if(!p)continue;const _=s.loaders.get(p);_&&(f?u.has(p)||_.abort():(u.add(p),this._uploadImageElements.set(p,m),_.status=="idle"&&this._readAndUpload(_)))}}}),this.on("uploadComplete",(c,{imageElement:u,data:d})=>{const h=d.urls?d.urls:d;this.editor.model.change(f=>{f.setAttribute("src",h.default,u),this._parseAndSetSrcsetAttributeOnImage(h,u,f),o.setImageNaturalSizeAttributes(u)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,s=t.locale.t,o=t.plugins.get(oi),r=t.plugins.get(Gu),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},u=>{u.setAttribute("uploadStatus","reading",l.get(e.id))}),e.read().then(()=>{const u=e.upload(),d=l.get(e.id);/* istanbul ignore next -- @preserve */if(M.isSafari){const h=t.editing.mapper.toViewElement(d),f=a.findViewImgElement(h);t.editing.view.once("render",()=>{if(!f.parent)return;const m=t.editing.view.domConverter.mapViewToDom(f.parent);if(!m)return;const p=m.style.display;m.style.display="none",m._ckHack=m.offsetHeight,m.style.display=p})}return i.enqueueChange({isUndoable:!1},h=>{h.setAttribute("uploadStatus","uploading",d)}),u}).then(u=>{i.enqueueChange({isUndoable:!1},d=>{const h=l.get(e.id);d.setAttribute("uploadStatus","complete",h),this.fire("uploadComplete",{data:u,imageElement:h})}),c()}).catch(u=>{if(e.status!=="error"&&e.status!=="aborted")throw u;e.status=="error"&&u&&r.showWarning(u,{title:s("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},d=>{d.remove(l.get(e.id))}),c()});function c(){i.enqueueChange({isUndoable:!1},u=>{const d=l.get(e.id);u.removeAttribute("uploadId",d),u.removeAttribute("uploadStatus",d),l.delete(e.id)}),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let s=0;const o=Object.keys(e).filter(r=>{const a=parseInt(r,10);if(!isNaN(a))return s=Math.max(s,a),!0}).map(r=>`${e[r]} ${r}w`).join(", ");if(o!=""){const r={srcset:o};!t.hasAttribute("width")&&!t.hasAttribute("height")&&(r.width=s),i.setAttributes(r,t)}}}function $4(n){return Array.from(n.types).includes("text/html")&&n.getData("text/html")!==""}function H4(n,e){const t=n.plugins.get("ImageUtils");return Array.from(n.model.createRangeOn(e)).filter(i=>t.isImage(i.item)).map(i=>i.item)}/**
|
|
1179
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1180
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1181
|
-
*/class z4 extends w{static get pluginName(){return"ImageUpload"}static get requires(){return[N4,x4,P4]}}/**
|
|
1182
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1183
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1184
|
-
*/class U4 extends R{refresh(){const e=this.editor,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!i,!i||!i.hasAttribute("resizedWidth")?this.value=null:this.value={width:i.getAttribute("resizedWidth"),height:null}}execute(e){const t=this.editor,i=t.model,s=t.plugins.get("ImageUtils"),o=s.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change(r=>{r.setAttribute("resizedWidth",e.width,o),r.removeAttribute("resizedHeight",o),s.setImageNaturalSizeAttributes(o)})}}/**
|
|
1185
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1186
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1187
|
-
*/class Vp extends w{static get requires(){return[Se]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new U4(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add(s=>s.on(`attribute:resizedWidth:${e}`,(o,r,a)=>{if(!a.consumable.consume(r.item,o.name))return;const l=a.writer,c=a.mapper.toViewElement(r.item);r.attributeNewValue!==null?(l.setStyle("width",r.attributeNewValue,c),l.addClass("image_resized",c)):(l.removeStyle("width",c),l.removeClass("image_resized",c))})),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:s=>({key:"style",value:{height:s}})}),t.conversion.for("editingDowncast").add(s=>s.on(`attribute:resizedHeight:${e}`,(o,r,a)=>{if(!a.consumable.consume(r.item,o.name))return;const l=a.writer,c=a.mapper.toViewElement(r.item),u=e==="imageInline"?i.findViewImgElement(c):c;r.attributeNewValue!==null?l.setStyle("height",r.attributeNewValue,u):l.removeStyle("height",u)})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:s=>So(s)?null:s.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:s=>So(s)?null:s.getStyle("height")}})}}/**
|
|
1188
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1189
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1190
|
-
*/const Rr={small:P.objectSizeSmall,medium:P.objectSizeMedium,large:P.objectSizeLarge,original:P.objectSizeFull};class W4 extends w{static get requires(){return[Vp]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const s of t)this._registerImageResizeButton(s);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:s,icon:o}=e,r=s?s+this._resizeUnit:null;t.ui.componentFactory.add(i,a=>{const l=new V(a),c=t.commands.get("resizeImage"),u=this._getOptionLabelValue(e,!0);if(!Rr[o])throw new g("imageresizebuttons-missing-icon",t,e);return l.set({label:u,icon:Rr[o],tooltip:u,isToggleable:!0}),l.bind("isEnabled").to(this),l.bind("isOn").to(c,"value",xd(r)),this.listenTo(l,"execute",()=>{t.execute("resizeImage",{width:r})}),l})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,s=e.find(r=>!r.value),o=r=>{const a=t.commands.get("resizeImage"),l=ge(r,Sg),c=l.buttonView,u=i("Resize image");return c.set({tooltip:u,commandValue:s.value,icon:Rr.medium,isToggleable:!0,label:this._getOptionLabelValue(s),withText:!0,class:"ck-resize-image-button",ariaLabel:u,ariaLabelledBy:void 0}),c.bind("label").to(a,"value",d=>d&&d.width?d.width:this._getOptionLabelValue(s)),l.bind("isEnabled").to(this),yi(l,()=>this._getResizeDropdownListItemDefinitions(e,a),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(l,"execute",d=>{t.execute(d.source.commandName,{width:d.source.commandValue}),t.editing.view.focus()}),l};t.ui.componentFactory.add("resizeImage",o),t.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(e,t=!1){const i=this.editor.t;return e.label?e.label:t?e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const i=new Ce;return e.map(s=>{const o=s.value?s.value+this._resizeUnit:null,r={type:"button",model:new ki({commandName:"resizeImage",commandValue:o,label:this._getOptionLabelValue(s),role:"menuitemradio",withText:!0,icon:null})};r.model.bind("isOn").to(t,"value",xd(o)),i.add(r)}),i}}function xd(n){return e=>{const t=e;return n===null&&t===n?!0:t!==null&&t.width===n}}/**
|
|
1191
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1192
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1193
|
-
*/const q4="figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img",Vr="image_resized";class j4 extends w{static get requires(){return[Ir,Se]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(xl),this.listenTo(t.document,"imageLoaded",(s,o)=>{if(!o.target.matches(q4))return;const r=e.editing.view.domConverter,a=r.domToView(o.target),l=i.getImageWidgetFromImageView(a);let c=this.editor.plugins.get(Ir).getResizerByViewElement(l);if(c){c.redraw();return}const u=e.editing.mapper,d=u.toModelElement(l);c=e.plugins.get(Ir).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:d,viewElement:l,editor:e,getHandleHost(h){return h.querySelector("img")},getResizeHost(){return r.mapViewToDom(u.toViewElement(d.parent))},isCentered(){return d.getAttribute("imageStyle")=="alignCenter"},onCommit(h){t.change(f=>{f.removeClass(Vr,l)}),e.execute("resizeImage",{width:h})}}),c.on("updateSize",()=>{l.hasClass(Vr)||t.change(f=>{f.addClass(Vr,l)});const h=d.name==="imageInline"?a:l;h.getStyle("height")&&t.change(f=>{f.removeStyle("height",h)})}),c.bind("isEnabled").to(this)})}}/**
|
|
1194
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1195
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1196
|
-
*/class G4 extends w{static get requires(){return[Vp,j4,W4]}static get pluginName(){return"ImageResize"}}/**
|
|
1197
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1198
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1199
|
-
*/class K4 extends R{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(const s of i.modelElements)this._defaultStyles[s]=i.name;return[i.name,i]}))}refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled?i.hasAttribute("imageStyle")?this.value=i.getAttribute("imageStyle"):this.value=this._defaultStyles[i.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,s=t.plugins.get("ImageUtils");i.change(o=>{const r=e.value,{setImageSizes:a=!0}=e;let l=s.getClosestSelectedImageElement(i.document.selection);r&&this.shouldConvertImageType(r,l)&&(this.editor.execute(s.isBlockImage(l)?"imageTypeInline":"imageTypeBlock",{setImageSizes:a}),l=s.getClosestSelectedImageElement(i.document.selection)),!r||this._styles.get(r).isDefault?o.removeAttribute("imageStyle",l):o.setAttribute("imageStyle",r,l),a&&s.setImageNaturalSizeAttributes(l)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}/**
|
|
1200
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1201
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1202
|
-
*/const{objectFullWidth:Z4,objectInline:Bp,objectLeft:Mp,objectRight:ya,objectCenter:ka,objectBlockLeft:Lp,objectBlockRight:Op}=P,no={get inline(){return{name:"inline",title:"In line",icon:Bp,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Mp,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Lp,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:ka,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:ya,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Op,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:ka,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:ya,modelElements:["imageBlock"],className:"image-style-side"}}},Fp={full:Z4,left:Lp,right:Op,center:ka,inlineLeft:Mp,inlineRight:ya,inline:Bp},Dp=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function J4(n){return(n.configuredStyles.options||[]).map(i=>X4(i)).filter(i=>e7(i,n))}function Y4(n,e){return n&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:n?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function Q4(n){return n.has("ImageBlockEditing")&&n.has("ImageInlineEditing")?[...Dp]:[]}function X4(n){return typeof n=="string"?no[n]?n={...no[n]}:n={name:n}:n=t7(no[n.name],n),typeof n.icon=="string"&&(n.icon=Fp[n.icon]||n.icon),n}function e7(n,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){const{modelElements:i,name:s}=n;if(!i||!i.length||!s)return Np({style:n}),!1;{const o=[e?"imageBlock":null,t?"imageInline":null];if(!i.some(r=>o.includes(r)))return D("image-style-missing-dependency",{style:n,missingPlugins:i.map(r=>r==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function t7(n,e){const t={...e};for(const i in n)Object.prototype.hasOwnProperty.call(e,i)||(t[i]=n[i]);return t}function Np(n){D("image-style-configuration-definition-invalid",n)}const Ca={normalizeStyles:J4,getDefaultStylesConfiguration:Y4,getDefaultDropdownDefinitions:Q4,warnInvalidStyle:Np,DEFAULT_OPTIONS:no,DEFAULT_ICONS:Fp,DEFAULT_DROPDOWN_DEFINITIONS:Dp};/**
|
|
1203
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1204
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1205
|
-
*/function i7(n){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const s=Id(t.attributeNewValue,n),o=Id(t.attributeOldValue,n),r=i.mapper.toViewElement(t.item),a=i.writer;o&&a.removeClass(o.className,r),s&&a.addClass(s.className,r)}}function n7(n){const e={imageInline:n.filter(t=>!t.isDefault&&t.modelElements.includes("imageInline")),imageBlock:n.filter(t=>!t.isDefault&&t.modelElements.includes("imageBlock"))};return(t,i,s)=>{if(!i.modelRange)return;const o=i.viewItem,r=J(i.modelRange.getItems());if(r&&s.schema.checkAttribute(r,"imageStyle"))for(const a of e[r.name])s.consumable.consume(o,{classes:a.className})&&s.writer.setAttribute("imageStyle",a.name,r)}}function Id(n,e){for(const t of e)if(t.name===n)return t}/**
|
|
1206
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1207
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1208
|
-
*/class $p extends w{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Se]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Ca,i=this.editor,s=i.plugins.has("ImageBlockEditing"),o=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(s,o)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:s,isInlinePluginLoaded:o}),this._setupConversion(s,o),this._setupPostFixer(),i.commands.add("imageStyle",new K4(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,s=i.model.schema,o=i7(this.normalizedStyles),r=n7(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",o),i.data.downcastDispatcher.on("attribute:imageStyle",o),e&&(s.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),t&&(s.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(Se),s=new Map(this.normalizedStyles.map(o=>[o.name,o]));t.registerPostFixer(o=>{let r=!1;for(const a of t.differ.getChanges())if(a.type=="insert"||a.type=="attribute"&&a.attributeKey=="imageStyle"){let l=a.type=="insert"?a.position.nodeAfter:a.range.start.nodeAfter;if(l&&l.is("element","paragraph")&&l.childCount>0&&(l=l.getChild(0)),!i.isImage(l))continue;const c=l.getAttribute("imageStyle");if(!c)continue;const u=s.get(c);(!u||!u.modelElements.includes(l.name))&&(o.removeAttribute("imageStyle",l),r=!0)}return r})}}/**
|
|
1209
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1210
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1211
|
-
*/class s7 extends w{static get requires(){return[$p]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=e.get("ImageStyleEditing"),s=Pd(i.normalizedStyles,this.localizedDefaultStylesTitles);for(const r of s)this._createButton(r);const o=Pd([...t.filter(Q),...Ca.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const r of o)this._createDropdown(r,s)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,s=>{let o;const{defaultItem:r,items:a,title:l}=e,c=a.filter(f=>t.find(({name:m})=>Rd(m)===f)).map(f=>{const m=i.create(f);return f===r&&(o=m),m});a.length!==c.length&&Ca.warnInvalidStyle({dropdown:e});const u=ge(s,hn),d=u.buttonView,h=d.arrowView;return Jo(u,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:Vd(l,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:l}),d.bind("icon").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Ot);return m<0?o.icon:c[m].icon}),d.bind("label").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Ot);return Vd(l,m<0?o.label:c[m].label)}),d.bind("isOn").toMany(c,"isOn",(...f)=>f.some(Ot)),d.bind("class").toMany(c,"isOn",(...f)=>f.some(Ot)?"ck-splitbutton_flatten":void 0),d.on("execute",()=>{c.some(({isOn:f})=>f)?u.isOpen=!u.isOpen:o.fire("execute")}),u.bind("isEnabled").toMany(c,"isEnabled",(...f)=>f.some(Ot)),this.listenTo(u,"execute",()=>{this.editor.editing.view.focus()}),u})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(Rd(t),i=>{const s=this.editor.commands.get("imageStyle"),o=new V(i);return o.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>r===t),o.on("execute",this._executeCommand.bind(this,t)),o})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Pd(n,e){for(const t of n)e[t.title]&&(t.title=e[t.title]);return n}function Rd(n){return`imageStyle:${n}`}function Vd(n,e){return(n?n+": ":"")+e}/**
|
|
1212
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1213
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1214
|
-
*/class o7 extends w{static get requires(){return[$p,s7]}static get pluginName(){return"ImageStyle"}}/**
|
|
1215
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1216
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1217
|
-
*/class r7 extends w{static get requires(){return[To,Se]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(To),s=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:a7(e.config.get("image.toolbar")||[]),getRelatedElement:o=>s.getClosestSelectedImageWidget(o)})}}function a7(n){return n.map(e=>Q(e)?e.name:e)}/**
|
|
1218
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1219
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1220
|
-
*/class l7 extends w{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Fc(e)),e.commands.add("outdent",new Fc(e))}}/**
|
|
1221
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1222
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1223
|
-
*/class c7 extends w{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?P.indent:P.outdent,o=t.uiLanguageDirection=="ltr"?P.outdent:P.indent;this._defineButton("indent",i("Increase indent"),s),this._defineButton("outdent",i("Decrease indent"),o)}_defineButton(e,t,i){const s=this.editor;s.ui.componentFactory.add(e,()=>{const o=this._createButton(V,e,t,i);return o.set({tooltip:!0}),o}),s.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(he,e,t,i))}_createButton(e,t,i,s){const o=this.editor,r=o.commands.get(t),a=new e(o.locale);return a.set({label:i,icon:s}),a.bind("isEnabled").to(r,"isEnabled"),this.listenTo(a,"execute",()=>{o.execute(t),o.editing.view.focus()}),a}}/**
|
|
1224
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1225
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1226
|
-
*/class u7 extends w{static get pluginName(){return"Indent"}static get requires(){return[l7,c7]}}/**
|
|
1227
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1228
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1229
|
-
*/class js extends R{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const t=this.editor.model,i=J(t.document.selection.getSelectedBlocks());if(!i||!this._isIndentationChangeAllowed(i)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(i.getAttribute("blockIndent"))}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change(i=>{for(const s of t){const o=s.getAttribute("blockIndent"),r=this._indentBehavior.getNextIndent(o);r?i.setAttribute("blockIndent",r,s):i.removeAttribute("blockIndent",s)}})}_getBlocksToChange(){const t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(s=>this._isIndentationChangeAllowed(s))}_isIndentationChangeAllowed(e){const t=this.editor;return t.model.schema.checkAttribute(e,"blockIndent")?!t.plugins.has("ListUtils")||!this._indentBehavior.isForward?!0:!t.plugins.get("ListUtils").isListItemBlock(e):!1}}/**
|
|
1230
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1231
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1232
|
-
*/class Bd{constructor(e){this.isForward=e.direction==="forward",this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const s=this.isForward?this.offset:-this.offset,o=t+s;return o>0?o+this.unit:void 0}}/**
|
|
1233
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1234
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1235
|
-
*/class Md{constructor(e){this.isForward=e.direction==="forward",this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),i=this.isForward?1:-1;return this.classes[t+i]}}/**
|
|
1236
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1237
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1238
|
-
*/const d7=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class h7 extends w{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new js(e,new Md({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new js(e,new Md({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(YT),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new js(e,new Bd({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new js(e,new Bd({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){const e=this.editor,t=e.model.schema,i=e.commands.get("indent"),s=e.commands.get("outdent"),o=e.config.get("heading.options");(o&&o.map(l=>l.model)||d7).forEach(l=>{t.isRegistered(l)&&t.extend(l,{allowAttributes:"blockIndent"})}),t.setAttributeProperties("blockIndent",{isFormatting:!0}),i.registerChildCommand(e.commands.get("indentBlock")),s.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,i=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[i]:/[\s\S]+/}},model:{key:"blockIndent",value:s=>{if(!s.is("element","li"))return s.getStyle(i)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:s=>({key:"style",value:{[i]:s}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t)}}/**
|
|
1239
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1240
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1241
|
-
*/class f7{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,s)=>{if(!s.consumable.test(i.item,"attribute:linkHref")||!(i.item.is("selection")||s.schema.isInline(i.item)))return;const o=s.writer,r=o.document.selection;for(const a of this._definitions){const l=o.createAttributeElement("a",a.attributes,{priority:5});a.classes&&o.addClass(a.classes,l);for(const c in a.styles)o.setStyle(c,a.styles[c],l);o.setCustomProperty("link",!0,l),a.callback(i.attributeNewValue)?i.item.is("selection")?o.wrap(r.getFirstRange(),l):o.wrap(s.mapper.toViewRange(i.range),l):o.unwrap(s.mapper.toViewRange(i.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:s,mapper:o})=>{const r=o.toViewElement(i.item),a=Array.from(r.getChildren()).find(l=>l.is("element","a"));for(const l of this._definitions){const c=pt(l.attributes);if(l.callback(i.attributeNewValue)){for(const[u,d]of c)u==="class"?s.addClass(d,a):s.setAttribute(u,d,a);l.classes&&s.addClass(l.classes,a);for(const u in l.styles)s.setStyle(u,l.styles[u],a)}else{for(const[u,d]of c)u==="class"?s.removeClass(d,a):s.removeAttribute(u,a);l.classes&&s.removeClass(l.classes,a);for(const u in l.styles)s.removeStyle(u,a)}}})}}}/**
|
|
1242
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1243
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1244
|
-
*/const m7=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,g7="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",p7=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,w7=/^((\w+:(\/{2,})?)|(\W))/i,b7=["https?","ftps?","mailto"],In="Ctrl+K";function _7(n){return n.is("attributeElement")&&!!n.getCustomProperty("link")}function Ld(n,{writer:e}){const t=e.createAttributeElement("a",{href:n},{priority:5});return e.setCustomProperty("link",!0,t),t}function Hp(n,e=b7){const t=String(n),i=e.join("|"),s=new RegExp(`${g7.replace("<protocols>",i)}`,"i");return v7(t,s)?t:"#"}function v7(n,e){return!!n.replace(m7,"").match(e)}function y7(n,e){const t={"Open in a new tab":n("Open in a new tab"),Downloadable:n("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function k7(n){const e=[];if(n)for(const[t,i]of Object.entries(n)){const s=Object.assign({},i,{id:`link${kf(t)}`});e.push(s)}return e}function Ea(n,e){return n?e.checkAttribute(n.name,"linkHref"):!1}function C7(n){return p7.test(n)}function Il(n,e){const t=C7(n)?"mailto:":e,i=!!t&&!zp(n);return n&&i?t+n:n}function zp(n){return w7.test(n)}function Od(n){window.open(n,"_blank","noopener")}/**
|
|
1245
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1246
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1247
|
-
*/class E7 extends R{constructor(){super(...arguments),this.manualDecorators=new Ce,this.automaticDecorators=new f7}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||J(t.getSelectedBlocks());Ea(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={}){const i=this.editor.model,s=i.document.selection,o=[],r=[];for(const a in t)t[a]?o.push(a):r.push(a);i.change(a=>{if(s.isCollapsed){const l=s.getFirstPosition();if(s.hasAttribute("linkHref")){const c=Fd(s);let u=ws(l,"linkHref",s.getAttribute("linkHref"),i);s.getAttribute("linkHref")===c&&(u=this._updateLinkContent(i,a,u,e)),a.setAttribute("linkHref",e,u),o.forEach(d=>{a.setAttribute(d,!0,u)}),r.forEach(d=>{a.removeAttribute(d,u)}),a.setSelection(a.createPositionAfter(u.end.nodeBefore))}else if(e!==""){const c=pt(s.getAttributes());c.set("linkHref",e),o.forEach(d=>{c.set(d,!0)});const{end:u}=i.insertContent(a.createText(e,c),l);a.setSelection(u)}["linkHref",...o,...r].forEach(c=>{a.removeSelectionAttribute(c)})}else{const l=i.schema.getValidRanges(s.getRanges(),"linkHref"),c=[];for(const d of s.getSelectedBlocks())i.schema.checkAttribute(d,"linkHref")&&c.push(a.createRangeOn(d));const u=c.slice();for(const d of l)this._isRangeToUpdate(d,c)&&u.push(d);for(const d of u){let h=d;if(u.length===1){const f=Fd(s);s.getAttribute("linkHref")===f&&(h=this._updateLinkContent(i,a,d,e),a.setSelection(a.createSelection(h)))}a.setAttribute("linkHref",e,h),o.forEach(f=>{a.setAttribute(f,!0,h)}),r.forEach(f=>{a.removeAttribute(f,h)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return Ea(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,s){const o=t.createText(s,{linkHref:s});return e.insertContent(o,i)}}function Fd(n){if(n.isCollapsed){const e=n.getFirstPosition();return e.textNode&&e.textNode.data}else{const e=Array.from(n.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}/**
|
|
1248
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1249
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1250
|
-
*/class T7 extends R{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();Ea(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,s=e.commands.get("link");t.change(o=>{const r=i.isCollapsed?[ws(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const a of r)if(o.removeAttribute("linkHref",a),s)for(const l of s.manualDecorators)o.removeAttribute(l.id,a)})}}/**
|
|
1251
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1252
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1253
|
-
*/class A7 extends W(){constructor({id:e,label:t,attributes:i,classes:s,styles:o,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=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}/**
|
|
1254
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1255
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1256
|
-
*/const S7="ck-link_selected",Dd="automatic",x7="manual",I7=/^(https?:)?\/\//;class Xo extends w{static get pluginName(){return"LinkEditing"}static get requires(){return[Co,Qg,rt]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const 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:Ld}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(o,r)=>Ld(Hp(o,t),r)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:o=>o.getAttribute("href")}}),e.commands.add("link",new E7(e)),e.commands.add("unlink",new T7(e));const i=y7(e.t,k7(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(o=>o.mode===Dd)),this._enableManualDecorators(i.filter(o=>o.mode===x7)),e.plugins.get(Co).registerAttribute("linkHref"),ip(e,"linkHref","a",S7),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:Dd,callback:o=>!!o&&I7.test(o),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(o=>{t.model.schema.extend("$text",{allowAttributes:o.id});const r=new A7(o);s.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(a,{writer:l,schema:c},{item:u})=>{if((u.is("selection")||c.isInline(u))&&a){const d=l.createAttributeElement("a",r.attributes,{priority:5});r.classes&&l.addClass(r.classes,d);for(const h in r.styles)l.setStyle(h,r.styles[h],d);return l.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...r._createPattern()},model:{key:r.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document;this.listenTo(i,"click",(s,o)=>{if(!(M.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let a=o.domTarget;if(a.tagName.toLowerCase()!="a"&&(a=a.closest("a")),!a)return;const l=a.getAttribute("href");l&&(s.stop(),o.preventDefault(),Od(l))},{context:"$capture"}),this.listenTo(i,"keydown",(s,o)=>{const a=e.commands.get("link").value;a&&o.keyCode===N.enter&&o.altKey&&(s.stop(),Od(a))})}_enableSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(s,{attributeKeys:o})=>{!o.includes("linkHref")||i.hasAttribute("linkHref")||t.change(r=>{P7(r,R7(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,o)=>{t.change(r=>{const a=r.createRangeIn(o.content);for(const l of a.getItems())if(l.hasAttribute("linkHref")){const c=Il(l.getAttribute("linkHref"),i);r.setAttribute("linkHref",c,l)}})})}}function P7(n,e){n.removeSelectionAttribute("linkHref");for(const t of e)n.removeSelectionAttribute(t)}function R7(n){return n.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}/**
|
|
1257
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1258
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1259
|
-
*/class V7 extends T{constructor(e,t){super(e),this.focusTracker=new te,this.keystrokes=new oe,this._focusables=new xe;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),P.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),P.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const s=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&s.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:s,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),Lo({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new dn(this.locale,ps);return t.label=e("Link URL"),t}_createButton(e,t,i,s){const o=new V(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),s&&o.delegate("execute").to(this,s),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const s=new ms(this.locale);s.set({name:i.id,label:i.label,withText:!0}),s.bind("isOn").toMany([i,e],"value",(o,r)=>r===void 0&&o===void 0?!!i.defaultValue:!!o),s.on("execute",()=>{i.set("value",!s.isOn)}),t.add(s)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const i=new T;i.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(s=>({tag:"li",children:[s],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(i)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}const B7='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>';/**
|
|
1260
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1261
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1262
|
-
*/class M7 extends T{constructor(e,t={}){super(e),this.focusTracker=new te,this.keystrokes=new oe,this._focusables=new xe;const i=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),B7,"unlink"),this.editButtonView=this._createButton(i("Edit link"),P.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const s=new V(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s.delegate("execute").to(this,i),s}_createPreviewButton(){const e=new V(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",s=>s&&Hp(s,this._linkConfig.allowedProtocols)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",s=>s||i("This link has no URL")),e.bind("isEnabled").to(this,"href",s=>!!s),e.template.tag="a",e.template.eventListeners={},e}}const Up='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>';/**
|
|
1263
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1264
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1265
|
-
*/const ut="link-ui";class Wp extends w{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[ko]}static get pluginName(){return"LinkUI"}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver(kT),this._balloon=e.plugins.get(ko),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:ut,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:ut,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:In},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new M7(e.locale,e.config.get("link")),i=e.commands.get("link"),s=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(s),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(o,r)=>{this._hideUI(),r()}),t.keystrokes.set(In,(o,r)=>{this._addFormView(),r()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),s=e.config.get("link.allowCreatingEmptyLinks"),o=new(za(V7))(e.locale,t);return o.urlInputView.fieldView.bind("value").to(t,"value"),o.urlInputView.bind("isEnabled").to(t,"isEnabled"),o.saveButtonView.bind("isEnabled").to(t,"isEnabled",o.urlInputView,"isEmpty",(r,a)=>r&&(s||!a)),this.listenTo(o,"submit",()=>{const{value:r}=o.urlInputView.fieldView.element,a=Il(r,i);e.execute("link",a,o.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(r,a)=>{this._closeFormView(),a()}),o}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link");e.ui.componentFactory.add("link",()=>{const i=this._createButton(V);return i.set({tooltip:!0,isToggleable:!0}),i.bind("isOn").to(t,"value",s=>!!s),i}),e.ui.componentFactory.add("menuBar:link",()=>this._createButton(he))}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("link"),o=new e(t.locale),r=i.t;return o.set({label:r("Link"),icon:Up,keystroke:In}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>this._showUI(!0)),o}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(In,(i,s)=>{s(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Mo({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),!this._areActionsInPanel&&this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=t.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),s=r();const o=()=>{const a=this._getSelectedLinkElement(),l=r();i&&!a||!i&&l!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=a,s=l};function r(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let s;if(t.markers.has(ut)){const o=Array.from(this.editor.editing.mapper.markerNameToElements(ut)),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));s=e.domConverter.viewRangeToDom(r)}else s=()=>{const o=this._getSelectedLinkElement();return o?e.domConverter.mapViewToDom(o):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:s}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&ce(i))return Br(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),o=Br(s.start),r=Br(s.end);return!o||o!=r?null:e.createRangeIn(o).getTrimmed().isEqual(s)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(ut))t.updateMarker(ut,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:i});t.addMarker(ut,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(ut,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(ut)&&e.change(t=>{t.removeMarker(ut)})}}function Br(n){return n.getAncestors().find(e=>_7(e))||null}/**
|
|
1266
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1267
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1268
|
-
*/const L7=4,qp=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),O7=2;class jp extends w{static get requires(){return[It,Xo]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?ws(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const s=this.editor.model,o=s.document.selection,r=o.getFirstPosition(),a=o.getLastPosition();let l=t.getJoined(this._expandLinkRange(s,r)||t);l&&(l=l.getJoined(this._expandLinkRange(s,a)||t)),l&&(l.start.isBefore(r)||l.end.isAfter(a))&&e.setSelection(l)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,s=e.plugins.get("ClipboardPipeline"),o=e.commands.get("link");s.on("inputTransformation",(r,a)=>{if(!this.isEnabled||!o.isEnabled||i.isCollapsed||a.method!=="paste"||i.rangeCount>1)return;const l=i.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const u=c.match(qp);u&&u[2]===c&&(t.change(d=>{this._selectEntireLinks(d,l),o.execute(c)}),r.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new aP(e.model,i=>{if(!F7(i))return;const s=Nd(i.substr(0,i.length-1));if(s)return{url:s}});t.on("matched:data",(i,s)=>{const{batch:o,range:r,url:a}=s;if(!o.isTyping)return;const l=r.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),u=e.model.createRange(c,l);this._applyAutoLink(a,u)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition();if(!s.parent.previousSibling)return;const o=t.createRangeIn(s.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(o)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(o)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:s}=tp(e,t),o=Nd(i);if(o){const r=t.createRange(s.end.getShiftedBy(-o.length),s.end);this._applyAutoLink(o,r)}}_applyAutoLink(e,t){const i=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),o=Il(e,s);!this.isEnabled||!D7(t,i)||!zp(o)||N7(t)||this._persistAutoLink(o,t)}_persistAutoLink(e,t){const i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(o=>{o.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function F7(n){return n.length>L7&&n[n.length-1]===" "&&n[n.length-2]!==" "}function Nd(n){const e=qp.exec(n);return e?e[O7]:null}function D7(n,e){return e.schema.checkAttributeInSelection(e.createSelection(n),"linkHref")}function N7(n){const e=n.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}/**
|
|
1269
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1270
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1271
|
-
*/class $7 extends w{static get requires(){return[Xo,Wp,jp]}static get pluginName(){return"Link"}}/**
|
|
1272
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1273
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1274
|
-
*/class H7 extends w{static get requires(){return["ImageEditing","ImageUtils",Xo]}static get pluginName(){return"LinkImageEditing"}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(z7(e)),e.conversion.for("downcast").add(U7(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,i=e.commands.get("link").automaticDecorators;i.length&&e.conversion.for("downcast").add(i.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(W7(i)),e.conversion.for("upcast").add(q7(e,i))}}function z7(n){const e=n.plugins.has("ImageInlineEditing"),t=n.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,o,r)=>{const a=o.viewItem,l=t.findViewImgElement(a);if(!l)return;const c=l.findAncestor(f=>t.isBlockImageView(f));if(e&&!c)return;const u={attributes:["href"]};if(!r.consumable.consume(a,u))return;const d=a.getAttribute("href");if(!d)return;let h=o.modelCursor.parent;if(!h.is("element","imageBlock")){const f=r.convertItem(l,o.modelCursor);o.modelRange=f.modelRange,o.modelCursor=f.modelCursor,h=o.modelCursor.nodeBefore}h&&h.is("element","imageBlock")&&r.writer.setAttribute("linkHref",d,h)},{priority:"high"})}}function U7(n){const e=n.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const r=o.mapper.toViewElement(s.item),a=o.writer,l=Array.from(r.getChildren()).find(d=>d.is("element","a")),c=e.findViewImgElement(r),u=c.parent.is("element","picture")?c.parent:c;if(l)s.attributeNewValue?a.setAttribute("href",s.attributeNewValue,l):(a.move(a.createRangeOn(u),a.createPositionAt(r,0)),a.remove(l));else{const d=a.createContainerElement("a",{href:s.attributeNewValue});a.insert(a.createPositionAt(r,0),d),a.move(a.createRangeOn(u),a.createPositionAt(d,0))}},{priority:"high"})}}function W7(n){return e=>{e.on(`attribute:${n.id}:imageBlock`,(t,i,s)=>{const o=s.mapper.toViewElement(i.item),r=Array.from(o.getChildren()).find(a=>a.is("element","a"));if(r){for(const[a,l]of pt(n.attributes))s.writer.setAttribute(a,l,r);n.classes&&s.writer.addClass(n.classes,r);for(const a in n.styles)s.writer.setStyle(a,n.styles[a],r)}})}}function q7(n,e){const t=n.plugins.has("ImageInlineEditing"),i=n.plugins.get("ImageUtils");return s=>{s.on("element:a",(o,r,a)=>{const l=r.viewItem,c=i.findViewImgElement(l);if(!c)return;const u=c.findAncestor(m=>i.isBlockImageView(m));if(t&&!u)return;const h=new Nt(e._createPattern()).match(l);if(!h||!a.consumable.consume(l,h.match))return;const f=r.modelCursor.nodeBefore||r.modelCursor.parent;a.writer.setAttribute(e.id,!0,f)},{priority:"high"})}}/**
|
|
1275
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1276
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1277
|
-
*/class j7 extends w{static get requires(){return[Xo,Wp,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,s)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(s.preventDefault(),i.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{const s=new V(i),o=e.plugins.get("LinkUI"),r=e.commands.get("link");return s.set({isEnabled:!0,label:t("Link image"),icon:Up,keystroke:In,tooltip:!0,isToggleable:!0}),s.bind("isEnabled").to(r,"isEnabled"),s.bind("isOn").to(r,"value",a=>!!a),this.listenTo(s,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addActionsView():o._showUI(!0)}),s})}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}/**
|
|
1278
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1279
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1280
|
-
*/class G7 extends w{static get requires(){return[H7,j7]}static get pluginName(){return"LinkImage"}}/**
|
|
1281
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1282
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1283
|
-
*/class Je{constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward=t.direction=="forward",this._includeSelf=!!t.includeSelf,this._sameAttributes=z(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){const s=new this(e,t)[Symbol.iterator]();return J(s)}*[Symbol.iterator](){const e=[];for(const{node:t}of ks(this._getStartNode(),this._isForward?"forward":"backward")){const 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}}function*ks(n,e="forward"){const t=e=="forward",i=[];let s=null;for(;se(n);){let o=null;if(s){const r=n.getAttribute("listIndent"),a=s.getAttribute("listIndent");r>a?i[a]=s:r<a?(o=i[r],i.length=r):o=s}yield{node:n,previous:s,previousNodeInList:o},s=n,n=t?n.nextSibling:n.previousSibling}}class K7{constructor(e){this._listHead=e}[Symbol.iterator](){return ks(this._listHead,"forward")}}/**
|
|
1284
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1285
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1286
|
-
*/class tn{static next(){return Ke()}}function se(n){return!!n&&n.is("element")&&n.hasAttribute("listItemId")}function Pl(n,e={}){return[...$t(n,{...e,direction:"backward"}),...$t(n,{...e,direction:"forward"})]}function $t(n,e={}){const t=e.direction=="forward",i=Array.from(new Je(n,{...e,includeSelf:t,sameIndent:!0,sameAttributes:"listItemId"}));return t?i:i.reverse()}function Z7(n){return Array.from(new Je(n,{direction:"forward",higherIndent:!0}))}function Gp(n,e){const t=new Je(n,{sameIndent:!0,sameAttributes:"listType",...e}),i=new Je(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...e});return[...Array.from(t).reverse(),...i]}function fi(n){return!Je.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function $d(n){return!Je.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function Cs(n,e={}){n=z(n);const t=e.withNested!==!1,i=new Set;for(const s of n)for(const o of Pl(s,{higherIndent:t}))i.add(o);return Ti(i)}function er(n){n=z(n);const e=new Set;for(const t of n)for(const i of Gp(t))e.add(i);return Ti(e)}function Rl(n,e){const t=$t(n,{direction:"forward"}),i=tn.next();for(const s of t)e.setAttribute("listItemId",i,s);return t}function Ta(n,e,t){const i={};for(const[o,r]of e.getAttributes())o.startsWith("list")&&(i[o]=r);const s=$t(n,{direction:"forward"});for(const o of s)t.setAttributes(i,o);return s}function Aa(n,e,{expand:t,indentBy:i=1}={}){n=z(n);const s=t?Cs(n):n;for(const o of s){const r=o.getAttribute("listIndent")+i;r<0?tr(o,e):e.setAttribute("listIndent",r,o)}return s}function J7(n,e){n=z(n);const t=Cs(n),i=new Set,s=Math.min(...t.map(r=>r.getAttribute("listIndent"))),o=new Map;for(const r of t)o.set(r,Je.first(r,{lowerIndent:!0}));for(const r of t){if(i.has(r))continue;i.add(r);const a=r.getAttribute("listIndent")-1;if(a<0){tr(r,e);continue}if(r.getAttribute("listIndent")==s){const l=Q7(r,o.get(r),e);for(const c of l)i.add(c);if(l.length)continue}e.setAttribute("listIndent",a,r)}return Ti(i)}function tr(n,e){n=z(n);for(const t of n)t.is("element","listItem")&&e.rename(t,"paragraph");for(const t of n)for(const i of t.getAttributeKeys())i.startsWith("list")&&e.removeAttribute(i,t);return n}function ns(n){if(!n.length)return!1;const e=n[0].getAttribute("listItemId");return e?!n.some(t=>t.getAttribute("listItemId")!=e):!1}function Y7(n,e){const t=[];let i=Number.POSITIVE_INFINITY;for(const{node:s}of ks(n.nextSibling,"forward")){const o=s.getAttribute("listIndent");if(o==0)break;o<i&&(i=o);const r=o-i;e.setAttribute("listIndent",r,s),t.push(s)}return t}function Ti(n){return Array.from(n).filter(e=>e.root.rootName!=="$graveyard").sort((e,t)=>e.index-t.index)}function ss(n){const e=n.document.selection.getSelectedElement();return e&&n.schema.isObject(e)&&n.schema.isBlock(e)?e:null}function Mr(n,e){return e.checkChild(n.parent,"listItem")&&e.checkChild(n,"$text")&&!e.isObject(n)}function Io(n){return n=="numbered"||n=="customNumbered"}function Q7(n,e,t){return $t(e,{direction:"forward"}).pop().index>n.index?Ta(n,e,t):[]}/**
|
|
1287
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1288
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1289
|
-
*/class Hd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=zd(e.document.selection);e.change(i=>{const s=[];ns(t)&&!fi(t[0])?(this._direction=="forward"&&s.push(...Aa(t,i)),s.push(...Rl(t[0],i))):this._direction=="forward"?s.push(...Aa(t,i,{expand:!0})):s.push(...J7(t,i));for(const o of s){if(!o.hasAttribute("listType"))continue;const r=Je.first(o,{sameIndent:!0});r&&i.setAttribute("listType",r.getAttribute("listType"),o)}this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",Ti(new Set(e)))}_checkEnabled(){let e=zd(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction=="backward"||ns(e)&&!fi(e[0]))return!0;e=Cs(e),t=e[0];const i=Je.first(t,{sameIndent:!0});return i?i.getAttribute("listType")==t.getAttribute("listType"):!1}}function zd(n){const e=Array.from(n.getSelectedBlocks()),t=e.findIndex(i=>!se(i));return t!=-1&&(e.length=t),e}/**
|
|
1290
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1291
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1292
|
-
*/class Gs extends R{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={}){const t=this.editor.model,i=t.document,s=ss(t),o=Array.from(i.selection.getSelectedBlocks()).filter(a=>t.schema.checkAttribute(a,"listType")||Mr(a,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(a=>{if(r){const l=o[o.length-1],c=$t(l,{direction:"forward"}),u=[];c.length>1&&u.push(...Rl(c[1],a)),u.push(...tr(o,a)),u.push(...Y7(l,a)),this._fireAfterExecute(u)}else if((s||i.selection.isCollapsed)&&se(o[0])){const l=Gp(s||o[0],this._listWalkerOptions);for(const c of l)a.setAttributes({...e.additionalAttributes,listType:this.type},c);this._fireAfterExecute(l)}else{const l=[];for(const c of o)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&Mr(c,t.schema)&&a.rename(c,"listItem"),a.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:tn.next(),listType:this.type},c),l.push(c);else for(const u of Cs(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(a.setAttributes({...e.additionalAttributes,listType:this.type},u),l.push(u));this._fireAfterExecute(l)}})}_fireAfterExecute(e){this.fire("afterExecute",Ti(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const i of t)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const 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(const o of s)if(t.checkAttribute(o,"listType")||Mr(o,t))return!0;return!1}}/**
|
|
1293
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1294
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1295
|
-
*/class Ud extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,i=t.document.selection,s=[];t.change(o=>{const{firstElement:r,lastElement:a}=this._getMergeSubjectElements(i,e),l=r.getAttribute("listIndent")||0,c=a.getAttribute("listIndent"),u=a.getAttribute("listItemId");if(l!=c){const d=Z7(a);s.push(...Aa([a,...d],o,{indentBy:l-c,expand:l<c}))}if(e){let d=i;i.isCollapsed&&(d=o.createSelection(o.createRange(o.createPositionAt(r,"end"),o.createPositionAt(a,0)))),t.deleteContent(d,{doNotResetEntireContent:i.isCollapsed});const h=d.getLastPosition().parent,f=h.nextSibling;s.push(h),f&&f!==a&&f.getAttribute("listItemId")==u&&s.push(...Ta(f,h,o))}else s.push(...Ta(a,r,o));this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",Ti(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,i=ss(e);if(t.isCollapsed||i){const s=i||t.getFirstPosition().parent;if(!se(s))return!1;const o=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!o||ns([s,o]))return!1}else{const s=t.getLastPosition(),o=t.getFirstPosition();if(s.parent===o.parent||!se(s.parent))return!1}return!0}_getMergeSubjectElements(e,t){const i=this.editor.model,s=ss(i);let o,r;if(e.isCollapsed||s){const a=s||e.getFirstPosition().parent,l=fi(a);this._direction=="backward"?(r=a,l&&!t?o=Je.first(a,{sameIndent:!0,lowerIndent:!0}):o=a.previousSibling):(o=a,r=a.nextSibling)}else o=e.getFirstPosition().parent,r=e.getLastPosition().parent;return{firstElement:o,lastElement:r}}}/**
|
|
1296
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1297
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1298
|
-
*/class Wd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(t=>{const i=Rl(this._getStartBlock(),t);this._fireAfterExecute(i)})}_fireAfterExecute(e){this.fire("afterExecute",Ti(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&se(t)&&!fi(t)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?t:t.nextSibling}}/**
|
|
1299
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1300
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1301
|
-
*/class X7 extends w{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(e){return er(e)}isFirstBlockOfListItem(e){return fi(e)}isListItemBlock(e){return se(e)}expandListBlocksToCompleteItems(e,t={}){return Cs(e,t)}isNumberedListType(e){return Io(e)}}/**
|
|
1302
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1303
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1304
|
-
*/function Kp(n){return n.is("element","ol")||n.is("element","ul")}function Po(n){return n.is("element","li")}function e6(n){let e=0,t=n.parent;for(;t;){if(Po(t))e++;else{const i=t.previousSibling;i&&Po(i)&&e++}t=t.parent}return e}function t6(n,e,t,i=Jp(t,e)){return n.createAttributeElement(Zp(t),null,{priority:2*e/100-100,id:i})}function i6(n,e,t){return n.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:t})}function Zp(n){return n=="numbered"||n=="customNumbered"?"ol":"ul"}function Jp(n,e){return`list-${n}-${e}`}/**
|
|
1305
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1306
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1307
|
-
*/function et(n,e){const t=n.nodeBefore;if(se(t)){let i=t;for(const{node:s}of ks(i,"backward"))if(i=s,e.has(i))return;e.set(t,i)}else{const i=n.nodeAfter;se(i)&&e.set(i,i)}}function n6(n,e){let t=0,i=-1,s=null,o=!1;for(const{node:r}of n){const a=r.getAttribute("listIndent");if(a>t){let l;s===null?(s=a-t,l=t):(s>a&&(s=a),l=a-s),l>i+1&&(l=i+1),e.setAttribute("listIndent",l,r),o=!0,i=l}else s=null,t=a+1,i=a}return o}function s6(n,e,t){const i=new Set;let s=!1;for(const{node:o}of n){if(i.has(o))continue;let r=o.getAttribute("listType"),a=o.getAttribute("listItemId");if(e.has(a)&&(a=tn.next()),e.add(a),o.is("element","listItem")){o.getAttribute("listItemId")!=a&&(t.setAttribute("listItemId",a,o),s=!0);continue}for(const l of $t(o,{direction:"forward"}))i.add(l),l.getAttribute("listType")!=r&&(a=tn.next(),r=l.getAttribute("listType")),l.getAttribute("listItemId")!=a&&(t.setAttribute("listItemId",a,l),s=!0)}return s}/**
|
|
1308
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1309
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1310
|
-
*/function o6(){return(n,e,t)=>{const{writer:i,schema:s}=t;if(!e.modelRange)return;const o=Array.from(e.modelRange.getItems({shallow:!0})).filter(d=>s.checkAttribute(d,"listItemId"));if(!o.length)return;const r=tn.next(),a=e6(e.viewItem);let l=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=o[0].getAttribute("listType");c&&(l=c);const u={listItemId:r,listIndent:a,listType:l};for(const d of o)d.hasAttribute("listItemId")||i.setAttributes(u,d);o.length>1&&o[1].getAttribute("listItemId")!=u.listItemId&&t.keepEmptyElement(o[0])}}function qd(){return(n,e,t)=>{if(!t.consumable.test(e.viewItem,{name:!0}))return;const i=new vi(e.viewItem.document);for(const s of Array.from(e.viewItem.getChildren()))!Po(s)&&!Kp(s)&&i.remove(s)}}function r6(n,e,t,i){return()=>{const a=n.document.differ.getChanges(),l=[],c=new Map,u=new Set;for(const d of a)if(d.type=="insert"&&d.name!="$text")et(d.position,c),d.attributes.has("listItemId")?u.add(d.position.nodeAfter):et(d.position.getShiftedBy(d.length),c);else if(d.type=="remove"&&d.attributes.has("listItemId"))et(d.position,c);else if(d.type=="attribute"){const h=d.range.start.nodeAfter;t.includes(d.attributeKey)?(et(d.range.start,c),d.attributeNewValue===null?(et(d.range.start.getShiftedBy(1),c),o(h)&&l.push(h)):u.add(h)):se(h)&&o(h)&&l.push(h)}for(const d of c.values())l.push(...s(d,u));for(const d of new Set(l))e.reconvertItem(d)};function s(a,l){const c=[],u=new Set,d=[];for(const{node:h,previous:f}of ks(a,"forward")){if(u.has(h))continue;const m=h.getAttribute("listIndent");f&&m<f.getAttribute("listIndent")&&(d.length=m+1),d[m]=Object.fromEntries(Array.from(h.getAttributes()).filter(([_])=>t.includes(_)));const p=$t(h,{direction:"forward"});for(const _ of p)u.add(_),(o(_,p)||r(_,d,l))&&c.push(_)}return c}function o(a,l){const c=e.mapper.toViewElement(a);if(!c)return!1;if(i.fire("checkElement",{modelElement:a,viewElement:c}))return!0;if(!a.is("element","paragraph")&&!a.is("element","listItem"))return!1;const d=Qp(a,t,l);return d&&c.is("element","p")?!0:!!(!d&&c.is("element","span"))}function r(a,l,c){if(c.has(a))return!1;const u=e.mapper.toViewElement(a);let d=l.length-1;for(let h=u.parent;!h.is("editableElement");h=h.parent){const f=Po(h),m=Kp(h);if(!m&&!f)continue;const p=`checkAttributes:${f?"item":"list"}`;if(i.fire(p,{viewElement:h,modelAttributes:l[d]}))break;if(m&&(d--,d<0))return!1}return!0}}function jd(n,e,t,{dataPipeline:i}={}){const s=f6(n);return(o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a,d=r.item;if(!n.includes(r.attributeKey)||!s(d,u))return;const h=l6(d,c,t);Yp(h,l,c),d6(h,l);const f=u6(d,h,e,l,{dataPipeline:i});h6(d,f,e,l)}}function a6(n){return(e,t,i)=>{const{writer:s,mapper:o}=i,r=e.name.split(":")[1];if(!n.checkAttribute(r,"listItemId"))return;const a=o.toViewPosition(t.position),l=t.position.getShiftedBy(t.length),c=o.toViewPosition(l,{isPhantom:!0}),d=s.createRange(a,c).getTrimmed().end.nodeBefore;/* istanbul ignore next -- @preserve */d&&Yp(d,s,o)}}function Gd(n,{dataPipeline:e}={}){return(t,{writer:i})=>{if(!Qp(t,n))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function l6(n,e,t){const i=t.createRangeOn(n);return e.toViewRange(i).getTrimmed().end.nodeBefore}function c6(n,e){return(t,i)=>{if(i.modelPosition.offset>0)return;const s=i.modelPosition.parent;if(!se(s)||!n.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(s)))return;const o=i.mapper.toViewElement(s),r=e.createRangeIn(o),a=r.getWalker();let l=r.start;for(const{item:c}of a){if(c.is("element")&&i.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(l=e.createPositionAfter(c),a.skip(({previousPosition:u})=>!u.isEqual(l)))}i.viewPosition=l}}function Yp(n,e,t){for(;n.parent.is("attributeElement")&&n.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeOn(n),n.parent);const i=[];s(e.createPositionBefore(n).getWalker({direction:"backward"})),s(e.createRangeIn(n).getWalker());for(const o of i)e.remove(o);function s(o){for(const{item:r}of o){if(r.is("element")&&t.toModelElement(r))break;r.is("element")&&r.getCustomProperty("listItemMarker")&&i.push(r)}}}function u6(n,e,t,i,{dataPipeline:s}){let o=i.createRangeOn(e);if(!fi(n))return o;for(const r of t){if(r.scope!="itemMarker")continue;const a=r.createElement(i,n,{dataPipeline:s});if(!a||(i.setCustomProperty("listItemMarker",!0,a),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(n)?i.insert(i.createPositionAt(e,0),a):(i.insert(o.start,a),o=i.createRange(i.createPositionBefore(a),i.createPositionAfter(e))),!r.createWrapperElement||!r.canWrapElement))continue;const l=r.createWrapperElement(i,n,{dataPipeline:s});i.setCustomProperty("listItemWrapper",!0,l),r.canWrapElement(n)?o=i.wrap(o,l):(o=i.wrap(i.createRangeOn(a),l),o=i.createRange(o.start,i.createPositionAfter(e)))}return o}function d6(n,e){let t=n.parent;for(;t.is("attributeElement")&&["ul","ol","li"].includes(t.name);){const i=t.parent;e.unwrap(e.createRangeOn(n),t),t=i}}function h6(n,e,t,i){if(!n.hasAttribute("listIndent"))return;const s=n.getAttribute("listIndent");let o=n;for(let r=s;r>=0;r--){const a=i6(i,r,o.getAttribute("listItemId")),l=t6(i,r,o.getAttribute("listType"));for(const c of t)(c.scope=="list"||c.scope=="item")&&o.hasAttribute(c.attributeName)&&c.setAttributeOnDowncast(i,o.getAttribute(c.attributeName),c.scope=="list"?l:a);if(e=i.wrap(e,a),e=i.wrap(e,l),r==0||(o=Je.first(o,{lowerIndent:!0}),!o))break}}function f6(n){return(e,t)=>{const i=[];for(const s of n)e.hasAttribute(s)&&i.push(`attribute:${s}`);return i.every(s=>t.test(e,s)!==!1)?(i.forEach(s=>t.consume(e,s)),!0):!1}}function Qp(n,e,t=Pl(n)){if(!se(n))return!1;for(const i of n.getAttributeKeys())if(!i.startsWith("selection:")&&!e.includes(i))return!1;return t.length<2}/**
|
|
1311
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1312
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1313
|
-
*/const so=["listType","listIndent","listItemId"];class Sa extends w{static get pluginName(){return"ListEditing"}static get requires(){return[vs,It,X7,rt]}constructor(e){super(e),this._downcastStrategies=[],e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new g("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:so}),i?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const s of so)t.schema.setAttributeProperties(s,{copyOnReplace:!0});e.commands.add("numberedList",new Gs(e,"numbered")),e.commands.add("bulletedList",new Gs(e,"bulleted")),e.commands.add("customNumberedList",new Gs(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new Gs(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new Hd(e,"forward")),e.commands.add("outdentList",new Hd(e,"backward")),e.commands.add("splitListItemBefore",new Wd(e,"before")),e.commands.add("splitListItemAfter",new Wd(e,"after")),i&&(e.commands.add("mergeListItemBackward",new Ud(e,"backward")),e.commands.add("mergeListItemForward",new Ud(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const t=this.editor.commands,i=t.get("indent"),s=t.get("outdent");i&&i.registerChildCommand(t.get("indentList"),{priority:"high"}),s&&s.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...so,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(s,o)=>{const r=e.model.document.selection;ss(e.model)||e.model.change(()=>{const a=r.getFirstPosition();if(r.isCollapsed&&o.direction=="backward"){if(!a.isAtStart)return;const l=a.parent;if(!se(l))return;if(!Je.first(l,{sameAttributes:"listType",sameIndent:!0})&&l.getAttribute("listIndent")===0)$d(l)||e.execute("splitListItemAfter"),e.execute("outdentList");else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:Kd(e.model,"backward")})}o.preventDefault(),s.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:Kd(e.model,"forward")}),o.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,i=e.commands,s=i.get("enter");this.listenTo(e.editing.view.document,"enter",(o,r)=>{const a=t.document,l=a.selection.getFirstPosition().parent;if(a.selection.isCollapsed&&se(l)&&l.isEmpty&&!r.isSoft){const c=fi(l),u=$d(l);c&&u?(e.execute("outdentList"),r.preventDefault(),o.stop()):c&&!u?(e.execute("splitListItemAfter"),r.preventDefault(),o.stop()):u&&(e.execute("splitListItemBefore"),r.preventDefault(),o.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{const o=i.get("splitListItemBefore");if(o.refresh(),!o.isEnabled)return;const a=e.model.document.selection.getLastPosition().parent;Pl(a).length===2&&o.execute()})}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,i)=>{const s=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(e.execute(s),i.stopPropagation(),i.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,i=this.getListAttributeNames(),s=e.config.get("list.multiBlock"),o=s?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(a,{writer:l})=>l.createElement(o,{listType:""})}).elementToElement({view:"p",model:(a,{writer:l})=>a.parent&&a.parent.is("element","li")?l.createElement(o,{listType:""}):null,converterPriority:"high"}).add(a=>{a.on("element:li",o6()),a.on("element:ul",qd(),{priority:"high"}),a.on("element:ol",qd(),{priority:"high"})}),s||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:Gd(i),converterPriority:"high"}).add(a=>{a.on("attribute",jd(i,this._downcastStrategies,t)),a.on("remove",a6(t.schema))}),e.conversion.for("dataDowncast").elementToElement({model:o,view:Gd(i,{dataPipeline:!0}),converterPriority:"high"}).add(a=>{a.on("attribute",jd(i,this._downcastStrategies,t,{dataPipeline:!0}))});const r=c6(this._downcastStrategies,e.editing.view);e.editing.mapper.on("modelToViewPosition",r),e.data.mapper.on("modelToViewPosition",r),this.listenTo(t.document,"change:data",r6(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!=Zp(c.listType)||l.id!=Jp(c.listType,c.listIndent))&&(a.return=!0,a.stop())})}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(i=>m6(e,i,t,this)),this.on("postFixer",(i,{listNodes:s,writer:o})=>{i.return=n6(s,o)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:o,seenIds:r})=>{i.return=s6(s,r,o)||i.return},{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",g6(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(i,s)=>{e.change(o=>{const r=Array.from(s.content.getChildren()),a=r[r.length-1];if(r.length>1&&a.is("element")&&a.isEmpty&&r.slice(0,-1).every(se)&&o.remove(a),s.method=="copy"||s.method=="cut"){const l=Array.from(s.content.getChildren());ns(l)&&tr(l,o)}})})}_setupAccessibilityIntegration(){const 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"}]})}}function m6(n,e,t,i){const s=n.document.differ.getChanges(),o=new Map,r=i.editor.config.get("list.multiBlock");let a=!1;for(const c of s){if(c.type=="insert"&&c.name!="$text"){const u=c.position.nodeAfter;if(!n.schema.checkAttribute(u,"listItemId"))for(const d of Array.from(u.getAttributeKeys()))t.includes(d)&&(e.removeAttribute(d,u),a=!0);et(c.position,o),c.attributes.has("listItemId")||et(c.position.getShiftedBy(c.length),o);for(const{item:d,previousPosition:h}of n.createRangeIn(u))se(d)&&et(h,o)}else c.type=="remove"?et(c.position,o):c.type=="attribute"&&t.includes(c.attributeKey)&&(et(c.range.start,o),c.attributeNewValue===null&&et(c.range.start.getShiftedBy(1),o));if(!r&&c.type=="attribute"&&so.includes(c.attributeKey)){const u=c.range.start.nodeAfter;c.attributeNewValue===null&&u&&u.is("element","listItem")?(e.rename(u,"paragraph"),a=!0):c.attributeOldValue===null&&u&&u.is("element")&&u.name!="listItem"&&(e.rename(u,"listItem"),a=!0)}}const l=new Set;for(const c of o.values())a=i.fire("postFixer",{listNodes:new K7(c),listHead:c,writer:e,seenIds:l})||a;return a}function g6(n){return(e,[t,i])=>{const s=t.is("documentFragment")?Array.from(t.getChildren()):[t];if(!s.length)return;const r=(i?n.createSelection(i):n.document.selection).getFirstPosition();let a;if(se(r.parent))a=r.parent;else if(se(r.nodeBefore))a=r.nodeBefore;else return;n.change(l=>{const c=a.getAttribute("listType"),u=a.getAttribute("listIndent"),d=s[0].getAttribute("listIndent")||0,h=Math.max(u-d,0);for(const f of s){const m=se(f);a.is("element","listItem")&&f.is("element","paragraph")&&l.rename(f,"listItem"),l.setAttributes({listIndent:(m?f.getAttribute("listIndent"):0)+h,listItemId:m?f.getAttribute("listItemId"):tn.next(),listType:c},f)}})}}function Kd(n,e){const t=n.document.selection;if(!t.isCollapsed)return!ss(n);if(e==="forward")return!0;const s=t.getFirstPosition().parent,o=s.previousSibling;return n.schema.isObject(o)?!1:o.isEmpty?!0:ns([s,o])}/**
|
|
1314
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1315
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1316
|
-
*/function Zd(n,e,t,i){n.ui.componentFactory.add(e,()=>{const s=Jd(V,n,e,t,i);return s.set({tooltip:!0,isToggleable:!0}),s}),n.ui.componentFactory.add(`menuBar:${e}`,()=>Jd(he,n,e,t,i))}function Jd(n,e,t,i,s){const o=e.commands.get(t),r=new n(e.locale);return r.set({label:i,icon:s}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{e.execute(t),e.editing.view.focus()}),r}/**
|
|
1317
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1318
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1319
|
-
*/class p6 extends w{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;Zd(this.editor,"numberedList",e("Numbered List"),P.numberedList),Zd(this.editor,"bulletedList",e("Bulleted List"),P.bulletedList)}}/**
|
|
1320
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1321
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1322
|
-
*/class w6 extends w{static get requires(){return[Sa,p6]}static get pluginName(){return"List"}}/**
|
|
1323
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1324
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1325
|
-
*/class b6 extends R{refresh(){const e=this._getValue();this.value=e,this.isEnabled=e!=null}execute({startIndex:e=1}={}){const t=this.editor.model,i=t.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(o=>se(o)&&Io(o.getAttribute("listType")));s=er(s),t.change(o=>{for(const r of s)o.setAttribute("listStart",e>=0?e:1,r)})}_getValue(){const t=this.editor.model.document,i=J(t.selection.getSelectedBlocks());return i&&se(i)&&Io(i.getAttribute("listType"))?i.getAttribute("listStart"):null}}/**
|
|
1326
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1327
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1328
|
-
*/const Xp={},e1={},t1={},i1=[{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"}];for(const{listStyle:n,typeAttribute:e,listType:t}of i1)Xp[n]=t,e1[n]=e,e&&(t1[e]=n);function n1(){return i1.map(n=>n.listStyle)}function Vl(n){return Xp[n]||null}function s1(n){return t1[n]||null}function xa(n){return e1[n]||null}/**
|
|
1329
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1330
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1331
|
-
*/class _6 extends R{constructor(e,t,i){super(e),this.defaultType=t,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document;t.change(s=>{this._tryToConvertItemsToList(e);let o=Array.from(i.selection.getSelectedBlocks()).filter(r=>r.hasAttribute("listType"));if(o.length){o=er(o);for(const r of o)s.setAttribute("listStyle",e.type||this.defaultType,r)}})}isStyleTypeSupported(e){return this._supportedTypes?this._supportedTypes.includes(e):!0}_getValue(){const e=J(this.editor.model.document.selection.getSelectedBlocks());return se(e)?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=Vl(e.type);if(!t)return;const i=this.editor,s=`${t}List`;i.commands.get(s).value||i.execute(s)}}/**
|
|
1332
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1333
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1334
|
-
*/class v6 extends R{refresh(){const e=this._getValue();this.value=e,this.isEnabled=e!=null}execute(e={}){const t=this.editor.model,i=t.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(o=>se(o)&&o.getAttribute("listType")=="numbered");s=er(s),t.change(o=>{for(const r of s)o.setAttribute("listReversed",!!e.reversed,r)})}_getValue(){const t=this.editor.model.document,i=J(t.selection.getSelectedBlocks());return se(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listReversed"):null}}/**
|
|
1335
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1336
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1337
|
-
*/function Yd(n){return(e,t,i)=>{const{writer:s,schema:o,consumable:r}=i;if(r.test(t.viewItem,n.viewConsumables)===!1)return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));let a=!1;for(const l of t.modelRange.getItems({shallow:!0}))o.checkAttribute(l,n.attributeName)&&n.appliesToListItem(l)&&(l.hasAttribute(n.attributeName)||(s.setAttribute(n.attributeName,n.getAttributeOnUpcast(t.viewItem),l),a=!0));a&&r.consume(t.viewItem,n.viewConsumables)}}/**
|
|
1338
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1339
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1340
|
-
*/class y6 extends w{static get pluginName(){return"ListPropertiesUtils"}getAllSupportedStyleTypes(){return n1()}getListTypeFromListStyleType(e){return Vl(e)}getListStyleTypeFromTypeAttribute(e){return s1(e)}getTypeAttributeFromListStyleType(e){return xa(e)}}/**
|
|
1341
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1342
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1343
|
-
*/const An="default";class k6 extends w{static get requires(){return[Sa,y6]}static get pluginName(){return"ListPropertiesEditing"}constructor(e){super(e),e.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const e=this.editor,t=e.model,i=e.plugins.get(Sa),s=e.config.get("list.properties"),o=C6(s);for(const r of o)r.addCommand(e),t.schema.extend("$listItem",{allowAttributes:r.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:r.attributeName,setAttributeOnDowncast(a,l,c){r.setAttributeOnDowncast(a,l,c)}});e.conversion.for("upcast").add(r=>{for(const a of o)r.on("element:ol",Yd(a)),r.on("element:ul",Yd(a))}),i.on("checkAttributes:list",(r,{viewElement:a,modelAttributes:l})=>{for(const c of o)c.getAttributeOnUpcast(a)!=l[c.attributeName]&&(r.return=!0,r.stop())}),this.listenTo(e.commands.get("indentList"),"afterExecute",(r,a)=>{t.change(l=>{for(const c of a)for(const u of o)u.appliesToListItem(c)&&l.setAttribute(u.attributeName,u.defaultValue,c)})}),i.on("postFixer",(r,{listNodes:a,writer:l})=>{for(const{node:c}of a)for(const u of o)u.hasValidAttribute(c)||(u.appliesToListItem(c)?l.setAttribute(u.attributeName,u.defaultValue,c):l.removeAttribute(u.attributeName,c),r.return=!0)}),i.on("postFixer",(r,{listNodes:a,writer:l})=>{for(const{node:c,previousNodeInList:u}of a)if(u&&u.getAttribute("listType")==c.getAttribute("listType"))for(const d of o){const{attributeName:h}=d;if(!d.appliesToListItem(c))continue;const f=u.getAttribute(h);c.getAttribute(h)!=f&&(l.setAttribute(h,f,c),r.return=!0)}})}}function C6(n){const e=[];if(n.styles){const t=typeof n.styles=="object"&&n.styles.useAttribute;e.push({attributeName:"listStyle",defaultValue:An,viewConsumables:{styles:"list-style-type"},addCommand(i){let s=n1();t&&(s=s.filter(o=>!!xa(o))),i.commands.add("listStyle",new _6(i,An,s))},appliesToListItem(i){return i.getAttribute("listType")=="numbered"||i.getAttribute("listType")=="bulleted"},hasValidAttribute(i){if(!this.appliesToListItem(i))return!i.hasAttribute("listStyle");if(!i.hasAttribute("listStyle"))return!1;const s=i.getAttribute("listStyle");return s==An?!0:Vl(s)==i.getAttribute("listType")},setAttributeOnDowncast(i,s,o){if(s&&s!==An)if(t){const r=xa(s);if(r){i.setAttribute("type",r,o);return}}else{i.setStyle("list-style-type",s,o);return}i.removeStyle("list-style-type",o),i.removeAttribute("type",o)},getAttributeOnUpcast(i){const s=i.getStyle("list-style-type");if(s)return s;const o=i.getAttribute("type");return o?s1(o):An}})}return n.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(t){t.commands.add("listReversed",new v6(t))},appliesToListItem(t){return t.getAttribute("listType")=="numbered"},hasValidAttribute(t){return this.appliesToListItem(t)==t.hasAttribute("listReversed")},setAttributeOnDowncast(t,i,s){i?t.setAttribute("reversed","reversed",s):t.removeAttribute("reversed",s)},getAttributeOnUpcast(t){return t.hasAttribute("reversed")}}),n.startIndex&&e.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(t){t.commands.add("listStart",new b6(t))},appliesToListItem(t){return Io(t.getAttribute("listType"))},hasValidAttribute(t){return this.appliesToListItem(t)==t.hasAttribute("listStart")},setAttributeOnDowncast(t,i,s){i==0||i>1?t.setAttribute("start",i,s):t.removeAttribute("start",s)},getAttributeOnUpcast(t){const i=t.getAttribute("start");return i>=0?i:1}}),e}/**
|
|
1344
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1345
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1346
|
-
*/class o1 extends T{constructor(e,{enabledProperties:t,styleButtonViews:i,styleGridAriaLabel:s}){super(e),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new te,this.keystrokes=new oe,this.focusables=new xe;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Ae({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),t.styles?(this.stylesView=this._createStylesView(i,s),this.children.add(this.stylesView)):o.push("ck-list-properties_without-styles"),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),o.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:o},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);as({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>S.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(e,t){const i=new T(this.locale);return i.children=i.createCollection(),i.children.addMany(e),i.setTemplate({tag:"div",attributes:{"aria-label":t,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){this.children.first.focus()},i.focusTracker=new te,i.keystrokes=new oe,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(e){const t=this.locale.t,i=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),e.styles?(this.additionalPropertiesCollapsibleView=new pg(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...s)=>s.some(o=>o)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(s,o,r)=>{r||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const e=this.locale.t,t=new dn(this.locale,mx);return t.set({label:e("Start at"),class:"ck-numbered-list-properties__start-index"}),t.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),t.fieldView.on("input",()=>{const i=t.fieldView.element,s=i.valueAsNumber;if(Number.isNaN(s)){t.errorText=e("Invalid start index value.");return}i.checkValidity()?this.fire("listStart",{startIndex:s}):t.errorText=e("Start index must be greater than 0.")}),t}_createReversedSwitchButton(){const e=this.locale.t,t=new ms(this.locale);return t.set({withText:!0,label:e("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),t.delegate("execute").to(this,"listReversed"),t}}const E6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>',T6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>',A6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M14 27v6H8v-6h6zm0-9v6H8v-6h6zm0-9v6H8V9h6z"/></svg>',S6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M10.29 15V8.531H9.286c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15h1.235zM11.3 24v-1.147H8.848c.064-.111.148-.226.252-.343.104-.117.351-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.494-.824.104-.263.156-.539.156-.829 0-.51-.182-.936-.545-1.279-.363-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.153-.155.358-.233.616-.233.26 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.468.536-1.024 1.055-.692.641-1.155 1.156-1.389 1.544-.234.389-.375.8-.422 1.233H11.3zm2.333 0v-1.235h-1.235V24h1.235zM9.204 34.11c.615 0 1.129-.2 1.542-.598.413-.398.62-.88.62-1.446 0-.39-.11-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.619-.337.928-.788.928-1.353 0-.399-.151-.756-.453-1.073-.366-.386-.852-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.668.55c-.16.232-.28.544-.358.933l1.138.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.215 0 .386.065.515.194s.193.302.193.518c0 .255-.087.46-.263.613-.176.154-.43.227-.765.218l-.136 1.006c.22-.061.409-.092.567-.092.24 0 .444.09.61.272.168.182.251.428.251.739 0 .328-.087.589-.261.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.307-.698l-1.196.145c.062.542.285.98.668 1.316.384.335.868.503 1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>',x6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M5.714 15.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm6.078.914V8.531H10.79c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.344 0v-1.235h-1.235V15h1.235zm-9.422 9.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm7.088.914v-1.147H10.35c.065-.111.149-.226.253-.343.104-.117.35-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.493-.824.104-.263.156-.539.156-.829 0-.51-.181-.936-.544-1.279-.364-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.152-.155.357-.233.615-.233.261 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.467.536-1.024 1.055-.691.641-1.154 1.156-1.388 1.544-.235.389-.375.8-.422 1.233h4.328zm2.334 0v-1.235h-1.235V24h1.235zM5.714 34.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm4.992 1.024c.616 0 1.13-.2 1.543-.598.413-.398.62-.88.62-1.446 0-.39-.111-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.618-.337.927-.788.927-1.353 0-.399-.15-.756-.452-1.073-.366-.386-.853-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.667.55c-.16.232-.28.544-.359.933l1.139.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.214 0 .386.065.515.194s.193.302.193.518c0 .255-.088.46-.264.613-.175.154-.43.227-.764.218l-.136 1.006c.22-.061.408-.092.566-.092.24 0 .444.09.611.272.167.182.25.428.25.739 0 .328-.086.589-.26.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.308-.698l-1.195.145c.062.542.284.98.668 1.316.384.335.867.503 1.45.503zm4.43-.11v-1.235h-1.235V34h1.235z"/></svg>',I6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.88 8.7V7.558h-1.234V8.7h1.234zm0 5.3V9.333h-1.234V14h1.234zm2.5 0v-1.235h-1.234V14h1.235zm-4.75 4.7v-1.142H8.395V18.7H9.63zm0 5.3v-4.667H8.395V24H9.63zm2.5-5.3v-1.142h-1.234V18.7h1.235zm0 5.3v-4.667h-1.234V24h1.235zm2.501 0v-1.235h-1.235V24h1.235zM7.38 28.7v-1.142H6.145V28.7H7.38zm0 5.3v-4.667H6.145V34H7.38zm2.5-5.3v-1.142H8.646V28.7H9.88zm0 5.3v-4.667H8.646V34H9.88zm2.5-5.3v-1.142h-1.234V28.7h1.235zm0 5.3v-4.667h-1.234V34h1.235zm2.501 0v-1.235h-1.235V34h1.235z"/></svg>',P6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.916 15V8.558h-1.301V15h1.3zm2.465 0v-1.235h-1.235V15h1.235zM9.665 25v-6.442h-1.3V25h1.3zm2.5 0v-6.442h-1.3V25h1.3zm2.466 0v-1.235h-1.235V25h1.235zm-7.216 9v-6.442h-1.3V34h1.3zm2.5 0v-6.442h-1.3V34h1.3zm2.501 0v-6.442h-1.3V34h1.3zm2.465 0v-1.235h-1.235V34h1.235z"/></svg>',R6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M9.62 14.105c.272 0 .528-.05.768-.153s.466-.257.677-.462c.009.024.023.072.044.145.047.161.086.283.119.365h1.221a2.649 2.649 0 0 1-.222-.626c-.04-.195-.059-.498-.059-.908l.013-1.441c0-.536-.055-.905-.165-1.105-.11-.201-.3-.367-.569-.497-.27-.13-.68-.195-1.23-.195-.607 0-1.064.108-1.371.325-.308.217-.525.55-.65 1.002l1.12.202c.076-.217.176-.369.299-.455.123-.086.294-.13.514-.13.325 0 .546.05.663.152.118.101.176.27.176.508v.123c-.222.093-.622.194-1.2.303-.427.082-.755.178-.982.288-.227.11-.403.268-.53.474a1.327 1.327 0 0 0-.188.706c0 .398.138.728.415.988.277.261.656.391 1.136.391zm.368-.87a.675.675 0 0 1-.492-.189.606.606 0 0 1-.193-.448c0-.176.08-.32.241-.435.106-.07.33-.142.673-.215a7.19 7.19 0 0 0 .751-.19v.247c0 .296-.016.496-.048.602a.773.773 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14h1.235zM10.2 25.105c.542 0 1.003-.215 1.382-.646.38-.43.57-1.044.57-1.84 0-.771-.187-1.362-.559-1.774a1.82 1.82 0 0 0-1.41-.617c-.522 0-.973.216-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592c.26.133.523.2.79.2zm-.299-.975c-.354 0-.638-.164-.852-.492-.153-.232-.229-.59-.229-1.073 0-.468.098-.818.295-1.048a.93.93 0 0 1 .738-.345c.302 0 .55.118.743.354.193.236.29.62.29 1.154 0 .5-.096.868-.288 1.1-.192.233-.424.35-.697.35zm4.478.87v-1.235h-1.234V25h1.234zm-4.017 9.105c.6 0 1.08-.142 1.437-.426.357-.284.599-.704.725-1.261l-1.213-.207c-.061.326-.167.555-.316.688a.832.832 0 0 1-.576.2.916.916 0 0 1-.75-.343c-.185-.228-.278-.62-.278-1.173 0-.498.091-.853.274-1.066.183-.212.429-.318.736-.318.232 0 .42.061.565.184.145.123.238.306.28.55l1.216-.22c-.146-.501-.387-.874-.722-1.119-.336-.244-.788-.366-1.356-.366-.695 0-1.245.214-1.653.643-.407.43-.61 1.03-.61 1.8 0 .762.202 1.358.608 1.788.406.431.95.646 1.633.646zM14.633 34v-1.235h-1.235V34h1.235z"/></svg>',V6='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15h1.38zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15h1.234zM9.352 25c.83-.006 1.352-.02 1.569-.044.346-.038.636-.14.872-.305.236-.166.422-.387.558-.664.137-.277.205-.562.205-.855 0-.372-.106-.695-.317-.97-.21-.276-.512-.471-.905-.585a1.51 1.51 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83c0-.28-.066-.53-.197-.754a1.654 1.654 0 0 0-.495-.539 1.676 1.676 0 0 0-.672-.266c-.25-.042-.63-.063-1.14-.063H7.158V25h2.193zm.142-3.88H8.46v-1.49h.747c.612 0 .983.007 1.112.022.217.026.38.102.49.226.11.125.165.287.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 11.47 11.47 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05c.592 0 .977.03 1.154.092.177.062.313.16.406.295a.84.84 0 0 1 .14.492c0 .228-.06.41-.181.547a.806.806 0 0 1-.473.257c-.126.026-.423.04-.892.04zM14.88 25v-1.235h-1.234V25h1.234zm-5.018 9.11c.691 0 1.262-.17 1.711-.512.45-.341.772-.864.965-1.567l-1.261-.4c-.109.472-.287.818-.536 1.037-.25.22-.547.33-.892.33-.47 0-.85-.173-1.143-.519-.293-.345-.44-.925-.44-1.74 0-.767.15-1.322.447-1.665.297-.343.684-.514 1.162-.514.346 0 .64.096.881.29.242.193.4.457.477.79l1.288-.307c-.147-.516-.367-.911-.66-1.187-.492-.465-1.132-.698-1.92-.698-.902 0-1.63.296-2.184.89-.554.593-.83 1.426-.83 2.498 0 1.014.275 1.813.825 2.397.551.585 1.254.877 2.11.877zM14.88 34v-1.235h-1.234V34h1.234z"/></svg>';/**
|
|
1347
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1348
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1349
|
-
*/class B6 extends w{static get pluginName(){return"ListPropertiesUI"}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties");if(i.styles){const s=[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:E6},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:T6},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:A6}],o=t("Bulleted List"),r=t("Bulleted list styles toolbar"),a="bulletedList";e.ui.componentFactory.add(a,Qd({editor:e,propertiesConfig:i,parentCommandName:a,buttonLabel:o,buttonIcon:P.bulletedList,styleGridAriaLabel:r,styleDefinitions:s})),e.ui.componentFactory.add(`menuBar:${a}`,Xd({editor:e,propertiesConfig:i,parentCommandName:a,buttonLabel:o,styleGridAriaLabel:r,styleDefinitions:s}))}if(i.styles||i.startIndex||i.reversed){const s=[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:S6},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:x6},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:I6},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:P6},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:R6},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:V6}],o=t("Numbered List"),r=t("Numbered list styles toolbar"),a="numberedList";e.ui.componentFactory.add(a,Qd({editor:e,propertiesConfig:i,parentCommandName:a,buttonLabel:o,buttonIcon:P.numberedList,styleGridAriaLabel:r,styleDefinitions:s})),i.styles&&e.ui.componentFactory.add(`menuBar:${a}`,Xd({editor:e,propertiesConfig:i,parentCommandName:a,buttonLabel:o,styleGridAriaLabel:r,styleDefinitions:s}))}}}function Qd({editor:n,propertiesConfig:e,parentCommandName:t,buttonLabel:i,buttonIcon:s,styleGridAriaLabel:o,styleDefinitions:r}){const a=n.commands.get(t);return l=>{const c=ge(l,hn),u=c.buttonView;return c.bind("isEnabled").to(a),c.class="ck-list-styles-dropdown",u.on("execute",()=>{n.execute(t),n.editing.view.focus()}),u.set({label:i,icon:s,tooltip:!0,isToggleable:!0}),u.bind("isOn").to(a,"value",d=>!!d),c.once("change:isOpen",()=>{const d=M6({editor:n,propertiesConfig:e,dropdownView:c,parentCommandName:t,styleGridAriaLabel:o,styleDefinitions:r});c.panelView.children.add(d)}),c.on("execute",()=>{n.editing.view.focus()}),c}}function r1({editor:n,listStyleCommand:e,parentCommandName:t}){const i=n.locale,s=n.commands.get(t);return({label:o,type:r,icon:a,tooltip:l})=>{const c=new V(i);return c.set({label:o,icon:a,tooltip:l}),e.on("change:value",()=>{c.isOn=e.value===r}),c.on("execute",()=>{s.value?e.value===r?n.execute(t):e.value!==r&&n.execute("listStyle",{type:r}):n.model.change(()=>{n.execute("listStyle",{type:r})})}),c}}function M6({editor:n,propertiesConfig:e,dropdownView:t,parentCommandName:i,styleDefinitions:s,styleGridAriaLabel:o}){const r=n.locale,a={...e};i!="numberedList"&&(a.startIndex=!1,a.reversed=!1);let l=null;if(a.styles){const u=n.commands.get("listStyle"),d=r1({editor:n,parentCommandName:i,listStyleCommand:u}),h=a1(u);l=s.filter(h).map(d)}const c=new o1(r,{styleGridAriaLabel:o,enabledProperties:a,styleButtonViews:l});if(a.styles&&Yo(t,()=>c.stylesView.children.find(u=>u.isOn)),a.startIndex){const u=n.commands.get("listStart");c.startIndexFieldView.bind("isEnabled").to(u),c.startIndexFieldView.fieldView.bind("value").to(u),c.on("listStart",(d,h)=>n.execute("listStart",h))}if(a.reversed){const u=n.commands.get("listReversed");c.reversedSwitchButtonView.bind("isEnabled").to(u),c.reversedSwitchButtonView.bind("isOn").to(u,"value",d=>!!d),c.on("listReversed",()=>{const d=u.value;n.execute("listReversed",{reversed:!d})})}return c.delegate("execute").to(t),c}function Xd({editor:n,propertiesConfig:e,parentCommandName:t,buttonLabel:i,styleGridAriaLabel:s,styleDefinitions:o}){return r=>{const a=new Oe(r),l=n.commands.get(t),c=n.commands.get("listStyle"),u=a1(c),d=r1({editor:n,parentCommandName:t,listStyleCommand:c}),h=o.filter(u).map(d),f=new o1(r,{styleGridAriaLabel:s,enabledProperties:{...e,startIndex:!1,reversed:!1},styleButtonViews:h});return f.delegate("execute").to(a),a.buttonView.set({label:i,icon:P[t]}),a.panelView.children.add(f),a.bind("isEnabled").to(l,"isEnabled"),a.on("execute",()=>{n.editing.view.focus()}),a}}function a1(n){return typeof n.isStyleTypeSupported=="function"?e=>n.isStyleTypeSupported(e.type):()=>!0}/**
|
|
1350
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1351
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1352
|
-
*/class L6 extends w{static get requires(){return[k6,B6]}static get pluginName(){return"ListProperties"}}/**
|
|
1353
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1354
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1355
|
-
*/hs("Ctrl+Enter");/**
|
|
1356
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1357
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1358
|
-
*/hs("Ctrl+Enter");/**
|
|
1359
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1360
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1361
|
-
*/function ae(n,e,t,i,s=1){e!=null&&s!==void 0&&s!==null&&e>s?i.setAttribute(n,e,t):i.removeAttribute(n,t)}function Ai(n,e,t={}){const i=n.createElement("tableCell",t);return n.insertElement("paragraph",i),n.insert(i,e),i}function Ia(n,e){const t=e.parent.parent,i=parseInt(t.getAttribute("headingColumns")||"0"),{column:s}=n.getCellLocation(e);return!!i&&s<i}/**
|
|
1362
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1363
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1364
|
-
*/function O6(){return n=>{n.on("element:figure",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const s=N6(t.viewItem);if(!s||!i.consumable.test(s,{name:!0}))return;i.consumable.consume(t.viewItem,{name:!0,classes:"table"});const o=i.convertItem(s,t.modelCursor),r=J(o.modelRange.getItems());if(!r){i.consumable.revert(t.viewItem,{name:!0,classes:"table"});return}i.convertChildren(t.viewItem,i.writer.createPositionAt(r,"end")),i.updateConversionResult(r,t)})}}function F6(){return n=>{n.on("element:table",(e,t,i)=>{const s=t.viewItem;if(!i.consumable.test(s,{name:!0}))return;const{rows:o,headingRows:r,headingColumns:a}=$6(s),l={};a&&(l.headingColumns=a),r&&(l.headingRows=r);const c=i.writer.createElement("table",l);if(i.safeInsert(c,t.modelCursor)){if(i.consumable.consume(s,{name:!0}),o.forEach(u=>i.convertItem(u,i.writer.createPositionAt(c,"end"))),i.convertChildren(s,i.writer.createPositionAt(c,"end")),c.isEmpty){const u=i.writer.createElement("tableRow");i.writer.insert(u,i.writer.createPositionAt(c,"end")),Ai(i.writer,i.writer.createPositionAt(u,"end"))}i.updateConversionResult(c,t)}})}}function D6(){return n=>{n.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&t.modelCursor.index==0&&e.stop()},{priority:"high"})}}function eh(n){return e=>{e.on(`element:${n}`,(t,i,{writer:s})=>{if(!i.modelRange)return;const o=i.modelRange.start.nodeAfter,r=s.createPositionAt(o,0);if(i.viewItem.isEmpty){s.insertElement("paragraph",r);return}const a=Array.from(o.getChildren());if(a.every(l=>l.is("element","$marker"))){const l=s.createElement("paragraph");s.insert(l,s.createPositionAt(o,0));for(const c of a)s.move(s.createRangeOn(c),s.createPositionAt(l,"end"))}},{priority:"low"})}}function N6(n){for(const e of n.getChildren())if(e.is("element","table"))return e}function $6(n){let e=0,t;const i=[],s=[];let o;for(const r of Array.from(n.getChildren())){if(r.name!=="tbody"&&r.name!=="thead"&&r.name!=="tfoot")continue;r.name==="thead"&&!o&&(o=r);const a=Array.from(r.getChildren()).filter(l=>l.is("element","tr"));for(const l of a)if(o&&r===o||r.name==="tbody"&&Array.from(l.getChildren()).length&&Array.from(l.getChildren()).every(c=>c.is("element","th")))e++,i.push(l);else{s.push(l);const c=H6(l);(!t||c<t)&&(t=c)}}return{headingRows:e,headingColumns:t||0,rows:[...i,...s]}}function H6(n){let e=0,t=0;const i=Array.from(n.getChildren()).filter(s=>s.name==="th"||s.name==="td");for(;t<i.length&&i[t].name==="th";){const s=i[t],o=parseInt(s.getAttribute("colspan")||"1");e=e+o,t++}return e}/**
|
|
1365
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1366
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1367
|
-
*/class j{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{const s=e.getChild(this._cellIndex);if(!s)return this._advanceToNextRow();const o=parseInt(s.getAttribute("colspan")||"1"),r=parseInt(s.getAttribute("rowspan")||"1");(o>1||r>1)&&this._recordSpans(s,r,o),this._shouldSkipSlot()||(t=this._formatOutValue(s)),this._nextCellAtColumn=this._column+o}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,i=this._column){return{done:!1,value:new z6(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,s=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||i||s}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const s={cell:e,row:this._row,column:this._column};for(let o=this._row;o<this._row+t;o++)for(let r=this._column;r<this._column+i;r++)(o!=this._row||r!=this._column)&&this._markSpannedCell(o,r,s)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,i)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((i,s)=>i+parseInt(s.getAttribute("colspan")||"1"),0)}}class z6{constructor(e,t,i,s){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=s,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}/**
|
|
1368
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1369
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1370
|
-
*/function th(n,e){return(t,{writer:i})=>{const s=t.getAttribute("headingRows")||0,o=i.createContainerElement("table",null,[]),r=i.createContainerElement("figure",{class:"table"},o);s>0&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("thead",null,i.createSlot(a=>a.is("element","tableRow")&&a.index<s))),s<n.getRows(t)&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("tbody",null,i.createSlot(a=>a.is("element","tableRow")&&a.index>=s)));for(const{positionOffset:a,filter:l}of e.additionalSlots)i.insert(i.createPositionAt(o,a),i.createSlot(l));return i.insert(i.createPositionAt(o,"after"),i.createSlot(a=>a.is("element","tableRow")?!1:!e.additionalSlots.some(({filter:l})=>l(a)))),e.asWidget?W6(r,i):r}}function U6(){return(n,{writer:e})=>n.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}function ih(n={}){return(e,{writer:t})=>{const i=e.parent,s=i.parent,o=s.getChildIndex(i),r=new j(s,{row:o}),a=s.getAttribute("headingRows")||0,l=s.getAttribute("headingColumns")||0;let c=null;for(const u of r)if(u.cell==e){const h=u.row<a||u.column<l?"th":"td";c=n.asWidget?lp(t.createEditableElement(h),t):t.createContainerElement(h);break}return c}}function nh(n={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!l1(e))return null;if(n.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const i=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,i),i}}}function l1(n){return n.parent.childCount==1&&!q6(n)}function W6(n,e){return e.setCustomProperty("table",!0,n),mn(n,e,{hasSelectionHandle:!0})}function q6(n){return!n.getAttributeKeys().next().done}/**
|
|
1371
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1372
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1373
|
-
*/class j6 extends R{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=G6(t,i)}execute(e={}){const t=this.editor,i=t.model,s=t.plugins.get("TableUtils"),o=t.config.get("table.defaultHeadings.rows"),r=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&o&&(e.headingRows=o),e.headingColumns===void 0&&r&&(e.headingColumns=r),i.change(a=>{const l=s.createTable(a,e);i.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}function G6(n,e){const t=n.getFirstPosition().parent,i=t===t.root?t:t.parent;return e.checkChild(i,"table")}/**
|
|
1374
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1375
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1376
|
-
*/class sh extends R{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,i=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=i}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),s=this.order==="above",o=i.getSelectionAffectedTableCells(t),r=i.getRowIndexes(o),a=s?r.first:r.last,l=o[0].findAncestor("table");i.insertRows(l,{at:s?a:a+1,copyStructureFromAbove:!s})}}/**
|
|
1377
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1378
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1379
|
-
*/class oh extends R{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,i=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=i}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),s=this.order==="left",o=i.getSelectionAffectedTableCells(t),r=i.getColumnIndexes(o),a=s?r.first:r.last,l=o[0].findAncestor("table");i.insertColumns(l,{columns:1,at:s?a:a+1})}}/**
|
|
1380
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1381
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1382
|
-
*/class rh extends R{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length===1}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}/**
|
|
1383
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1384
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1385
|
-
*/function c1(n,e,t){const{startRow:i,startColumn:s,endRow:o,endColumn:r}=e,a=t.createElement("table"),l=o-i+1;for(let u=0;u<l;u++)t.insertElement("tableRow",a,"end");const c=[...new j(n,{startRow:i,endRow:o,startColumn:s,endColumn:r,includeAllSlots:!0})];for(const{row:u,column:d,cell:h,isAnchor:f,cellAnchorRow:m,cellAnchorColumn:p}of c){const _=u-i,k=a.getChild(_);if(!f)(m<i||p<s)&&Ai(t,t.createPositionAt(k,"end"));else{const A=t.cloneElement(h);t.append(A,k),m1(A,u,d,o,r,t)}}return K6(a,n,i,s,t),a}function u1(n,e,t=0){const i=[],s=new j(n,{startRow:t,endRow:e-1});for(const o of s){const{row:r,cellHeight:a}=o,l=r+a-1;r<e&&e<=l&&i.push(o)}return i}function d1(n,e,t){const i=n.parent,s=i.parent,o=i.index,r=parseInt(n.getAttribute("rowspan")),a=e-o,l={},c=r-a;c>1&&(l.rowspan=c);const u=parseInt(n.getAttribute("colspan")||"1");u>1&&(l.colspan=u);const d=o,h=d+a,f=[...new j(s,{startRow:d,endRow:h,includeAllSlots:!0})];let m=null,p;for(const _ of f){const{row:k,column:A,cell:F}=_;F===n&&p===void 0&&(p=A),p!==void 0&&p===A&&k===h&&(m=Ai(t,_.getPositionBefore(),l))}return ae("rowspan",a,n,t),m}function h1(n,e){const t=[],i=new j(n);for(const s of i){const{column:o,cellWidth:r}=s,a=o+r-1;o<e&&e<=a&&t.push(s)}return t}function f1(n,e,t,i){const s=parseInt(n.getAttribute("colspan")),o=t-e,r={},a=s-o;a>1&&(r.colspan=a);const l=parseInt(n.getAttribute("rowspan")||"1");l>1&&(r.rowspan=l);const c=Ai(i,i.createPositionAfter(n),r);return ae("colspan",o,n,i),c}function m1(n,e,t,i,s,o){const r=parseInt(n.getAttribute("colspan")||"1"),a=parseInt(n.getAttribute("rowspan")||"1");if(t+r-1>s){const u=s-t+1;ae("colspan",u,n,o,1)}if(e+a-1>i){const u=i-e+1;ae("rowspan",u,n,o,1)}}function K6(n,e,t,i,s){const o=parseInt(e.getAttribute("headingRows")||"0");if(o>0){const a=o-t;ae("headingRows",a,n,s,0)}const r=parseInt(e.getAttribute("headingColumns")||"0");if(r>0){const a=r-i;ae("headingColumns",a,n,s,0)}}function Pa(n,e){const t=e.getColumns(n),i=new Array(t).fill(0);for(const{column:o}of new j(n))i[o]++;const s=i.reduce((o,r,a)=>r?o:[...o,a],[]);if(s.length>0){const o=s[s.length-1];return e.removeColumns(n,{at:o}),!0}return!1}function Ra(n,e){const t=[],i=e.getRows(n);for(let s=0;s<i;s++)n.getChild(s).isEmpty&&t.push(s);if(t.length>0){const s=t[t.length-1];return e.removeRows(n,{at:s}),!0}return!1}function Bl(n,e){Pa(n,e)||Ra(n,e)}function g1(n,e){const t=Array.from(new j(n,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:o})=>o===1))return e.lastRow;const s=t[0].cellHeight-1;return e.lastRow+s}function p1(n,e){const t=Array.from(new j(n,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:o})=>o===1))return e.lastColumn;const s=t[0].cellWidth-1;return e.lastColumn+s}/**
|
|
1386
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1387
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1388
|
-
*/class Ks extends R{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,s=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],o=this.value,r=this.direction;e.change(a=>{const l=r=="right"||r=="down",c=l?s:o,u=l?o:s,d=u.parent;Y6(u,c,a);const h=this.isHorizontal?"colspan":"rowspan",f=parseInt(s.getAttribute(h)||"1"),m=parseInt(o.getAttribute(h)||"1");a.setAttribute(h,f+m,c),a.setSelection(a.createRangeIn(c));const p=this.editor.plugins.get("TableUtils"),_=d.findAncestor("table");Bl(_,p)})}_getMergeableCell(){const t=this.editor.model.document,i=this.editor.plugins.get("TableUtils"),s=i.getTableCellsContainingSelection(t.selection)[0];if(!s)return;const o=this.isHorizontal?Z6(s,this.direction,i):J6(s,this.direction,i);if(!o)return;const r=this.isHorizontal?"rowspan":"colspan",a=parseInt(s.getAttribute(r)||"1");if(parseInt(o.getAttribute(r)||"1")===a)return o}}function Z6(n,e,t){const s=n.parent.parent,o=e=="right"?n.nextSibling:n.previousSibling,r=(s.getAttribute("headingColumns")||0)>0;if(!o)return;const a=e=="right"?n:o,l=e=="right"?o:n,{column:c}=t.getCellLocation(a),{column:u}=t.getCellLocation(l),d=parseInt(a.getAttribute("colspan")||"1"),h=Ia(t,a),f=Ia(t,l);return r&&h!=f?void 0:c+d===u?o:void 0}function J6(n,e,t){const i=n.parent,s=i.parent,o=s.getChildIndex(i);if(e=="down"&&o===t.getRows(s)-1||e=="up"&&o===0)return null;const r=parseInt(n.getAttribute("rowspan")||"1"),a=s.getAttribute("headingRows")||0,l=e=="down"&&o+r===a,c=e=="up"&&o===a;if(a&&(l||c))return null;const u=parseInt(n.getAttribute("rowspan")||"1"),d=e=="down"?o+u:o,h=[...new j(s,{endRow:d})],m=h.find(_=>_.cell===n).column,p=h.find(({row:_,cellHeight:k,column:A})=>A!==m?!1:e=="down"?_===d:d===_+k);return p&&p.cell?p.cell:null}function Y6(n,e,t){ah(n)||(ah(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function ah(n){const e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}/**
|
|
1389
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1390
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1391
|
-
*/class Q6 extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const s=i.findAncestor("table"),r=e.getRows(s)-1,a=e.getRowIndexes(t),l=a.first===0&&a.last===r;this.isEnabled=!l}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),s=t.getRowIndexes(i),o=i[0],r=o.findAncestor("table"),a=t.getCellLocation(o).column;e.change(l=>{const c=s.last-s.first+1;t.removeRows(r,{at:s.first,rows:c});const u=X6(r,s.first,a,t.getRows(r));l.setSelection(l.createPositionAt(u,0))})}}function X6(n,e,t,i){const s=n.getChild(Math.min(e,i-1));let o=s.getChild(0),r=0;for(const a of s.getChildren()){if(r>t)return o;o=a,r+=parseInt(a.getAttribute("colspan")||"1")}return o}/**
|
|
1392
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1393
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1394
|
-
*/class eR extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const s=i.findAncestor("table"),o=e.getColumns(s),{first:r,last:a}=e.getColumnIndexes(t);this.isEnabled=a-r<o-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,i]=iR(this.editor.model.document.selection,e),s=t.parent.parent,o=[...new j(s)],r={first:o.find(l=>l.cell===t).column,last:o.find(l=>l.cell===i).column},a=tR(o,t,i,r);this.editor.model.change(l=>{const c=r.last-r.first+1;e.removeColumns(s,{at:r.first,columns:c}),l.setSelection(l.createPositionAt(a,0))})}}function tR(n,e,t,i){return parseInt(t.getAttribute("colspan")||"1")>1?t:e.previousSibling||t.nextSibling?t.nextSibling||e.previousSibling:i.first?n.reverse().find(({column:o})=>o<i.first).cell:n.reverse().find(({column:o})=>o>i.last).cell}function iR(n,e){const t=e.getSelectionAffectedTableCells(n),i=t[0],s=t.pop(),o=[i,s];return i.isBefore(s)?o:o.reverse()}/**
|
|
1395
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1396
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1397
|
-
*/class nR extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),s=i.length>0;this.isEnabled=s,this.value=s&&i.every(o=>this._isInHeading(o,o.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,s=t.getSelectionAffectedTableCells(i.document.selection),o=s[0].findAncestor("table"),{first:r,last:a}=t.getRowIndexes(s),l=this.value?r:a+1,c=o.getAttribute("headingRows")||0;i.change(u=>{if(l){const d=l>c?c:0,h=u1(o,l,d);for(const{cell:f}of h)d1(f,l,u)}ae("headingRows",l,o,u,0)})}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||"0");return!!i&&e.parent.index<i}}/**
|
|
1398
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1399
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1400
|
-
*/class sR extends R{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),s=i.length>0;this.isEnabled=s,this.value=s&&i.every(o=>Ia(t,o))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,s=t.getSelectionAffectedTableCells(i.document.selection),o=s[0].findAncestor("table"),{first:r,last:a}=t.getColumnIndexes(s),l=this.value?r:a+1;i.change(c=>{if(l){const u=h1(o,l);for(const{cell:d,column:h}of u)f1(d,h,l,c)}ae("headingColumns",l,o,c,0)})}}/**
|
|
1401
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1402
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1403
|
-
*/function oR(n){if(n.is("element","tableColumnGroup"))return n;const e=n.getChildren();return Array.from(e).find(t=>t.is("element","tableColumnGroup"))}function rR(n){const e=oR(n);return e?Array.from(e.getChildren()):[]}/**
|
|
1404
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1405
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1406
|
-
*/class ve extends w{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,i=t.parent,s=i.getChildIndex(t),o=new j(i,{row:s});for(const{cell:r,row:a,column:l}of o)if(r===e)return{row:a,column:l};/* istanbul ignore next -- @preserve */}createTable(e,t){const i=e.createElement("table"),s=t.rows||2,o=t.columns||2;return Lr(e,i,0,s,o),t.headingRows&&ae("headingRows",Math.min(t.headingRows,s),i,e,0),t.headingColumns&&ae("headingColumns",Math.min(t.headingColumns,o),i,e,0),i}insertRows(e,t={}){const i=this.editor.model,s=t.at||0,o=t.rows||1,r=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?s-1:s,l=this.getRows(e),c=this.getColumns(e);if(s>l)throw new g("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change(u=>{const d=e.getAttribute("headingRows")||0;if(d>s&&ae("headingRows",d+o,e,u,0),!r&&(s===0||s===l)){Lr(u,e,s,o,c);return}const h=r?Math.max(s,a):s,f=new j(e,{endRow:h}),m=new Array(c).fill(1);for(const{row:p,column:_,cellHeight:k,cellWidth:A,cell:F}of f){const U=p+k-1,Y=p<s&&s<=U,x=p<=a&&a<=U;Y?(u.setAttribute("rowspan",k+o,F),m[_]=-A):r&&x&&(m[_]=A)}for(let p=0;p<o;p++){const _=u.createElement("tableRow");u.insert(_,e,s);for(let k=0;k<m.length;k++){const A=m[k],F=u.createPositionAt(_,"end");A>0&&Ai(u,F,A>1?{colspan:A}:void 0),k+=Math.abs(A)-1}}})}insertColumns(e,t={}){const i=this.editor.model,s=t.at||0,o=t.columns||1;i.change(r=>{const a=e.getAttribute("headingColumns");s<a&&r.setAttribute("headingColumns",a+o,e);const l=this.getColumns(e);if(s===0||l===s){for(const u of e.getChildren())u.is("element","tableRow")&&Ui(o,r,r.createPositionAt(u,s?"end":0));return}const c=new j(e,{column:s,includeAllSlots:!0});for(const u of c){const{row:d,cell:h,cellAnchorColumn:f,cellAnchorRow:m,cellWidth:p,cellHeight:_}=u;if(f<s){r.setAttribute("colspan",p+o,h);const k=m+_-1;for(let A=d;A<=k;A++)c.skipRow(A)}else Ui(o,r,u.getPositionBefore())}})}removeRows(e,t){const i=this.editor.model,s=t.rows||1,o=this.getRows(e),r=t.at,a=r+s-1;if(a>o-1)throw new g("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change(l=>{const c={first:r,last:a},{cellsToMove:u,cellsToTrim:d}=cR(e,c);if(u.size){const h=a+1;uR(e,h,u,l)}for(let h=a;h>=r;h--)l.remove(e.getChild(h));for(const{rowspan:h,cell:f}of d)ae("rowspan",h,f,l);lR(e,c,l),Pa(e,this)||Ra(e,this)})}removeColumns(e,t){const i=this.editor.model,s=t.at,o=t.columns||1,r=t.at+o-1;i.change(a=>{aR(e,{first:s,last:r},a);const l=rR(e);for(let c=r;c>=s;c--){for(const{cell:u,column:d,cellWidth:h}of[...new j(e)])d<=c&&h>1&&d+h>c?ae("colspan",h-1,u,a):d===c&&a.remove(u);if(l[c]){const u=c===0?l[1]:l[c-1],d=parseFloat(l[c].getAttribute("columnWidth")),h=parseFloat(u.getAttribute("columnWidth"));a.remove(l[c]),a.setAttribute("columnWidth",d+h+"%",u)}}Ra(e,this)||Pa(e,this)})}splitCellVertically(e,t=2){const i=this.editor.model,o=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");i.change(l=>{if(a>1){const{newCellsSpan:c,updatedSpan:u}=lh(a,t);ae("colspan",u,e,l);const d={};c>1&&(d.colspan=c),r>1&&(d.rowspan=r);const h=a>t?t-1:a-1;Ui(h,l,l.createPositionAfter(e),d)}if(a<t){const c=t-a,u=[...new j(o)],{column:d}=u.find(({cell:p})=>p===e),h=u.filter(({cell:p,cellWidth:_,column:k})=>{const A=p!==e&&k===d,F=k<d&&k+_>d;return A||F});for(const{cell:p,cellWidth:_}of h)l.setAttribute("colspan",_+c,p);const f={};r>1&&(f.rowspan=r),Ui(c,l,l.createPositionAfter(e),f);const m=o.getAttribute("headingColumns")||0;m>d&&ae("headingColumns",m+c,o,l)}})}splitCellHorizontally(e,t=2){const i=this.editor.model,s=e.parent,o=s.parent,r=o.getChildIndex(s),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");i.change(c=>{if(a>1){const u=[...new j(o,{startRow:r,endRow:r+a-1,includeAllSlots:!0})],{newCellsSpan:d,updatedSpan:h}=lh(a,t);ae("rowspan",h,e,c);const{column:f}=u.find(({cell:p})=>p===e),m={};d>1&&(m.rowspan=d),l>1&&(m.colspan=l);for(const p of u){const{column:_,row:k}=p,A=k>=r+h,F=_===f,U=(k+r+h)%d===0;A&&F&&U&&Ui(1,c,p.getPositionBefore(),m)}}if(a<t){const u=t-a,d=[...new j(o,{startRow:0,endRow:r})];for(const{cell:m,cellHeight:p,row:_}of d)if(m!==e&&_+p>r){const k=p+u;c.setAttribute("rowspan",k,m)}const h={};l>1&&(h.colspan=l),Lr(c,o,r+1,u,1,h);const f=o.getAttribute("headingRows")||0;f>r&&ae("headingRows",f+u,o,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(i=>i.is("element","tableCell")).reduce((i,s)=>{const o=parseInt(s.getAttribute("colspan")||"1");return i+o},0)}getRows(e){return Array.from(e.getChildren()).reduce((t,i)=>i.is("element","tableRow")?t+1:t,0)}createTableWalker(e,t={}){return new j(e,t)}getSelectedTableCells(e){const t=[];for(const i of this.sortRanges(e.getRanges())){const s=i.getContainedElement();s&&s.is("element","tableCell")&&t.push(s)}return t}getTableCellsContainingSelection(e){const t=[];for(const i of e.getRanges()){const s=i.start.findAncestor("tableCell");s&&t.push(s)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(i=>i.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),s=[...new j(t)].filter(o=>e.includes(o.cell)).map(o=>o.column);return this._getFirstLastIndexesObject(s)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,i=new Set;let s=0;for(const r of e){const{row:a,column:l}=this.getCellLocation(r),c=parseInt(r.getAttribute("rowspan"))||1,u=parseInt(r.getAttribute("colspan"))||1;t.add(a),i.add(l),c>1&&t.add(a+c-1),u>1&&i.add(l+u-1),s+=c*u}return hR(t,i)==s}sortRanges(e){return Array.from(e).sort(dR)}_getFirstLastIndexesObject(e){const t=e.sort((o,r)=>o-r),i=t[0],s=t[t.length-1];return{first:i,last:s}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),i=this.getRowIndexes(e),s=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(i,s))return!1;const o=this.getColumnIndexes(e),r=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,r)}_areIndexesInSameSection({first:e,last:t},i){const s=e<i,o=t<i;return s===o}}function Lr(n,e,t,i,s,o={}){for(let r=0;r<i;r++){const a=n.createElement("tableRow");n.insert(a,e,t),Ui(s,n,n.createPositionAt(a,"end"),o)}}function Ui(n,e,t,i={}){for(let s=0;s<n;s++)Ai(e,t,i)}function lh(n,e){if(n<e)return{newCellsSpan:1,updatedSpan:1};const t=Math.floor(n/e),i=n-t*e+t;return{newCellsSpan:t,updatedSpan:i}}function aR(n,e,t){const i=n.getAttribute("headingColumns")||0;if(i&&e.first<i){const s=Math.min(i-1,e.last)-e.first+1;t.setAttribute("headingColumns",i-s,n)}}function lR(n,{first:e,last:t},i){const s=n.getAttribute("headingRows")||0;if(e<s){const o=t<s?s-(t-e+1):e;ae("headingRows",o,n,i,0)}}function cR(n,{first:e,last:t}){const i=new Map,s=[];for(const{row:o,column:r,cellHeight:a,cell:l}of new j(n,{endRow:t})){const c=o+a-1;if(o>=e&&o<=t&&c>t){const h=t-o+1,f=a-h;i.set(r,{cell:l,rowspan:f})}if(o<e&&c>=e){let h;c>=t?h=t-e+1:h=c-e+1,s.push({cell:l,rowspan:a-h})}}return{cellsToMove:i,cellsToTrim:s}}function uR(n,e,t,i){const o=[...new j(n,{includeAllSlots:!0,row:e})],r=n.getChild(e);let a;for(const{column:l,cell:c,isAnchor:u}of o)if(t.has(l)){const{cell:d,rowspan:h}=t.get(l),f=a?i.createPositionAfter(a):i.createPositionAt(r,0);i.move(i.createRangeOn(d),f),ae("rowspan",h,d,i),a=d}else u&&(a=c)}function dR(n,e){const t=n.start,i=e.start;return t.isBefore(i)?-1:1}function hR(n,e){const t=Array.from(n.values()),i=Array.from(e.values()),s=Math.max(...t),o=Math.min(...t),r=Math.max(...i),a=Math.min(...i);return(s-o+1)*(r-a+1)}/**
|
|
1407
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1408
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1409
|
-
*/class fR extends R{refresh(){const e=this.editor.plugins.get(ve),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(ve);e.change(i=>{const s=t.getSelectedTableCells(e.document.selection),o=s.shift(),{mergeWidth:r,mergeHeight:a}=gR(o,s,t);ae("colspan",r,o,i),ae("rowspan",a,o,i);for(const c of s)mR(c,o,i);const l=o.findAncestor("table");Bl(l,t),i.setSelection(o,"in")})}}function mR(n,e,t){ch(n)||(ch(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function ch(n){const e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function gR(n,e,t){let i=0,s=0;for(const c of e){const{row:u,column:d}=t.getCellLocation(c);i=uh(c,d,i,"colspan"),s=uh(c,u,s,"rowspan")}const{row:o,column:r}=t.getCellLocation(n),a=i-r,l=s-o;return{mergeWidth:a,mergeHeight:l}}function uh(n,e,t,i){const s=parseInt(n.getAttribute(i)||"1");return Math.max(t,e+s)}/**
|
|
1410
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1411
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1412
|
-
*/class pR extends R{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),s=t.getRowIndexes(i),o=i[0].findAncestor("table"),r=[];for(let a=s.first;a<=s.last;a++)for(const l of o.getChild(a).getChildren())r.push(e.createRangeOn(l));e.change(a=>{a.setSelection(r)})}}/**
|
|
1413
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1414
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1415
|
-
*/class wR extends R{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),s=i[0],o=i.pop(),r=s.findAncestor("table"),a=e.getCellLocation(s),l=e.getCellLocation(o),c=Math.min(a.column,l.column),u=Math.max(a.column,l.column),d=[];for(const h of new j(r,{startColumn:c,endColumn:u}))d.push(t.createRangeOn(h.cell));t.change(h=>{h.setSelection(d)})}}/**
|
|
1416
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1417
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1418
|
-
*/function bR(n){n.document.registerPostFixer(e=>_R(e,n))}function _R(n,e){const t=e.document.differ.getChanges();let i=!1;const s=new Set;for(const o of t){let r=null;o.type=="insert"&&o.name=="table"&&(r=o.position.nodeAfter),(o.type=="insert"||o.type=="remove")&&(o.name=="tableRow"||o.name=="tableCell")&&(r=o.position.findAncestor("table")),ER(o)&&(r=o.range.start.findAncestor("table")),r&&!s.has(r)&&(i=vR(r,n)||i,i=yR(r,n)||i,s.add(r))}return i}function vR(n,e){let t=!1;const i=kR(n);if(i.length){t=!0;for(const s of i)ae("rowspan",s.rowspan,s.cell,e,1)}return t}function yR(n,e){let t=!1;const i=CR(n),s=[];for(const[l,c]of i.entries())!c&&n.getChild(l).is("element","tableRow")&&s.push(l);if(s.length){t=!0;for(const l of s.reverse())e.remove(n.getChild(l)),i.splice(l,1)}const o=i.filter((l,c)=>n.getChild(c).is("element","tableRow")),r=o[0];if(!o.every(l=>l===r)){const l=o.reduce((c,u)=>u>c?u:c,0);for(const[c,u]of o.entries()){const d=l-u;if(d){for(let h=0;h<d;h++)Ai(e,e.createPositionAt(n.getChild(c),"end"));t=!0}}}return t}function kR(n){const e=parseInt(n.getAttribute("headingRows")||"0"),t=Array.from(n.getChildren()).reduce((s,o)=>o.is("element","tableRow")?s+1:s,0),i=[];for(const{row:s,cell:o,cellHeight:r}of new j(n)){if(r<2)continue;const l=s<e?e:t;if(s+r>l){const c=l-s;i.push({cell:o,rowspan:c})}}return i}function CR(n){const e=new Array(n.childCount).fill(0);for(const{rowIndex:t}of new j(n,{includeAllSlots:!0}))e[t]++;return e}function ER(n){if(n.type!=="attribute")return!1;const e=n.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}/**
|
|
1419
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1420
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1421
|
-
*/function TR(n){n.document.registerPostFixer(e=>AR(e,n))}function AR(n,e){const t=e.document.differ.getChanges();let i=!1;for(const s of t)s.type=="insert"&&s.name=="table"&&(i=SR(s.position.nodeAfter,n)||i),s.type=="insert"&&s.name=="tableRow"&&(i=w1(s.position.nodeAfter,n)||i),s.type=="insert"&&s.name=="tableCell"&&(i=Va(s.position.nodeAfter,n)||i),(s.type=="remove"||s.type=="insert")&&xR(s)&&(i=Va(s.position.parent,n)||i);return i}function SR(n,e){let t=!1;for(const i of n.getChildren())i.is("element","tableRow")&&(t=w1(i,e)||t);return t}function w1(n,e){let t=!1;for(const i of n.getChildren())t=Va(i,e)||t;return t}function Va(n,e){if(n.childCount==0)return e.insertElement("paragraph",n),!0;const t=Array.from(n.getChildren()).filter(i=>i.is("$text"));for(const i of t)e.wrap(e.createRangeOn(i),"paragraph");return!!t.length}function xR(n){return n.position.parent.is("element","tableCell")?n.type=="insert"&&n.name=="$text"||n.type=="remove":!1}/**
|
|
1422
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1423
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1424
|
-
*/function IR(n,e){const t=n.document.differ;for(const i of t.getChanges()){let s,o=!1;if(i.type=="attribute"){const c=i.range.start.nodeAfter;if(!c||!c.is("element","table")||i.attributeKey!="headingRows"&&i.attributeKey!="headingColumns")continue;s=c,o=i.attributeKey=="headingRows"}else(i.name=="tableRow"||i.name=="tableCell")&&(s=i.position.findAncestor("table"),o=i.name=="tableRow");if(!s)continue;const r=s.getAttribute("headingRows")||0,a=s.getAttribute("headingColumns")||0,l=new j(s);for(const c of l){const d=c.row<r||c.column<a?"th":"td",h=e.mapper.toViewElement(c.cell);h&&h.is("element")&&h.name!=d&&e.reconvertItem(o?c.cell.parent:c.cell)}}}/**
|
|
1425
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1426
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1427
|
-
*/function PR(n,e){const t=n.document.differ,i=new Set;for(const s of t.getChanges()){const o=s.type=="attribute"?s.range.start.parent:s.position.parent;o.is("element","tableCell")&&i.add(o)}for(const s of i.values()){const o=Array.from(s.getChildren()).filter(r=>RR(r,e.mapper));for(const r of o)e.reconvertItem(r)}}function RR(n,e){if(!n.is("element","paragraph"))return!1;const t=e.toViewElement(n);return t?l1(n)!==t.is("element","span"):!1}/**
|
|
1428
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1429
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1430
|
-
*/class VR extends w{static get pluginName(){return"TableEditing"}static get requires(){return[ve]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,i=t.schema,s=e.conversion,o=e.plugins.get(ve);i.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),s.for("upcast").add(O6()),s.for("upcast").add(F6()),s.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:th(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),s.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:th(o,{additionalSlots:this._additionalSlots})}),s.for("upcast").elementToElement({model:"tableRow",view:"tr"}),s.for("upcast").add(D6()),s.for("downcast").elementToElement({model:"tableRow",view:U6()}),s.for("upcast").elementToElement({model:"tableCell",view:"td"}),s.for("upcast").elementToElement({model:"tableCell",view:"th"}),s.for("upcast").add(eh("td")),s.for("upcast").add(eh("th")),s.for("editingDowncast").elementToElement({model:"tableCell",view:ih({asWidget:!0})}),s.for("dataDowncast").elementToElement({model:"tableCell",view:ih()}),s.for("editingDowncast").elementToElement({model:"paragraph",view:nh({asWidget:!0}),converterPriority:"high"}),s.for("dataDowncast").elementToElement({model:"paragraph",view:nh(),converterPriority:"high"}),s.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),s.for("upcast").attributeToAttribute({model:{key:"colspan",value:dh("colspan")},view:"colspan"}),s.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),s.for("upcast").attributeToAttribute({model:{key:"rowspan",value:dh("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new j6(e)),e.commands.add("insertTableRowAbove",new sh(e,{order:"above"})),e.commands.add("insertTableRowBelow",new sh(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new oh(e,{order:"left"})),e.commands.add("insertTableColumnRight",new oh(e,{order:"right"})),e.commands.add("removeTableRow",new Q6(e)),e.commands.add("removeTableColumn",new eR(e)),e.commands.add("splitTableCellVertically",new rh(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new rh(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new fR(e)),e.commands.add("mergeTableCellRight",new Ks(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Ks(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Ks(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Ks(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new sR(e)),e.commands.add("setTableRowHeader",new nR(e)),e.commands.add("selectTableRow",new pR(e)),e.commands.add("selectTableColumn",new wR(e)),bR(t),TR(t),this.listenTo(t.document,"change:data",()=>{IR(t,e.editing),PR(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function dh(n){return e=>{const t=parseInt(e.getAttribute(n));return Number.isNaN(t)||t<=0?null:t}}/**
|
|
1431
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1432
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1433
|
-
*/class hh extends T{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new oe,this.focusTracker=new te,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(i,s)=>`${s} × ${i}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(i=>{i.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(i,s)=>{const{row:o,column:r}=s.target.dataset;this.items.get((parseInt(o,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(i,s,o)=>{if(!o)return;const{row:r,column:a}=o.dataset;this.set({rows:parseInt(r),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),as({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((i,s)=>{const o=Math.floor(s/10),r=s%10,a=o<e&&r<t;i.set("isOn",a)})}_createGridButton(e,t,i,s){const o=new V(e);return o.set({label:s,class:"ck-insert-table-dropdown-grid-box"}),o.extendTemplate({attributes:{"data-row":t,"data-column":i}}),o}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),s=t%10,o=`${i+1} × ${s+1}`;e.push(this._createGridButton(this.locale,i+1,s+1,o))}return this.createCollection(e)}}const BR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',MR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',LR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>';/**
|
|
1434
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1435
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1436
|
-
*/class OR extends w{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,s=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",o=>{const r=e.commands.get("insertTable"),a=ge(o);a.bind("isEnabled").to(r),a.buttonView.set({icon:P.table,label:t("Insert table"),tooltip:!0});let l;return a.on("change:isOpen",()=>{l||(l=new hh(o),a.panelView.children.add(l),l.delegate("execute").to(a),a.on("execute",()=>{e.execute("insertTable",{rows:l.rows,columns:l.columns}),e.editing.view.focus()}))}),a}),e.ui.componentFactory.add("menuBar:insertTable",o=>{const r=e.commands.get("insertTable"),a=new Oe(o),l=new hh(o);return l.delegate("execute").to(a),a.on("change:isOpen",(c,u,d)=>{d||l.reset()}),l.on("execute",()=>{e.execute("insertTable",{rows:l.rows,columns:l.columns}),e.editing.view.focus()}),a.buttonView.set({label:t("Table"),icon:P.table}),a.panelView.children.add(l),a.bind("isEnabled").to(r),a}),e.ui.componentFactory.add("tableColumn",o=>{const r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:s?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:s?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),BR,r,o)}),e.ui.componentFactory.add("tableRow",o=>{const r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),MR,r,o)}),e.ui.componentFactory.add("mergeTableCells",o=>{const r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:s?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:s?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),LR,r,o)})}_prepareDropdown(e,t,i,s){const o=this.editor,r=ge(s),a=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(a,"isEnabled",(...l)=>l.some(c=>c)),this.listenTo(r,"execute",l=>{o.execute(l.source.commandName),l.source instanceof ms||o.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,i,s){const o=this.editor,r=ge(s,hn),a="mergeTableCells",l=o.commands.get(a),c=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([l,...c],"isEnabled",(...u)=>u.some(d=>d)),this.listenTo(r.buttonView,"execute",()=>{o.execute(a),o.editing.view.focus()}),this.listenTo(r,"execute",u=>{o.execute(u.source.commandName),o.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){const i=this.editor,s=[],o=new Ce;for(const r of t)FR(r,i,s,o);return yi(e,o),s}}function FR(n,e,t,i){if(n.type==="button"||n.type==="switchbutton"){const s=n.model=new ki(n.model),{commandName:o,bindIsOn:r}=n.model,a=e.commands.get(o);t.push(a),s.set({commandName:o}),s.bind("isEnabled").to(a),r&&s.bind("isOn").to(a,"value"),s.set({withText:!0})}i.add(n)}/**
|
|
1437
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1438
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1439
|
-
*/class ri extends w{static get pluginName(){return"TableSelection"}static get requires(){return[ve,ve]}init(){const e=this.editor,t=e.model,i=e.editing.view;this.listenTo(t,"deleteContent",(s,o)=>this._handleDeleteContent(s,o),{priority:"high"}),this.listenTo(i.document,"insertText",(s,o)=>this._handleInsertTextEvent(s,o),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(ve),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return i.length==0?null:i}getSelectionAsFragment(){const e=this.editor.plugins.get(ve),t=this.getSelectedTableCells();return t?this.editor.model.change(i=>{const s=i.createDocumentFragment(),{first:o,last:r}=e.getColumnIndexes(t),{first:a,last:l}=e.getRowIndexes(t),c=t[0].findAncestor("table");let u=l,d=r;if(e.isSelectionRectangular(t)){const m={firstColumn:o,lastColumn:r,firstRow:a,lastRow:l};u=g1(c,m),d=p1(c,m)}const f=c1(c,{startRow:a,startColumn:o,endRow:u,endColumn:d},i);return i.insert(f,s,0),s}):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change(s=>{s.setSelection(i.cells.map(o=>s.createRangeOn(o)),{backward:i.backward})})}getFocusCell(){const i=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return i&&i.is("element","tableCell")?i:null}getAnchorCell(){const e=this.editor.model.document.selection,i=J(e.getRanges()).getContainedElement();return i&&i.is("element","tableCell")?i:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(s=>s.on("selection",(o,r,a)=>{const l=a.writer;i(l);const c=this.getSelectedTableCells();if(!c)return;for(const d of c){const h=a.mapper.toViewElement(d);l.addClass("ck-editor__editable_selected",h),t.add(h)}const u=a.mapper.toViewElement(c[c.length-1]);l.setSelection(u,0)},{priority:"lowest"}));function i(s){for(const o of t)s.removeClass("ck-editor__editable_selected",o);t.clear()}}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(i=>{const s=i.createPositionAt(t[0],0),o=e.model.schema.getNearestSelectionRange(s);i.setSelection(o)})}})}_handleDeleteContent(e,t){const i=this.editor.plugins.get(ve),s=t[0],o=t[1],r=this.editor.model,a=!o||o.direction=="backward",l=i.getSelectedTableCells(s);l.length&&(e.stop(),r.change(c=>{const u=l[a?l.length-1:0];r.change(h=>{for(const f of l)r.deleteContent(h.createSelection(f,"in"))});const d=r.schema.getNearestSelectionRange(c.createPositionAt(u,0));s.is("documentSelection")?c.setSelection(d):s.setTo(d)}))}_handleInsertTextEvent(e,t){const i=this.editor,s=this.getSelectedTableCells();if(!s)return;const o=i.editing.view,r=i.editing.mapper,a=s.map(l=>o.createRangeOn(r.toViewElement(l)));t.selection=o.createSelection(a)}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),s=i.getCellLocation(e),o=i.getCellLocation(t),r=Math.min(s.row,o.row),a=Math.max(s.row,o.row),l=Math.min(s.column,o.column),c=Math.max(s.column,o.column),u=new Array(a-r+1).fill(null).map(()=>[]),d={startRow:r,endRow:a,startColumn:l,endColumn:c};for(const{row:m,cell:p}of new j(e.findAncestor("table"),d))u[m-r].push(p);const h=o.row<s.row,f=o.column<s.column;return h&&u.reverse(),f&&u.forEach(m=>m.reverse()),{cells:u.flat(),backward:h||f}}}/**
|
|
1440
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1441
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1442
|
-
*/class DR extends w{static get pluginName(){return"TableClipboard"}static get requires(){return[Dn,rt,ri,ve]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(i,s)=>this._onCopyCut(i,s)),this.listenTo(t,"cut",(i,s)=>this._onCopyCut(i,s)),this.listenTo(e.model,"insertContent",(i,[s,o])=>this._onInsertContent(i,s,o),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const i=this.editor.editing.view,s=this.editor.plugins.get(ri),o=this.editor.plugins.get(Dn);s.getSelectedTableCells()&&(e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name==="cut"},()=>{const r=o._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>s.getSelectionAsFragment());i.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(r),method:e.name})})))}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const s=this.editor.model,o=this.editor.plugins.get(ve),r=this.editor.plugins.get(Dn),a=this.getTableIfOnlyTableInContent(t,s);if(!a)return;const l=o.getSelectionAffectedTableCells(s.document.selection);if(!l.length){Bl(a,o);return}e.stop(),t.is("documentFragment")?r._pasteMarkersIntoTransformedElement(t.markers,c=>this._replaceSelectedCells(a,l,c)):this.editor.model.change(c=>{this._replaceSelectedCells(a,l,c)})}_replaceSelectedCells(e,t,i){const s=this.editor.plugins.get(ve),o={width:s.getColumns(e),height:s.getRows(e)},r=NR(t,o,i,s),a=r.lastRow-r.firstRow+1,l=r.lastColumn-r.firstColumn+1,c={startRow:0,startColumn:0,endRow:Math.min(a,o.height)-1,endColumn:Math.min(l,o.width)-1};e=c1(e,c,i);const u=t[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(e,o,u,r,i);if(this.editor.plugins.get("TableSelection").isEnabled){const h=s.sortRanges(d.map(f=>i.createRangeOn(f)));i.setSelection(h)}else i.setSelection(d[0],0);return u}_replaceSelectedCellsWithPasted(e,t,i,s,o){const{width:r,height:a}=t,l=HR(e,r,a),c=[...new j(i,{startRow:s.firstRow,endRow:s.lastRow,startColumn:s.firstColumn,endColumn:s.lastColumn,includeAllSlots:!0})],u=[];let d;for(const _ of c){const{row:k,column:A}=_;A===s.firstColumn&&(d=_.getPositionBefore());const F=k-s.firstRow,U=A-s.firstColumn,Y=l[F%a][U%r],x=Y?o.cloneElement(Y):null,v=this._replaceTableSlotCell(_,x,d,o);v&&(m1(v,k,A,s.lastRow,s.lastColumn,o),u.push(v),d=o.createPositionAfter(v))}const h=parseInt(i.getAttribute("headingRows")||"0"),f=parseInt(i.getAttribute("headingColumns")||"0"),m=s.firstRow<h&&h<=s.lastRow,p=s.firstColumn<f&&f<=s.lastColumn;if(m){const _={first:s.firstColumn,last:s.lastColumn},k=Ba(i,h,_,o,s.firstRow);u.push(...k)}if(p){const _={first:s.firstRow,last:s.lastRow},k=Ma(i,f,_,o);u.push(...k)}return u}_replaceTableSlotCell(e,t,i,s){const{cell:o,isAnchor:r}=e;return r&&s.remove(o),t?(s.insert(t,i),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);const i=t.createRangeIn(e);for(const s of i.getItems())if(s.is("element","table")){const o=t.createRange(i.start,t.createPositionBefore(s));if(t.hasContent(o,{ignoreWhitespaces:!0}))return null;const r=t.createRange(t.createPositionAfter(s),i.end);return t.hasContent(r,{ignoreWhitespaces:!0})?null:s}return null}}function NR(n,e,t,i){const s=n[0].findAncestor("table"),o=i.getColumnIndexes(n),r=i.getRowIndexes(n),a={firstColumn:o.first,lastColumn:o.last,firstRow:r.first,lastRow:r.last},l=n.length===1;return l&&(a.lastRow+=e.height-1,a.lastColumn+=e.width-1,$R(s,a.lastRow+1,a.lastColumn+1,i)),l||!i.isSelectionRectangular(n)?zR(s,a,t):(a.lastRow=g1(s,a),a.lastColumn=p1(s,a)),a}function $R(n,e,t,i){const s=i.getColumns(n),o=i.getRows(n);t>s&&i.insertColumns(n,{at:s,columns:t-s}),e>o&&i.insertRows(n,{at:o,rows:e-o})}function HR(n,e,t){const i=new Array(t).fill(null).map(()=>new Array(e).fill(null));for(const{column:s,row:o,cell:r}of new j(n))i[o][s]=r;return i}function zR(n,e,t){const{firstRow:i,lastRow:s,firstColumn:o,lastColumn:r}=e,a={first:i,last:s},l={first:o,last:r};Ma(n,o,a,t),Ma(n,r+1,a,t),Ba(n,i,l,t),Ba(n,s+1,l,t,i)}function Ba(n,e,t,i,s=0){return e<1?void 0:u1(n,e,s).filter(({column:a,cellWidth:l})=>b1(a,l,t)).map(({cell:a})=>d1(a,e,i))}function Ma(n,e,t,i){return e<1?void 0:h1(n,e).filter(({row:r,cellHeight:a})=>b1(r,a,t)).map(({cell:r,column:a})=>f1(r,a,e,i))}function b1(n,e,t){const i=n+e-1,{first:s,last:o}=t,r=n>=s&&n<=o,a=n<s&&i>=s;return r||a}/**
|
|
1443
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1444
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1445
|
-
*/class UR extends w{static get pluginName(){return"TableKeyboard"}static get requires(){return[ri,ve]}init(){const e=this.editor,i=e.editing.view.document,s=e.t;this.listenTo(i,"arrowKey",(...o)=>this._onArrowKey(...o),{context:"table"}),this.listenTo(i,"tab",(...o)=>this._handleTabOnSelectedTable(...o),{context:"figure"}),this.listenTo(i,"tab",(...o)=>this._handleTab(...o),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:s("Keystrokes that can be used in a table cell"),keystrokes:[{label:s("Move the selection to the next cell"),keystroke:"Tab"},{label:s("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:s("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:s("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const i=this.editor,o=i.model.document.selection.getSelectedElement();!o||!o.is("element","table")||(t.preventDefault(),t.stopPropagation(),e.stop(),i.model.change(r=>{r.setSelection(r.createRangeIn(o.getChild(0).getChild(0)))}))}_handleTab(e,t){const i=this.editor,s=this.editor.plugins.get(ve),o=this.editor.plugins.get("TableSelection"),r=i.model.document.selection,a=!t.shiftKey;let l=s.getTableCellsContainingSelection(r)[0];if(l||(l=o.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();const c=l.parent,u=c.parent,d=u.getChildIndex(c),h=c.getChildIndex(l),f=h===0;if(!a&&f&&d===0){i.model.change(k=>{k.setSelection(k.createRangeOn(u))});return}const m=h===c.childCount-1,p=d===s.getRows(u)-1;if(a&&p&&m&&(i.execute("insertTableRowBelow"),d===s.getRows(u)-1)){i.model.change(k=>{k.setSelection(k.createRangeOn(u))});return}let _;if(a&&m)_=u.getChild(d+1).getChild(0);else if(!a&&f){const k=u.getChild(d-1);_=k.getChild(k.childCount-1)}else _=c.getChild(h+(a?1:-1));i.model.change(k=>{k.setSelection(k.createRangeIn(_))})}_onArrowKey(e,t){const i=this.editor,s=t.keyCode,o=ol(s,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.plugins.get(ve),s=this.editor.plugins.get("TableSelection"),o=this.editor.model,r=o.document.selection,a=["right","down"].includes(e),l=i.getSelectedTableCells(r);if(l.length){let u;return t?u=s.getFocusCell():u=a?l[l.length-1]:l[0],this._navigateFromCellInDirection(u,e,t),!0}const c=r.focus.findAncestor("tableCell");/* istanbul ignore if: paranoid check -- @preserve */if(!c)return!1;if(!r.isCollapsed)if(t){if(r.isBackward==a&&!r.containsEntireContent(c))return!1}else{const u=r.getSelectedElement();if(!u||!o.schema.isObject(u))return!1}return this._isSelectionAtCellEdge(r,c,a)?(this._navigateFromCellInDirection(c,e,t),!0):!1}_isSelectionAtCellEdge(e,t,i){const s=this.editor.model,o=this.editor.model.schema,r=i?e.getLastPosition():e.getFirstPosition();if(!o.getLimitElement(r).is("element","tableCell"))return s.createPositionAt(t,i?"end":0).isTouching(r);const a=s.createSelection(r);return s.modifySelection(a,{direction:i?"forward":"backward"}),r.isEqual(a.focus)}_navigateFromCellInDirection(e,t,i=!1){const s=this.editor.model,o=e.findAncestor("table"),r=[...new j(o,{includeAllSlots:!0})],{row:a,column:l}=r[r.length-1],c=r.find(({cell:A})=>A==e);let{row:u,column:d}=c;switch(t){case"left":d--;break;case"up":u--;break;case"right":d+=c.cellWidth;break;case"down":u+=c.cellHeight;break}const h=u<0||u>a,f=d<0&&u<=0,m=d>l&&u>=a;if(h||f||m){s.change(A=>{A.setSelection(A.createRangeOn(o))});return}d<0?(d=i?0:l,u--):d>l&&(d=i?l:0,u++);const p=r.find(A=>A.row==u&&A.column==d).cell,_=["right","down"].includes(t),k=this.editor.plugins.get("TableSelection");if(i&&k.isEnabled){const A=k.getAnchorCell()||e;k.setCellSelection(A,p)}else{const A=s.createPositionAt(p,_?0:"end");s.change(F=>{F.setSelection(A)})}}}/**
|
|
1446
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1447
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1448
|
-
*/class WR extends zt{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
1449
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1450
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1451
|
-
*/class qR extends w{static get pluginName(){return"TableMouse"}static get requires(){return[ri,ve]}init(){this.editor.editing.view.addObserver(WR),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(ve);let i=!1;const s=e.plugins.get(ri);this.listenTo(e.editing.view.document,"mousedown",(o,r)=>{const a=e.model.document.selection;if(!this.isEnabled||!s.isEnabled||!r.domEvent.shiftKey)return;const l=s.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;const c=this._getModelTableCellFromDomEvent(r);c&&fh(l,c)&&(i=!0,s.setCellSelection(l,c),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1}),this.listenTo(e.editing.view.document,"selectionChange",o=>{i&&o.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,i,s=!1,o=!1;const r=e.plugins.get(ri);this.listenTo(e.editing.view.document,"mousedown",(a,l)=>{!this.isEnabled||!r.isEnabled||l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l))}),this.listenTo(e.editing.view.document,"mousemove",(a,l)=>{if(!l.domEvent.buttons||!t)return;const c=this._getModelTableCellFromDomEvent(l);c&&fh(t,c)&&(i=c,!s&&i!=t&&(s=!0)),s&&(o=!0,r.setCellSelection(t,i),l.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{s=!1,o=!1,t=null,i=null}),this.listenTo(e.editing.view.document,"selectionChange",a=>{o&&a.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}}function fh(n,e){return n.parent.parent==e.parent.parent}/**
|
|
1452
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1453
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1454
|
-
*/class _1 extends w{static get requires(){return[VR,OR,ri,qR,UR,DR,Ei]}static get pluginName(){return"Table"}}/**
|
|
1455
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1456
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1457
|
-
*/class jR extends w{static get pluginName(){return"PlainTableOutput"}static get requires(){return[_1]}init(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:GR,converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:i})=>{if(t.parent.name==="table")return i.createContainerElement("caption")},converterPriority:"high"}),e.plugins.has("TableProperties")&&KR(e)}}function GR(n,{writer:e}){const t=n.getAttribute("headingRows")||0,i=e.createSlot(c=>c.is("element","tableRow")&&c.index<t),s=e.createSlot(c=>c.is("element","tableRow")&&c.index>=t),o=e.createSlot(c=>!c.is("element","tableRow")),r=e.createContainerElement("thead",null,i),a=e.createContainerElement("tbody",null,s),l=[];return t&&l.push(r),t<n.childCount&&l.push(a),e.createContainerElement("table",null,[o,...l])}function KR(n){const e={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[t,i]of Object.entries(e))n.conversion.for("dataDowncast").add(s=>s.on(`attribute:${i}:table`,(o,r,a)=>{const{item:l,attributeNewValue:c}=r,{mapper:u,writer:d}=a;if(!a.consumable.consume(l,o.name))return;const h=u.toViewElement(l);c?d.setStyle(t,c,h):d.removeStyle(t,h)},{priority:"high"}))}/**
|
|
1458
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1459
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1460
|
-
*/function ZR(n){const e=n.getSelectedElement();return e&&v1(e)?e:null}function JR(n){const e=n.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&v1(t))return t;t=t.parent}return null}function v1(n){return!!n.getCustomProperty("table")&&ce(n)}/**
|
|
1461
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1462
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1463
|
-
*/class YR extends w{static get requires(){return[To]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(To),s=e.config.get("table.contentToolbar"),o=e.config.get("table.tableToolbar");s&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:s,getRelatedElement:JR}),o&&i.register("table",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:ZR})}}/**
|
|
1464
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1465
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1466
|
-
*/const Jt=ke.defaultPositions;Jt.northArrowSouth,Jt.northArrowSouthWest,Jt.northArrowSouthEast,Jt.southArrowNorth,Jt.southArrowNorthWest,Jt.southArrowNorthEast,Jt.viewportStickyNorth;/**
|
|
1467
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1468
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1469
|
-
*/function QR(n){const e=[{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:"tr",isVoid:!1},{name:"ul",isVoid:!1}],t=e.map(r=>r.name).join("|"),i=n.replace(new RegExp(`</?(${t})( .*?)?>`,"g"),`
|
|
1470
|
-
$&
|
|
1471
|
-
`).replace(/<br[^>]*>/g,`$&
|
|
1472
|
-
`).split(`
|
|
1473
|
-
`);let s=0,o=!1;return i.filter(r=>r.length).map(r=>(o=tV(r,o),XR(r,e)?Or(r,s++):eV(r,e)?Or(r,--s):o==="middle"||o==="last"?r:Or(r,s))).join(`
|
|
1474
|
-
`)}function XR(n,e){return e.some(t=>!(t.isVoid||!new RegExp(`<${t.name}( .*?)?>`).test(n)))}function eV(n,e){return e.some(t=>new RegExp(`</${t.name}>`).test(n))}function Or(n,e,t=" "){return`${t.repeat(Math.max(0,e))}${n}`}function tV(n,e){return new RegExp("<pre( .*?)?>").test(n)?"first":new RegExp("</pre>").test(n)?"last":e==="first"||e==="middle"?"middle":!1}const iV='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 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.692L3 1.5z"/><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-3.5-2.5V9.14l3.496-2.5zm4.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.22l-3.496 2.5zm7.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 0z"/></svg>';/**
|
|
1475
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1476
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1477
|
-
*/const Zs="SourceEditingMode";class nV extends w{static get pluginName(){return"SourceEditing"}static get requires(){return[_o]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new em,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",()=>{const i=this._createButton(V);return i.set({label:t("Source"),icon:iV,tooltip:!0,class:"ck-source-editing-button"}),i}),e.ui.componentFactory.add("menuBar:sourceEditing",()=>{const i=this._createButton(he);return i.set({label:t("Show source")}),i}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(i,s,o)=>{o?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(i,s,o)=>this._handleReadOnlyMode(!o)),this.listenTo(e,"change:isReadOnly",(i,s,o)=>this._handleReadOnlyMode(o))),e.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}updateEditorData(){const e=this.editor,t={};for(const[i,s]of this._replacedRoots){const o=this._dataFromRoots.get(i),r=s.dataset.value;o!==r&&(t[i]=r,this._dataFromRoots.set(i,r))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){const e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new g("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some(s=>e.plugins.has(s))&&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(){const e=this.editor,t=e.editing.view,i=e.model;i.change(s=>{s.setSelection(null),s.removeSelectionAttribute(i.document.selection.getAttributeKeys())});for(const[s,o]of t.domRoots){const r=sV(e.data.get({rootName:s})),a=Fe(o.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),l=Fe(o.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[a]);a.value=r,a.setSelectionRange(0,0),a.addEventListener("input",()=>{l.dataset.value=a.value,e.ui.update()}),t.change(c=>{const u=t.document.getRoot(s);c.addClass("ck-hidden",u)}),e.ui.setEditableElement("sourceEditing:"+s,a),this._replacedRoots.set(s,l),this._elementReplacer.replace(o,l),this._dataFromRoots.set(s,r)}this._focusSourceEditing()}_hideSourceEditing(){const t=this.editor.editing.view;this.updateEditorData(),t.change(i=>{for(const[s]of this._replacedRoots)i.removeClass("ck-hidden",t.document.getRoot(s))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),t.focus()}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=!1,i.focus()}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(Zs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(Zs)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(Zs);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(Zs)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){const t=this.editor.ui.view.editable;return t&&!t.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){const e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){const t=this.editor,i=new e(t.locale);return i.set({withText:!0}),i.bind("isOn").to(this,"isSourceEditingMode"),i.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(_o),"hasAny",(s,o,r)=>!(!s||o||r)),this.listenTo(i,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),i}}function sV(n){return oV(n)?QR(n):n}function oV(n){return n.startsWith("<")}/**
|
|
1478
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1479
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1480
|
-
*/function mi(n,e,t,i){e&&rV(n,e,i),t&&mt(n,t,i)}function mt(n,e,t){if(e.attributes)for(const[i,s]of Object.entries(e.attributes))n.setAttribute(i,s,t);e.styles&&n.setStyle(e.styles,t),e.classes&&n.addClass(e.classes,t)}function rV(n,e,t){if(e.attributes)for(const[i]of Object.entries(e.attributes))n.removeAttribute(i,t);if(e.styles)for(const i of Object.keys(e.styles))n.removeStyle(i,t);e.classes&&n.removeClass(e.classes,t)}function aV(n,e){const t=Ye(n);let i="attributes";for(i in e)i=="classes"?t[i]=Array.from(new Set([...n[i]||[],...e[i]])):t[i]={...n[i],...e[i]};return t}function Li(n,e,t,i,s){const o=e.getAttribute(t),r={};for(const a of["attributes","styles","classes"]){if(a!=i){o&&o[a]&&(r[a]=o[a]);continue}if(i=="classes"){const c=new Set(o&&o.classes||[]);s(c),c.size&&(r[a]=Array.from(c));continue}const l=new Map(Object.entries(o&&o[a]||{}));s(l),l.size&&(r[a]=Object.fromEntries(l))}Object.keys(r).length?e.is("documentSelection")?n.setSelectionAttribute(t,r):n.setAttribute(t,r,e):o&&(e.is("documentSelection")?n.removeSelectionAttribute(t):n.removeAttribute(t,e))}function lV(n){return i2(n).replace(/ /g,"")}function Ge(n){return`html${lV(n)}Attributes`}/**
|
|
1481
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1482
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1483
|
-
*/function Ml({model:n}){return(e,t)=>t.writer.createElement(n,{htmlContent:e.getCustomProperty("$rawContent")})}function cV(n,{view:e,isInline:t}){const i=n.t;return(s,{writer:o})=>{const r=i("HTML object"),a=ir(e,s,o),l=s.getAttribute(Ge(e));o.addClass("html-object-embed__content",a),l&&mt(o,l,a);const c=o.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":r},a);return mn(c,o,{label:r})}}function ir(n,e,t){return t.createRawElement(n,null,(i,s)=>{s.setContentOf(i,e.getAttribute("htmlContent"))})}function uV({view:n,model:e,allowEmpty:t},i){return o=>{o.on(`element:${n}`,(r,a,l)=>{let c=i.processViewAttributes(a.viewItem,l);if(!(!c&&!l.consumable.test(a.viewItem,{name:!0}))){if(c=c||{},l.consumable.consume(a.viewItem,{name:!0}),a.modelRange||(a=Object.assign(a,l.convertChildren(a.viewItem,a.modelCursor))),t&&a.modelRange.isCollapsed&&Object.keys(c).length){const u=l.writer.createElement("htmlEmptyElement");if(!l.safeInsert(u,a.modelCursor))return;const d=l.getSplitParts(u);a.modelRange=l.writer.createRange(a.modelRange.start,l.writer.createPositionAfter(d[d.length-1])),l.updateConversionResult(u,a),s(u,c,l);return}for(const u of a.modelRange.getItems())s(u,c,l)}},{priority:"low"})};function s(o,r,a){if(a.schema.checkAttribute(o,e)){const l=o.getAttribute(e),c=aV(r,l||{});a.writer.setAttribute(e,c,o)}}}function mh({model:n,view:e},t){return(i,{writer:s,consumable:o})=>{if(!i.hasAttribute(n))return null;const r=s.createContainerElement(e),a=i.getAttribute(n);return o.consume(i,`attribute:${n}`),mt(s,a,r),r.getFillerOffset=()=>null,t?mn(r,s):r}}function dV({priority:n,view:e}){return(t,i)=>{if(!t)return;const{writer:s}=i,o=s.createAttributeElement(e,null,{priority:n});return mt(s,t,o),o}}function os({view:n},e){return t=>{t.on(`element:${n}`,(i,s,o)=>{if(!s.modelRange||s.modelRange.isCollapsed)return;const r=e.processViewAttributes(s.viewItem,o);r&&o.writer.setAttribute(Ge(s.viewItem.name),r,s.modelRange)},{priority:"low"})}}function rs({view:n,model:e}){return t=>{t.on(`attribute:${Ge(n)}:${e}`,(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const{attributeOldValue:r,attributeNewValue:a}=s,l=o.writer,c=o.mapper.toViewElement(s.item);mi(l,r,a,c)})}}/**
|
|
1484
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1485
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1486
|
-
*/const gh={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref"},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]};/**
|
|
1487
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1488
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1489
|
-
*/class nn extends w{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const e of gh.block)this.registerBlockElement(e);for(const e of gh.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){const i=new Set;for(const s of this._getMatchingViewDefinitions(e)){if(t)for(const o of this._getReferences(s.model))i.add(o);i.add(s)}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&hV(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(s=>s.model==e);for(const{modelSchema:s}of i)if(s)for(const o of t)for(const r of z(s[o]||[])){const a=this._definitions.filter(l=>l.model==r);for(const l of a)r!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,i])=>i.model==e.model);if(t.length==0){this._definitions.push(e);return}for(const[i,s]of t)this._definitions[i]=qk({},s,e,(o,r)=>Array.isArray(o)?o.concat(r):void 0)}}function hV(n,e){return typeof n=="string"?n===e:n instanceof RegExp?n.test(e):!1}/**
|
|
1490
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1491
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1492
|
-
*/class de extends w{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new Nt,this._disallowedAttributes=new Nt,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return"DataFilter"}static get requires(){return[nn,Ei]}loadAllowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=wh(t);this.allowElement(i),s.forEach(o=>this.allowAttributes(o))}}loadDisallowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=wh(t);s.length==0?this.disallowElement(i):s.forEach(o=>this.disallowAttributes(o))}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t)}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){const{consumable:i}=t;return ph(e,this._disallowedAttributes,i),fV(e,ph(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:$e.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:$e.highest+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else if(t.isInline)this._registerInlineElement(t);else throw new g("data-filter-invalid-definition",null,t);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(i=>{const s=e.document.differ.getChanges();let o=!1;const r=this._getCoupledAttributesMap();for(const a of s){if(a.type!="attribute"||a.attributeNewValue!==null)continue;const l=r.get(a.attributeKey);if(l)for(const{item:c}of a.range.getWalker())for(const u of l)c.hasAttribute(u)&&(i.removeAttribute(u,c),o=!0)}return o}),this.listenTo(t,"change:attribute",(i,{attributeKeys:s})=>{const o=new Set,r=this._getCoupledAttributesMap();for(const a of s){if(t.hasAttribute(a))continue;const l=r.get(a);if(l)for(const c of l)t.hasAttribute(c)&&o.add(c)}o.size!=0&&e.change(a=>{for(const l of o)a.removeSelectionAttribute(l)})})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let s=!1;for(const o of i)if(!(o.type!=="insert"||o.name==="$text"))for(const r of o.attributes.keys())!r.startsWith("html")||!r.endsWith("Attributes")||e.schema.checkAttribute(o.name,r)||(t.removeAttribute(r,o.position.nodeAfter),s=!0);return s})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,{view:o,model:r}=e;i.register(r,e.modelSchema);/* istanbul ignore next: paranoid check -- @preserve */o&&(i.extend(e.model,{allowAttributes:[Ge(o),"htmlContent"]}),t.data.registerRawContentMatcher({name:o}),s.for("upcast").elementToElement({view:o,model:Ml(e),converterPriority:$e.low+2}),s.for("upcast").add(os(e,this)),s.for("editingDowncast").elementToStructure({model:{name:r,attributes:[Ge(o)]},view:cV(t,e)}),s.for("dataDowncast").elementToElement({model:r,view:(a,{writer:l})=>ir(o,a,l)}),s.for("dataDowncast").add(rs(e)))}_registerBlockElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,{view:o,model:r}=e;if(!i.isRegistered(e.model)){if(i.register(e.model,e.modelSchema),!o)return;s.for("upcast").elementToElement({model:r,view:o,converterPriority:$e.low+2}),s.for("downcast").elementToElement({model:r,view:o})}o&&(i.extend(e.model,{allowAttributes:Ge(o)}),s.for("upcast").add(os(e,this)),s.for("downcast").add(rs(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,o=e.model;e.appliesToBlock||(i.extend("$text",{allowAttributes:o}),e.attributeProperties&&i.setAttributeProperties(o,e.attributeProperties),s.for("upcast").add(uV(e,this)),s.for("downcast").attributeToElement({model:o,view:dV(e)}),e.allowEmpty&&(i.setAttributeProperties(o,{copyFromObject:!1}),i.isRegistered("htmlEmptyElement")||i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"}),t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(r=>r.name==e.view&&r.isEmpty&&Array.from(r.getAttributeKeys()).length?{name:!0}:null),s.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:mh(e,!0)}),s.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:mh(e)})))}}function ph(n,e,t){const i=e.matchAll(n)||[],s=n.document.stylesProcessor;return i.reduce((o,{match:r})=>{for(const a of r.styles||[]){const l=s.getRelatedStyles(a).filter(c=>c.split("-").length>a.split("-").length).sort((c,u)=>u.split("-").length-c.split("-").length);for(const c of l)t.consume(n,{styles:[c]})&&o.styles.push(c);t.consume(n,{styles:[a]})&&o.styles.push(a)}for(const a of r.classes||[])t.consume(n,{classes:[a]})&&o.classes.push(a);for(const a of r.attributes||[])t.consume(n,{attributes:[a]})&&o.attributes.push(a);return o},{attributes:[],classes:[],styles:[]})}function fV(n,{attributes:e,classes:t,styles:i}){return!e.length&&!t.length&&!i.length?null:{...e.length&&{attributes:mV(n,e)},...i.length&&{styles:gV(n,i)},...t.length&&{classes:t}}}function mV(n,e){const t={};for(const i of e){const s=n.getAttribute(i);s!==void 0&&lm(i)&&(t[i]=s)}return t}function gV(n,e){const t=new po(n.document.stylesProcessor);for(const i of e){const s=n.getStyle(i);s!==void 0&&t.set(i,s)}return Object.fromEntries(t.getStylesEntries())}function Fr(n,e){const{name:t}=n,i=n[e];return Ve(i)?Object.entries(i).map(([s,o])=>({name:t,[e]:{[s]:o}})):Array.isArray(i)?i.map(s=>({name:t,[e]:[s]})):[n]}function wh(n){const{name:e,attributes:t,classes:i,styles:s}=n,o=[];return t&&o.push(...Fr({name:e,attributes:t},"attributes")),i&&o.push(...Fr({name:e,classes:i},"classes")),s&&o.push(...Fr({name:e,styles:s},"styles")),o}/**
|
|
1493
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1494
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1495
|
-
*/class pV extends w{static get requires(){return[de]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(de);e.on("register:pre",(t,i)=>{if(i.model!=="codeBlock")return;const s=this.editor,o=s.model.schema,r=s.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),r.for("upcast").add(wV(e)),r.for("downcast").add(bV()),t.stop()})}}function wV(n){return e=>{e.on("element:code",(t,i,s)=>{const o=i.viewItem,r=o.parent;if(!r||!r.is("element","pre"))return;a(r,"htmlPreAttributes"),a(o,"htmlContentAttributes");function a(l,c){const u=n.processViewAttributes(l,s);u&&s.writer.setAttribute(c,u,i.modelRange)}},{priority:"low"})}}function bV(){return n=>{n.on("attribute:htmlPreAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:s,attributeNewValue:o}=t,a=i.mapper.toViewElement(t.item).parent;mi(i.writer,s,o,a)}),n.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:s,attributeNewValue:o}=t,r=i.mapper.toViewElement(t.item);mi(i.writer,s,o,r)})}}/**
|
|
1496
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1497
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1498
|
-
*/class _V extends w{static get requires(){return[de]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(de).on("register",(t,i)=>{const s=i,o=this.editor,r=o.model.schema,a=o.conversion;if(!s.paragraphLikeModel||r.isRegistered(s.model)||r.isRegistered(s.paragraphLikeModel))return;const l={model:s.paragraphLikeModel,view:s.view};r.register(s.model,s.modelSchema),r.register(l.model,{inheritAllFrom:"$block"}),a.for("upcast").elementToElement({view:s.view,model:(c,{writer:u})=>this._hasBlockContent(c)?u.createElement(s.model):u.createElement(l.model),converterPriority:$e.low+.5}),a.for("downcast").elementToElement({view:s.view,model:s.model}),this._addAttributeConversion(s),a.for("downcast").elementToElement({view:l.view,model:l.model}),this._addAttributeConversion(l),t.stop()})}_hasBlockContent(e){const t=this.editor.editing.view,i=t.domConverter.blockElements;for(const s of t.createRangeIn(e).getItems())if(s.is("element")&&i.includes(s.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,i=t.conversion,s=t.plugins.get(de);t.model.schema.extend(e.model,{allowAttributes:Ge(e.view)}),i.for("upcast").add(os(e,s)),i.for("downcast").add(rs(e))}}/**
|
|
1499
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1500
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1501
|
-
*/class vV extends w{static get requires(){return[nn,vs]}static get pluginName(){return"HeadingElementSupport"}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){const i=e.plugins.get(nn),s=[];for(const o of t)"model"in o&&"view"in o&&(i.registerBlockElement({view:o.view,model:o.model}),s.push(o.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:s}})}}/**
|
|
1502
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1503
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1504
|
-
*/function Ro(n,e,t){const i=n.createRangeOn(e);for(const{item:s}of i.getWalker())if(s.is("element",t))return s}/**
|
|
1505
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1506
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1507
|
-
*/class yV extends w{static get requires(){return[de]}static get pluginName(){return"ImageElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(de);s.on("register:figure",()=>{i.for("upcast").add(EV(s))}),s.on("register:img",(o,r)=>{r.model!=="imageBlock"&&r.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(kV(s)),i.for("downcast").add(TV()),e.plugins.has("LinkImage")&&i.for("upcast").add(CV(s,e)),o.stop())})}}function kV(n){return e=>{e.on("element:img",(t,i,s)=>{if(!i.modelRange)return;const o=i.viewItem,r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlImgAttributes",r,i.modelRange)},{priority:"low"})}}function CV(n,e){const t=e.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,o,r)=>{const a=o.viewItem;if(!t.findViewImgElement(a))return;const c=o.modelCursor.parent;if(!c.is("element","imageBlock"))return;const u=n.processViewAttributes(a,r);u&&r.writer.setAttribute("htmlLinkAttributes",u,c)},{priority:"low"})}}function EV(n){return e=>{e.on("element:figure",(t,i,s)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("image"))return;const r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function TV(){return n=>{e("htmlImgAttributes"),t("img","htmlImgAttributes"),t("figure","htmlFigureAttributes"),t("a","htmlLinkAttributes");function e(i){n.on(`attribute:${i}:imageInline`,(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const{attributeOldValue:a,attributeNewValue:l}=o,c=r.mapper.toViewElement(o.item);mi(r.writer,a,l,c)},{priority:"low"})}function t(i,s){n.on(`attribute:${s}:imageBlock`,(o,r,a)=>{if(!a.consumable.test(r.item,o.name))return;const{attributeOldValue:l,attributeNewValue:c}=r,u=a.mapper.toViewElement(r.item),d=Ro(a.writer,u,i);d&&(mi(a.writer,l,c,d),a.consumable.consume(r.item,o.name))},{priority:"low"}),i==="a"&&n.on("attribute:linkHref:imageBlock",(o,r,a)=>{if(!a.consumable.consume(r.item,"attribute:htmlLinkAttributes:imageBlock"))return;const l=a.mapper.toViewElement(r.item),c=Ro(a.writer,l,"a");mt(a.writer,r.item.getAttribute("htmlLinkAttributes"),c)},{priority:"low"})}}}/**
|
|
1508
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1509
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1510
|
-
*/class AV extends w{static get requires(){return[de]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,s=this.editor.plugins.get(de),o=this.editor.plugins.get(nn),r=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:r}),s.on("register:figure",()=>{i.for("upcast").add(xV(s))}),s.on(`register:${r}`,(a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:[Ge(r),"htmlFigureAttributes"]}),i.for("upcast").add(SV(s,r)),i.for("dataDowncast").add(IV(r)),a.stop())})}}function SV(n,e){const t=(i,s,o)=>{const r=s.viewItem;a(r,Ge(e));function a(l,c){const u=n.processViewAttributes(l,o);u&&o.writer.setAttribute(c,u,s.modelRange)}};return i=>{i.on(`element:${e}`,t,{priority:"low"})}}function xV(n){return e=>{e.on("element:figure",(t,i,s)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("media"))return;const r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function IV(n){return e=>{t(n,Ge(n)),t("figure","htmlFigureAttributes");function t(i,s){e.on(`attribute:${s}:media`,(o,r,a)=>{if(!a.consumable.consume(r.item,o.name))return;const{attributeOldValue:l,attributeNewValue:c}=r,u=a.mapper.toViewElement(r.item),d=Ro(a.writer,u,i);mi(a.writer,l,c,d)})}}}/**
|
|
1511
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1512
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1513
|
-
*/class PV extends w{static get requires(){return[de]}static get pluginName(){return"ScriptElementSupport"}init(){const e=this.editor.plugins.get(de);e.on("register:script",(t,i)=>{const s=this.editor,o=s.model.schema,r=s.conversion;o.register("htmlScript",i.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),s.data.registerRawContentMatcher({name:"script"}),r.for("upcast").elementToElement({view:"script",model:Ml(i)}),r.for("upcast").add(os(i,e)),r.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>ir("script",a,l)}),r.for("downcast").add(rs(i)),t.stop()})}}/**
|
|
1514
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1515
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1516
|
-
*/class RV extends w{static get requires(){return[de]}static get pluginName(){return"TableElementSupport"}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(de),o=e.plugins.get("TableUtils");s.on("register:figure",()=>{i.for("upcast").add(MV(s))}),s.on("register:table",(r,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(BV(s)),i.for("downcast").add(LV()),e.model.document.registerPostFixer(VV(e.model,o)),r.stop())})}}function VV(n,e){return t=>{const i=n.document.differ.getChanges();let s=!1;for(const o of i){if(o.type!="attribute"||o.attributeKey!="headingRows")continue;const r=o.range.start.nodeAfter,a=r.getAttribute("htmlTheadAttributes"),l=r.getAttribute("htmlTbodyAttributes");a&&!o.attributeNewValue?(t.removeAttribute("htmlTheadAttributes",r),s=!0):l&&o.attributeNewValue==e.getRows(r)&&(t.removeAttribute("htmlTbodyAttributes",r),s=!0)}return s}}function BV(n){return e=>{e.on("element:table",(t,i,s)=>{if(!i.modelRange)return;const o=i.viewItem;r(o,"htmlTableAttributes");for(const a of o.getChildren())a.is("element","thead")&&r(a,"htmlTheadAttributes"),a.is("element","tbody")&&r(a,"htmlTbodyAttributes");function r(a,l){const c=n.processViewAttributes(a,s);c&&s.writer.setAttribute(l,c,i.modelRange)}},{priority:"low"})}}function MV(n){return e=>{e.on("element:figure",(t,i,s)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("table"))return;const r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function LV(){return n=>{e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes");function e(t,i){n.on(`attribute:${i}:table`,(s,o,r)=>{if(!r.consumable.test(o.item,s.name))return;const a=r.mapper.toViewElement(o.item),l=Ro(r.writer,a,t);l&&(r.consumable.consume(o.item,s.name),mi(r.writer,o.attributeOldValue,o.attributeNewValue,l))})}}}/**
|
|
1517
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1518
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1519
|
-
*/class OV extends w{static get requires(){return[de]}static get pluginName(){return"StyleElementSupport"}init(){const e=this.editor.plugins.get(de);e.on("register:style",(t,i)=>{const s=this.editor,o=s.model.schema,r=s.conversion;o.register("htmlStyle",i.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),s.data.registerRawContentMatcher({name:"style"}),r.for("upcast").elementToElement({view:"style",model:Ml(i)}),r.for("upcast").add(os(i,e)),r.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>ir("style",a,l)}),r.for("downcast").add(rs(i)),t.stop()})}}/**
|
|
1520
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1521
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1522
|
-
*/class FV extends w{static get requires(){return[de]}static get pluginName(){return"ListElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(de),o=e.plugins.get("ListEditing"),r=e.plugins.get("ListUtils"),a=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:mt}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:mt}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:mt}),s.on("register",(l,c)=>{if(!a.includes(c.view)||(l.stop(),t.checkAttribute("$block","htmlLiAttributes")))return;const u=a.map(d=>Ge(d));t.extend("$listItem",{allowAttributes:u}),i.for("upcast").add(d=>{d.on("element:ul",Dr("htmlUlAttributes",s),{priority:"low"}),d.on("element:ol",Dr("htmlOlAttributes",s),{priority:"low"}),d.on("element:li",Dr("htmlLiAttributes",s),{priority:"low"})})}),o.on("postFixer",(l,{listNodes:c,writer:u})=>{for(const{node:d,previousNodeInList:h}of c)if(h){if(h.getAttribute("listType")==d.getAttribute("listType")){const f=bh(h.getAttribute("listType")),m=h.getAttribute(f);!uo(d.getAttribute(f),m)&&u.model.schema.checkAttribute(d,f)&&(u.setAttribute(f,m,d),l.return=!0)}if(h.getAttribute("listItemId")==d.getAttribute("listItemId")){const f=h.getAttribute("htmlLiAttributes");!uo(d.getAttribute("htmlLiAttributes"),f)&&u.model.schema.checkAttribute(d,"htmlLiAttributes")&&(u.setAttribute("htmlLiAttributes",f,d),l.return=!0)}}}),o.on("postFixer",(l,{listNodes:c,writer:u})=>{for(const{node:d}of c){const h=d.getAttribute("listType");!r.isNumberedListType(h)&&d.getAttribute("htmlOlAttributes")&&(u.removeAttribute("htmlOlAttributes",d),l.return=!0),r.isNumberedListType(h)&&d.getAttribute("htmlUlAttributes")&&(u.removeAttribute("htmlUlAttributes",d),l.return=!0)}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(i,s)=>{e.model.change(o=>{for(const r of s){const a=bh(r.getAttribute("listType"));e.model.schema.checkAttribute(r,a)&&o.setAttribute(a,{},r)}})})}}function Dr(n,e){return(t,i,s)=>{const o=i.viewItem;i.modelRange||Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor));const r=e.processViewAttributes(o,s);for(const a of i.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(n)||s.writer.model.schema.checkAttribute(a,n)&&s.writer.setAttribute(n,r||{},a))}}function bh(n){return n==="numbered"||n=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}/**
|
|
1523
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1524
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1525
|
-
*/class DV extends w{static get requires(){return[de,nn]}static get pluginName(){return"CustomElementSupport"}init(){const e=this.editor.plugins.get(de),t=this.editor.plugins.get(nn);e.on("register:$customElement",(i,s)=>{i.stop();const o=this.editor,r=o.model.schema,a=o.conversion,l=o.editing.view.domConverter.unsafeElements,c=o.data.htmlProcessor.domConverter.preElements;r.register(s.model,s.modelSchema),r.extend(s.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),a.for("upcast").elementToElement({view:/.*/,model:(u,d)=>{if(u.name=="$comment"||!NV(u.name)||t.getDefinitionsForView(u.name).size)return null;l.includes(u.name)||l.push(u.name),c.includes(u.name)||c.push(u.name);const h=d.writer.createElement(s.model,{htmlElementName:u.name}),f=e.processViewAttributes(u,d);f&&d.writer.setAttribute("htmlCustomElementAttributes",f,h);let m;if(u.is("element","template")&&u.getCustomProperty("$rawContent"))m=u.getCustomProperty("$rawContent");else{const _=new vi(u.document).createDocumentFragment(u),k=o.data.htmlProcessor.domConverter.viewToDom(_),A=k.firstChild;for(;A.firstChild;)k.appendChild(A.firstChild);A.remove(),m=o.data.htmlProcessor.htmlWriter.getHtml(k)}d.writer.setAttribute("htmlContent",m,h);for(const{item:p}of o.editing.view.createRangeIn(u))d.consumable.consume(p,{name:!0});return h},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:s.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:d})=>{const h=u.getAttribute("htmlElementName"),f=d.createRawElement(h);return u.hasAttribute("htmlCustomElementAttributes")&&mt(d,u.getAttribute("htmlCustomElementAttributes"),f),f}}),a.for("dataDowncast").elementToElement({model:{name:s.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:d})=>{const h=u.getAttribute("htmlElementName"),f=u.getAttribute("htmlContent"),m=d.createRawElement(h,null,(p,_)=>{_.setContentOf(p,f)});return u.hasAttribute("htmlCustomElementAttributes")&&mt(d,u.getAttribute("htmlCustomElementAttributes"),m),m}})})}}function NV(n){try{document.createElement(n)}catch{return!1}return!0}/**
|
|
1526
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1527
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1528
|
-
*/class $V extends w{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[de,pV,_V,vV,yV,AV,PV,RV,OV,FV,DV]}init(){const e=this.editor,t=e.plugins.get(de);t.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(e){const t=this.editor.plugins.get("DataSchema"),i=Array.from(t.getDefinitionsForView(e,!1)),s=i.find(o=>o.isInline&&!i[0].isObject);return s?s.model:Ge(e)}addModelHtmlClass(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Oi(s,i,o))Li(r,a,o,"classes",l=>{for(const c of z(t))l.add(c)})})}removeModelHtmlClass(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Oi(s,i,o))Li(r,a,o,"classes",l=>{for(const c of z(t))l.delete(c)})})}setModelHtmlAttributes(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Oi(s,i,o))Li(r,a,o,"attributes",l=>{for(const[c,u]of Object.entries(t))l.set(c,u)})})}removeModelHtmlAttributes(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Oi(s,i,o))Li(r,a,o,"attributes",l=>{for(const c of z(t))l.delete(c)})})}setModelHtmlStyles(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Oi(s,i,o))Li(r,a,o,"styles",l=>{for(const[c,u]of Object.entries(t))l.set(c,u)})})}removeModelHtmlStyles(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Oi(s,i,o))Li(r,a,o,"styles",l=>{for(const c of z(t))l.delete(c)})})}}function*Oi(n,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)n.schema.checkAttributeInSelection(e,t)&&(yield e);else for(const i of HV(n,e,t))yield*i.getItems({shallow:!0})}function HV(n,e,t){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?n.schema.checkAttribute(e,t)?[n.createRangeOn(e)]:[]:n.schema.getValidRanges(n.createSelection(e).getRanges(),t)}/**
|
|
1529
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1530
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1531
|
-
*/class nr extends R{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,s=t.document.selection,o=e.value,r=e.batch,a=l=>{if(s.isCollapsed)o?l.setSelectionAttribute(this.attributeKey,o):l.removeSelectionAttribute(this.attributeKey);else{const c=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const u of c)o?l.setAttribute(this.attributeKey,o,u):l.removeAttribute(this.attributeKey,u)}};r?t.enqueueChange(r,l=>{a(l)}):t.change(l=>{a(l)})}}/**
|
|
1532
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1533
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1534
|
-
*/const Pe="fontSize",Re="fontFamily",ht="fontColor",Et="fontBackgroundColor";function y1(n,e){const t={model:{key:n,values:[]},view:{},upcastAlso:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]=i.view,i.upcastAlso&&(t.upcastAlso[i.model]=i.upcastAlso);return t}function k1(n){return e=>UV(e.getStyle(n))}function C1(n){return(e,{writer:t})=>t.createAttributeElement("span",{style:`${n}:${e}`},{priority:7})}function zV({dropdownView:n,colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a}){const l=n.locale,c=new Lg(l,{colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a});return n.colorSelectorView=c,n.panelView.children.add(c),c}function UV(n){return n.replace(/\s/g,"")}/**
|
|
1535
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1536
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1537
|
-
*/class WV extends nr{constructor(e){super(e,Re)}}/**
|
|
1538
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1539
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1540
|
-
*/function E1(n){return n.map(qV).filter(e=>e!==void 0)}function qV(n){if(typeof n=="object")return n;if(n==="default")return{title:"Default",model:void 0};if(typeof n=="string")return jV(n)}function jV(n){const e=n.replace(/"|'/g,"").split(","),t=e[0],i=e.map(GV).join(", ");return{title:t,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}function GV(n){return n=n.trim(),n.indexOf(" ")>0&&(n=`'${n}'`),n}/**
|
|
1541
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1542
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1543
|
-
*/class KV extends w{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(Re,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Re}),e.model.schema.setAttributeProperties(Re,{isFormatting:!0,copyOnEnter:!0});const t=E1(e.config.get("fontFamily.options")).filter(s=>s.model),i=y1(Re,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(Re,new WV(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:Re,view:(t,{writer:i})=>i.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:Re,value:t=>t.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:Re,value:t=>t.getAttribute("face")}})}}const _h='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';/**
|
|
1544
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1545
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1546
|
-
*/class ZV extends w{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(Re),o=t("Font Family"),r=JV(i,s);e.ui.componentFactory.add(Re,a=>{const l=ge(a);return yi(l,r,{role:"menu",ariaLabel:o}),l.buttonView.set({label:o,icon:_h,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),l.bind("isEnabled").to(s),this.listenTo(l,"execute",c=>{e.execute(c.source.commandName,{value:c.source.commandParam}),e.editing.view.focus()}),l}),e.ui.componentFactory.add(`menuBar:${Re}`,a=>{const l=new Oe(a);l.buttonView.set({label:o,icon:_h}),l.bind("isEnabled").to(s);const c=new hi(a);for(const u of r){const d=new Ci(a,l),h=new he(a);h.bind(...Object.keys(u.model)).to(u.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",()=>{e.execute(u.model.commandName,{value:u.model.commandParam}),e.editing.view.focus()}),d.children.add(h),c.items.add(d)}return l.panelView.children.add(c),l})}_getLocalizedOptions(){const e=this.editor,t=e.t;return E1(e.config.get(Re).options).map(s=>(s.title==="Default"&&(s.title=t("Default")),s))}}function JV(n,e){const t=new Ce;for(const i of n){const s={type:"button",model:new ki({commandName:Re,commandParam:i.model,label:i.title,role:"menuitemradio",withText:!0})};s.model.bind("isOn").to(e,"value",o=>o===i.model?!0:!o||!i.model?!1:o.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase()),i.view&&typeof i.view!="string"&&i.view.styles&&s.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),t.add(s)}return t}/**
|
|
1547
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1548
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1549
|
-
*/class YV extends w{static get requires(){return[KV,ZV]}static get pluginName(){return"FontFamily"}}/**
|
|
1550
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1551
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1552
|
-
*/class QV extends nr{constructor(e){super(e,Pe)}}/**
|
|
1553
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1554
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1555
|
-
*/function Ll(n){return n.map(e=>XV(e)).filter(e=>e!==void 0)}const vh={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 XV(n){if(typeof n=="number"&&(n=String(n)),typeof n=="object"&&i8(n))return La(n);const e=t8(n);if(e)return La(e);if(n==="default")return{model:void 0,title:"Default"};if(!n8(n))return e8(n)}function e8(n){return typeof n=="string"&&(n={title:n,model:`${parseFloat(n)}px`}),n.view={name:"span",styles:{"font-size":n.model}},La(n)}function La(n){return n.view&&typeof n.view!="string"&&!n.view.priority&&(n.view.priority=7),n}function t8(n){return typeof n=="string"?vh[n]:vh[n.model]}function i8(n){return n.title&&n.model&&n.view}function n8(n){let e;if(typeof n=="object")if(n.model)e=parseFloat(n.model);else throw new g("font-size-invalid-definition",null,n);else e=parseFloat(n);return isNaN(e)}/**
|
|
1556
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1557
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1558
|
-
*/const yh=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class s8 extends w{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(Pe,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Pe}),e.model.schema.setAttributeProperties(Pe,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=Ll(this.editor.config.get("fontSize.options")).filter(o=>o.model),s=y1(Pe,i);t?(this._prepareAnyValueConverters(s),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(s),e.commands.add(Pe,new QV(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter(s=>!VT(String(s))&&!MT(String(s)));if(i.length)throw new g("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:Pe,view:(s,{writer:o})=>{if(s)return o.createAttributeElement("span",{style:"font-size:"+s},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:Pe,value:s=>s.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:Pe,value:t=>{const i=t.getAttribute("size"),s=i[0]==="-"||i[0]==="+";let o=parseInt(i,10);s&&(o=3+o);const r=yh.length-1,a=Math.min(Math.max(o,0),r);return yh[a]}}})}}const kh='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';/**
|
|
1559
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1560
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1561
|
-
*/class o8 extends w{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(Pe),o=t("Font Size"),r=r8(i,s);e.ui.componentFactory.add(Pe,a=>{const l=ge(a);return yi(l,r,{role:"menu",ariaLabel:o}),l.buttonView.set({label:o,icon:kh,tooltip:!0}),l.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),l.bind("isEnabled").to(s),this.listenTo(l,"execute",c=>{e.execute(c.source.commandName,{value:c.source.commandParam}),e.editing.view.focus()}),l}),e.ui.componentFactory.add(`menuBar:${Pe}`,a=>{const l=new Oe(a);l.buttonView.set({label:o,icon:kh}),l.bind("isEnabled").to(s);const c=new hi(a);for(const u of r){const d=new Ci(a,l),h=new he(a);h.bind(...Object.keys(u.model)).to(u.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",()=>{e.execute(u.model.commandName,{value:u.model.commandParam}),e.editing.view.focus()}),d.children.add(h),c.items.add(d)}return l.panelView.children.add(c),l})}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return Ll(e.config.get(Pe).options).map(o=>{const r=i[o.title];return r&&r!=o.title&&(o=Object.assign({},o,{title:r})),o})}}function r8(n,e){const t=new Ce;for(const i of n){const s={type:"button",model:new ki({commandName:Pe,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&typeof i.view!="string"&&(i.view.styles&&s.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view.classes&&s.model.set("class",`${s.model.class} ${i.view.classes}`)),s.model.bind("isOn").to(e,"value",o=>o===i.model),t.add(s)}return t}/**
|
|
1562
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1563
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1564
|
-
*/class a8 extends w{static get requires(){return[s8,o8]}static get pluginName(){return"FontSize"}normalizeSizeOptions(e){return Ll(e)}}/**
|
|
1565
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1566
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1567
|
-
*/class l8 extends nr{constructor(e){super(e,ht)}}/**
|
|
1568
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1569
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1570
|
-
*/class c8 extends w{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define(ht,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:ht,value:k1("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:ht,value:t=>t.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:ht,view:C1("color")}),e.commands.add(ht,new l8(e)),e.model.schema.extend("$text",{allowAttributes:ht}),e.model.schema.setAttributeProperties(ht,{isFormatting:!0,copyOnEnter:!0})}}/**
|
|
1571
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1572
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1573
|
-
*/class T1 extends w{constructor(e,{commandName:t,componentName:i,icon:s,dropdownLabel:o}){super(e),this.commandName=t,this.componentName=i,this.icon=s,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,i=t.t,s=e.commands.get(this.commandName),o=e.config.get(this.componentName),r=RS(o.colors),a=PS(t,r),l=o.documentColors,c=o.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,u=>{const d=ge(u);let h=!1;const f=zV({dropdownView:d,colors:a.map(m=>({label:m.label,color:m.model,options:{hasBorder:m.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:l!==0?i("Document colors"):"",documentColorsCount:l===void 0?this.columns:l,colorPickerViewConfig:c?o.colorPicker||{}:!1});return f.bind("selectedColor").to(s,"value"),d.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),d.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),d.bind("isEnabled").to(s),f.on("execute",(m,p)=>{d.isOpen&&e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),p.source!=="colorPicker"&&e.editing.view.focus(),p.source==="colorPickerSaveButton"&&(d.isOpen=!1)}),f.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),f.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(d.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),d.on("change:isOpen",(m,p,_)=>{h||(h=!0,d.colorSelectorView.appendUI()),_&&(l!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),Yo(d,()=>d.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(m=>m.isOn)),d}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,u=>{const d=new Oe(u);d.buttonView.set({label:this.dropdownLabel,icon:this.icon}),d.bind("isEnabled").to(s);let h=!1;const f=new Lg(u,{colors:a.map(m=>({label:m.label,color:m.model,options:{hasBorder:m.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:l!==0?i("Document colors"):"",documentColorsCount:l===void 0?this.columns:l,colorPickerViewConfig:!1});return f.bind("selectedColor").to(s,"value"),f.delegate("execute").to(d),f.on("execute",(m,p)=>{e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),e.editing.view.focus()}),d.on("change:isOpen",(m,p,_)=>{h||(h=!0,f.appendUI()),_&&(l!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),d.panelView.children.add(f),d})}}const u8='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>';/**
|
|
1574
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1575
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1576
|
-
*/class d8 extends T1{constructor(e){const t=e.locale.t;super(e,{commandName:ht,componentName:ht,icon:u8,dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}/**
|
|
1577
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1578
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1579
|
-
*/class h8 extends w{static get requires(){return[c8,d8]}static get pluginName(){return"FontColor"}}/**
|
|
1580
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1581
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1582
|
-
*/class f8 extends nr{constructor(e){super(e,Et)}}/**
|
|
1583
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1584
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1585
|
-
*/class m8 extends w{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define(Et,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(GT),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:Et,value:k1("background-color")}}),e.conversion.for("downcast").attributeToElement({model:Et,view:C1("background-color")}),e.commands.add(Et,new f8(e)),e.model.schema.extend("$text",{allowAttributes:Et}),e.model.schema.setAttributeProperties(Et,{isFormatting:!0,copyOnEnter:!0})}}const g8='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>';/**
|
|
1586
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1587
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1588
|
-
*/class p8 extends T1{constructor(e){const t=e.locale.t;super(e,{commandName:Et,componentName:Et,icon:g8,dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}/**
|
|
1589
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1590
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1591
|
-
*/class w8 extends w{static get requires(){return[m8,p8]}static get pluginName(){return"FontBackgroundColor"}}/**
|
|
1592
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1593
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1594
|
-
*/class b8 extends w{static get requires(){return[YV,a8,h8,w8]}static get pluginName(){return"Font"}}/**
|
|
1595
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1596
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1597
|
-
*/class _8 extends V{constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new T(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}/**
|
|
1598
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1599
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1600
|
-
*/class v8 extends T{constructor(e,t){super(e),this.focusTracker=new te,this.keystrokes=new oe,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const i of t){const s=new _8(e,i);this.children.add(s)}this.on("change:activeStyles",()=>{for(const i of this.children)i.isOn=this.activeStyles.includes(i.styleDefinition.name)}),this.on("change:enabledStyles",()=>{for(const i of this.children)i.isEnabled=this.enabledStyles.includes(i.styleDefinition.name)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);as({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}/**
|
|
1601
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1602
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1603
|
-
*/class Ch extends T{constructor(e,t,i){super(e),this.labelView=new un(e),this.labelView.text=t,this.gridView=new v8(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}/**
|
|
1604
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1605
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1606
|
-
*/class y8 extends T{constructor(e,t){super(e);const i=e.t;this.focusTracker=new te,this.keystrokes=new oe,this.children=this.createCollection(),this.blockStylesGroupView=new Ch(e,i("Block styles"),t.block),this.inlineStylesGroupView=new Ch(e,i("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new xe,this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),t.block.length&&this.children.add(this.blockStylesGroupView),t.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}/**
|
|
1607
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1608
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1609
|
-
*/const k8=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class Pt extends w{static get pluginName(){return"StyleUtils"}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const i={block:[],inline:[]};for(const s of t){const o=[],r=[];for(const l of e.getDefinitionsForView(s.element)){const c="appliesToBlock"in l?l.appliesToBlock:!1;if(l.isBlock||c){if(typeof c=="string")o.push(c);else if(l.isBlock){const u=l;o.push(l.model),u.paragraphLikeModel&&o.push(u.paragraphLikeModel)}}else r.push(l.model)}const a=this.getStylePreview(s,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);o.length?i.block.push({...s,previewTemplate:a,modelElements:o,isBlock:!0}):i.inline.push({...s,previewTemplate:a,ghsAttributes:r})}return i}isStyleEnabledForBlock(e,t){const i=this.editor.model,s=this._htmlSupport.getGhsAttributeNameForElement(e.element);return i.schema.checkAttribute(t,s)?e.modelElements.includes(t.name):!1}isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),s=t.getAttribute(i);return this.hasAllClasses(s,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const i=this.editor.model;for(const s of e.ghsAttributes)if(i.schema.checkAttributeInSelection(t,s))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const i of e.ghsAttributes){const s=this._getValueFromFirstAllowedNode(t,i);if(this.hasAllClasses(s,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:i,classes:s}=e;return{tag:E8(i)?i:"div",attributes:{class:s},children:t}}hasAllClasses(e,t){return Q(e)&&C8(e)&&t.every(i=>e.classes.includes(i))}configureGHSDataFilter({block:e,inline:t}){const i=this.editor.plugins.get("DataFilter");i.loadAllowedConfig(e.map(Eh)),i.loadAllowedConfig(t.map(Eh))}_getValueFromFirstAllowedNode(e,t){const s=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const o of e.getRanges())for(const r of o.getItems())if(s.checkAttribute(r,t))return r.getAttribute(t);return null}}function C8(n){return!!n.classes&&Array.isArray(n.classes)}function E8(n){return!k8.includes(n)}function Eh({element:n,classes:e}){return{name:n,classes:e}}/**
|
|
1610
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1611
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1612
|
-
*/class T8 extends w{static get pluginName(){return"StyleUI"}static get requires(){return[Pt]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),s=e.config.get("style.definitions"),o=i.normalizeConfig(t,s);e.ui.componentFactory.add("style",r=>{const a=r.t,l=ge(r),c=e.commands.get("style");return l.once("change:isOpen",()=>{const u=new y8(r,o);l.panelView.children.add(u),u.delegate("execute").to(l),u.bind("activeStyles").to(c,"value"),u.bind("enabledStyles").to(c,"enabledStyles")}),l.bind("isEnabled").to(c),l.buttonView.withText=!0,l.buttonView.bind("label").to(c,"value",u=>u.length>1?a("Multiple styles"):u.length===1?u[0]:a("Styles")),l.bind("class").to(c,"value",u=>{const d=["ck-style-dropdown"];return u.length>1&&d.push("ck-style-dropdown_multiple-active"),d.join(" ")}),l.on("execute",u=>{e.execute("style",{styleName:u.source.styleDefinition.name}),e.editing.view.focus()}),l})}}/**
|
|
1613
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1614
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1615
|
-
*/class A8 extends R{constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(Pt)}refresh(){const e=this.editor.model,t=e.document.selection,i=new Set,s=new Set;for(const r of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(r,t)&&s.add(r.name),this._styleUtils.isStyleActiveForInlineSelection(r,t)&&i.add(r.name);const o=J(t.getSelectedBlocks())||t.getFirstPosition().parent;if(o){const r=o.getAncestors({includeSelf:!0,parentFirst:!0});for(const a of r){if(a.is("rootElement"))break;for(const l of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(l,a)&&(s.add(l.name),this._styleUtils.isStyleActiveForBlock(l,a)&&i.add(l.name));if(e.schema.isObject(a))break}}this.enabledStyles=Array.from(s).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(i).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e)){D("style-command-executed-with-incorrect-style-name");return}const i=this.editor.model,s=i.document.selection,o=this.editor.plugins.get("GeneralHtmlSupport"),r=[...this._styleDefinitions.inline,...this._styleDefinitions.block],a=r.filter(({name:u})=>this.value.includes(u)),l=r.find(({name:u})=>u==e),c=t===void 0?!this.value.includes(l.name):t;i.change(()=>{let u;x8(l)?u=this._findAffectedBlocks(I8(s),l):u=[this._styleUtils.getAffectedInlineSelectable(l,s)];for(const d of u)c?o.addModelHtmlClass(l.element,l.classes,d):o.removeModelHtmlClass(l.element,S8(a,l),d)})}_findAffectedBlocks(e,t){const i=new Set;for(const s of e){const o=s.getAncestors({includeSelf:!0,parentFirst:!0});for(const r of o){if(r.is("rootElement"))break;const a=this._styleUtils.getAffectedBlocks(t,r);if(a){for(const l of a)i.add(l);break}}}return i}}function S8(n,e){return n.reduce((t,i)=>i.name===e.name?t:t.filter(s=>!i.classes.includes(s)),e.classes)}function x8(n){return"isBlock"in n}function I8(n){const e=Array.from(n.getSelectedBlocks());return e.length?e:[n.getFirstPosition().parent]}/**
|
|
1616
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1617
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1618
|
-
*/class P8 extends w{static get pluginName(){return"ListStyleSupport"}static get requires(){return[Pt,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(Pt),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[i,s])=>{this._isStyleEnabledForBlock(i,s)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(t,[i,s])=>{this._isStyleActiveForBlock(i,s)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[i,s])=>{const o=this._getAffectedBlocks(i,s);o&&(t.return=o,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(t,[i,s])=>{const o=this._getStylePreview(i,s);o&&(t.return=o,t.stop())},{priority:"high"}))}_isStyleEnabledForBlock(e,t){const i=this.editor.model;if(!["ol","ul","li"].includes(e.element)||!this._listUtils.isListItemBlock(t))return!1;const s=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(e.element=="ol"||e.element=="ul"){if(!i.schema.checkAttribute(t,s))return!1;const r=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==r}else return i.schema.checkAttribute(t,s)}_isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),s=t.getAttribute(i);return this._styleUtils.hasAllClasses(s,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?e.element=="li"?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:i,classes:s}=e;return i=="ol"||i=="ul"?{tag:i,attributes:{class:s},children:[{tag:"li",children:t}]}:i=="li"?{tag:"ol",children:[{tag:i,attributes:{class:s},children:t}]}:null}}/**
|
|
1619
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1620
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1621
|
-
*/class R8 extends w{static get pluginName(){return"TableStyleSupport"}static get requires(){return[Pt]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(Pt),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[i,s])=>{this._isApplicable(i,s)&&(t.return=this._isStyleEnabledForBlock(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[i,s])=>{this._isApplicable(i,s)&&(t.return=this._getAffectedBlocks(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(t,[{block:i}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(i.filter(o=>o.element=="figcaption").map(o=>({name:"caption",classes:o.classes})))}))}_isApplicable(e,t){return["td","th"].includes(e.element)?t.name=="tableCell":["thead","tbody"].includes(e.element)?t.name=="table":!1}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const i=this._tableUtils.getCellLocation(t),o=t.parent.parent,r=o.getAttribute("headingRows")||0,a=o.getAttribute("headingColumns")||0,l=i.row<r||i.column<a;return e.element=="th"?l:!l}if(["thead","tbody"].includes(e.element)){const i=t.getAttribute("headingRows")||0;return e.element=="thead"?i>0:i<this._tableUtils.getRows(t)}/* istanbul ignore next -- @preserve */return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}/**
|
|
1622
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1623
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1624
|
-
*/class V8 extends w{static get pluginName(){return"LinkStyleSupport"}static get requires(){return[Pt,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(Pt),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(t,[i,s])=>{i.element=="a"&&(t.return=this._isStyleEnabled(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(t,[i,s])=>{i.element=="a"&&(t.return=this._isStyleActive(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(t,[i,s])=>{if(i.element!="a")return;const o=this._getAffectedSelectable(i,s);o&&(t.return=o,t.stop())},{priority:"high"}))}_isStyleEnabled(e,t){const i=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const s of t.getRanges())for(const o of s.getItems())if((o.is("$textProxy")||i.schema.isInline(o))&&o.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const i=this.editor.model,s=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const o=t.getAttribute(s);if(this._styleUtils.hasAllClasses(o,e.classes))return!0}return!1}for(const o of t.getRanges())for(const r of o.getItems())if((r.is("$textProxy")||i.schema.isInline(r))&&r.hasAttribute("linkHref")){const a=r.getAttribute(s);return this._styleUtils.hasAllClasses(a,e.classes)}return!1}_getAffectedSelectable(e,t){const i=this.editor.model;if(t.isCollapsed){const o=t.getAttribute("linkHref");return ws(t.getFirstPosition(),"linkHref",o,i)}const s=[];for(const o of t.getRanges()){const r=i.createRange(Th(o.start,"linkHref",!0,i),Th(o.end,"linkHref",!1,i));for(const a of r.getItems())(a.is("$textProxy")||i.schema.isInline(a))&&a.hasAttribute("linkHref")&&s.push(this.editor.model.createRangeOn(a))}return B8(s)}}function Th(n,e,t,i){const s=n.textNode||(t?n.nodeAfter:n.nodeBefore);if(!s||!s.hasAttribute(e))return n;const o=s.getAttribute(e);return _a(n,e,o,t,i)}function B8(n){for(let e=1;e<n.length;e++){const t=n[e-1].getJoined(n[e]);t&&n.splice(--e,2,t)}return n}/**
|
|
1625
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1626
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1627
|
-
*/class M8 extends w{static get pluginName(){return"StyleEditing"}static get requires(){return["GeneralHtmlSupport",Pt,P8,R8,V8]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),s=e.config.get("style.definitions"),o=i.normalizeConfig(t,s);e.commands.add("style",new A8(e,o)),i.configureGHSDataFilter(o)}}/**
|
|
1628
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1629
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1630
|
-
*/class L8 extends w{static get pluginName(){return"Style"}static get requires(){return[M8,T8]}}/**
|
|
1631
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1632
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1633
|
-
*/function Ol(n){const e=n.t,t=n.config.get("codeBlock.languages");for(const i of t)i.label==="Plain text"&&(i.label=e("Plain text")),i.class===void 0&&(i.class=`language-${i.language}`);return t}function Oa(n,e,t){const i={};for(const s of n)if(e==="class"){const o=s[e].split(" ").shift();i[o]=s[t]}else i[s[e]]=s[t];return i}function Fl(n){return n.data.match(/^(\s*)/)[0]}function O8(n,e){const t=n.createDocumentFragment(),i=e.split(`
|
|
1634
|
-
`),s=i.reduce((o,r,a)=>(o.push(r),a<i.length-1&&o.push(n.createElement("br")),o),[]);return n.appendChild(s,t),t}function Fa(n){const e=n.document.selection,t=[];if(e.isCollapsed)return[e.anchor];const i=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:s}of i){if(!s.is("$textProxy"))continue;const{parent:o,startOffset:r}=s.textNode;if(!o.is("element","codeBlock"))continue;const a=Fl(s.textNode),l=n.createPositionAt(o,r+a.length);t.push(l)}return t}function A1(n){const e=J(n.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function Ah(n,e){return e.is("rootElement")||n.isLimit(e)?!1:n.checkChild(e.parent,"codeBlock")}/**
|
|
1635
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1636
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1637
|
-
*/class F8 extends R{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,i=t.model,s=i.document.selection,r=Ol(t)[0],a=Array.from(s.getSelectedBlocks()),l=e.forceValue==null?!this.value:e.forceValue,c=D8(e,this._lastLanguage,r.language);i.change(u=>{l?this._applyCodeBlock(u,a,c):this._removeCodeBlock(u,a)})}_getValue(){const e=this.editor.model.document.selection,t=J(e.getSelectedBlocks());return!!(t&&t.is("element","codeBlock"))?t.getAttribute("language"):!1}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=J(e.getSelectedBlocks());return i?Ah(t,i):!1}_applyCodeBlock(e,t,i){this._lastLanguage=i;const s=this.editor.model.schema,o=t.filter(r=>Ah(s,r));for(const r of o)e.rename(r,"codeBlock"),e.setAttribute("language",i,r),s.removeDisallowedAttributes([r],e),Array.from(r.getChildren()).filter(a=>!s.checkChild(r,a)).forEach(a=>e.remove(a));o.reverse().forEach((r,a)=>{const l=o[a+1];r.previousSibling===l&&(e.appendElement("softBreak",l),e.merge(e.createPositionBefore(r)))})}_removeCodeBlock(e,t){const i=t.filter(s=>s.is("element","codeBlock"));for(const s of i){const o=e.createRangeOn(s);for(const r of Array.from(o.getItems()).reverse())if(r.is("element","softBreak")&&r.parent.is("element","codeBlock")){const{position:a}=e.split(e.createPositionBefore(r)),l=a.nodeAfter;e.rename(l,"paragraph"),e.removeAttribute("language",l),e.remove(r)}e.rename(s,"paragraph"),e.removeAttribute("language",s)}}}function D8(n,e,t){return n.language?n.language:n.usePreviousLanguageChoice&&e?e:t}/**
|
|
1638
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1639
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1640
|
-
*/class N8 extends R{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change(i=>{const s=Fa(t);for(const o of s){const r=i.createText(this._indentSequence);t.insertContent(r,o)}})}_checkEnabled(){return this._indentSequence?A1(this.editor.model.document.selection):!1}}/**
|
|
1641
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1642
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1643
|
-
*/class $8 extends R{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change(()=>{const i=Fa(t);for(const s of i){const o=Sh(t,s,this._indentSequence);o&&t.deleteContent(t.createSelection(o))}})}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return A1(e.document.selection)?Fa(e).some(t=>Sh(e,t,this._indentSequence)):!1}}function Sh(n,e,t){const i=H8(e);if(!i)return null;const s=Fl(i),o=s.lastIndexOf(t);if(o+t.length!==s.length||o===-1)return null;const{parent:r,startOffset:a}=i;return n.createRange(n.createPositionAt(r,a+o),n.createPositionAt(r,a+o+t.length))}function H8(n){let e=n.parent.getChild(n.index);return(!e||e.is("element","softBreak"))&&(e=n.nodeBefore),!e||e.is("element","softBreak")?null:e}/**
|
|
1644
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1645
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1646
|
-
*/function xh(n,e,t=!1){const i=Oa(e,"language","class"),s=Oa(e,"language","label");return(o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a;if(!u.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),h=c.toViewPosition(n.createPositionBefore(r.item)),f={};t&&(f["data-language"]=s[d],f.spellcheck="false");const m=i[d]?{class:i[d]}:void 0,p=l.createContainerElement("code",m),_=l.createContainerElement("pre",f,p);l.insert(h,_),c.bindElements(r.item,p)}}function z8(n){return(e,t,i)=>{if(t.item.parent.name!=="codeBlock")return;const{writer:s,mapper:o,consumable:r}=i;if(!r.consume(t.item,"insert"))return;const a=o.toViewPosition(n.createPositionBefore(t.item));s.insert(a,s.createText(`
|
|
1647
|
-
`))}}function U8(n,e){const t=Oa(e,"class","language"),i=e[0].language;return(s,o,r)=>{const a=o.viewItem,l=a.parent;if(!l||!l.is("element","pre")||o.modelCursor.findAncestor("codeBlock"))return;const{consumable:c,writer:u}=r;if(!c.test(a,{name:!0}))return;const d=u.createElement("codeBlock"),h=[...a.getClassNames()];h.length||h.push("");for(const f of h){const m=t[f];if(m){u.setAttribute("language",m,d);break}}d.hasAttribute("language")||u.setAttribute("language",i,d),r.convertChildren(a,d),r.safeInsert(d,o.modelCursor)&&(c.consume(a,{name:!0}),r.updateConversionResult(d,o))}}function W8(){return(n,e,{consumable:t,writer:i})=>{let s=e.modelCursor;if(!t.test(e.viewItem)||!s.findAncestor("codeBlock"))return;t.consume(e.viewItem);const r=e.viewItem.data.split(`
|
|
1648
|
-
`).map(l=>i.createText(l)),a=r[r.length-1];for(const l of r)if(i.insert(l,s),s=s.getShiftedBy(l.offsetSize),l!==a){const c=i.createElement("softBreak");i.insert(c,s),s=i.createPositionAfter(c)}e.modelRange=i.createRange(e.modelCursor,s),e.modelCursor=s}}function q8(){return(n,e,{consumable:t})=>{const i=e.viewItem;if(i.findAncestor("pre"))return;const s=Array.from(i.getChildren()),o=s.find(r=>r.is("element","code"));if(o)for(const r of s)r===o||!r.is("$text")||t.consume(r,{name:!0})}}/**
|
|
1649
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1650
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1651
|
-
*/const S1="paragraph";class j8 extends w{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[op]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:" "})}init(){const e=this.editor,t=e.model.schema,i=e.model,s=e.editing.view,o=e.plugins.has("ListEditing")?e.plugins.get("ListEditing"):null,r=Ol(e);e.commands.add("codeBlock",new F8(e)),e.commands.add("indentCodeBlock",new N8(e)),e.commands.add("outdentCodeBlock",new $8(e)),this.listenTo(s.document,"tab",(a,l)=>{const c=l.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(c).isEnabled&&(e.execute(c),l.stopPropagation(),l.preventDefault(),a.stop())},{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck((a,l)=>{if(a.endsWith("codeBlock")&&o&&o.getListAttributeNames().includes(l))return!0;if(a.endsWith("codeBlock $text"))return!1}),e.model.schema.addChildCheck((a,l)=>{if(a.endsWith("codeBlock")&&l.isObject)return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",xh(i,r,!0)),e.data.downcastDispatcher.on("insert:codeBlock",xh(i,r)),e.data.downcastDispatcher.on("insert:softBreak",z8(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",U8(s,r)),e.data.upcastDispatcher.on("text",W8()),e.data.upcastDispatcher.on("element:pre",q8(),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",(a,l)=>{let c=i.createRange(i.document.selection.anchor);if(l.targetRanges&&(c=e.editing.mapper.toModelRange(l.targetRanges[0])),!c.start.parent.is("element","codeBlock"))return;const u=l.dataTransfer.getData("text/plain"),d=new vi(e.editing.view.document);l.content=O8(d,u)}),this.listenTo(i,"getSelectedContent",(a,[l])=>{const c=l.anchor;l.isCollapsed||!c.parent.is("element","codeBlock")||!c.hasSameParentAs(l.focus)||i.change(u=>{const d=a.return;if(c.parent.is("element")&&(d.childCount>1||l.containsEntireContent(c.parent))){const f=u.createElement("codeBlock",c.parent.getAttributes());u.append(d,f);const m=u.createDocumentFragment();u.append(f,m),a.return=m;return}const h=d.getChild(0);t.checkAttribute(h,"code")&&u.setAttribute("code",!0,h)})})}afterInit(){const e=this.editor,t=e.commands,i=t.get("indent"),s=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),s&&s.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(o,r)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(!K8(e,r.isSoft)&&!Z8(e,r.isSoft)&&G8(e),r.preventDefault(),o.stop())},{context:"pre"})}}function G8(n){const t=n.model.document,i=t.selection.getLastPosition(),s=i.nodeBefore||i.textNode;let o;s&&s.is("$text")&&(o=Fl(s)),n.model.change(r=>{n.execute("shiftEnter"),o&&r.insertText(o,t.selection.anchor)})}function K8(n,e){const i=n.model.document,s=n.editing.view,o=i.selection.getLastPosition(),r=o.nodeAfter;return e||!i.selection.isCollapsed||!o.isAtStart||!Qt(r)?!1:(n.model.change(a=>{n.execute("enter");const l=i.selection.anchor.parent.previousSibling;a.rename(l,S1),a.setSelection(l,"in"),n.model.schema.removeDisallowedAttributes([l],a),a.remove(r)}),s.scrollToTheSelection(),!0)}function Z8(n,e){const t=n.model,i=t.document,s=n.editing.view,o=i.selection.getLastPosition(),r=o.nodeBefore;let a;if(e||!i.selection.isCollapsed||!o.isAtEnd||!r||!r.previousSibling)return!1;if(Qt(r)&&Qt(r.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling),t.createPositionAfter(r));else if(Nr(r)&&Qt(r.previousSibling)&&Qt(r.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling),t.createPositionAfter(r));else if(Nr(r)&&Qt(r.previousSibling)&&Nr(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&Qt(r.previousSibling.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling.previousSibling),t.createPositionAfter(r));else return!1;return n.model.change(l=>{l.remove(a),n.execute("enter");const c=i.selection.anchor.parent;l.rename(c,S1),n.model.schema.removeDisallowedAttributes([c],l)}),s.scrollToTheSelection(),!0}function Nr(n){return n&&n.is("$text")&&!n.data.match(/\S/)}function Qt(n){return n&&n.is("element","softBreak")}/**
|
|
1652
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1653
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1654
|
-
*/class J8 extends w{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,s=Ol(e),o=this._getLanguageListItemDefinitions(s),r=e.commands.get("codeBlock");i.add("codeBlock",a=>{const l=ge(a,hn),c=l.buttonView,u=t("Insert code block");return c.set({label:u,tooltip:!0,icon:P.codeBlock,isToggleable:!0}),c.bind("isOn").to(r,"value",d=>!!d),c.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),l.on("execute",d=>{e.execute("codeBlock",{language:d.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),l.class="ck-code-block-dropdown",l.bind("isEnabled").to(r),yi(l,o,{role:"menu",ariaLabel:u}),l}),i.add("menuBar:codeBlock",a=>{const l=new Oe(a);l.buttonView.set({label:t("Code block"),icon:P.codeBlock}),l.bind("isEnabled").to(r);const c=new hi(a);c.set({ariaLabel:t("Insert code block")});for(const u of o){const d=new Ci(a,l),h=new he(a);h.bind(...Object.keys(u.model)).to(u.model),h.bind("ariaChecked").to(h,"isOn"),h.delegate("execute").to(l),h.on("execute",()=>{e.execute("codeBlock",{language:u.model._codeBlockLanguage,forceValue:r.value!=u.model._codeBlockLanguage}),e.editing.view.focus()}),d.children.add(h),c.items.add(d)}return l.panelView.children.add(c),l})}_getLanguageListItemDefinitions(e){const i=this.editor.commands.get("codeBlock"),s=new Ce;for(const o of e){const r={type:"button",model:new ki({_codeBlockLanguage:o.language,label:o.label,role:"menuitemradio",withText:!0})};r.model.bind("isOn").to(i,"value",a=>a===r.model._codeBlockLanguage),s.add(r)}return s}}/**
|
|
1655
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1656
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1657
|
-
*/class Y8 extends w{static get requires(){return[j8,J8]}static get pluginName(){return"CodeBlock"}}/**
|
|
1658
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1659
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1660
|
-
*/class Q8 extends R{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=X8(i,t,e)}execute(){const e=this.editor.model;e.change(t=>{const i=t.createElement("horizontalLine");e.insertObject(i,null,null,{setSelection:"after"})})}}function X8(n,e,t){const i=eB(n,t);return e.checkChild(i,"horizontalLine")}function eB(n,e){const i=Al(n,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}/**
|
|
1661
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1662
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1663
|
-
*/class tB extends w{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,s=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),s.for("dataDowncast").elementToElement({model:"horizontalLine",view:(o,{writer:r})=>r.createEmptyElement("hr")}),s.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(o,{writer:r})=>{const a=i("Horizontal line"),l=r.createContainerElement("div",null,r.createEmptyElement("hr"));return r.addClass("ck-horizontal-line",l),r.setCustomProperty("hr",!0,l),iB(l,r,a)}}),s.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new Q8(e))}}function iB(n,e,t){return e.setCustomProperty("horizontalLine",!0,n),mn(n,e,{label:t})}/**
|
|
1664
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1665
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1666
|
-
*/class nB extends w{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",()=>{const t=this._createButton(V);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(he))}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get("horizontalLine"),o=new e(t.locale),r=i.t;return o.set({label:r("Horizontal line"),icon:P.horizontalLine}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("horizontalLine"),t.editing.view.focus()}),o}}/**
|
|
1667
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1668
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1669
|
-
*/class sB extends w{static get requires(){return[tB,nB,Ei]}static get pluginName(){return"HorizontalLine"}}const oB='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>';/**
|
|
1670
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1671
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1672
|
-
*/const Js="removeFormat";class rB extends w{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor;e.ui.componentFactory.add(Js,()=>{const t=this._createButton(V);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add(`menuBar:${Js}`,()=>this._createButton(he))}_createButton(e){const t=this.editor,i=t.locale,s=t.commands.get(Js),o=new e(t.locale),r=i.t;return o.set({label:r("Remove Format"),icon:oB}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute(Js),t.editing.view.focus()}),o}}/**
|
|
1673
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1674
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1675
|
-
*/class aB extends R{refresh(){const e=this.editor.model;this.isEnabled=!!J(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(i=>{for(const s of this._getFormattingItems(e.document.selection,t))if(s.is("selection"))for(const o of this._getFormattingAttributes(s,t))i.removeSelectionAttribute(o);else{const o=i.createRangeOn(s);for(const r of this._getFormattingAttributes(s,t))i.removeAttribute(r,o)}})}*_getFormattingItems(e,t){const i=s=>!!J(this._getFormattingAttributes(s,t));for(const s of e.getRanges())for(const o of s.getItems())!t.isBlock(o)&&i(o)&&(yield o);for(const s of e.getSelectedBlocks())i(s)&&(yield s);i(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[i]of e.getAttributes()){const s=t.getAttributeProperties(i);s&&s.isFormatting&&(yield i)}}}/**
|
|
1676
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1677
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1678
|
-
*/class lB extends w{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new aB(e))}}/**
|
|
1679
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1680
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1681
|
-
*/class cB extends w{static get requires(){return[lB,rB]}static get pluginName(){return"RemoveFormat"}}/**
|
|
1682
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1683
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1684
|
-
*/class uB extends Og{constructor(e,t){super(e);const i=e.t;this.set("class","ck-special-characters-navigation"),this.groupDropdownView=this._createGroupDropdown(t),this.groupDropdownView.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",this.label=i("Special characters"),this.children.add(this.groupDropdownView)}get currentGroupName(){return this.groupDropdownView.value}focus(){this.groupDropdownView.focus()}_createGroupDropdown(e){const t=this.locale,i=t.t,s=ge(t),o=this._getCharacterGroupListItemDefinitions(s,e),r=i("Character categories");return s.set("value",o.first.model.name),s.buttonView.bind("label").to(s,"value",a=>e.get(a)),s.buttonView.set({isOn:!1,withText:!0,tooltip:r,class:["ck-dropdown__button_label-width_auto"],ariaLabel:r,ariaLabelledBy:void 0}),s.on("execute",a=>{s.value=a.source.name}),s.delegate("execute").to(this),yi(s,o,{ariaLabel:r,role:"menu"}),s}_getCharacterGroupListItemDefinitions(e,t){const i=new Ce;for(const[s,o]of t){const r=new ki({name:s,label:o,withText:!0,role:"menuitemradio"});r.bind("isOn").to(e,"value",a=>a===r.name),i.add({type:"button",model:r})}return i}}/**
|
|
1685
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1686
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1687
|
-
*/class dB extends T{constructor(e){super(e),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new te,this.keystrokes=new oe,as({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>S.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(e,t){const i=new V(this.locale);return i.set({label:e,withText:!0,class:"ck-character-grid__tile"}),i.extendTemplate({attributes:{title:t},on:{mouseover:i.bindTemplate.to("mouseover"),focus:i.bindTemplate.to("focus")}}),i.on("mouseover",()=>{this.fire("tileHover",{name:t,character:e})}),i.on("focus",()=>{this.fire("tileFocus",{name:t,character:e})}),i.on("execute",()=>{this.fire("execute",{name:t,character:e})}),i}render(){super.render();for(const e of this.tiles)this.focusTracker.add(e.element);this.tiles.on("change",(e,{added:t,removed:i})=>{if(t.length>0)for(const s of t)this.focusTracker.add(s.element);if(i.length>0)for(const s of i)this.focusTracker.remove(s.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}}/**
|
|
1688
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1689
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1690
|
-
*/class hB extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",fB),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:t.to("name",i=>i||"")}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:t.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}}function fB(n){return n===null?"":"U+"+("0000"+n.codePointAt(0).toString(16)).slice(-4)}/**
|
|
1691
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1692
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1693
|
-
*/class mB extends T{constructor(e,t,i,s){super(e),this.navigationView=t,this.gridView=i,this.infoView=s,this.items=this.createCollection(),this.focusTracker=new te,this.keystrokes=new oe,this._focusCycler=new Ae({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.navigationView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.navigationView.groupDropdownView.buttonView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.navigationView.focus()}}const gB='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.268 7.268 0 0 1 2.703 3.454 7.128 7.128 0 0 1 .199 4.353c-.39 1.436-1.475 2.72-2.633 3.677h2.013c0-.226.092-.443.254-.603a.876.876 0 0 1 1.229 0c.163.16.254.377.254.603v.853c0 .209-.078.41-.22.567a.873.873 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.601 5.601 0 0 0 2.492-2.371 5.459 5.459 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.71 5.71 0 0 0 10 4.206 5.708 5.708 0 0 0 6.419 5.46 5.527 5.527 0 0 0 4.46 8.663a5.457 5.457 0 0 0 .554 3.695 5.6 5.6 0 0 0 2.497 2.37.55.55 0 0 1 .317.49v1.264c0 .286-.23.518-.516.518H2.618a.877.877 0 0 1-.614-.25.845.845 0 0 1-.254-.603v-.853c0-.226.091-.443.254-.603a.876.876 0 0 1 1.228 0c.163.16.255.377.255.603h1.925c-1.158-.958-2.155-2.241-2.545-3.678a7.128 7.128 0 0 1 .199-4.352 7.268 7.268 0 0 1 2.703-3.455A7.475 7.475 0 0 1 10 2.5z"/></svg>';/**
|
|
1694
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1695
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1696
|
-
*/const $r="All";class pB extends w{static get requires(){return[ep]}static get pluginName(){return"SpecialCharacters"}constructor(e){super(e);const t=e.t;this._characters=new Map,this._groups=new Map,this._allSpecialCharactersGroupLabel=t("All")}init(){const e=this.editor,t=e.t,i=e.commands.get("insertText");e.ui.componentFactory.add("specialCharacters",s=>{const o=ge(s);let r;return o.buttonView.set({label:t("Special characters"),icon:gB,tooltip:!0}),o.bind("isEnabled").to(i),o.on("execute",(a,l)=>{e.execute("insertText",{text:l.character}),e.editing.view.focus()}),o.on("change:isOpen",()=>{if(!r){r=this._createDropdownPanelContent(s,o);const a=new mB(s,r.navigationView,r.gridView,r.infoView);o.panelView.children.add(a)}r.infoView.set({character:null,name:null})}),o})}addItems(e,t,i={label:e}){if(e===$r)throw new g("special-character-invalid-group-name",null);const s=this._getGroup(e,i.label);for(const o of t)s.items.add(o.title),this._characters.set(o.title,o.character)}getGroups(){const e=Array.from(this._groups.keys()),t=this.editor.config.get("specialCharacters.order")||[],i=t.find(s=>!e.includes(s));if(i)throw new g("special-character-invalid-order-group-name",null,{invalidGroup:i});return new Set([...t,...e])}getCharactersForGroup(e){if(e===$r)return new Set(this._characters.keys());const t=this._groups.get(e);if(t)return t.items}getCharacter(e){return this._characters.get(e)}_getGroup(e,t){return this._groups.has(e)||this._groups.set(e,{items:new Set,label:t}),this._groups.get(e)}_updateGrid(e,t){t.tiles.clear();const i=this.getCharactersForGroup(e);for(const s of i){const o=this.getCharacter(s);t.tiles.add(t.createTile(o,s))}}_createDropdownPanelContent(e,t){const i=Array.from(this.getGroups()).map(l=>[l,this._groups.get(l).label]),s=new Map([[$r,this._allSpecialCharactersGroupLabel],...i]),o=new uB(e,s),r=new dB(e),a=new hB(e);return r.delegate("execute").to(t),r.on("tileHover",(l,c)=>{a.set(c)}),r.on("tileFocus",(l,c)=>{a.set(c)}),o.on("execute",()=>{this._updateGrid(o.currentGroupName,r)}),this._updateGrid(o.currentGroupName,r),{navigationView:o,gridView:r,infoView:a}}}/**
|
|
1697
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1698
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1699
|
-
*/class wB extends w{static get pluginName(){return"SpecialCharactersArrows"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Arrows",[{title:t("leftwards simple arrow"),character:"←"},{title:t("rightwards simple arrow"),character:"→"},{title:t("upwards simple arrow"),character:"↑"},{title:t("downwards simple arrow"),character:"↓"},{title:t("leftwards double arrow"),character:"⇐"},{title:t("rightwards double arrow"),character:"⇒"},{title:t("upwards double arrow"),character:"⇑"},{title:t("downwards double arrow"),character:"⇓"},{title:t("leftwards dashed arrow"),character:"⇠"},{title:t("rightwards dashed arrow"),character:"⇢"},{title:t("upwards dashed arrow"),character:"⇡"},{title:t("downwards dashed arrow"),character:"⇣"},{title:t("leftwards arrow to bar"),character:"⇤"},{title:t("rightwards arrow to bar"),character:"⇥"},{title:t("upwards arrow to bar"),character:"⤒"},{title:t("downwards arrow to bar"),character:"⤓"},{title:t("up down arrow with base"),character:"↨"},{title:t("back with leftwards arrow above"),character:"🔙"},{title:t("end with leftwards arrow above"),character:"🔚"},{title:t("on with exclamation mark with left right arrow above"),character:"🔛"},{title:t("soon with rightwards arrow above"),character:"🔜"},{title:t("top with upwards arrow above"),character:"🔝"}],{label:t("Arrows")})}}/**
|
|
1700
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1701
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1702
|
-
*/class bB extends w{static get pluginName(){return"SpecialCharactersText"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:t("Single left-pointing angle quotation mark")},{character:"›",title:t("Single right-pointing angle quotation mark")},{character:"«",title:t("Left-pointing double angle quotation mark")},{character:"»",title:t("Right-pointing double angle quotation mark")},{character:"‘",title:t("Left single quotation mark")},{character:"’",title:t("Right single quotation mark")},{character:"“",title:t("Left double quotation mark")},{character:"”",title:t("Right double quotation mark")},{character:"‚",title:t("Single low-9 quotation mark")},{character:"„",title:t("Double low-9 quotation mark")},{character:"¡",title:t("Inverted exclamation mark")},{character:"¿",title:t("Inverted question mark")},{character:"‥",title:t("Two dot leader")},{character:"…",title:t("Horizontal ellipsis")},{character:"‡",title:t("Double dagger")},{character:"‰",title:t("Per mille sign")},{character:"‱",title:t("Per ten thousand sign")},{character:"‼",title:t("Double exclamation mark")},{character:"⁈",title:t("Question exclamation mark")},{character:"⁉",title:t("Exclamation question mark")},{character:"⁇",title:t("Double question mark")},{character:"©",title:t("Copyright sign")},{character:"®",title:t("Registered sign")},{character:"™",title:t("Trade mark sign")},{character:"§",title:t("Section sign")},{character:"¶",title:t("Paragraph sign")},{character:"⁋",title:t("Reversed paragraph sign")}],{label:t("Text")})}}/**
|
|
1703
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1704
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1705
|
-
*/class _B extends w{static get pluginName(){return"SpecialCharactersMathematical"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:t("Less-than sign")},{character:">",title:t("Greater-than sign")},{character:"≤",title:t("Less-than or equal to")},{character:"≥",title:t("Greater-than or equal to")},{character:"–",title:t("En dash")},{character:"—",title:t("Em dash")},{character:"¯",title:t("Macron")},{character:"‾",title:t("Overline")},{character:"°",title:t("Degree sign")},{character:"−",title:t("Minus sign")},{character:"±",title:t("Plus-minus sign")},{character:"÷",title:t("Division sign")},{character:"⁄",title:t("Fraction slash")},{character:"×",title:t("Multiplication sign")},{character:"ƒ",title:t("Latin small letter f with hook")},{character:"∫",title:t("Integral")},{character:"∑",title:t("N-ary summation")},{character:"∞",title:t("Infinity")},{character:"√",title:t("Square root")},{character:"∼",title:t("Tilde operator")},{character:"≅",title:t("Approximately equal to")},{character:"≈",title:t("Almost equal to")},{character:"≠",title:t("Not equal to")},{character:"≡",title:t("Identical to")},{character:"∈",title:t("Element of")},{character:"∉",title:t("Not an element of")},{character:"∋",title:t("Contains as member")},{character:"∏",title:t("N-ary product")},{character:"∧",title:t("Logical and")},{character:"∨",title:t("Logical or")},{character:"¬",title:t("Not sign")},{character:"∩",title:t("Intersection")},{character:"∪",title:t("Union")},{character:"∂",title:t("Partial differential")},{character:"∀",title:t("For all")},{character:"∃",title:t("There exists")},{character:"∅",title:t("Empty set")},{character:"∇",title:t("Nabla")},{character:"∗",title:t("Asterisk operator")},{character:"∝",title:t("Proportional to")},{character:"∠",title:t("Angle")},{character:"¼",title:t("Vulgar fraction one quarter")},{character:"½",title:t("Vulgar fraction one half")},{character:"¾",title:t("Vulgar fraction three quarters")}],{label:t("Mathematical")})}}/**
|
|
1706
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1707
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1708
|
-
*/class vB extends w{static get pluginName(){return"SpecialCharactersLatin"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:t("Latin capital letter a with macron")},{character:"ā",title:t("Latin small letter a with macron")},{character:"Ă",title:t("Latin capital letter a with breve")},{character:"ă",title:t("Latin small letter a with breve")},{character:"Ą",title:t("Latin capital letter a with ogonek")},{character:"ą",title:t("Latin small letter a with ogonek")},{character:"Ć",title:t("Latin capital letter c with acute")},{character:"ć",title:t("Latin small letter c with acute")},{character:"Ĉ",title:t("Latin capital letter c with circumflex")},{character:"ĉ",title:t("Latin small letter c with circumflex")},{character:"Ċ",title:t("Latin capital letter c with dot above")},{character:"ċ",title:t("Latin small letter c with dot above")},{character:"Č",title:t("Latin capital letter c with caron")},{character:"č",title:t("Latin small letter c with caron")},{character:"Ď",title:t("Latin capital letter d with caron")},{character:"ď",title:t("Latin small letter d with caron")},{character:"Đ",title:t("Latin capital letter d with stroke")},{character:"đ",title:t("Latin small letter d with stroke")},{character:"Ē",title:t("Latin capital letter e with macron")},{character:"ē",title:t("Latin small letter e with macron")},{character:"Ĕ",title:t("Latin capital letter e with breve")},{character:"ĕ",title:t("Latin small letter e with breve")},{character:"Ė",title:t("Latin capital letter e with dot above")},{character:"ė",title:t("Latin small letter e with dot above")},{character:"Ę",title:t("Latin capital letter e with ogonek")},{character:"ę",title:t("Latin small letter e with ogonek")},{character:"Ě",title:t("Latin capital letter e with caron")},{character:"ě",title:t("Latin small letter e with caron")},{character:"Ĝ",title:t("Latin capital letter g with circumflex")},{character:"ĝ",title:t("Latin small letter g with circumflex")},{character:"Ğ",title:t("Latin capital letter g with breve")},{character:"ğ",title:t("Latin small letter g with breve")},{character:"Ġ",title:t("Latin capital letter g with dot above")},{character:"ġ",title:t("Latin small letter g with dot above")},{character:"Ģ",title:t("Latin capital letter g with cedilla")},{character:"ģ",title:t("Latin small letter g with cedilla")},{character:"Ĥ",title:t("Latin capital letter h with circumflex")},{character:"ĥ",title:t("Latin small letter h with circumflex")},{character:"Ħ",title:t("Latin capital letter h with stroke")},{character:"ħ",title:t("Latin small letter h with stroke")},{character:"Ĩ",title:t("Latin capital letter i with tilde")},{character:"ĩ",title:t("Latin small letter i with tilde")},{character:"Ī",title:t("Latin capital letter i with macron")},{character:"ī",title:t("Latin small letter i with macron")},{character:"Ĭ",title:t("Latin capital letter i with breve")},{character:"ĭ",title:t("Latin small letter i with breve")},{character:"Į",title:t("Latin capital letter i with ogonek")},{character:"į",title:t("Latin small letter i with ogonek")},{character:"İ",title:t("Latin capital letter i with dot above")},{character:"ı",title:t("Latin small letter dotless i")},{character:"IJ",title:t("Latin capital ligature ij")},{character:"ij",title:t("Latin small ligature ij")},{character:"Ĵ",title:t("Latin capital letter j with circumflex")},{character:"ĵ",title:t("Latin small letter j with circumflex")},{character:"Ķ",title:t("Latin capital letter k with cedilla")},{character:"ķ",title:t("Latin small letter k with cedilla")},{character:"ĸ",title:t("Latin small letter kra")},{character:"Ĺ",title:t("Latin capital letter l with acute")},{character:"ĺ",title:t("Latin small letter l with acute")},{character:"Ļ",title:t("Latin capital letter l with cedilla")},{character:"ļ",title:t("Latin small letter l with cedilla")},{character:"Ľ",title:t("Latin capital letter l with caron")},{character:"ľ",title:t("Latin small letter l with caron")},{character:"Ŀ",title:t("Latin capital letter l with middle dot")},{character:"ŀ",title:t("Latin small letter l with middle dot")},{character:"Ł",title:t("Latin capital letter l with stroke")},{character:"ł",title:t("Latin small letter l with stroke")},{character:"Ń",title:t("Latin capital letter n with acute")},{character:"ń",title:t("Latin small letter n with acute")},{character:"Ņ",title:t("Latin capital letter n with cedilla")},{character:"ņ",title:t("Latin small letter n with cedilla")},{character:"Ň",title:t("Latin capital letter n with caron")},{character:"ň",title:t("Latin small letter n with caron")},{character:"ʼn",title:t("Latin small letter n preceded by apostrophe")},{character:"Ŋ",title:t("Latin capital letter eng")},{character:"ŋ",title:t("Latin small letter eng")},{character:"Ō",title:t("Latin capital letter o with macron")},{character:"ō",title:t("Latin small letter o with macron")},{character:"Ŏ",title:t("Latin capital letter o with breve")},{character:"ŏ",title:t("Latin small letter o with breve")},{character:"Ő",title:t("Latin capital letter o with double acute")},{character:"ő",title:t("Latin small letter o with double acute")},{character:"Œ",title:t("Latin capital ligature oe")},{character:"œ",title:t("Latin small ligature oe")},{character:"Ŕ",title:t("Latin capital letter r with acute")},{character:"ŕ",title:t("Latin small letter r with acute")},{character:"Ŗ",title:t("Latin capital letter r with cedilla")},{character:"ŗ",title:t("Latin small letter r with cedilla")},{character:"Ř",title:t("Latin capital letter r with caron")},{character:"ř",title:t("Latin small letter r with caron")},{character:"Ś",title:t("Latin capital letter s with acute")},{character:"ś",title:t("Latin small letter s with acute")},{character:"Ŝ",title:t("Latin capital letter s with circumflex")},{character:"ŝ",title:t("Latin small letter s with circumflex")},{character:"Ş",title:t("Latin capital letter s with cedilla")},{character:"ş",title:t("Latin small letter s with cedilla")},{character:"Š",title:t("Latin capital letter s with caron")},{character:"š",title:t("Latin small letter s with caron")},{character:"Ţ",title:t("Latin capital letter t with cedilla")},{character:"ţ",title:t("Latin small letter t with cedilla")},{character:"Ť",title:t("Latin capital letter t with caron")},{character:"ť",title:t("Latin small letter t with caron")},{character:"Ŧ",title:t("Latin capital letter t with stroke")},{character:"ŧ",title:t("Latin small letter t with stroke")},{character:"Ũ",title:t("Latin capital letter u with tilde")},{character:"ũ",title:t("Latin small letter u with tilde")},{character:"Ū",title:t("Latin capital letter u with macron")},{character:"ū",title:t("Latin small letter u with macron")},{character:"Ŭ",title:t("Latin capital letter u with breve")},{character:"ŭ",title:t("Latin small letter u with breve")},{character:"Ů",title:t("Latin capital letter u with ring above")},{character:"ů",title:t("Latin small letter u with ring above")},{character:"Ű",title:t("Latin capital letter u with double acute")},{character:"ű",title:t("Latin small letter u with double acute")},{character:"Ų",title:t("Latin capital letter u with ogonek")},{character:"ų",title:t("Latin small letter u with ogonek")},{character:"Ŵ",title:t("Latin capital letter w with circumflex")},{character:"ŵ",title:t("Latin small letter w with circumflex")},{character:"Ŷ",title:t("Latin capital letter y with circumflex")},{character:"ŷ",title:t("Latin small letter y with circumflex")},{character:"Ÿ",title:t("Latin capital letter y with diaeresis")},{character:"Ź",title:t("Latin capital letter z with acute")},{character:"ź",title:t("Latin small letter z with acute")},{character:"Ż",title:t("Latin capital letter z with dot above")},{character:"ż",title:t("Latin small letter z with dot above")},{character:"Ž",title:t("Latin capital letter z with caron")},{character:"ž",title:t("Latin small letter z with caron")},{character:"ſ",title:t("Latin small letter long s")}],{label:t("Latin")})}}/**
|
|
1709
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1710
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1711
|
-
*/class yB extends w{static get pluginName(){return"SpecialCharactersCurrency"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:t("Dollar sign")},{character:"€",title:t("Euro sign")},{character:"¥",title:t("Yen sign")},{character:"£",title:t("Pound sign")},{character:"¢",title:t("Cent sign")},{character:"₠",title:t("Euro-currency sign")},{character:"₡",title:t("Colon sign")},{character:"₢",title:t("Cruzeiro sign")},{character:"₣",title:t("French franc sign")},{character:"₤",title:t("Lira sign")},{character:"¤",title:t("Currency sign")},{character:"₿",title:t("Bitcoin sign")},{character:"₥",title:t("Mill sign")},{character:"₦",title:t("Naira sign")},{character:"₧",title:t("Peseta sign")},{character:"₨",title:t("Rupee sign")},{character:"₩",title:t("Won sign")},{character:"₪",title:t("New sheqel sign")},{character:"₫",title:t("Dong sign")},{character:"₭",title:t("Kip sign")},{character:"₮",title:t("Tugrik sign")},{character:"₯",title:t("Drachma sign")},{character:"₰",title:t("German penny sign")},{character:"₱",title:t("Peso sign")},{character:"₲",title:t("Guarani sign")},{character:"₳",title:t("Austral sign")},{character:"₴",title:t("Hryvnia sign")},{character:"₵",title:t("Cedi sign")},{character:"₶",title:t("Livre tournois sign")},{character:"₷",title:t("Spesmilo sign")},{character:"₸",title:t("Tenge sign")},{character:"₹",title:t("Indian rupee sign")},{character:"₺",title:t("Turkish lira sign")},{character:"₻",title:t("Nordic mark sign")},{character:"₼",title:t("Manat sign")},{character:"₽",title:t("Ruble sign")}],{label:t("Currency")})}}/**
|
|
1712
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1713
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1714
|
-
*/class kB extends w{static get pluginName(){return"SpecialCharactersEssentials"}static get requires(){return[yB,bB,_B,wB,vB]}}/**
|
|
1715
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1716
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1717
|
-
*/function Ih(n,e){const t=(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const r=s.attributeNewValue,a=o.writer,l=o.mapper.toViewElement(s.item),c=[...l.getChildren()].find(d=>d.getCustomProperty("media-content"));a.remove(c);const u=n.getMediaViewElement(a,r,e);a.insert(a.createPositionAt(l,0),u)};return i=>{i.on("attribute:url:media",t)}}/**
|
|
1718
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1719
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1720
|
-
*/function CB(n,e,t){return e.setCustomProperty("media",!0,n),mn(n,e,{label:t})}function Ph(n,e,t,i){return n.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(n,t,i),n.createSlot()])}function Rh(n){const e=n.getSelectedElement();return e&&e.is("element","media")?e:null}function x1(n,e,t,i){n.change(s=>{const o=s.createElement("media",{url:e});n.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}/**
|
|
1721
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1722
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1723
|
-
*/class EB extends R{refresh(){const e=this.editor.model,t=e.document.selection,i=Rh(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=AB(t)||TB(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,s=Rh(i);s?t.change(o=>{o.setAttribute("url",e,s)}):x1(t,e,i,!0)}}function TB(n,e){let i=Al(n,e).start.parent;return i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent),e.schema.checkChild(i,"media")}function AB(n){const e=n.getSelectedElement();return!!e&&e.name==="media"}const SB='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>';/**
|
|
1724
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1725
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1726
|
-
*/const xB="0 0 64 42";class IB{constructor(e,t){const i=t.providers,s=t.extraProviders||[],o=new Set(t.removeProviders),r=i.concat(s).filter(a=>{const l=a.name;return l?!o.has(l):(D("media-embed-no-provider-name",{provider:a}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new Vh(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,s=z(t.url);for(const o of s){const r=this._getUrlMatches(e,o);if(r)return new Vh(this.locale,e,r,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let s=e.replace(/^https?:\/\//,"");return i=s.match(t),i||(s=s.replace(/^www\./,""),i=s.match(t),i)?i:null}}class Vh{constructor(e,t,i,s){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=s}getViewElement(e,t){const i={};let s;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const o=this._getPreviewHtml(t);s=e.createRawElement("div",i,(r,a)=>{a.setContentOf(r,o)})}else this.url&&(i.url=this.url),s=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,s),s}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new lt,t=this._locale.t;return e.content=SB,e.viewBox=xB,new Le({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}/**
|
|
1727
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1728
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1729
|
-
*/class Vo extends w{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],s=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${i}${s?`?start=${s}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new IB(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,i=e.t,s=e.conversion,o=e.config.get("mediaEmbed.previewsInData"),r=e.config.get("mediaEmbed.elementName"),a=this.registry;e.commands.add("mediaEmbed",new EB(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),s.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url");return Ph(c,a,u,{elementName:r,renderMediaPreview:!!u&&o})}}),s.for("dataDowncast").add(Ih(a,{elementName:r,renderMediaPreview:o})),s.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url"),d=Ph(c,a,u,{elementName:r,renderForEditingView:!0});return CB(d,c,i("media widget"))}}),s.for("editingDowncast").add(Ih(a,{elementName:r,renderForEditingView:!0})),s.for("upcast").elementToElement({view:l=>["oembed",r].includes(l.name)&&l.getAttribute("url")?{name:!0}:null,model:(l,{writer:c})=>{const u=l.getAttribute("url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(l,{writer:c})=>{const u=l.getAttribute("data-oembed-url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).add(l=>{const c=(u,d,h)=>{if(!h.consumable.consume(d.viewItem,{name:!0,classes:"media"}))return;const{modelRange:f,modelCursor:m}=h.convertChildren(d.viewItem,d.modelCursor);d.modelRange=f,d.modelCursor=m,J(f.getItems())||h.consumable.revert(d.viewItem,{name:!0,classes:"media"})};l.on("element:figure",c)})}}/**
|
|
1730
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1731
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1732
|
-
*/const PB=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class RB extends w{static get requires(){return[fp,It,gp]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const o=t.selection.getFirstRange(),r=_e.fromPosition(o.start);r.stickiness="toPrevious";const a=_e.fromPosition(o.end);a.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(r,a),r.detach(),a.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(S.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,s=i.plugins.get(Vo).registry,o=new He(e,t),r=o.getWalker({ignoreElementEnd:!0});let a="";for(const c of r)c.item.is("$textProxy")&&(a+=c.item.data);if(a=a.trim(),!a.match(PB)){o.detach();return}if(!s.hasMedia(a)){o.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=_e.fromPosition(e),this._timeoutId=S.window.setTimeout(()=>{i.model.change(c=>{this._timeoutId=null,c.remove(o),o.detach();let u=null;this._positionToInsert.root.rootName!=="$graveyard"&&(u=this._positionToInsert),x1(i.model,a,u,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(It).requestUndoOnBackspace()},100)}}/**
|
|
1733
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1734
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1735
|
-
*/class VB extends T{constructor(e,t){super(t);const i=t.t;this.focusTracker=new te,this.keystrokes=new oe,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),P.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",s=>!!s),this.cancelButtonView=this._createButton(i("Cancel"),P.cancel,"ck-button-cancel","cancel"),this._focusables=new xe,this._focusCycler=new Ae({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),Lo({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(i=>{this._focusables.add(i),this.focusTracker.add(i.element)}),this.keystrokes.listenTo(this.element);const t=i=>i.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new dn(this.locale,ps),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}_createButton(e,t,i,s){const o=new V(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),s&&o.delegate("execute").to(this,s),o}}const BB='<svg viewBox="0 0 22 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-14.24 1h13.008v12H4.467l.029-12Zm-2.208 1h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003l-.029 1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h.974v1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Z"/><path d="M8.374 6.648a.399.399 0 0 1 .395-.4.402.402 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35V6.648Z"/></svg>';/**
|
|
1736
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1737
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1738
|
-
*/class MB extends w{static get requires(){return[Vo]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",i=>{const s=ge(i);return this._setUpDropdown(s,t),s})}_setUpDropdown(e,t){const i=this.editor,s=i.t,o=e.buttonView,r=i.plugins.get(Vo).registry;e.once("change:isOpen",()=>{const a=new(za(VB))(LB(i.t,r),i.locale);e.panelView.children.add(a),o.on("open",()=>{a.disableCssTransitions(),a.url=t.value||"",a.urlInputView.fieldView.select(),a.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{a.isValid()&&(i.execute("mediaEmbed",a.url),i.editing.view.focus())}),e.on("change:isOpen",()=>a.resetFormStatus()),e.on("cancel",()=>{i.editing.view.focus()}),a.delegate("submit","cancel").to(e),a.urlInputView.fieldView.bind("value").to(t,"value"),a.urlInputView.bind("isEnabled").to(t,"isEnabled")}),e.bind("isEnabled").to(t),o.set({label:s("Insert media"),icon:BB,tooltip:!0})}}function LB(n,e){return[t=>{if(!t.url.length)return n("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return n("This media URL is not supported.")}]}/**
|
|
1739
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1740
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1741
|
-
*/class OB extends w{static get requires(){return[Vo,MB,RB,Ei]}static get pluginName(){return"MediaEmbed"}}/**
|
|
1742
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1743
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1744
|
-
*/const Bh="ckCsrfToken",Mh=40,Lh="abcdefghijklmnopqrstuvwxyz0123456789";function FB(){let n=DB(Bh);return(!n||n.length!=Mh)&&(n=$B(Mh),NB(Bh,n)),n}function DB(n){n=n.toLowerCase();const e=document.cookie.split(";");for(const t of e){const i=t.split("=");if(decodeURIComponent(i[0].trim().toLowerCase())===n)return decodeURIComponent(i[1])}return null}function NB(n,e){document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(e)+";path=/"}function $B(n){let e="";const t=new Uint8Array(n);window.crypto.getRandomValues(t);for(let i=0;i<t.length;i++){const s=Lh.charAt(t[i]%Lh.length);e+=Math.random()>.5?s.toUpperCase():s}return e}/**
|
|
1745
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1746
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1747
|
-
*/class HB extends w{static get requires(){return[oi]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(oi).createUploadAdapter=t=>new zB(t,e,this.editor.t))}}class zB{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const s=this.xhr,o=this.loader,r=this.t,a=r("Cannot upload file:")+` ${i.name}.`;s.addEventListener("error",()=>t(a)),s.addEventListener("abort",()=>t()),s.addEventListener("load",()=>{const l=s.response;if(!l||!l.uploaded)return t(l&&l.error&&l.error.message?l.error.message:a);e({default:l.url})});/* istanbul ignore else -- @preserve */s.upload&&s.upload.addEventListener("progress",l=>{l.lengthComputable&&(o.uploadTotal=l.total,o.uploaded=l.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",FB()),this.xhr.send(t)}}class Da extends Qo{}pe(Da,"builtinPlugins",[e4,XI,cP,DP,hP,G3,_4,C4,G4,o7,r7,z4,u7,h7,yP,$7,G7,jp,w6,L6,ys,_1,YR,jR,nV,$V,b8,TP,IP,wP,L8,Y8,sB,cB,pB,kB,OB,HB]),pe(Da,"defaultConfig",{toolbar:{items:["undo","redo","|","heading","bold","italic","strikethrough","underline","fontColor","fontBackgroundColor","fontFamily","fontSize","|","numberedList","bulletedList","|","outdent","indent","blockQuote","|","alignment","|","link","imageUpload","mediaEmbed","horizontalLine","specialCharacters","code","codeBlock","insertTable","|","style","|","removeFormat","selectAll","|","sourceEditing"]},style:{definitions:[{name:"Source code",element:"pre",classes:["SourceCode"]},{name:"Error",element:"p",classes:["Error"]},{name:"Path",element:"p",classes:["Path"]}]},codeBlock:{languages:[{language:"plaintext",label:"Plain text"},{language:"html",label:"HTML"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"css",label:"CSS"}]},headingConfig:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h1",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"}]},image:{resizeOptions:[{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"},{name:"resizeImage:original",value:null,icon:"original"}],toolbar:["toggleImageCaption","imageTextAlternative","|","imageStyle:inline","imageStyle:block","imageStyle:side","|","imageStyle:wrapText","imageStyle:breakText","|","resizeImage:25","resizeImage:50","resizeImage:75","resizeImage:original"]},language:"en"});class UB{constructor(e,t,i){pe(this,"loader");pe(this,"xhr");pe(this,"insertImageServiceUrl");pe(this,"getImageServiceUrl");this.loader=e,this.insertImageServiceUrl=t,this.getImageServiceUrl=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(e),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(e){const t=this.xhr=new XMLHttpRequest;let i=this.insertImageServiceUrl;i+="&dADFileUpload=Y",i+="&max_file_size=0",i+="&name="+window.btoa(encodeURIComponent(e.name)),i+="&size="+e.size,i+="&type="+(e.type?e.type:"n/a"),t.open("POST",i,!0),t.responseType="json"}_initListeners(e,t,i){const s=this.xhr,o=this.loader,r=`Couldn't upload file: ${i.name}.`;s.addEventListener("error",()=>t(r)),s.addEventListener("abort",()=>t()),s.addEventListener("load",()=>{const a=s.response;if(a&&a.S){if(a.S==="Y"){const l=this._getFileIdFromResponse(a);if(l){e({default:this.getImageServiceUrl+"?view=Y&file="+l});return}}else if(a.M){t(a.M);return}}t(r)}),s.upload&&s.upload.addEventListener("progress",a=>{a.lengthComputable&&(o.uploadTotal=a.total,o.uploaded=a.loaded)})}_sendRequest(e){this.xhr.send(e.slice())}_getFileIdFromResponse(e){if(e.F&&Array.isArray(e.F)){for(const t of e.F)if(Array.isArray(t)&&t.length>1&&t[0]==="id")return t[1]}return null}}function WB(n){let e;return{c(){e=Ha("div")},m(t,i){$a(t,e,i),n[16](e)},p:ti,i:ti,o:ti,d(t){t&&Bo(e),n[16](null)}}}function qB(n){const e=n.editing.view.domConverter.unsafeElements,t=e.indexOf("style");t>-1&&e.splice(t,1)}function jB(n){n.conversion.for("downcast").add(e=>e.on("insert:imageBlock",(t,i,s)=>{const o=s.mapper.toViewElement(i.item);o&&s.writer.setStyle("margin","0",o)},{priority:"lowest"}))}function I1(n,e){for(let t of n)t.is("element")&&(e.removeAttribute("style",t),t.childCount>0&&I1(t.getChildren(),e))}function GB(n,e,t){const i=e.createRangeIn(t);for(const s of i.getWalker()){const o=s.item;if(o.is("$textProxy")&&o.data!=""&&o.data.includes(n))return o}return null}function KB(n,e,t){let{insertImageServiceUrl:i=""}=e,{getImageServiceUrl:s=""}=e,{items:o=["undo","redo","|","heading","bold","italic","strikethrough","underline","fontColor","fontBackgroundColor","fontFamily","fontSize","|","numberedList","bulletedList","|","outdent","indent","blockQuote","|","alignment","|","link","imageUpload","mediaEmbed","horizontalLine","specialCharacters","code","codeBlock","insertTable","|","style","|","removeFormat","selectAll","|","sourceEditing"]}=e,{allowHtmlSupport:r=!1}=e,{value:a=""}=e,{placeHolder:l=""}=e,{lang:c="en"}=e,{valueChange:u=(v,C)=>{}}=e,{stateChange:d=(v,C)=>{}}=e,{sourceEditingModeChange:h=(v,C)=>{}}=e,{selectionRangeChange:f=(v,C)=>{}}=e;const m=()=>p;let p=null,_=null;function k(v){v.plugins.get("FileRepository").createUploadAdapter=C=>new UB(C,i,s)}function A(v){v.plugins.has("ClipboardPipeline")&&v.plugins.get("ClipboardPipeline").isEnabled&&v.plugins.get("ClipboardPipeline").on("inputTransformation",(C,B)=>{if(B.content.childCount>0){const re=new vi(v.editing.view.document);I1(B.content.getChildren(),re)}})}function F(v,C){if(v.root==null||v.path==null||v.stickiness==null||p==null)return null;let B=p.model.document.getRoot(v.root);return B==null?null:C.createPositionFromPath(B,v.path,v.stickiness)}const U=v=>{p!=null&&(p.focus(),p.model.change(C=>{if(p==null)return;let B=p.model.document.getRoot();if(B==null)return;const re=GB(v,C,B);if(re!=null){C.setSelection(C.createPositionBefore(re)),C.remove(re);const ct=re.data.split(v);C.insertText(ct[0],p.model.document.selection.getFirstPosition()??void 0);const Es=p.model.document.selection.getFirstPosition();C.insertText(ct[1],p.model.document.selection.getFirstPosition()??void 0),C.setSelection(Es)}}))},Y=v=>{p!=null&&(p.focus(),p.model.change(C=>{if(p==null)return;let B=JSON.parse(v);if(B.start==null)return;let re=F(B.start,C);if(re==null)return;let ct=C.createRange(re);if(B.end!=null){let Es=F(B.end,C);Es!=null&&(ct=C.createRange(re,Es))}C.setSelection(ct)}))};Da.create(a,{placeholder:l,toolbar:o,extraPlugins:[k,qB,jB,A],htmlSupport:{allow:r?[{name:/.*/,attributes:!0,classes:!0,styles:!0}]:[{name:"a",attributes:["href","target","rel"],classes:!0,styles:!0},{name:/^(b|i|br|center|hr|nav|s|strong|style|u)$/},{name:/^(div|p|span)$/,classes:!0,styles:!0},{name:"img",attributes:["src","width","height","alt"],classes:!0,styles:!0},{name:/^(table|tbody|th|tr|td)$/,attributes:["id","cellpadding","cellspacing","colspan","rowspan","border","width","height","align","valign"],classes:!0,styles:!0}]},language:{ui:c}}).then(v=>{t(15,p=v),_!=null&&v.ui.view.element!=null&&_.appendChild(v.ui.view.element),v.model.document.on("change:data",(C,B)=>{t(1,a=v.getData()),u(C,B)}),v.on("change:state",(C,B,re,ct)=>{d(C,re)}),v.model.document.selection.on("change:range",(C,B)=>{f(C,B)}),v.plugins.has("SourceEditing")&&v.plugins.get("SourceEditing").isEnabled&&v.plugins.get("SourceEditing").on("change:isSourceEditingMode",(C,B,re,ct)=>{h(C,re)}),d(null,"ready")}).catch(v=>{console.error(v.stack)});function x(v){oo[v?"unshift":"push"](()=>{_=v,t(0,_)})}return n.$$set=v=>{"insertImageServiceUrl"in v&&t(2,i=v.insertImageServiceUrl),"getImageServiceUrl"in v&&t(3,s=v.getImageServiceUrl),"items"in v&&t(4,o=v.items),"allowHtmlSupport"in v&&t(5,r=v.allowHtmlSupport),"value"in v&&t(1,a=v.value),"placeHolder"in v&&t(6,l=v.placeHolder),"lang"in v&&t(7,c=v.lang),"valueChange"in v&&t(8,u=v.valueChange),"stateChange"in v&&t(9,d=v.stateChange),"sourceEditingModeChange"in v&&t(10,h=v.sourceEditingModeChange),"selectionRangeChange"in v&&t(11,f=v.selectionRangeChange)},n.$$.update=()=>{if(n.$$.dirty&32832){let v;p!=null&&(v=p.editing.view.document.getRoot("main"))!=null&&v.placeholder!=l&&(v.placeholder=l)}},[_,a,i,s,o,r,l,c,u,d,h,f,m,U,Y,p,x]}class P1 extends jh{constructor(e){super(),Uh(this,e,KB,WB,Fh,{insertImageServiceUrl:2,getImageServiceUrl:3,items:4,allowHtmlSupport:5,value:1,placeHolder:6,lang:7,valueChange:8,stateChange:9,sourceEditingModeChange:10,selectionRangeChange:11,getEditor:12,setCursorPositionAtPlaceholder:13,setSelectionFromRangeJSONString:14})}get insertImageServiceUrl(){return this.$$.ctx[2]}set insertImageServiceUrl(e){this.$$set({insertImageServiceUrl:e}),Ie()}get getImageServiceUrl(){return this.$$.ctx[3]}set getImageServiceUrl(e){this.$$set({getImageServiceUrl:e}),Ie()}get items(){return this.$$.ctx[4]}set items(e){this.$$set({items:e}),Ie()}get allowHtmlSupport(){return this.$$.ctx[5]}set allowHtmlSupport(e){this.$$set({allowHtmlSupport:e}),Ie()}get value(){return this.$$.ctx[1]}set value(e){this.$$set({value:e}),Ie()}get placeHolder(){return this.$$.ctx[6]}set placeHolder(e){this.$$set({placeHolder:e}),Ie()}get lang(){return this.$$.ctx[7]}set lang(e){this.$$set({lang:e}),Ie()}get valueChange(){return this.$$.ctx[8]}set valueChange(e){this.$$set({valueChange:e}),Ie()}get stateChange(){return this.$$.ctx[9]}set stateChange(e){this.$$set({stateChange:e}),Ie()}get sourceEditingModeChange(){return this.$$.ctx[10]}set sourceEditingModeChange(e){this.$$set({sourceEditingModeChange:e}),Ie()}get selectionRangeChange(){return this.$$.ctx[11]}set selectionRangeChange(e){this.$$set({selectionRangeChange:e}),Ie()}get getEditor(){return this.$$.ctx[12]}get setCursorPositionAtPlaceholder(){return this.$$.ctx[13]}get setSelectionFromRangeJSONString(){return this.$$.ctx[14]}}customElements.define("ckeditor5-classic",qh(P1,{insertImageServiceUrl:{},getImageServiceUrl:{},items:{},allowHtmlSupport:{type:"Boolean"},value:{},placeHolder:{},lang:{},valueChange:{},stateChange:{},sourceEditingModeChange:{},selectionRangeChange:{}},[],["getEditor","setCursorPositionAtPlaceholder","setSelectionFromRangeJSONString"],!1));exports.CKEditor5Classic_1=P1;exports.SvelteComponent=jh;exports.add_flush_callback=K1;exports.append=L1;exports.attr=Nh;exports.bind=ew;exports.binding_callbacks=oo;exports.check_outros=Q1;exports.createEventDispatcher=q1;exports.create_component=tw;exports.create_custom_element=qh;exports.destroy_component=zh;exports.destroy_each=O1;exports.detach=Bo;exports.element=Ha;exports.flush=Ie;exports.group_outros=Y1;exports.init=Uh;exports.insert=$a;exports.is_function=Na;exports.listen=D1;exports.mount_component=Hh;exports.noop=ti;exports.run_all=sn;exports.safe_not_equal=Fh;exports.set_data=$1;exports.set_input_value=H1;exports.space=F1;exports.text=Dh;exports.transition_in=$h;exports.transition_out=X1;
|