@qualityunit/liveagent-components-editor 0.0.26 → 0.0.28
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.cjs +1 -1
- package/dist/ckeditor.js +1 -1
- package/dist/{ckeditor5-DYXUWFJ1.js → ckeditor5-JntJCb_D.js} +452 -441
- package/dist/{ckeditor5-DrqZ4XP0.cjs → ckeditor5-jifeVsuD.cjs} +117 -117
- package/dist/editor-lib.cjs +1 -1
- package/dist/editor-lib.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Qp=Object.defineProperty;var Xp=(n,e,t)=>e in n?Qp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var me=(n,e,t)=>(Xp(n,typeof e!="symbol"?e+"":e,t),t);function e1(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 Jt(){}function mh(n){return n()}function yl(){return Object.create(null)}function Zi(n){n.forEach(mh)}function va(n){return typeof n=="function"}function gh(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function t1(n){return Object.keys(n).length===0}function i1(n,e){n.appendChild(e)}function ya(n,e,t){n.insertBefore(e,t||null)}function fo(n){n.parentNode&&n.parentNode.removeChild(n)}function n1(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function ka(n){return document.createElement(n)}function ph(n){return document.createTextNode(n)}function s1(){return ph(" ")}function o1(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function wh(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function r1(n){return Array.from(n.childNodes)}function a1(n,e){e=""+e,n.data!==e&&(n.data=e)}function l1(n,e){n.value=e??""}function c1(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 xn;function _n(n){xn=n}function d1(){if(!xn)throw new Error("Function called outside component initialization");return xn}function h1(){const n=d1();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const o=c1(e,t,{cancelable:i});return s.slice().forEach(r=>{r.call(n,o)}),!o.defaultPrevented}return!0}}const Ii=[],Ns=[];let Fi=[];const kr=[],f1=Promise.resolve();let Cr=!1;function m1(){Cr||(Cr=!0,f1.then(
|
|
1
|
+
"use strict";var Qp=Object.defineProperty;var Xp=(n,e,t)=>e in n?Qp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var me=(n,e,t)=>(Xp(n,typeof e!="symbol"?e+"":e,t),t);function e1(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 Jt(){}function mh(n){return n()}function yl(){return Object.create(null)}function Zi(n){n.forEach(mh)}function va(n){return typeof n=="function"}function gh(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function t1(n){return Object.keys(n).length===0}function i1(n,e){n.appendChild(e)}function ya(n,e,t){n.insertBefore(e,t||null)}function fo(n){n.parentNode&&n.parentNode.removeChild(n)}function n1(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function ka(n){return document.createElement(n)}function ph(n){return document.createTextNode(n)}function s1(){return ph(" ")}function o1(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function wh(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function r1(n){return Array.from(n.childNodes)}function a1(n,e){e=""+e,n.data!==e&&(n.data=e)}function l1(n,e){n.value=e??""}function c1(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 xn;function _n(n){xn=n}function d1(){if(!xn)throw new Error("Function called outside component initialization");return xn}function h1(){const n=d1();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const o=c1(e,t,{cancelable:i});return s.slice().forEach(r=>{r.call(n,o)}),!o.defaultPrevented}return!0}}const Ii=[],Ns=[];let Fi=[];const kr=[],f1=Promise.resolve();let Cr=!1;function m1(){Cr||(Cr=!0,f1.then(Re))}function Er(n){Fi.push(n)}function g1(n){kr.push(n)}const Lo=new Set;let _i=0;function Re(){if(_i!==0)return;const n=xn;do{try{for(;_i<Ii.length;){const e=Ii[_i];_i++,_n(e),p1(e.$$)}}catch(e){throw Ii.length=0,_i=0,e}for(_n(null),Ii.length=0,_i=0;Ns.length;)Ns.pop()();for(let e=0;e<Fi.length;e+=1){const t=Fi[e];Lo.has(t)||(Lo.add(t),t())}Fi.length=0}while(Ii.length);for(;kr.length;)kr.pop()();Cr=!1,Lo.clear(),_n(n)}function p1(n){if(n.fragment!==null){n.update(),Zi(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Er)}}function w1(n){const e=[],t=[];Fi.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),Fi=e}const Rs=new Set;let Kt;function b1(){Kt={r:0,c:[],p:Kt}}function _1(){Kt.r||Zi(Kt.c),Kt=Kt.p}function bh(n,e){n&&n.i&&(Rs.delete(n),n.i(e))}function v1(n,e,t,i){if(n&&n.o){if(Rs.has(n))return;Rs.add(n),Kt.c.push(()=>{Rs.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}function y1(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function k1(n){n&&n.c()}function _h(n,e,t){const{fragment:i,after_update:s}=n.$$;i&&i.m(e,t),Er(()=>{const o=n.$$.on_mount.map(mh).filter(va);n.$$.on_destroy?n.$$.on_destroy.push(...o):Zi(o),n.$$.on_mount=[]}),s.forEach(Er)}function vh(n,e){const t=n.$$;t.fragment!==null&&(w1(t.after_update),Zi(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function C1(n,e){n.$$.dirty[0]===-1&&(Ii.push(n),m1(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function yh(n,e,t,i,s,o,r=null,a=[-1]){const l=xn;_n(n);const c=n.$$={fragment:null,ctx:[],props:o,update:Jt,not_equal:s,bound:yl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:yl(),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&&C1(n,d)),h}):[],c.update(),u=!0,Zi(c.before_update),c.fragment=i?i(c.ctx):!1,e.target){if(e.hydrate){const d=r1(e.target);c.fragment&&c.fragment.l(d),d.forEach(fo)}else c.fragment&&c.fragment.c();e.intro&&bh(n.$$.fragment),_h(n,e.target,e.anchor),Re()}_n(l)}let kh;typeof HTMLElement=="function"&&(kh=class extends HTMLElement{constructor(e,t,i){super();me(this,"$$ctor");me(this,"$$s");me(this,"$$c");me(this,"$$cn",!1);me(this,"$$d",{});me(this,"$$r",!1);me(this,"$$p_d",{});me(this,"$$l",{});me(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=ka("slot"),o!=="default"&&wh(r,"name",o)},m:function(c,u){ya(c,r,u)},d:function(c){c&&fo(r)}}}};if(await Promise.resolve(),!this.$$cn)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]=Vs(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=Vs(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]=Vs(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 Vs(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 Ch(n,e,t,i,s,o){let r=class extends kh{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=Vs(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 Eh{constructor(){me(this,"$$");me(this,"$$set")}$destroy(){vh(this,1),this.$destroy=Jt}$on(e,t){if(!va(t))return Jt;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&&!t1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const E1="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(E1);/**
|
|
2
2
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/function Ca({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()})}/**
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/function Ah(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=M1(s,o,t);return i?O1(r,o.length):L1(o,r)}function M1(n,e,t){const i=kl(n,e,t);if(i===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=Cl(n,i),o=Cl(e,i),r=kl(s,o,t),a=n.length-r,l=e.length-r;return{firstIndex:i,lastIndexOld:a,lastIndexNew:l}}function kl(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 Cl(n,e){return n.slice(e).reverse()}function L1(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 O1(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
20
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
21
21
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
22
|
-
*/function vn(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 vn.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,y=d[p+1]!==void 0?d[p+1]:-1,T=_>y?-1:1;u[p+T]&&(u[p]=u[p+T].slice(0)),u[p]||(u[p]=[]),u[p].push(_>y?o:r);let
|
|
22
|
+
*/function vn(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 vn.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,y=d[p+1]!==void 0?d[p+1]:-1,T=_>y?-1:1;u[p+T]&&(u[p]=u[p+T].slice(0)),u[p]||(u[p]=[]),u[p].push(_>y?o:r);let D=Math.max(_,y),k=D-p;for(;k<a&&D<l&&t(n[k],e[D]);)k++,D++,u[p].push("equal");return D}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)}vn.fastDiff=Ah;/**
|
|
23
23
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
24
24
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
25
25
|
*/function El(){return function n(){n.called=!0}}/**
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
*/const ke=new Array(256).fill("").map((n,e)=>("0"+e.toString(16)).slice(-2));function qe(){const n=Math.random()*4294967296>>>0,e=Math.random()*4294967296>>>0,t=Math.random()*4294967296>>>0,i=Math.random()*4294967296>>>0;return"e"+ke[n>>0&255]+ke[n>>8&255]+ke[n>>16&255]+ke[n>>24&255]+ke[e>>0&255]+ke[e>>8&255]+ke[e>>16&255]+ke[e>>24&255]+ke[t>>0&255]+ke[t>>8&255]+ke[t>>16&255]+ke[t>>24&255]+ke[i>>0&255]+ke[i>>8&255]+ke[i>>16&255]+ke[i>>24&255]}/**
|
|
32
32
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
33
33
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
34
|
-
*/const
|
|
34
|
+
*/const Fe={get(n="normal"){return typeof n!="number"?this[n]||this.normal:n},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};/**
|
|
35
35
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
36
36
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
37
|
-
*/function Sh(n,e){const t=
|
|
37
|
+
*/function Sh(n,e){const t=Fe.get(e.priority);for(let i=0;i<n.length;i++)if(Fe.get(n[i].priority)<t){n.splice(i,0,e);return}n.push(e)}/**
|
|
38
38
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
39
39
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
40
40
|
*/const B1="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class g extends Error{constructor(e,t,i){super(F1(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 U(n,e){console.warn(...D1(n,e))}function xh(n){return`
|
|
@@ -44,10 +44,10 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
44
44
|
*/const N1="41.2.1",$1=new Date(2024,2,18);/* istanbul ignore next -- @preserve */if(globalThis.CKEDITOR_VERSION)throw new g("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=N1;/**
|
|
45
45
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
46
46
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
47
|
-
*/const Pi=Symbol("listeningTo"),Tr=Symbol("emitterId"),ht=Symbol("delegations"),Ih=Z(Object);function Z(n){if(!n)return Ih;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[Pi]||(this[Pi]={});const c=this[Pi];Oo(i)||Ph(i);const u=Oo(i);(a=c[u])||(a=c[u]={emitter:i,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(o),W1(this,i,s,o,r)}stopListening(i,s,o){const r=this[Pi];let a=i&&Oo(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)Bo(this,i,s,o),c.indexOf(o)!==-1&&(c.length===1?delete l.callbacks[s]:Bo(this,i,s,o));else if(c){for(;o=c.pop();)Bo(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[Pi]}}fire(i,...s){try{const o=i instanceof kt?i:new kt(this,i),r=o.name;let a=Vh(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[ht];if(l){const c=l.get(r),u=l.get("*");c&&Tl(c,o,s),u&&Tl(u,o,s)}return o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}delegate(...i){return{to:(s,o)=>{this[ht]||(this[ht]=new Map),i.forEach(r=>{const a=this[ht].get(r);a?a.set(s,o):this[ht].set(r,new Map([[s,o]]))})}}}stopDelegating(i,s){if(this[ht])if(!i)this[ht].clear();else if(!s)this[ht].delete(i);else{const o=this[ht].get(i);o&&o.delete(s)}}_addEventListener(i,s,o){U1(this,i);const r=Ar(this,i),a=Be.get(o.priority),l={callback:s,priority:a};for(const c of r)Sh(c,l)}_removeEventListener(i,s){const o=Ar(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]=Ih.prototype[n]});function z1(n,e){const t=n[Pi];return t&&t[e]?t[e].emitter:null}function Ph(n,e){n[Tr]||(n[Tr]=e||qe())}function Oo(n){return n[Tr]}function Rh(n){return n._events||Object.defineProperty(n,"_events",{value:{}}),n._events}function H1(){return{callbacks:[],childEvents:[]}}function U1(n,e){const t=Rh(n);if(t[e])return;let i=e,s=null;const o=[];for(;i!==""&&!t[i];)t[i]=H1(),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 Ar(n,e){const t=Rh(n)[e];if(!t)return[];let i=[t.callbacks];for(let s=0;s<t.childEvents.length;s++){const o=Ar(n,t.childEvents[s]);i=i.concat(o)}return i}function Vh(n,e){let t;return!n._events||!(t=n._events[e])||!t.callbacks.length?e.indexOf(":")>-1?Vh(n,e.substr(0,e.lastIndexOf(":"))):null:t.callbacks}function Tl(n,e,t){for(let[i,s]of n){s?typeof s=="function"&&(s=s(e.name)):s=e.name;const o=new kt(e.source,s);o.path=[...e.path],i.fire(o,...t)}}function W1(n,e,t,i,s){e._addEventListener?e._addEventListener(t,i,s):n._addEventListener.call(e,t,i,s)}function Bo(n,e,t,i){e._removeEventListener?e._removeEventListener(t,i):n._removeEventListener.call(e,t,i)}var Mh=typeof global=="object"&&global&&global.Object===Object&&global,q1=typeof self=="object"&&self&&self.Object===Object&&self,nt=Mh||q1||Function("return this")(),ct=nt.Symbol,Lh=Object.prototype,j1=Lh.hasOwnProperty,G1=Lh.toString,an=ct?ct.toStringTag:void 0;function K1(n){var e=j1.call(n,an),t=n[an];try{n[an]=void 0;var i=!0}catch{}var s=G1.call(n);return i&&(e?n[an]=t:delete n[an]),s}var Z1=Object.prototype,J1=Z1.toString;function Y1(n){return J1.call(n)}var Q1="[object Null]",X1="[object Undefined]",Al=ct?ct.toStringTag:void 0;function Bt(n){return n==null?n===void 0?X1:Q1:Al&&Al in Object(n)?K1(n):Y1(n)}function je(n){return n!=null&&typeof n=="object"}var e0="[object Symbol]";function go(n){return typeof n=="symbol"||je(n)&&Bt(n)==e0}function t0(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 De=Array.isArray,i0=1/0,Sl=ct?ct.prototype:void 0,xl=Sl?Sl.toString:void 0;function Oh(n){if(typeof n=="string")return n;if(De(n))return t0(n,Oh)+"";if(go(n))return xl?xl.call(n):"";var e=n+"";return e=="0"&&1/n==-i0?"-0":e}var n0=/\s/;function s0(n){for(var e=n.length;e--&&n0.test(n.charAt(e)););return e}var o0=/^\s+/;function r0(n){return n&&n.slice(0,s0(n)+1).replace(o0,"")}function X(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Il=NaN,a0=/^[-+]0x[0-9a-f]+$/i,l0=/^0b[01]+$/i,c0=/^0o[0-7]+$/i,u0=parseInt;function Pl(n){if(typeof n=="number")return n;if(go(n))return Il;if(X(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=X(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=r0(n);var t=l0.test(n);return t||c0.test(n)?u0(n.slice(2),t?2:8):a0.test(n)?Il:+n}function Vt(n){return n}var d0="[object AsyncFunction]",h0="[object Function]",f0="[object GeneratorFunction]",m0="[object Proxy]";function ii(n){if(!X(n))return!1;var e=Bt(n);return e==h0||e==f0||e==d0||e==m0}var Fo=nt["__core-js_shared__"],Rl=function(){var n=/[^.]+$/.exec(Fo&&Fo.keys&&Fo.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function g0(n){return!!Rl&&Rl in n}var p0=Function.prototype,w0=p0.toString;function ci(n){if(n!=null){try{return w0.call(n)}catch{}try{return n+""}catch{}}return""}var b0=/[\\^$.*+?()[\]{}|]/g,_0=/^\[object .+?Constructor\]$/,v0=Function.prototype,y0=Object.prototype,k0=v0.toString,C0=y0.hasOwnProperty,E0=RegExp("^"+k0.call(C0).replace(b0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function T0(n){if(!X(n)||g0(n))return!1;var e=ii(n)?E0:_0;return e.test(ci(n))}function A0(n,e){return n==null?void 0:n[e]}function ui(n,e){var t=A0(n,e);return T0(t)?t:void 0}var Sr=ui(nt,"WeakMap"),Vl=Object.create,S0=function(){function n(){}return function(e){if(!X(e))return{};if(Vl)return Vl(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();function x0(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 Bh(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var I0=800,P0=16,R0=Date.now;function V0(n){var e=0,t=0;return function(){var i=R0(),s=P0-(i-t);if(t=i,s>0){if(++e>=I0)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function M0(n){return function(){return n}}var $s=function(){try{var n=ui(Object,"defineProperty");return n({},"",{}),n}catch{}}(),L0=$s?function(n,e){return $s(n,"toString",{configurable:!0,enumerable:!1,value:M0(e),writable:!0})}:Vt;const O0=L0;var B0=V0(O0);function F0(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}var D0=9007199254740991,N0=/^(?:0|[1-9]\d*)$/;function po(n,e){var t=typeof n;return e=e??D0,!!e&&(t=="number"||t!="symbol"&&N0.test(n))&&n>-1&&n%1==0&&n<e}function wo(n,e,t){e=="__proto__"&&$s?$s(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function Yn(n,e){return n===e||n!==n&&e!==e}var $0=Object.prototype,z0=$0.hasOwnProperty;function Ta(n,e,t){var i=n[e];(!(z0.call(n,e)&&Yn(i,t))||t===void 0&&!(e in n))&&wo(n,e,t)}function Ji(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?wo(t,a,l):Ta(t,a,l)}return t}var Ml=Math.max;function H0(n,e,t){return e=Ml(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,o=Ml(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),x0(n,this,a)}}function U0(n,e){return B0(H0(n,e,Vt),n+"")}var W0=9007199254740991;function Aa(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=W0}function bo(n){return n!=null&&Aa(n.length)&&!ii(n)}function q0(n,e,t){if(!X(t))return!1;var i=typeof e;return(i=="number"?bo(t)&&po(e,t.length):i=="string"&&e in t)?Yn(t[e],n):!1}function Sa(n){return U0(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&&q0(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 j0=Object.prototype;function xa(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||j0;return n===t}function G0(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var K0="[object Arguments]";function Ll(n){return je(n)&&Bt(n)==K0}var Fh=Object.prototype,Z0=Fh.hasOwnProperty,J0=Fh.propertyIsEnumerable,zs=Ll(function(){return arguments}())?Ll:function(n){return je(n)&&Z0.call(n,"callee")&&!J0.call(n,"callee")};function Y0(){return!1}var Dh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ol=Dh&&typeof module=="object"&&module&&!module.nodeType&&module,Q0=Ol&&Ol.exports===Dh,Bl=Q0?nt.Buffer:void 0,X0=Bl?Bl.isBuffer:void 0,In=X0||Y0,ew="[object Arguments]",tw="[object Array]",iw="[object Boolean]",nw="[object Date]",sw="[object Error]",ow="[object Function]",rw="[object Map]",aw="[object Number]",lw="[object Object]",cw="[object RegExp]",uw="[object Set]",dw="[object String]",hw="[object WeakMap]",fw="[object ArrayBuffer]",mw="[object DataView]",gw="[object Float32Array]",pw="[object Float64Array]",ww="[object Int8Array]",bw="[object Int16Array]",_w="[object Int32Array]",vw="[object Uint8Array]",yw="[object Uint8ClampedArray]",kw="[object Uint16Array]",Cw="[object Uint32Array]",te={};te[gw]=te[pw]=te[ww]=te[bw]=te[_w]=te[vw]=te[yw]=te[kw]=te[Cw]=!0;te[ew]=te[tw]=te[fw]=te[iw]=te[mw]=te[nw]=te[sw]=te[ow]=te[rw]=te[aw]=te[lw]=te[cw]=te[uw]=te[dw]=te[hw]=!1;function Ew(n){return je(n)&&Aa(n.length)&&!!te[Bt(n)]}function Ia(n){return function(e){return n(e)}}var Nh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yn=Nh&&typeof module=="object"&&module&&!module.nodeType&&module,Tw=yn&&yn.exports===Nh,Do=Tw&&Mh.process,$i=function(){try{var n=yn&&yn.require&&yn.require("util").types;return n||Do&&Do.binding&&Do.binding("util")}catch{}}(),Fl=$i&&$i.isTypedArray,Pa=Fl?Ia(Fl):Ew,Aw=Object.prototype,Sw=Aw.hasOwnProperty;function $h(n,e){var t=De(n),i=!t&&zs(n),s=!t&&!i&&In(n),o=!t&&!i&&!s&&Pa(n),r=t||i||s||o,a=r?G0(n.length,String):[],l=a.length;for(var c in n)(e||Sw.call(n,c))&&!(r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||po(c,l)))&&a.push(c);return a}function zh(n,e){return function(t){return n(e(t))}}var xw=zh(Object.keys,Object),Iw=Object.prototype,Pw=Iw.hasOwnProperty;function Rw(n){if(!xa(n))return xw(n);var e=[];for(var t in Object(n))Pw.call(n,t)&&t!="constructor"&&e.push(t);return e}function Qn(n){return bo(n)?$h(n):Rw(n)}function Vw(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var Mw=Object.prototype,Lw=Mw.hasOwnProperty;function Ow(n){if(!X(n))return Vw(n);var e=xa(n),t=[];for(var i in n)i=="constructor"&&(e||!Lw.call(n,i))||t.push(i);return t}function Yi(n){return bo(n)?$h(n,!0):Ow(n)}var Hh=Sa(function(n,e){Ji(e,Yi(e),n)}),Bw=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fw=/^\w*$/;function Ra(n,e){if(De(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||go(n)?!0:Fw.test(n)||!Bw.test(n)||e!=null&&n in Object(e)}var Pn=ui(Object,"create");function Dw(){this.__data__=Pn?Pn(null):{},this.size=0}function Nw(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var $w="__lodash_hash_undefined__",zw=Object.prototype,Hw=zw.hasOwnProperty;function Uw(n){var e=this.__data__;if(Pn){var t=e[n];return t===$w?void 0:t}return Hw.call(e,n)?e[n]:void 0}var Ww=Object.prototype,qw=Ww.hasOwnProperty;function jw(n){var e=this.__data__;return Pn?e[n]!==void 0:qw.call(e,n)}var Gw="__lodash_hash_undefined__";function Kw(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=Pn&&e===void 0?Gw:e,this}function ni(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])}}ni.prototype.clear=Dw;ni.prototype.delete=Nw;ni.prototype.get=Uw;ni.prototype.has=jw;ni.prototype.set=Kw;function Zw(){this.__data__=[],this.size=0}function _o(n,e){for(var t=n.length;t--;)if(Yn(n[t][0],e))return t;return-1}var Jw=Array.prototype,Yw=Jw.splice;function Qw(n){var e=this.__data__,t=_o(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():Yw.call(e,t,1),--this.size,!0}function Xw(n){var e=this.__data__,t=_o(e,n);return t<0?void 0:e[t][1]}function eb(n){return _o(this.__data__,n)>-1}function tb(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 At(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])}}At.prototype.clear=Zw;At.prototype.delete=Qw;At.prototype.get=Xw;At.prototype.has=eb;At.prototype.set=tb;var Rn=ui(nt,"Map");function ib(){this.size=0,this.__data__={hash:new ni,map:new(Rn||At),string:new ni}}function nb(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function vo(n,e){var t=n.__data__;return nb(e)?t[typeof e=="string"?"string":"hash"]:t.map}function sb(n){var e=vo(this,n).delete(n);return this.size-=e?1:0,e}function ob(n){return vo(this,n).get(n)}function rb(n){return vo(this,n).has(n)}function ab(n,e){var t=vo(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function St(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])}}St.prototype.clear=ib;St.prototype.delete=sb;St.prototype.get=ob;St.prototype.has=rb;St.prototype.set=ab;var lb="Expected a function";function Va(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(lb);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(Va.Cache||St),t}Va.Cache=St;var cb=500;function ub(n){var e=Va(n,function(i){return t.size===cb&&t.clear(),i}),t=e.cache;return e}var db=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hb=/\\(\\)?/g,fb=ub(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(db,function(t,i,s,o){e.push(s?o.replace(hb,"$1"):i||t)}),e});function Xn(n){return n==null?"":Oh(n)}function yo(n,e){return De(n)?n:Ra(n,e)?[n]:fb(Xn(n))}var mb=1/0;function Qi(n){if(typeof n=="string"||go(n))return n;var e=n+"";return e=="0"&&1/n==-mb?"-0":e}function Ma(n,e){e=yo(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[Qi(e[t++])];return t&&t==i?n:void 0}function Vn(n,e,t){var i=n==null?void 0:Ma(n,e);return i===void 0?t:i}function Uh(n,e){for(var t=-1,i=e.length,s=n.length;++t<i;)n[s+t]=e[t];return n}var La=zh(Object.getPrototypeOf,Object),gb="[object Object]",pb=Function.prototype,wb=Object.prototype,Wh=pb.toString,bb=wb.hasOwnProperty,_b=Wh.call(Object);function Se(n){if(!je(n)||Bt(n)!=gb)return!1;var e=La(n);if(e===null)return!0;var t=bb.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Wh.call(t)==_b}function qh(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 vb(n,e,t){var i=n.length;return t=t===void 0?i:t,!e&&t>=i?n:qh(n,e,t)}var yb="\\ud800-\\udfff",kb="\\u0300-\\u036f",Cb="\\ufe20-\\ufe2f",Eb="\\u20d0-\\u20ff",Tb=kb+Cb+Eb,Ab="\\ufe0e\\ufe0f",Sb="\\u200d",xb=RegExp("["+Sb+yb+Tb+Ab+"]");function jh(n){return xb.test(n)}function Ib(n){return n.split("")}var Gh="\\ud800-\\udfff",Pb="\\u0300-\\u036f",Rb="\\ufe20-\\ufe2f",Vb="\\u20d0-\\u20ff",Mb=Pb+Rb+Vb,Lb="\\ufe0e\\ufe0f",Ob="["+Gh+"]",xr="["+Mb+"]",Ir="\\ud83c[\\udffb-\\udfff]",Bb="(?:"+xr+"|"+Ir+")",Kh="[^"+Gh+"]",Zh="(?:\\ud83c[\\udde6-\\uddff]){2}",Jh="[\\ud800-\\udbff][\\udc00-\\udfff]",Fb="\\u200d",Yh=Bb+"?",Qh="["+Lb+"]?",Db="(?:"+Fb+"(?:"+[Kh,Zh,Jh].join("|")+")"+Qh+Yh+")*",Nb=Qh+Yh+Db,$b="(?:"+[Kh+xr+"?",xr,Zh,Jh,Ob].join("|")+")",zb=RegExp(Ir+"(?="+Ir+")|"+$b+Nb,"g");function Hb(n){return n.match(zb)||[]}function Ub(n){return jh(n)?Hb(n):Ib(n)}function Wb(n){return function(e){e=Xn(e);var t=jh(e)?Ub(e):void 0,i=t?t[0]:e.charAt(0),s=t?vb(t,1).join(""):e.slice(1);return i[n]()+s}}var Xh=Wb("toUpperCase");function qb(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 jb(n){return function(e){return n==null?void 0:n[e]}}var Gb={À:"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"},Kb=jb(Gb);const Zb=Kb;var Jb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yb="\\u0300-\\u036f",Qb="\\ufe20-\\ufe2f",Xb="\\u20d0-\\u20ff",e_=Yb+Qb+Xb,t_="["+e_+"]",i_=RegExp(t_,"g");function n_(n){return n=Xn(n),n&&n.replace(Jb,Zb).replace(i_,"")}var s_=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function o_(n){return n.match(s_)||[]}var r_=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function a_(n){return r_.test(n)}var ef="\\ud800-\\udfff",l_="\\u0300-\\u036f",c_="\\ufe20-\\ufe2f",u_="\\u20d0-\\u20ff",d_=l_+c_+u_,tf="\\u2700-\\u27bf",nf="a-z\\xdf-\\xf6\\xf8-\\xff",h_="\\xac\\xb1\\xd7\\xf7",f_="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",m_="\\u2000-\\u206f",g_=" \\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",sf="A-Z\\xc0-\\xd6\\xd8-\\xde",p_="\\ufe0e\\ufe0f",of=h_+f_+m_+g_,rf="['’]",Dl="["+of+"]",w_="["+d_+"]",af="\\d+",b_="["+tf+"]",lf="["+nf+"]",cf="[^"+ef+of+af+tf+nf+sf+"]",__="\\ud83c[\\udffb-\\udfff]",v_="(?:"+w_+"|"+__+")",y_="[^"+ef+"]",uf="(?:\\ud83c[\\udde6-\\uddff]){2}",df="[\\ud800-\\udbff][\\udc00-\\udfff]",Ri="["+sf+"]",k_="\\u200d",Nl="(?:"+lf+"|"+cf+")",C_="(?:"+Ri+"|"+cf+")",$l="(?:"+rf+"(?:d|ll|m|re|s|t|ve))?",zl="(?:"+rf+"(?:D|LL|M|RE|S|T|VE))?",hf=v_+"?",ff="["+p_+"]?",E_="(?:"+k_+"(?:"+[y_,uf,df].join("|")+")"+ff+hf+")*",T_="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",A_="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",S_=ff+hf+E_,x_="(?:"+[b_,uf,df].join("|")+")"+S_,I_=RegExp([Ri+"?"+lf+"+"+$l+"(?="+[Dl,Ri,"$"].join("|")+")",C_+"+"+zl+"(?="+[Dl,Ri+Nl,"$"].join("|")+")",Ri+"?"+Nl+"+"+$l,Ri+"+"+zl,A_,T_,af,x_].join("|"),"g");function P_(n){return n.match(I_)||[]}function R_(n,e,t){return n=Xn(n),e=t?void 0:e,e===void 0?a_(n)?P_(n):o_(n):n.match(e)||[]}var V_="['’]",M_=RegExp(V_,"g");function L_(n){return function(e){return qb(R_(n_(e).replace(M_,"")),n,"")}}function O_(){this.__data__=new At,this.size=0}function B_(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function F_(n){return this.__data__.get(n)}function D_(n){return this.__data__.has(n)}var N_=200;function $_(n,e){var t=this.__data__;if(t instanceof At){var i=t.__data__;if(!Rn||i.length<N_-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new St(i)}return t.set(n,e),this.size=t.size,this}function Xe(n){var e=this.__data__=new At(n);this.size=e.size}Xe.prototype.clear=O_;Xe.prototype.delete=B_;Xe.prototype.get=F_;Xe.prototype.has=D_;Xe.prototype.set=$_;function z_(n,e){return n&&Ji(e,Qn(e),n)}function H_(n,e){return n&&Ji(e,Yi(e),n)}var mf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hl=mf&&typeof module=="object"&&module&&!module.nodeType&&module,U_=Hl&&Hl.exports===mf,Ul=U_?nt.Buffer:void 0,Wl=Ul?Ul.allocUnsafe:void 0;function gf(n,e){if(e)return n.slice();var t=n.length,i=Wl?Wl(t):new n.constructor(t);return n.copy(i),i}function W_(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 pf(){return[]}var q_=Object.prototype,j_=q_.propertyIsEnumerable,ql=Object.getOwnPropertySymbols,Oa=ql?function(n){return n==null?[]:(n=Object(n),W_(ql(n),function(e){return j_.call(n,e)}))}:pf;function G_(n,e){return Ji(n,Oa(n),e)}var K_=Object.getOwnPropertySymbols,wf=K_?function(n){for(var e=[];n;)Uh(e,Oa(n)),n=La(n);return e}:pf;function Z_(n,e){return Ji(n,wf(n),e)}function bf(n,e,t){var i=e(n);return De(n)?i:Uh(i,t(n))}function Pr(n){return bf(n,Qn,Oa)}function J_(n){return bf(n,Yi,wf)}var Rr=ui(nt,"DataView"),Vr=ui(nt,"Promise"),Mr=ui(nt,"Set"),jl="[object Map]",Y_="[object Object]",Gl="[object Promise]",Kl="[object Set]",Zl="[object WeakMap]",Jl="[object DataView]",Q_=ci(Rr),X_=ci(Rn),ev=ci(Vr),tv=ci(Mr),iv=ci(Sr),jt=Bt;(Rr&&jt(new Rr(new ArrayBuffer(1)))!=Jl||Rn&&jt(new Rn)!=jl||Vr&&jt(Vr.resolve())!=Gl||Mr&&jt(new Mr)!=Kl||Sr&&jt(new Sr)!=Zl)&&(jt=function(n){var e=Bt(n),t=e==Y_?n.constructor:void 0,i=t?ci(t):"";if(i)switch(i){case Q_:return Jl;case X_:return jl;case ev:return Gl;case tv:return Kl;case iv:return Zl}return e});const Mn=jt;var nv=Object.prototype,sv=nv.hasOwnProperty;function ov(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&sv.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var Hs=nt.Uint8Array;function Ba(n){var e=new n.constructor(n.byteLength);return new Hs(e).set(new Hs(n)),e}function rv(n,e){var t=e?Ba(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var av=/\w*$/;function lv(n){var e=new n.constructor(n.source,av.exec(n));return e.lastIndex=n.lastIndex,e}var Yl=ct?ct.prototype:void 0,Ql=Yl?Yl.valueOf:void 0;function cv(n){return Ql?Object(Ql.call(n)):{}}function _f(n,e){var t=e?Ba(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var uv="[object Boolean]",dv="[object Date]",hv="[object Map]",fv="[object Number]",mv="[object RegExp]",gv="[object Set]",pv="[object String]",wv="[object Symbol]",bv="[object ArrayBuffer]",_v="[object DataView]",vv="[object Float32Array]",yv="[object Float64Array]",kv="[object Int8Array]",Cv="[object Int16Array]",Ev="[object Int32Array]",Tv="[object Uint8Array]",Av="[object Uint8ClampedArray]",Sv="[object Uint16Array]",xv="[object Uint32Array]";function Iv(n,e,t){var i=n.constructor;switch(e){case bv:return Ba(n);case uv:case dv:return new i(+n);case _v:return rv(n,t);case vv:case yv:case kv:case Cv:case Ev:case Tv:case Av:case Sv:case xv:return _f(n,t);case hv:return new i;case fv:case pv:return new i(n);case mv:return lv(n);case gv:return new i;case wv:return cv(n)}}function vf(n){return typeof n.constructor=="function"&&!xa(n)?S0(La(n)):{}}var Pv="[object Map]";function Rv(n){return je(n)&&Mn(n)==Pv}var Xl=$i&&$i.isMap,Vv=Xl?Ia(Xl):Rv,Mv="[object Set]";function Lv(n){return je(n)&&Mn(n)==Mv}var ec=$i&&$i.isSet,Ov=ec?Ia(ec):Lv,Bv=1,Fv=2,Dv=4,yf="[object Arguments]",Nv="[object Array]",$v="[object Boolean]",zv="[object Date]",Hv="[object Error]",kf="[object Function]",Uv="[object GeneratorFunction]",Wv="[object Map]",qv="[object Number]",Cf="[object Object]",jv="[object RegExp]",Gv="[object Set]",Kv="[object String]",Zv="[object Symbol]",Jv="[object WeakMap]",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]",Y={};Y[yf]=Y[Nv]=Y[Yv]=Y[Qv]=Y[$v]=Y[zv]=Y[Xv]=Y[ey]=Y[ty]=Y[iy]=Y[ny]=Y[Wv]=Y[qv]=Y[Cf]=Y[jv]=Y[Gv]=Y[Kv]=Y[Zv]=Y[sy]=Y[oy]=Y[ry]=Y[ay]=!0;Y[Hv]=Y[kf]=Y[Jv]=!1;function Di(n,e,t,i,s,o){var r,a=e&Bv,l=e&Fv,c=e&Dv;if(t&&(r=s?t(n,i,s,o):t(n)),r!==void 0)return r;if(!X(n))return n;var u=De(n);if(u){if(r=ov(n),!a)return Bh(n,r)}else{var d=Mn(n),h=d==kf||d==Uv;if(In(n))return gf(n,a);if(d==Cf||d==yf||h&&!s){if(r=l||h?{}:vf(n),!a)return l?Z_(n,H_(r,n)):G_(n,z_(r,n))}else{if(!Y[d])return s?n:{};r=Iv(n,d,a)}}o||(o=new Xe);var f=o.get(n);if(f)return f;o.set(n,r),Ov(n)?n.forEach(function(_){r.add(Di(_,e,t,_,n,o))}):Vv(n)&&n.forEach(function(_,y){r.set(y,Di(_,e,t,y,n,o))});var m=c?l?J_:Pr:l?Yi:Qn,p=u?void 0:m(n);return F0(p||n,function(_,y){p&&(y=_,_=n[y]),Ta(r,y,Di(_,e,t,y,n,o))}),r}var ly=4;function Ef(n){return Di(n,ly)}var cy=1,uy=4;function xt(n){return Di(n,cy|uy)}var dy=1,hy=4;function Fa(n,e){return e=typeof e=="function"?e:void 0,Di(n,dy|hy,e)}var fy="__lodash_hash_undefined__";function my(n){return this.__data__.set(n,fy),this}function gy(n){return this.__data__.has(n)}function Us(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new St;++e<t;)this.add(n[e])}Us.prototype.add=Us.prototype.push=my;Us.prototype.has=gy;function py(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 wy(n,e){return n.has(e)}var by=1,_y=2;function Tf(n,e,t,i,s,o){var r=t&by,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&_y?new Us: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(!py(e,function(y,T){if(!wy(f,T)&&(m===y||s(m,y,t,i,o)))return f.push(T)})){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 vy(n){var e=-1,t=Array(n.size);return n.forEach(function(i,s){t[++e]=[s,i]}),t}function yy(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var ky=1,Cy=2,Ey="[object Boolean]",Ty="[object Date]",Ay="[object Error]",Sy="[object Map]",xy="[object Number]",Iy="[object RegExp]",Py="[object Set]",Ry="[object String]",Vy="[object Symbol]",My="[object ArrayBuffer]",Ly="[object DataView]",tc=ct?ct.prototype:void 0,No=tc?tc.valueOf:void 0;function Oy(n,e,t,i,s,o,r){switch(t){case Ly:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case My:return!(n.byteLength!=e.byteLength||!o(new Hs(n),new Hs(e)));case Ey:case Ty:case xy:return Yn(+n,+e);case Ay:return n.name==e.name&&n.message==e.message;case Iy:case Ry:return n==e+"";case Sy:var a=vy;case Py:var l=i&ky;if(a||(a=yy),n.size!=e.size&&!l)return!1;var c=r.get(n);if(c)return c==e;i|=Cy,r.set(n,e);var u=Tf(a(n),a(e),i,s,o,r);return r.delete(n),u;case Vy:if(No)return No.call(n)==No.call(e)}return!1}var By=1,Fy=Object.prototype,Dy=Fy.hasOwnProperty;function Ny(n,e,t,i,s,o){var r=t&By,a=Pr(n),l=a.length,c=Pr(e),u=c.length;if(l!=u&&!r)return!1;for(var d=l;d--;){var h=a[d];if(!(r?h in e:Dy.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 y=n[h],T=e[h];if(i)var k=r?i(T,y,h,e,n,o):i(y,T,h,n,e,o);if(!(k===void 0?y===T||s(y,T,t,i,o):k)){p=!1;break}_||(_=h=="constructor")}if(p&&!_){var M=n.constructor,D=e.constructor;M!=D&&"constructor"in n&&"constructor"in e&&!(typeof M=="function"&&M instanceof M&&typeof D=="function"&&D instanceof D)&&(p=!1)}return o.delete(n),o.delete(e),p}var $y=1,ic="[object Arguments]",nc="[object Array]",hs="[object Object]",zy=Object.prototype,sc=zy.hasOwnProperty;function Hy(n,e,t,i,s,o){var r=De(n),a=De(e),l=r?nc:Mn(n),c=a?nc:Mn(e);l=l==ic?hs:l,c=c==ic?hs:c;var u=l==hs,d=c==hs,h=l==c;if(h&&In(n)){if(!In(e))return!1;r=!0,u=!1}if(h&&!u)return o||(o=new Xe),r||Pa(n)?Tf(n,e,t,i,s,o):Oy(n,e,l,t,i,s,o);if(!(t&$y)){var f=u&&sc.call(n,"__wrapped__"),m=d&&sc.call(e,"__wrapped__");if(f||m){var p=f?n.value():n,_=m?e.value():e;return o||(o=new Xe),s(p,_,t,i,o)}}return h?(o||(o=new Xe),Ny(n,e,t,i,s,o)):!1}function es(n,e,t,i,s){return n===e?!0:n==null||e==null||!je(n)&&!je(e)?n!==n&&e!==e:Hy(n,e,t,i,es,s)}var Uy=1,Wy=2;function qy(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 Xe;if(i)var h=i(c,u,l,n,e,d);if(!(h===void 0?es(u,c,Uy|Wy,i,d):h))return!1}}return!0}function Af(n){return n===n&&!X(n)}function jy(n){for(var e=Qn(n),t=e.length;t--;){var i=e[t],s=n[i];e[t]=[i,s,Af(s)]}return e}function Sf(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function Gy(n){var e=jy(n);return e.length==1&&e[0][2]?Sf(e[0][0],e[0][1]):function(t){return t===n||qy(t,n,e)}}function Ky(n,e){return n!=null&&e in Object(n)}function Zy(n,e,t){e=yo(e,n);for(var i=-1,s=e.length,o=!1;++i<s;){var r=Qi(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&&Aa(s)&&po(r,s)&&(De(n)||zs(n)))}function Jy(n,e){return n!=null&&Zy(n,e,Ky)}var Yy=1,Qy=2;function Xy(n,e){return Ra(n)&&Af(e)?Sf(Qi(n),e):function(t){var i=Vn(t,n);return i===void 0&&i===e?Jy(t,n):es(e,i,Yy|Qy)}}function e2(n){return function(e){return e==null?void 0:e[n]}}function t2(n){return function(e){return Ma(e,n)}}function i2(n){return Ra(n)?e2(Qi(n)):t2(n)}function n2(n){return typeof n=="function"?n:n==null?Vt:typeof n=="object"?De(n)?Xy(n[0],n[1]):Gy(n):i2(n)}function s2(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 xf=s2();function o2(n,e){return n&&xf(n,e,Qn)}var $o=function(){return nt.Date.now()},r2="Expected a function",a2=Math.max,l2=Math.min;function zi(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(r2);e=Pl(e)||0,X(t)&&(u=!!t.leading,d="maxWait"in t,o=d?a2(Pl(t.maxWait)||0,e):o,h="trailing"in t?!!t.trailing:h);function f(E){var R=i,I=s;return i=s=void 0,c=E,r=n.apply(I,R),r}function m(E){return c=E,a=setTimeout(y,e),u?f(E):r}function p(E){var R=E-l,I=E-c,ee=e-R;return d?l2(ee,o-I):ee}function _(E){var R=E-l,I=E-c;return l===void 0||R>=e||R<0||d&&I>=o}function y(){var E=$o();if(_(E))return T(E);a=setTimeout(y,p(E))}function T(E){return a=void 0,h&&i?f(E):(i=s=void 0,r)}function k(){a!==void 0&&clearTimeout(a),c=0,i=l=s=a=void 0}function M(){return a===void 0?r:T($o())}function D(){var E=$o(),R=_(E);if(i=arguments,s=this,l=E,R){if(a===void 0)return m(l);if(d)return clearTimeout(a),a=setTimeout(y,e),f(l)}return a===void 0&&(a=setTimeout(y,e)),r}return D.cancel=k,D.flush=M,D}function Lr(n,e,t){(t!==void 0&&!Yn(n[e],t)||t===void 0&&!(e in n))&&wo(n,e,t)}function c2(n){return je(n)&&bo(n)}function Or(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function u2(n){return Ji(n,Yi(n))}function d2(n,e,t,i,s,o,r){var a=Or(n,t),l=Or(e,t),c=r.get(l);if(c){Lr(n,t,c);return}var u=o?o(a,l,t+"",n,e,r):void 0,d=u===void 0;if(d){var h=De(l),f=!h&&In(l),m=!h&&!f&&Pa(l);u=l,h||f||m?De(a)?u=a:c2(a)?u=Bh(a):f?(d=!1,u=gf(l,!0)):m?(d=!1,u=_f(l,!0)):u=[]:Se(l)||zs(l)?(u=a,zs(a)?u=u2(a):(!X(a)||ii(a))&&(u=vf(l))):d=!1}d&&(r.set(l,u),s(u,l,i,o,r),r.delete(l)),Lr(n,t,u)}function Da(n,e,t,i,s){n!==e&&xf(e,function(o,r){if(s||(s=new Xe),X(o))d2(n,e,r,t,Da,i,s);else{var a=i?i(Or(n,r),o,r+"",n,e,s):void 0;a===void 0&&(a=o),Lr(n,r,a)}},Yi)}var h2=Sa(function(n,e,t,i){Da(n,e,t,i)});function f2(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var If=/[\\^$.*+?()[\]{}|]/g,m2=RegExp(If.source);function g2(n){return n=Xn(n),n&&m2.test(n)?n.replace(If,"\\$&"):n}var p2="[object String]";function oc(n){return typeof n=="string"||!De(n)&&je(n)&&Bt(n)==p2}function w2(n,e){return e.length<2?n:Ma(n,qh(e,0,-1))}function si(n){return je(n)&&n.nodeType===1&&!Se(n)}function Ws(n,e){return es(n,e)}function b2(n,e,t){t=typeof t=="function"?t:void 0;var i=t?t(n,e):void 0;return i===void 0?es(n,e,void 0,t):!!i}function _2(n,e){var t={};return e=n2(e),o2(n,function(i,s,o){wo(t,s,e(i,s,o))}),t}var Na=Sa(function(n,e,t){Da(n,e,t)});function v2(n,e){return e=yo(e,n),n=w2(n,e),n==null||delete n[Qi(f2(e))]}function y2(n,e,t,i){if(!X(n))return n;e=yo(e,n);for(var s=-1,o=e.length,r=o-1,a=n;a!=null&&++s<o;){var l=Qi(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=X(u)?u:po(e[s+1])?[]:{})}Ta(a,l,c),a=a[l]}return n}function k2(n,e,t){return n==null?n:y2(n,e,t)}var C2=L_(function(n,e,t){return n+(t?" ":"")+Xh(e)}),E2="Expected a function";function Ln(n,e,t){var i=!0,s=!0;if(typeof n!="function")throw new TypeError(E2);return X(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),zi(n,e,{leading:i,maxWait:e,trailing:s})}function T2(n,e){return n==null?!0:v2(n,e)}/**
|
|
47
|
+
*/const Pi=Symbol("listeningTo"),Tr=Symbol("emitterId"),ht=Symbol("delegations"),Ih=Z(Object);function Z(n){if(!n)return Ih;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[Pi]||(this[Pi]={});const c=this[Pi];Oo(i)||Ph(i);const u=Oo(i);(a=c[u])||(a=c[u]={emitter:i,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(o),W1(this,i,s,o,r)}stopListening(i,s,o){const r=this[Pi];let a=i&&Oo(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)Bo(this,i,s,o),c.indexOf(o)!==-1&&(c.length===1?delete l.callbacks[s]:Bo(this,i,s,o));else if(c){for(;o=c.pop();)Bo(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[Pi]}}fire(i,...s){try{const o=i instanceof kt?i:new kt(this,i),r=o.name;let a=Vh(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[ht];if(l){const c=l.get(r),u=l.get("*");c&&Tl(c,o,s),u&&Tl(u,o,s)}return o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}delegate(...i){return{to:(s,o)=>{this[ht]||(this[ht]=new Map),i.forEach(r=>{const a=this[ht].get(r);a?a.set(s,o):this[ht].set(r,new Map([[s,o]]))})}}}stopDelegating(i,s){if(this[ht])if(!i)this[ht].clear();else if(!s)this[ht].delete(i);else{const o=this[ht].get(i);o&&o.delete(s)}}_addEventListener(i,s,o){U1(this,i);const r=Ar(this,i),a=Fe.get(o.priority),l={callback:s,priority:a};for(const c of r)Sh(c,l)}_removeEventListener(i,s){const o=Ar(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]=Ih.prototype[n]});function z1(n,e){const t=n[Pi];return t&&t[e]?t[e].emitter:null}function Ph(n,e){n[Tr]||(n[Tr]=e||qe())}function Oo(n){return n[Tr]}function Rh(n){return n._events||Object.defineProperty(n,"_events",{value:{}}),n._events}function H1(){return{callbacks:[],childEvents:[]}}function U1(n,e){const t=Rh(n);if(t[e])return;let i=e,s=null;const o=[];for(;i!==""&&!t[i];)t[i]=H1(),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 Ar(n,e){const t=Rh(n)[e];if(!t)return[];let i=[t.callbacks];for(let s=0;s<t.childEvents.length;s++){const o=Ar(n,t.childEvents[s]);i=i.concat(o)}return i}function Vh(n,e){let t;return!n._events||!(t=n._events[e])||!t.callbacks.length?e.indexOf(":")>-1?Vh(n,e.substr(0,e.lastIndexOf(":"))):null:t.callbacks}function Tl(n,e,t){for(let[i,s]of n){s?typeof s=="function"&&(s=s(e.name)):s=e.name;const o=new kt(e.source,s);o.path=[...e.path],i.fire(o,...t)}}function W1(n,e,t,i,s){e._addEventListener?e._addEventListener(t,i,s):n._addEventListener.call(e,t,i,s)}function Bo(n,e,t,i){e._removeEventListener?e._removeEventListener(t,i):n._removeEventListener.call(e,t,i)}var Mh=typeof global=="object"&&global&&global.Object===Object&&global,q1=typeof self=="object"&&self&&self.Object===Object&&self,nt=Mh||q1||Function("return this")(),ct=nt.Symbol,Lh=Object.prototype,j1=Lh.hasOwnProperty,G1=Lh.toString,an=ct?ct.toStringTag:void 0;function K1(n){var e=j1.call(n,an),t=n[an];try{n[an]=void 0;var i=!0}catch{}var s=G1.call(n);return i&&(e?n[an]=t:delete n[an]),s}var Z1=Object.prototype,J1=Z1.toString;function Y1(n){return J1.call(n)}var Q1="[object Null]",X1="[object Undefined]",Al=ct?ct.toStringTag:void 0;function Bt(n){return n==null?n===void 0?X1:Q1:Al&&Al in Object(n)?K1(n):Y1(n)}function je(n){return n!=null&&typeof n=="object"}var e0="[object Symbol]";function go(n){return typeof n=="symbol"||je(n)&&Bt(n)==e0}function t0(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 Ne=Array.isArray,i0=1/0,Sl=ct?ct.prototype:void 0,xl=Sl?Sl.toString:void 0;function Oh(n){if(typeof n=="string")return n;if(Ne(n))return t0(n,Oh)+"";if(go(n))return xl?xl.call(n):"";var e=n+"";return e=="0"&&1/n==-i0?"-0":e}var n0=/\s/;function s0(n){for(var e=n.length;e--&&n0.test(n.charAt(e)););return e}var o0=/^\s+/;function r0(n){return n&&n.slice(0,s0(n)+1).replace(o0,"")}function ee(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Il=NaN,a0=/^[-+]0x[0-9a-f]+$/i,l0=/^0b[01]+$/i,c0=/^0o[0-7]+$/i,u0=parseInt;function Pl(n){if(typeof n=="number")return n;if(go(n))return Il;if(ee(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=ee(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=r0(n);var t=l0.test(n);return t||c0.test(n)?u0(n.slice(2),t?2:8):a0.test(n)?Il:+n}function Vt(n){return n}var d0="[object AsyncFunction]",h0="[object Function]",f0="[object GeneratorFunction]",m0="[object Proxy]";function ii(n){if(!ee(n))return!1;var e=Bt(n);return e==h0||e==f0||e==d0||e==m0}var Fo=nt["__core-js_shared__"],Rl=function(){var n=/[^.]+$/.exec(Fo&&Fo.keys&&Fo.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function g0(n){return!!Rl&&Rl in n}var p0=Function.prototype,w0=p0.toString;function ci(n){if(n!=null){try{return w0.call(n)}catch{}try{return n+""}catch{}}return""}var b0=/[\\^$.*+?()[\]{}|]/g,_0=/^\[object .+?Constructor\]$/,v0=Function.prototype,y0=Object.prototype,k0=v0.toString,C0=y0.hasOwnProperty,E0=RegExp("^"+k0.call(C0).replace(b0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function T0(n){if(!ee(n)||g0(n))return!1;var e=ii(n)?E0:_0;return e.test(ci(n))}function A0(n,e){return n==null?void 0:n[e]}function ui(n,e){var t=A0(n,e);return T0(t)?t:void 0}var Sr=ui(nt,"WeakMap"),Vl=Object.create,S0=function(){function n(){}return function(e){if(!ee(e))return{};if(Vl)return Vl(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();function x0(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 Bh(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var I0=800,P0=16,R0=Date.now;function V0(n){var e=0,t=0;return function(){var i=R0(),s=P0-(i-t);if(t=i,s>0){if(++e>=I0)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function M0(n){return function(){return n}}var $s=function(){try{var n=ui(Object,"defineProperty");return n({},"",{}),n}catch{}}(),L0=$s?function(n,e){return $s(n,"toString",{configurable:!0,enumerable:!1,value:M0(e),writable:!0})}:Vt;const O0=L0;var B0=V0(O0);function F0(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}var D0=9007199254740991,N0=/^(?:0|[1-9]\d*)$/;function po(n,e){var t=typeof n;return e=e??D0,!!e&&(t=="number"||t!="symbol"&&N0.test(n))&&n>-1&&n%1==0&&n<e}function wo(n,e,t){e=="__proto__"&&$s?$s(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function Yn(n,e){return n===e||n!==n&&e!==e}var $0=Object.prototype,z0=$0.hasOwnProperty;function Ta(n,e,t){var i=n[e];(!(z0.call(n,e)&&Yn(i,t))||t===void 0&&!(e in n))&&wo(n,e,t)}function Ji(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?wo(t,a,l):Ta(t,a,l)}return t}var Ml=Math.max;function H0(n,e,t){return e=Ml(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,o=Ml(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),x0(n,this,a)}}function U0(n,e){return B0(H0(n,e,Vt),n+"")}var W0=9007199254740991;function Aa(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=W0}function bo(n){return n!=null&&Aa(n.length)&&!ii(n)}function q0(n,e,t){if(!ee(t))return!1;var i=typeof e;return(i=="number"?bo(t)&&po(e,t.length):i=="string"&&e in t)?Yn(t[e],n):!1}function Sa(n){return U0(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&&q0(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 j0=Object.prototype;function xa(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||j0;return n===t}function G0(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var K0="[object Arguments]";function Ll(n){return je(n)&&Bt(n)==K0}var Fh=Object.prototype,Z0=Fh.hasOwnProperty,J0=Fh.propertyIsEnumerable,zs=Ll(function(){return arguments}())?Ll:function(n){return je(n)&&Z0.call(n,"callee")&&!J0.call(n,"callee")};function Y0(){return!1}var Dh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ol=Dh&&typeof module=="object"&&module&&!module.nodeType&&module,Q0=Ol&&Ol.exports===Dh,Bl=Q0?nt.Buffer:void 0,X0=Bl?Bl.isBuffer:void 0,In=X0||Y0,ew="[object Arguments]",tw="[object Array]",iw="[object Boolean]",nw="[object Date]",sw="[object Error]",ow="[object Function]",rw="[object Map]",aw="[object Number]",lw="[object Object]",cw="[object RegExp]",uw="[object Set]",dw="[object String]",hw="[object WeakMap]",fw="[object ArrayBuffer]",mw="[object DataView]",gw="[object Float32Array]",pw="[object Float64Array]",ww="[object Int8Array]",bw="[object Int16Array]",_w="[object Int32Array]",vw="[object Uint8Array]",yw="[object Uint8ClampedArray]",kw="[object Uint16Array]",Cw="[object Uint32Array]",te={};te[gw]=te[pw]=te[ww]=te[bw]=te[_w]=te[vw]=te[yw]=te[kw]=te[Cw]=!0;te[ew]=te[tw]=te[fw]=te[iw]=te[mw]=te[nw]=te[sw]=te[ow]=te[rw]=te[aw]=te[lw]=te[cw]=te[uw]=te[dw]=te[hw]=!1;function Ew(n){return je(n)&&Aa(n.length)&&!!te[Bt(n)]}function Ia(n){return function(e){return n(e)}}var Nh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yn=Nh&&typeof module=="object"&&module&&!module.nodeType&&module,Tw=yn&&yn.exports===Nh,Do=Tw&&Mh.process,$i=function(){try{var n=yn&&yn.require&&yn.require("util").types;return n||Do&&Do.binding&&Do.binding("util")}catch{}}(),Fl=$i&&$i.isTypedArray,Pa=Fl?Ia(Fl):Ew,Aw=Object.prototype,Sw=Aw.hasOwnProperty;function $h(n,e){var t=Ne(n),i=!t&&zs(n),s=!t&&!i&&In(n),o=!t&&!i&&!s&&Pa(n),r=t||i||s||o,a=r?G0(n.length,String):[],l=a.length;for(var c in n)(e||Sw.call(n,c))&&!(r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||po(c,l)))&&a.push(c);return a}function zh(n,e){return function(t){return n(e(t))}}var xw=zh(Object.keys,Object),Iw=Object.prototype,Pw=Iw.hasOwnProperty;function Rw(n){if(!xa(n))return xw(n);var e=[];for(var t in Object(n))Pw.call(n,t)&&t!="constructor"&&e.push(t);return e}function Qn(n){return bo(n)?$h(n):Rw(n)}function Vw(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var Mw=Object.prototype,Lw=Mw.hasOwnProperty;function Ow(n){if(!ee(n))return Vw(n);var e=xa(n),t=[];for(var i in n)i=="constructor"&&(e||!Lw.call(n,i))||t.push(i);return t}function Yi(n){return bo(n)?$h(n,!0):Ow(n)}var Hh=Sa(function(n,e){Ji(e,Yi(e),n)}),Bw=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fw=/^\w*$/;function Ra(n,e){if(Ne(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||go(n)?!0:Fw.test(n)||!Bw.test(n)||e!=null&&n in Object(e)}var Pn=ui(Object,"create");function Dw(){this.__data__=Pn?Pn(null):{},this.size=0}function Nw(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var $w="__lodash_hash_undefined__",zw=Object.prototype,Hw=zw.hasOwnProperty;function Uw(n){var e=this.__data__;if(Pn){var t=e[n];return t===$w?void 0:t}return Hw.call(e,n)?e[n]:void 0}var Ww=Object.prototype,qw=Ww.hasOwnProperty;function jw(n){var e=this.__data__;return Pn?e[n]!==void 0:qw.call(e,n)}var Gw="__lodash_hash_undefined__";function Kw(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=Pn&&e===void 0?Gw:e,this}function ni(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])}}ni.prototype.clear=Dw;ni.prototype.delete=Nw;ni.prototype.get=Uw;ni.prototype.has=jw;ni.prototype.set=Kw;function Zw(){this.__data__=[],this.size=0}function _o(n,e){for(var t=n.length;t--;)if(Yn(n[t][0],e))return t;return-1}var Jw=Array.prototype,Yw=Jw.splice;function Qw(n){var e=this.__data__,t=_o(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():Yw.call(e,t,1),--this.size,!0}function Xw(n){var e=this.__data__,t=_o(e,n);return t<0?void 0:e[t][1]}function eb(n){return _o(this.__data__,n)>-1}function tb(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 At(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])}}At.prototype.clear=Zw;At.prototype.delete=Qw;At.prototype.get=Xw;At.prototype.has=eb;At.prototype.set=tb;var Rn=ui(nt,"Map");function ib(){this.size=0,this.__data__={hash:new ni,map:new(Rn||At),string:new ni}}function nb(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function vo(n,e){var t=n.__data__;return nb(e)?t[typeof e=="string"?"string":"hash"]:t.map}function sb(n){var e=vo(this,n).delete(n);return this.size-=e?1:0,e}function ob(n){return vo(this,n).get(n)}function rb(n){return vo(this,n).has(n)}function ab(n,e){var t=vo(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function St(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])}}St.prototype.clear=ib;St.prototype.delete=sb;St.prototype.get=ob;St.prototype.has=rb;St.prototype.set=ab;var lb="Expected a function";function Va(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(lb);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(Va.Cache||St),t}Va.Cache=St;var cb=500;function ub(n){var e=Va(n,function(i){return t.size===cb&&t.clear(),i}),t=e.cache;return e}var db=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hb=/\\(\\)?/g,fb=ub(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(db,function(t,i,s,o){e.push(s?o.replace(hb,"$1"):i||t)}),e});function Xn(n){return n==null?"":Oh(n)}function yo(n,e){return Ne(n)?n:Ra(n,e)?[n]:fb(Xn(n))}var mb=1/0;function Qi(n){if(typeof n=="string"||go(n))return n;var e=n+"";return e=="0"&&1/n==-mb?"-0":e}function Ma(n,e){e=yo(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[Qi(e[t++])];return t&&t==i?n:void 0}function Vn(n,e,t){var i=n==null?void 0:Ma(n,e);return i===void 0?t:i}function Uh(n,e){for(var t=-1,i=e.length,s=n.length;++t<i;)n[s+t]=e[t];return n}var La=zh(Object.getPrototypeOf,Object),gb="[object Object]",pb=Function.prototype,wb=Object.prototype,Wh=pb.toString,bb=wb.hasOwnProperty,_b=Wh.call(Object);function Se(n){if(!je(n)||Bt(n)!=gb)return!1;var e=La(n);if(e===null)return!0;var t=bb.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Wh.call(t)==_b}function qh(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 vb(n,e,t){var i=n.length;return t=t===void 0?i:t,!e&&t>=i?n:qh(n,e,t)}var yb="\\ud800-\\udfff",kb="\\u0300-\\u036f",Cb="\\ufe20-\\ufe2f",Eb="\\u20d0-\\u20ff",Tb=kb+Cb+Eb,Ab="\\ufe0e\\ufe0f",Sb="\\u200d",xb=RegExp("["+Sb+yb+Tb+Ab+"]");function jh(n){return xb.test(n)}function Ib(n){return n.split("")}var Gh="\\ud800-\\udfff",Pb="\\u0300-\\u036f",Rb="\\ufe20-\\ufe2f",Vb="\\u20d0-\\u20ff",Mb=Pb+Rb+Vb,Lb="\\ufe0e\\ufe0f",Ob="["+Gh+"]",xr="["+Mb+"]",Ir="\\ud83c[\\udffb-\\udfff]",Bb="(?:"+xr+"|"+Ir+")",Kh="[^"+Gh+"]",Zh="(?:\\ud83c[\\udde6-\\uddff]){2}",Jh="[\\ud800-\\udbff][\\udc00-\\udfff]",Fb="\\u200d",Yh=Bb+"?",Qh="["+Lb+"]?",Db="(?:"+Fb+"(?:"+[Kh,Zh,Jh].join("|")+")"+Qh+Yh+")*",Nb=Qh+Yh+Db,$b="(?:"+[Kh+xr+"?",xr,Zh,Jh,Ob].join("|")+")",zb=RegExp(Ir+"(?="+Ir+")|"+$b+Nb,"g");function Hb(n){return n.match(zb)||[]}function Ub(n){return jh(n)?Hb(n):Ib(n)}function Wb(n){return function(e){e=Xn(e);var t=jh(e)?Ub(e):void 0,i=t?t[0]:e.charAt(0),s=t?vb(t,1).join(""):e.slice(1);return i[n]()+s}}var Xh=Wb("toUpperCase");function qb(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 jb(n){return function(e){return n==null?void 0:n[e]}}var Gb={À:"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"},Kb=jb(Gb);const Zb=Kb;var Jb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yb="\\u0300-\\u036f",Qb="\\ufe20-\\ufe2f",Xb="\\u20d0-\\u20ff",e_=Yb+Qb+Xb,t_="["+e_+"]",i_=RegExp(t_,"g");function n_(n){return n=Xn(n),n&&n.replace(Jb,Zb).replace(i_,"")}var s_=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function o_(n){return n.match(s_)||[]}var r_=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function a_(n){return r_.test(n)}var ef="\\ud800-\\udfff",l_="\\u0300-\\u036f",c_="\\ufe20-\\ufe2f",u_="\\u20d0-\\u20ff",d_=l_+c_+u_,tf="\\u2700-\\u27bf",nf="a-z\\xdf-\\xf6\\xf8-\\xff",h_="\\xac\\xb1\\xd7\\xf7",f_="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",m_="\\u2000-\\u206f",g_=" \\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",sf="A-Z\\xc0-\\xd6\\xd8-\\xde",p_="\\ufe0e\\ufe0f",of=h_+f_+m_+g_,rf="['’]",Dl="["+of+"]",w_="["+d_+"]",af="\\d+",b_="["+tf+"]",lf="["+nf+"]",cf="[^"+ef+of+af+tf+nf+sf+"]",__="\\ud83c[\\udffb-\\udfff]",v_="(?:"+w_+"|"+__+")",y_="[^"+ef+"]",uf="(?:\\ud83c[\\udde6-\\uddff]){2}",df="[\\ud800-\\udbff][\\udc00-\\udfff]",Ri="["+sf+"]",k_="\\u200d",Nl="(?:"+lf+"|"+cf+")",C_="(?:"+Ri+"|"+cf+")",$l="(?:"+rf+"(?:d|ll|m|re|s|t|ve))?",zl="(?:"+rf+"(?:D|LL|M|RE|S|T|VE))?",hf=v_+"?",ff="["+p_+"]?",E_="(?:"+k_+"(?:"+[y_,uf,df].join("|")+")"+ff+hf+")*",T_="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",A_="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",S_=ff+hf+E_,x_="(?:"+[b_,uf,df].join("|")+")"+S_,I_=RegExp([Ri+"?"+lf+"+"+$l+"(?="+[Dl,Ri,"$"].join("|")+")",C_+"+"+zl+"(?="+[Dl,Ri+Nl,"$"].join("|")+")",Ri+"?"+Nl+"+"+$l,Ri+"+"+zl,A_,T_,af,x_].join("|"),"g");function P_(n){return n.match(I_)||[]}function R_(n,e,t){return n=Xn(n),e=t?void 0:e,e===void 0?a_(n)?P_(n):o_(n):n.match(e)||[]}var V_="['’]",M_=RegExp(V_,"g");function L_(n){return function(e){return qb(R_(n_(e).replace(M_,"")),n,"")}}function O_(){this.__data__=new At,this.size=0}function B_(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function F_(n){return this.__data__.get(n)}function D_(n){return this.__data__.has(n)}var N_=200;function $_(n,e){var t=this.__data__;if(t instanceof At){var i=t.__data__;if(!Rn||i.length<N_-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new St(i)}return t.set(n,e),this.size=t.size,this}function Xe(n){var e=this.__data__=new At(n);this.size=e.size}Xe.prototype.clear=O_;Xe.prototype.delete=B_;Xe.prototype.get=F_;Xe.prototype.has=D_;Xe.prototype.set=$_;function z_(n,e){return n&&Ji(e,Qn(e),n)}function H_(n,e){return n&&Ji(e,Yi(e),n)}var mf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hl=mf&&typeof module=="object"&&module&&!module.nodeType&&module,U_=Hl&&Hl.exports===mf,Ul=U_?nt.Buffer:void 0,Wl=Ul?Ul.allocUnsafe:void 0;function gf(n,e){if(e)return n.slice();var t=n.length,i=Wl?Wl(t):new n.constructor(t);return n.copy(i),i}function W_(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 pf(){return[]}var q_=Object.prototype,j_=q_.propertyIsEnumerable,ql=Object.getOwnPropertySymbols,Oa=ql?function(n){return n==null?[]:(n=Object(n),W_(ql(n),function(e){return j_.call(n,e)}))}:pf;function G_(n,e){return Ji(n,Oa(n),e)}var K_=Object.getOwnPropertySymbols,wf=K_?function(n){for(var e=[];n;)Uh(e,Oa(n)),n=La(n);return e}:pf;function Z_(n,e){return Ji(n,wf(n),e)}function bf(n,e,t){var i=e(n);return Ne(n)?i:Uh(i,t(n))}function Pr(n){return bf(n,Qn,Oa)}function J_(n){return bf(n,Yi,wf)}var Rr=ui(nt,"DataView"),Vr=ui(nt,"Promise"),Mr=ui(nt,"Set"),jl="[object Map]",Y_="[object Object]",Gl="[object Promise]",Kl="[object Set]",Zl="[object WeakMap]",Jl="[object DataView]",Q_=ci(Rr),X_=ci(Rn),ev=ci(Vr),tv=ci(Mr),iv=ci(Sr),jt=Bt;(Rr&&jt(new Rr(new ArrayBuffer(1)))!=Jl||Rn&&jt(new Rn)!=jl||Vr&&jt(Vr.resolve())!=Gl||Mr&&jt(new Mr)!=Kl||Sr&&jt(new Sr)!=Zl)&&(jt=function(n){var e=Bt(n),t=e==Y_?n.constructor:void 0,i=t?ci(t):"";if(i)switch(i){case Q_:return Jl;case X_:return jl;case ev:return Gl;case tv:return Kl;case iv:return Zl}return e});const Mn=jt;var nv=Object.prototype,sv=nv.hasOwnProperty;function ov(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&sv.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var Hs=nt.Uint8Array;function Ba(n){var e=new n.constructor(n.byteLength);return new Hs(e).set(new Hs(n)),e}function rv(n,e){var t=e?Ba(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var av=/\w*$/;function lv(n){var e=new n.constructor(n.source,av.exec(n));return e.lastIndex=n.lastIndex,e}var Yl=ct?ct.prototype:void 0,Ql=Yl?Yl.valueOf:void 0;function cv(n){return Ql?Object(Ql.call(n)):{}}function _f(n,e){var t=e?Ba(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var uv="[object Boolean]",dv="[object Date]",hv="[object Map]",fv="[object Number]",mv="[object RegExp]",gv="[object Set]",pv="[object String]",wv="[object Symbol]",bv="[object ArrayBuffer]",_v="[object DataView]",vv="[object Float32Array]",yv="[object Float64Array]",kv="[object Int8Array]",Cv="[object Int16Array]",Ev="[object Int32Array]",Tv="[object Uint8Array]",Av="[object Uint8ClampedArray]",Sv="[object Uint16Array]",xv="[object Uint32Array]";function Iv(n,e,t){var i=n.constructor;switch(e){case bv:return Ba(n);case uv:case dv:return new i(+n);case _v:return rv(n,t);case vv:case yv:case kv:case Cv:case Ev:case Tv:case Av:case Sv:case xv:return _f(n,t);case hv:return new i;case fv:case pv:return new i(n);case mv:return lv(n);case gv:return new i;case wv:return cv(n)}}function vf(n){return typeof n.constructor=="function"&&!xa(n)?S0(La(n)):{}}var Pv="[object Map]";function Rv(n){return je(n)&&Mn(n)==Pv}var Xl=$i&&$i.isMap,Vv=Xl?Ia(Xl):Rv,Mv="[object Set]";function Lv(n){return je(n)&&Mn(n)==Mv}var ec=$i&&$i.isSet,Ov=ec?Ia(ec):Lv,Bv=1,Fv=2,Dv=4,yf="[object Arguments]",Nv="[object Array]",$v="[object Boolean]",zv="[object Date]",Hv="[object Error]",kf="[object Function]",Uv="[object GeneratorFunction]",Wv="[object Map]",qv="[object Number]",Cf="[object Object]",jv="[object RegExp]",Gv="[object Set]",Kv="[object String]",Zv="[object Symbol]",Jv="[object WeakMap]",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]",Q={};Q[yf]=Q[Nv]=Q[Yv]=Q[Qv]=Q[$v]=Q[zv]=Q[Xv]=Q[ey]=Q[ty]=Q[iy]=Q[ny]=Q[Wv]=Q[qv]=Q[Cf]=Q[jv]=Q[Gv]=Q[Kv]=Q[Zv]=Q[sy]=Q[oy]=Q[ry]=Q[ay]=!0;Q[Hv]=Q[kf]=Q[Jv]=!1;function Di(n,e,t,i,s,o){var r,a=e&Bv,l=e&Fv,c=e&Dv;if(t&&(r=s?t(n,i,s,o):t(n)),r!==void 0)return r;if(!ee(n))return n;var u=Ne(n);if(u){if(r=ov(n),!a)return Bh(n,r)}else{var d=Mn(n),h=d==kf||d==Uv;if(In(n))return gf(n,a);if(d==Cf||d==yf||h&&!s){if(r=l||h?{}:vf(n),!a)return l?Z_(n,H_(r,n)):G_(n,z_(r,n))}else{if(!Q[d])return s?n:{};r=Iv(n,d,a)}}o||(o=new Xe);var f=o.get(n);if(f)return f;o.set(n,r),Ov(n)?n.forEach(function(_){r.add(Di(_,e,t,_,n,o))}):Vv(n)&&n.forEach(function(_,y){r.set(y,Di(_,e,t,y,n,o))});var m=c?l?J_:Pr:l?Yi:Qn,p=u?void 0:m(n);return F0(p||n,function(_,y){p&&(y=_,_=n[y]),Ta(r,y,Di(_,e,t,y,n,o))}),r}var ly=4;function Ef(n){return Di(n,ly)}var cy=1,uy=4;function xt(n){return Di(n,cy|uy)}var dy=1,hy=4;function Fa(n,e){return e=typeof e=="function"?e:void 0,Di(n,dy|hy,e)}var fy="__lodash_hash_undefined__";function my(n){return this.__data__.set(n,fy),this}function gy(n){return this.__data__.has(n)}function Us(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new St;++e<t;)this.add(n[e])}Us.prototype.add=Us.prototype.push=my;Us.prototype.has=gy;function py(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 wy(n,e){return n.has(e)}var by=1,_y=2;function Tf(n,e,t,i,s,o){var r=t&by,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&_y?new Us: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(!py(e,function(y,T){if(!wy(f,T)&&(m===y||s(m,y,t,i,o)))return f.push(T)})){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 vy(n){var e=-1,t=Array(n.size);return n.forEach(function(i,s){t[++e]=[s,i]}),t}function yy(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var ky=1,Cy=2,Ey="[object Boolean]",Ty="[object Date]",Ay="[object Error]",Sy="[object Map]",xy="[object Number]",Iy="[object RegExp]",Py="[object Set]",Ry="[object String]",Vy="[object Symbol]",My="[object ArrayBuffer]",Ly="[object DataView]",tc=ct?ct.prototype:void 0,No=tc?tc.valueOf:void 0;function Oy(n,e,t,i,s,o,r){switch(t){case Ly:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case My:return!(n.byteLength!=e.byteLength||!o(new Hs(n),new Hs(e)));case Ey:case Ty:case xy:return Yn(+n,+e);case Ay:return n.name==e.name&&n.message==e.message;case Iy:case Ry:return n==e+"";case Sy:var a=vy;case Py:var l=i&ky;if(a||(a=yy),n.size!=e.size&&!l)return!1;var c=r.get(n);if(c)return c==e;i|=Cy,r.set(n,e);var u=Tf(a(n),a(e),i,s,o,r);return r.delete(n),u;case Vy:if(No)return No.call(n)==No.call(e)}return!1}var By=1,Fy=Object.prototype,Dy=Fy.hasOwnProperty;function Ny(n,e,t,i,s,o){var r=t&By,a=Pr(n),l=a.length,c=Pr(e),u=c.length;if(l!=u&&!r)return!1;for(var d=l;d--;){var h=a[d];if(!(r?h in e:Dy.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 y=n[h],T=e[h];if(i)var D=r?i(T,y,h,e,n,o):i(y,T,h,n,e,o);if(!(D===void 0?y===T||s(y,T,t,i,o):D)){p=!1;break}_||(_=h=="constructor")}if(p&&!_){var k=n.constructor,M=e.constructor;k!=M&&"constructor"in n&&"constructor"in e&&!(typeof k=="function"&&k instanceof k&&typeof M=="function"&&M instanceof M)&&(p=!1)}return o.delete(n),o.delete(e),p}var $y=1,ic="[object Arguments]",nc="[object Array]",hs="[object Object]",zy=Object.prototype,sc=zy.hasOwnProperty;function Hy(n,e,t,i,s,o){var r=Ne(n),a=Ne(e),l=r?nc:Mn(n),c=a?nc:Mn(e);l=l==ic?hs:l,c=c==ic?hs:c;var u=l==hs,d=c==hs,h=l==c;if(h&&In(n)){if(!In(e))return!1;r=!0,u=!1}if(h&&!u)return o||(o=new Xe),r||Pa(n)?Tf(n,e,t,i,s,o):Oy(n,e,l,t,i,s,o);if(!(t&$y)){var f=u&&sc.call(n,"__wrapped__"),m=d&&sc.call(e,"__wrapped__");if(f||m){var p=f?n.value():n,_=m?e.value():e;return o||(o=new Xe),s(p,_,t,i,o)}}return h?(o||(o=new Xe),Ny(n,e,t,i,s,o)):!1}function es(n,e,t,i,s){return n===e?!0:n==null||e==null||!je(n)&&!je(e)?n!==n&&e!==e:Hy(n,e,t,i,es,s)}var Uy=1,Wy=2;function qy(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 Xe;if(i)var h=i(c,u,l,n,e,d);if(!(h===void 0?es(u,c,Uy|Wy,i,d):h))return!1}}return!0}function Af(n){return n===n&&!ee(n)}function jy(n){for(var e=Qn(n),t=e.length;t--;){var i=e[t],s=n[i];e[t]=[i,s,Af(s)]}return e}function Sf(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function Gy(n){var e=jy(n);return e.length==1&&e[0][2]?Sf(e[0][0],e[0][1]):function(t){return t===n||qy(t,n,e)}}function Ky(n,e){return n!=null&&e in Object(n)}function Zy(n,e,t){e=yo(e,n);for(var i=-1,s=e.length,o=!1;++i<s;){var r=Qi(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&&Aa(s)&&po(r,s)&&(Ne(n)||zs(n)))}function Jy(n,e){return n!=null&&Zy(n,e,Ky)}var Yy=1,Qy=2;function Xy(n,e){return Ra(n)&&Af(e)?Sf(Qi(n),e):function(t){var i=Vn(t,n);return i===void 0&&i===e?Jy(t,n):es(e,i,Yy|Qy)}}function e2(n){return function(e){return e==null?void 0:e[n]}}function t2(n){return function(e){return Ma(e,n)}}function i2(n){return Ra(n)?e2(Qi(n)):t2(n)}function n2(n){return typeof n=="function"?n:n==null?Vt:typeof n=="object"?Ne(n)?Xy(n[0],n[1]):Gy(n):i2(n)}function s2(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 xf=s2();function o2(n,e){return n&&xf(n,e,Qn)}var $o=function(){return nt.Date.now()},r2="Expected a function",a2=Math.max,l2=Math.min;function zi(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(r2);e=Pl(e)||0,ee(t)&&(u=!!t.leading,d="maxWait"in t,o=d?a2(Pl(t.maxWait)||0,e):o,h="trailing"in t?!!t.trailing:h);function f(C){var P=i,x=s;return i=s=void 0,c=C,r=n.apply(x,P),r}function m(C){return c=C,a=setTimeout(y,e),u?f(C):r}function p(C){var P=C-l,x=C-c,Y=e-P;return d?l2(Y,o-x):Y}function _(C){var P=C-l,x=C-c;return l===void 0||P>=e||P<0||d&&x>=o}function y(){var C=$o();if(_(C))return T(C);a=setTimeout(y,p(C))}function T(C){return a=void 0,h&&i?f(C):(i=s=void 0,r)}function D(){a!==void 0&&clearTimeout(a),c=0,i=l=s=a=void 0}function k(){return a===void 0?r:T($o())}function M(){var C=$o(),P=_(C);if(i=arguments,s=this,l=C,P){if(a===void 0)return m(l);if(d)return clearTimeout(a),a=setTimeout(y,e),f(l)}return a===void 0&&(a=setTimeout(y,e)),r}return M.cancel=D,M.flush=k,M}function Lr(n,e,t){(t!==void 0&&!Yn(n[e],t)||t===void 0&&!(e in n))&&wo(n,e,t)}function c2(n){return je(n)&&bo(n)}function Or(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function u2(n){return Ji(n,Yi(n))}function d2(n,e,t,i,s,o,r){var a=Or(n,t),l=Or(e,t),c=r.get(l);if(c){Lr(n,t,c);return}var u=o?o(a,l,t+"",n,e,r):void 0,d=u===void 0;if(d){var h=Ne(l),f=!h&&In(l),m=!h&&!f&&Pa(l);u=l,h||f||m?Ne(a)?u=a:c2(a)?u=Bh(a):f?(d=!1,u=gf(l,!0)):m?(d=!1,u=_f(l,!0)):u=[]:Se(l)||zs(l)?(u=a,zs(a)?u=u2(a):(!ee(a)||ii(a))&&(u=vf(l))):d=!1}d&&(r.set(l,u),s(u,l,i,o,r),r.delete(l)),Lr(n,t,u)}function Da(n,e,t,i,s){n!==e&&xf(e,function(o,r){if(s||(s=new Xe),ee(o))d2(n,e,r,t,Da,i,s);else{var a=i?i(Or(n,r),o,r+"",n,e,s):void 0;a===void 0&&(a=o),Lr(n,r,a)}},Yi)}var h2=Sa(function(n,e,t,i){Da(n,e,t,i)});function f2(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var If=/[\\^$.*+?()[\]{}|]/g,m2=RegExp(If.source);function g2(n){return n=Xn(n),n&&m2.test(n)?n.replace(If,"\\$&"):n}var p2="[object String]";function oc(n){return typeof n=="string"||!Ne(n)&&je(n)&&Bt(n)==p2}function w2(n,e){return e.length<2?n:Ma(n,qh(e,0,-1))}function si(n){return je(n)&&n.nodeType===1&&!Se(n)}function Ws(n,e){return es(n,e)}function b2(n,e,t){t=typeof t=="function"?t:void 0;var i=t?t(n,e):void 0;return i===void 0?es(n,e,void 0,t):!!i}function _2(n,e){var t={};return e=n2(e),o2(n,function(i,s,o){wo(t,s,e(i,s,o))}),t}var Na=Sa(function(n,e,t){Da(n,e,t)});function v2(n,e){return e=yo(e,n),n=w2(n,e),n==null||delete n[Qi(f2(e))]}function y2(n,e,t,i){if(!ee(n))return n;e=yo(e,n);for(var s=-1,o=e.length,r=o-1,a=n;a!=null&&++s<o;){var l=Qi(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=ee(u)?u:po(e[s+1])?[]:{})}Ta(a,l,c),a=a[l]}return n}function k2(n,e,t){return n==null?n:y2(n,e,t)}var C2=L_(function(n,e,t){return n+(t?" ":"")+Xh(e)}),E2="Expected a function";function Ln(n,e,t){var i=!0,s=!0;if(typeof n!="function")throw new TypeError(E2);return ee(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),zi(n,e,{leading:i,maxWait:e,trailing:s})}function T2(n,e){return n==null?!0:v2(n,e)}/**
|
|
48
48
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
49
49
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
50
|
-
*/const qs=Symbol("observableProperties"),ko=Symbol("boundObservables"),js=Symbol("boundProperties"),vi=Symbol("decoratedMethods"),rc=Symbol("decoratedOriginal"),Pf=W(Z());function W(n){if(!n)return Pf;class e extends n{set(i,s){if(
|
|
50
|
+
*/const qs=Symbol("observableProperties"),ko=Symbol("boundObservables"),js=Symbol("boundProperties"),vi=Symbol("decoratedMethods"),rc=Symbol("decoratedOriginal"),Pf=W(Z());function W(n){if(!n)return Pf;class e extends n{set(i,s){if(ee(i)){Object.keys(i).forEach(r=>{this.set(r,i[r])},this);return}zo(this);const o=this[qs];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||!ac(i))throw new g("observable-bind-wrong-properties",this);if(new Set(i).size!==i.length)throw new g("observable-bind-duplicate-properties",this);zo(this);const s=this[js];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:A2,toMany:S2,_observable:this,_bindProperties:i,_to:[],_bindings:o}}unbind(...i){if(!this[qs])return;const s=this[js],o=this[ko];if(i.length){if(!ac(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){zo(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][rc]=s,this[vi]||(this[vi]=[]),this[vi].push(i)}stopListening(i,s,o){if(!i&&this[vi]){for(const r of this[vi])this[r]=this[r][rc];delete this[vi]}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]=Pf.prototype[n]});function zo(n){n[qs]||(Object.defineProperty(n,qs,{value:new Map}),Object.defineProperty(n,ko,{value:new Map}),Object.defineProperty(n,js,{value:new Map}))}function A2(...n){const e=I2(...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),V2(this._observable,this._to),R2(this),this._bindProperties.forEach(s=>{Rf(this._observable,s)})}function S2(n,e,t){if(this._bindings.size>1)throw new g("observable-bind-to-many-not-one-binding",this);this.to(...x2(n,e),t)}function x2(n,e){const t=n.map(i=>[i,e]);return Array.prototype.concat.apply([],t)}function ac(n){return n.every(e=>typeof e=="string")}function I2(...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 P2(n,e,t,i){const s=n[ko],o=s.get(t),r=o||{};r[i]||(r[i]=new Set),r[i].add(e),o||s.set(t,r)}function R2(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]),P2(n._observable,t,s.observable,e)})})}function Rf(n,e){const i=n[js].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 V2(n,e){e.forEach(t=>{const i=n[ko];let s;i.get(t.observable)||n.listenTo(t.observable,"change",(o,r)=>{s=i.get(t.observable)[r],s&&s.forEach(a=>{Rf(n,a.property)})})})}/**
|
|
51
51
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
52
52
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
53
53
|
*/class Vf{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=[]}}/**
|
|
@@ -59,10 +59,10 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
59
59
|
*/function Ce(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
60
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
61
61
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
62
|
-
*/function
|
|
62
|
+
*/function $e(n){return!!(n&&n[Symbol.iterator])}/**
|
|
63
63
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
64
64
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
65
|
-
*/function
|
|
65
|
+
*/function Ve(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]);(oc(i)||!$e(i))&&(i=[i]);for(let r of i)oc(r)&&(r=n.createTextNode(r)),o.appendChild(r);return o}/**
|
|
66
66
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
67
67
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
68
68
|
*/class Mf{constructor(e,t){this._config={},t&&this.define(lc(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(Se(t)){this._setObjectToTarget(e,t,s);return}const o=t.split(".");t=o.pop();for(const r of o)Se(e[r])||(e[r]={}),e=e[r];if(Se(i)){Se(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(!Se(e[s])){e=null;break}e=e[s]}return e?lc(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(s=>{this._setToTarget(e,s,t[s],i)})}}function lc(n){return Fa(n,M2)}function M2(n){return si(n)||typeof n=="function"?n:void 0}/**
|
|
@@ -74,7 +74,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
74
74
|
*/function Gs(n){const e=Object.prototype.toString.apply(n);return e=="[object Window]"||e=="[object global]"}/**
|
|
75
75
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
76
76
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
77
|
-
*/const Lf=
|
|
77
|
+
*/const Lf=He(Z());function He(n){if(!n)return Lf;class e extends n{listenTo(i,s,o,r={}){if(Lt(i)||Gs(i)){const a={capture:!!r.useCapture,passive:!!r.usePassive},l=this._getProxyEmitter(i,a)||new L2(i,a);this.listenTo(l,s,o,r)}else super.listenTo(i,s,o,r)}stopListening(i,s,o){if(Lt(i)||Gs(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 z1(this,Of(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=>{He[n]=Lf.prototype[n]});class L2 extends Z(){constructor(e,t){super(),Ph(this,Of(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 O2(n){return n["data-ck-expando"]||(n["data-ck-expando"]=qe())}function Of(n,e){let t=O2(n);for(const i of Object.keys(e).sort())e[i]&&(t+="-"+i);return t}/**
|
|
78
78
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
79
79
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
80
80
|
*/let Fr;try{Fr={window,document}}catch{/* istanbul ignore next -- @preserve */Fr={window:{},document:{}}}const S=Fr;/**
|
|
@@ -101,7 +101,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
101
101
|
*/const Df=["top","right","bottom","left","width","height"];class B{constructor(e){const t=Co(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),Dr(e)||t)if(t){const i=B.getDomRangeRects(e);fs(this,B.getBoundingRect(i))}else fs(this,e.getBoundingClientRect());else if(Gs(e)){const{innerWidth:i,innerHeight:s}=e;fs(this,{top:0,right:i,bottom:s,left:0,width:i,height:s})}else fs(this,e)}clone(){return new B(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 B(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(cc(e))return t;let i=e,s=e.parentNode||e.commonAncestorContainer,o;for(;s&&!cc(s);){const r=D2(s)==="visible";i instanceof HTMLElement&&uc(i)==="absolute"&&(o=i);const a=uc(s);if(r||o&&(a==="relative"&&r||a!=="relative")){i=s,s=s.parentNode;continue}const l=new B(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 Df)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(Dr(i._source)){const s=Ff(i._source);s&&N2(i,s)}return i}excludeScrollbarsAndBorders(){const e=this._source;let t,i,s;if(Gs(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=Bf(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 B(s));else{let s=e.startContainer;ue(s)&&(s=s.parentNode);const o=new B(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 B(t))}}function fs(n,e){for(const t of Df)n[t]=e[t]}function cc(n){return Dr(n)?n===n.ownerDocument.body:!1}function Dr(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&typeof n.getBoundingClientRect=="function"}function uc(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).position:"static"}function D2(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).overflow:"visible"}function N2(n,e){const t=new B(e),i=Bf(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
102
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
103
103
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
104
|
-
*/class
|
|
104
|
+
*/class X{constructor(e,t){X._observerInstance||X._createObserver(),this._element=e,this._callback=t,X._addElementCallback(e,t),X._observerInstance.observe(e)}get element(){return this._element}destroy(){X._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){X._elementCallbacks||(X._elementCallbacks=new Map);let i=X._elementCallbacks.get(e);i||(i=new Set,X._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=X._getElementCallbacks(e);i&&(i.delete(t),i.size||(X._elementCallbacks.delete(e),X._observerInstance.unobserve(e))),X._elementCallbacks&&!X._elementCallbacks.size&&(X._observerInstance=null,X._elementCallbacks=null)}static _getElementCallbacks(e){return X._elementCallbacks?X._elementCallbacks.get(e):null}static _createObserver(){X._observerInstance=new S.window.ResizeObserver(e=>{for(const t of e){const i=X._getElementCallbacks(t.target);if(i)for(const s of i)s(t)}})}}X._observerInstance=null;X._elementCallbacks=null;/**
|
|
105
105
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
106
106
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
107
107
|
*/function dc(n,e){n instanceof HTMLTextAreaElement&&(n.value=e),n.innerHTML=e}/**
|
|
@@ -149,22 +149,22 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
149
149
|
*/class ok{constructor({uiLanguage:e="en",contentLanguage:t,translations:i}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=wc(this.uiLanguage),this.contentLanguageDirection=wc(this.contentLanguage),this.translations=ik(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=H(t),typeof e=="string"&&(e={string:e});const s=!!e.plural?t[0]:1,o=tk(this.uiLanguage,e,s,this.translations);return rk(o,t)}}function rk(n,e){return n.replace(/%(\d+)/g,(t,i)=>i<e.length?e[i]:t)}/**
|
|
150
150
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
151
151
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
152
|
-
*/class ye extends Z(){constructor(e={},t={}){super();const i
|
|
152
|
+
*/class ye extends Z(){constructor(e={},t={}){super();const i=$e(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=qe();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
153
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
154
154
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
155
155
|
*/function J(n){const e=n.next();return e.done?null:e.value}/**
|
|
156
156
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
157
157
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
158
|
-
*/class ne extends
|
|
158
|
+
*/class ne extends He(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
159
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
160
160
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
161
|
-
*/class ae{constructor(){this._listener=new(
|
|
161
|
+
*/class ae{constructor(){this._listener=new(He())}listenTo(e){this._listener.listenTo(e,"keydown",(t,i)=>{this._listener.fire("_keydown:"+Hi(i),i)})}set(e,t,i={}){const s=ts(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:"+Hi(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}/**
|
|
162
162
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
163
163
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
164
164
|
*/function ak(n){const e=new Map;for(const t in n)e.set(t,n[t]);return e}/**
|
|
165
165
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
166
166
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
167
|
-
*/function Ct(n){return
|
|
167
|
+
*/function Ct(n){return $e(n)?new Map(n):ak(n)}/**
|
|
168
168
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
169
169
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
170
170
|
*/const lk=1e4;function ck(n,e,t,i){if(Math.max(e.length,n.length)>lk)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}}/**
|
|
@@ -188,7 +188,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
188
188
|
*/class vc extends V{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Sh(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
189
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
190
190
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
191
|
-
*/class Gf 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(
|
|
191
|
+
*/class Gf 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(C=>!d(C,t)),a=[...m(r)];M(a,i);const l=D(a);return k(l,"init").then(()=>k(l,"afterInit")).then(()=>l);function c(C){return typeof C=="function"}function u(C){return c(C)&&!!C.isContextPlugin}function d(C,P){return P.some(x=>x===C||h(C)===x||h(x)===C)}function h(C){return c(C)?C.pluginName||C.name:C}function f(C,P=new Set){C.forEach(x=>{c(x)&&(P.has(x)||(P.add(x),x.pluginName&&!s._availablePlugins.has(x.pluginName)&&s._availablePlugins.set(x.pluginName,x),x.requires&&f(x.requires,P)))})}function m(C,P=new Set){return C.map(x=>c(x)?x:s._availablePlugins.get(x)).reduce((x,Y)=>P.has(Y)?x:(P.add(Y),Y.requires&&(p(Y.requires,Y),m(Y.requires,P).forEach(Nt=>x.add(Nt))),x.add(Y)),new Set)}function p(C,P=null){C.map(x=>c(x)?x:s._availablePlugins.get(x)||x).forEach(x=>{_(x,P),y(x,P),T(x,P)})}function _(C,P){if(!c(C))throw P?new g("plugincollection-soft-required",o,{missingPlugin:C,requiredBy:h(P)}):new g("plugincollection-plugin-not-found",o,{plugin:C})}function y(C,P){if(u(P)&&!u(C))throw new g("plugincollection-context-required",o,{plugin:h(C),requiredBy:h(P)})}function T(C,P){if(P&&d(C,t))throw new g("plugincollection-required",o,{plugin:h(C),requiredBy:h(P)})}function D(C){return C.map(P=>{let x=s._contextPlugins.get(P);return x=x||new P(o),s._add(P,x),x})}function k(C,P){return C.reduce((x,Y)=>!Y[P]||s._contextPlugins.has(Y)?x:x.then(Y[P].bind(Y)),Promise.resolve())}function M(C,P){for(const x of P){if(typeof x!="function")throw new g("plugincollection-replace-plugin-invalid-type",null,{pluginItem:x});const Y=x.pluginName;if(!Y)throw new g("plugincollection-replace-plugin-missing-name",null,{pluginItem:x});if(x.requires&&x.requires.length)throw new g("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:Y});const Nt=s._availablePlugins.get(Y);if(!Nt)throw new g("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:Y});const vl=C.indexOf(Nt);if(vl===-1){if(s._contextPlugins.has(Nt))return;throw new g("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:Y})}if(Nt.requires&&Nt.requires.length)throw new g("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:Y});C.splice(vl,1,x),s._availablePlugins.set(Y,x)}}}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
192
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
193
193
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
194
194
|
*/class Kf{constructor(e){this._contextOwner=null;const{translations:t,...i}=e||{};this.config=new Mf(i,this.constructor.defaultConfig);const s=this.constructor.builtinPlugins;this.config.define("plugins",s),this.plugins=new Gf(this,s);const o=this.config.get("language")||{};this.locale=new ok({uiLanguage:typeof o=="string"?o:o.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new ye}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))})}}/**
|
|
@@ -215,10 +215,10 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
215
215
|
*/class ri{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=Cc(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=Cc(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 Cc(n,e){if(typeof e=="function")return e(n);const t={};return e.name&&(t.name=yk(e.name,n.name),!t.name)||e.attributes&&(t.attributes=Tk(e.attributes,n),!t.attributes)||e.classes&&(t.classes=Ak(e.classes,n),!t.classes)||e.styles&&(t.styles=Sk(e.styles,n),!t.styles)?null:t}function yk(n,e){return n instanceof RegExp?!!e.match(n):n===e}function ja(n,e,t){const i=kk(n),s=Array.from(e),o=[];if(i.forEach(([r,a])=>{s.forEach(l=>{Ck(r,l)&&Ek(a,l,t)&&o.push(l)})}),!(!i.length||o.length<i.length))return o}function kk(n){return Array.isArray(n)?n.map(e=>Se(e)?((e.key===void 0||e.value===void 0)&&U("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]):Se(n)?Object.entries(n):[[n,!0]]}function Ck(n,e){return n===!0||n===e||n instanceof RegExp&&e.match(n)}function Ek(n,e,t){if(n===!0)return!0;const i=t(e);return n===i||n instanceof RegExp&&!!String(i).match(n)}function Tk(n,e){const t=new Set(e.getAttributeKeys());return Se(n)?(n.style!==void 0&&U("matcher-pattern-deprecated-attributes-style-key",n),n.class!==void 0&&U("matcher-pattern-deprecated-attributes-class-key",n)):(t.delete("style"),t.delete("class")),ja(n,t,i=>e.getAttribute(i))}function Ak(n,e){return ja(n,e.getClassNames(),()=>{})}function Sk(n,e){return ja(n,e.getStyleNames(!0),t=>e.getStyle(t))}/**
|
|
216
216
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
217
217
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
218
|
-
*/class Zs{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=Ik(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(
|
|
218
|
+
*/class Zs{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=Ik(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(ee(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=$r(e);T2(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]&&!ee(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=Vn(this._styles,s);if(!o)return;!Object.keys(o).length&&this.remove(s)}}class xk{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(ee(t)){Uo(i,$r(e),t);return}if(this._normalizers.has(e)){const s=this._normalizers.get(e),{path:o,value:r}=s(t);Uo(i,o,r)}else Uo(i,e,t)}getNormalized(e,t){if(!e)return Na({},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 Vn(t,i);const s=i(e,t);if(s)return s}return Vn(t,$r(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 Ik(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 $r(n){return n.replace("-",".")}function Uo(n,e,t){let i=t;ee(t)&&(i=Na({},Vn(n,e),t)),k2(n,e,i)}/**
|
|
219
219
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
220
220
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
221
|
-
*/let et=class Yf extends hi{constructor(e,t,i,s){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=Pk(i),this._children=[],s&&this._insertChild(0,s),this._classes=new Set,this._attrs.has("class")){const o=this._attrs.get("class");Ec(this._classes,o),this._attrs.delete("class")}this._styles=new Zs(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 Yf))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 ri(...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=Rk(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"?Ec(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 H(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of H(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 H(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};et.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 Pk(n){const e=Ct(n);for(const[t,i]of e)i===null?e.delete(t):typeof i!="string"&&e.set(t,String(i));return e}function Ec(n,e){const t=e.split(/\s+/);n.clear(),t.forEach(i=>n.add(i))}function Rk(n,e){return typeof e=="string"?[new ie(n,e)]:(
|
|
221
|
+
*/let et=class Yf extends hi{constructor(e,t,i,s){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=Pk(i),this._children=[],s&&this._insertChild(0,s),this._classes=new Set,this._attrs.has("class")){const o=this._attrs.get("class");Ec(this._classes,o),this._attrs.delete("class")}this._styles=new Zs(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 Yf))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 ri(...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=Rk(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"?Ec(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 H(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of H(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 H(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};et.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 Pk(n){const e=Ct(n);for(const[t,i]of e)i===null?e.delete(t):typeof i!="string"&&e.set(t,String(i));return e}function Ec(n,e){const t=e.split(/\s+/);n.clear(),t.forEach(i=>n.add(i))}function Rk(n,e){return typeof e=="string"?[new ie(n,e)]:($e(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new ie(n,t):t instanceof ot?new ie(n,t.data):t))}/**
|
|
222
222
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
223
223
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
224
224
|
*/class On extends et{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=Vk}}On.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 Vk(){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}/**
|
|
@@ -230,16 +230,16 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
230
230
|
*/const Tc=Symbol("rootName");class Qf extends Eo{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Tc)}set rootName(e){this._setCustomProperty(Tc,e)}set _name(e){this.name=e}}Qf.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
231
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
232
232
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
233
|
-
*/let Zt=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=
|
|
233
|
+
*/let Zt=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 ie){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 et){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 ie){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 ot(s,0,o),e=E._createAfter(r)):(r=new ot(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 ot(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 ie){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 et)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 ie){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 ot(s,a,s.data.length-a),o=r.data.length,e=E._createBefore(r)}else r=new ot(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 ot(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 ot&&(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
234
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
235
235
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
236
|
-
*/let
|
|
236
|
+
*/let E=class mt extends di{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 Eo);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const t=mt._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new Zt(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=Ce(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 Zt(e)}clone(){return new mt(this.parent,this.offset)}static _createAt(e,t){if(e instanceof mt)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 mt(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new mt(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new g("view-position-after-root",e,{root:e});return new mt(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new mt(e.textNode,e.offsetInText);if(!e.parent)throw new g("view-position-before-root",e,{root:e});return new mt(e.parent,e.index)}};E.prototype.is=function(n){return n==="position"||n==="view:position"};/**
|
|
237
237
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
238
238
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
239
|
-
*/let F=class Pt extends di{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Zt({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(gs,{direction:"backward"}),t=this.end.getLastMatchingPosition(gs);return e.parent.is("$text")&&e.isAtStart&&(e=
|
|
239
|
+
*/let F=class Pt extends di{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Zt({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(gs,{direction:"backward"}),t=this.end.getLastMatchingPosition(gs);return e.parent.is("$text")&&e.isAtStart&&(e=E._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=E._createAfter(t.parent)),new Pt(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(gs);if(e.isAfter(this.end)||e.isEqual(this.end))return new Pt(e,e);let t=this.end.getLastMatchingPosition(gs,{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 Pt(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new Pt(this.start,e.start)),this.containsPosition(e.end)&&t.push(new Pt(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new Pt(t,i)}return null}getWalker(e={}){return e.boundaries=this,new Zt(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new Pt(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Zt(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new Zt(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)}};F.prototype.is=function(n){return n==="range"||n==="view:range"};function gs(n){return!!(n.item.is("attributeElement")||n.item.is("uiElement"))}/**
|
|
240
240
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
241
241
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
242
|
-
*/let vt=class Xf extends Z(di){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=Br(this.getRanges()),i=Br(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 Xf||t instanceof Ga)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof F)this._setRanges([t],s&&s.backward),this._setFakeOptions(s);else if(t instanceof
|
|
242
|
+
*/let vt=class Xf extends Z(di){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=Br(this.getRanges()),i=Br(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 Xf||t instanceof Ga)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof F)this._setRanges([t],s&&s.backward),this._setFakeOptions(s);else if(t instanceof E)this._setRanges([new F(t)]),this._setFakeOptions(s);else if(t instanceof hi){const o=!!s&&!!s.backward;let r;if(i===void 0)throw new g("view-selection-setto-required-second-parameter",this);i=="in"?r=F._createIn(t):i=="on"?r=F._createOn(t):r=new F(E._createAt(t,i)),this._setRanges([r],o),this._setFakeOptions(s)}else if($e(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 F(i,s),!0):this._addRange(new F(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 F))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 F(e.start,e.end))}};vt.prototype.is=function(n){return n==="selection"||n==="view:selection"};/**
|
|
243
243
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
244
244
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
245
245
|
*/let Ga=class extends Z(di){constructor(...e){super(),this._selection=new vt,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)}};Ga.prototype.is=function(n){return n==="selection"||n=="documentSelection"||n=="view:selection"||n=="view:documentSelection"};/**
|
|
@@ -266,22 +266,22 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
266
266
|
*/class Za extends et{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=Nk}_insertChild(e,t){if(t&&(t instanceof hi||Array.from(t).length>0))throw new g("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}Za.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 Nk(){return null}/**
|
|
267
267
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
268
268
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
269
|
-
*/let Qt=class extends Z(di){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=$k(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)}};Qt.prototype.is=function(n){return n==="documentFragment"||n==="view:documentFragment"};function $k(n,e){return typeof e=="string"?[new ie(n,e)]:(
|
|
269
|
+
*/let Qt=class extends Z(di){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=$k(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)}};Qt.prototype.is=function(n){return n==="documentFragment"||n==="view:documentFragment"};function $k(n,e){return typeof e=="string"?[new ie(n,e)]:($e(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new ie(n,t):t instanceof ot?new ie(n,t.data):t))}/**
|
|
270
270
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
271
271
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
272
|
-
*/class nm{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 Qt(this.document,e)}createText(e){return new ie(this.document,e)}createAttributeElement(e,t,i={}){const s=new Yt(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;Se(i)?s=i:o=i;const r=new On(this.document,e,t,o);return s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}createEditableElement(e,t,i={}){const s=new Eo(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEmptyElement(e,t,i={}){const s=new Ka(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createUIElement(e,t,i){const s=new To(this.document,e,t);return i&&(s.render=i),s}createRawElement(e,t,i,s={}){const o=new Za(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){Se(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof C?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 C._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(C._createAfter(t),i);const s=new F(e,C._createAt(t,"end")),o=new C(i,0);this.move(s,o)}return C._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 C(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 Sc(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 C(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 ie?C._createAt(s,"end"):C._createAt(t,"end");return this.move(F._createIn(i),C._createAt(t,"end")),this.remove(F._createOn(i)),o}insert(e,t){t=Ne(t)?[...t]:[t],sm(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 F(s,o):new F(e)}remove(e){const t=e instanceof F?e:F._createOn(e);if(cn(t,this.document),t.isCollapsed)return new Qt(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 Qt(this.document,a)}clear(e,t){cn(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=F._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=F._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 Yt))throw new g("view-writer-wrap-invalid-attribute",this.document);if(cn(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&!zk(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 F(i)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof Yt))throw new g("view-writer-unwrap-invalid-attribute",this.document);if(cn(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 F(a,l)}rename(e,t){const i=new On(this.document,e,t.getAttributes());return this.insert(C._createAfter(t),i),this.move(F._createIn(t),C._createAt(i,0)),this.remove(F._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return C._createAt(e,t)}createPositionAfter(e){return C._createAfter(e)}createPositionBefore(e){return C._createBefore(e)}createRange(e,t){return new F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new vt(...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=Hr(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")?Go(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 F(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 C(e,o));else if(c||!u||Hk(s,l)){const d=s._clone();l._remove(),d._appendChild(l),e._insertChild(o,d),this._addToClonedElementsGroup(d),r.push(new C(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 F._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 C(e,o),new C(e,o+u)),o+=u,i+=u-1;continue}if(this._unwrapAttributeElement(s,l)){r.push(new C(e,o),new C(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 F._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 F(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Ac(e.clone());e.parent.is("$text")&&(e=Go(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 F(e,e.getShiftedBy(1));this.wrap(s,t);const o=new C(i.parent,i.index);i._remove();const r=o.nodeBefore,a=o.nodeAfter;return r instanceof ie&&a instanceof ie?Sc(r,a):Ac(o)}_wrapAttributeElement(e,t){if(!xc(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(!xc(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(cn(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new F(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 F(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")&&Ur(s.parent)||Ur(s))return e.clone();if(s.is("$text"))return this._breakAttributes(Go(e),t);const o=s.childCount;if(i==o){const r=new C(s.parent,s.index+1);return this._breakAttributes(r,t)}else if(i===0){const r=new C(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 C(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 zk(n){return Array.from(n.getChildren()).some(e=>!e.is("uiElement"))}function Hr(n){let e=n.parent;for(;!Ur(e);){if(!e)return;e=e.parent}return e}function Hk(n,e){return n.priority<e.priority?!0:n.priority>e.priority?!1:n.getIdentity()<e.getIdentity()}function Ac(n){const e=n.nodeBefore;if(e&&e.is("$text"))return new C(e,e.data.length);const t=n.nodeAfter;return t&&t.is("$text")?new C(t,0):n}function Go(n){if(n.offset==n.parent.data.length)return new C(n.parent.parent,n.parent.index+1);if(n.offset===0)return new C(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 ie(n.root.document,e)),new C(n.parent.parent,n.parent.index+1)}function Sc(n,e){const t=n.data.length;return n._data+=e.data,e._remove(),new C(n,t)}const Uk=[ie,Yt,On,Ka,Za,To];function sm(n,e){for(const t of n){if(!Uk.some(i=>t instanceof i))throw new g("view-writer-insert-invalid-node-type",e);t.is("$text")||sm(t.getChildren(),e)}}function Ur(n){return n&&(n.is("containerElement")||n.is("documentFragment"))}function cn(n,e){const t=Hr(n.start),i=Hr(n.end);if(!t||!i||t!==i)throw new g("view-writer-invalid-range-container",e)}function xc(n,e){return n.id===null&&e.id===null}/**
|
|
272
|
+
*/class nm{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 Qt(this.document,e)}createText(e){return new ie(this.document,e)}createAttributeElement(e,t,i={}){const s=new Yt(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;Se(i)?s=i:o=i;const r=new On(this.document,e,t,o);return s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}createEditableElement(e,t,i={}){const s=new Eo(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEmptyElement(e,t,i={}){const s=new Ka(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createUIElement(e,t,i){const s=new To(this.document,e,t);return i&&(s.render=i),s}createRawElement(e,t,i,s={}){const o=new Za(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){Se(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof 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 F(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 Sc(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 ie?E._createAt(s,"end"):E._createAt(t,"end");return this.move(F._createIn(i),E._createAt(t,"end")),this.remove(F._createOn(i)),o}insert(e,t){t=$e(t)?[...t]:[t],sm(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 F(s,o):new F(e)}remove(e){const t=e instanceof F?e:F._createOn(e);if(cn(t,this.document),t.isCollapsed)return new Qt(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 Qt(this.document,a)}clear(e,t){cn(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=F._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=F._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 Yt))throw new g("view-writer-wrap-invalid-attribute",this.document);if(cn(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&!zk(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 F(i)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof Yt))throw new g("view-writer-unwrap-invalid-attribute",this.document);if(cn(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 F(a,l)}rename(e,t){const i=new On(this.document,e,t.getAttributes());return this.insert(E._createAfter(t),i),this.move(F._createIn(t),E._createAt(i,0)),this.remove(F._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 F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new vt(...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=Hr(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")?Go(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 F(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||Hk(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 F._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 F._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 F(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Ac(e.clone());e.parent.is("$text")&&(e=Go(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 F(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 ie&&a instanceof ie?Sc(r,a):Ac(o)}_wrapAttributeElement(e,t){if(!xc(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(!xc(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(cn(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new F(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 F(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")&&Ur(s.parent)||Ur(s))return e.clone();if(s.is("$text"))return this._breakAttributes(Go(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 zk(n){return Array.from(n.getChildren()).some(e=>!e.is("uiElement"))}function Hr(n){let e=n.parent;for(;!Ur(e);){if(!e)return;e=e.parent}return e}function Hk(n,e){return n.priority<e.priority?!0:n.priority>e.priority?!1:n.getIdentity()<e.getIdentity()}function Ac(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 Go(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 ie(n.root.document,e)),new E(n.parent.parent,n.parent.index+1)}function Sc(n,e){const t=n.data.length;return n._data+=e.data,e._remove(),new E(n,t)}const Uk=[ie,Yt,On,Ka,Za,To];function sm(n,e){for(const t of n){if(!Uk.some(i=>t instanceof i))throw new g("view-writer-insert-invalid-node-type",e);t.is("$text")||sm(t.getChildren(),e)}}function Ur(n){return n&&(n.is("containerElement")||n.is("documentFragment"))}function cn(n,e){const t=Hr(n.start),i=Hr(n.end);if(!t||!i||t!==i)throw new g("view-writer-invalid-range-container",e)}function xc(n,e){return n.id===null&&e.id===null}/**
|
|
273
273
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
274
274
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
275
|
-
*/const om=n=>n.createTextNode(" "),rm=n=>{const e=n.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},am=n=>{const e=n.createElement("br");return e.dataset.ckeFiller="true",e},Ye=7,Bn="".repeat(Ye);function
|
|
275
|
+
*/const om=n=>n.createTextNode(" "),rm=n=>{const e=n.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},am=n=>{const e=n.createElement("br");return e.dataset.ckeFiller="true",e},Ye=7,Bn="".repeat(Ye);function Oe(n){return typeof n=="string"?n.substr(0,Ye)===Bn:ue(n)&&n.data.substr(0,Ye)===Bn}function wn(n){return n.data.length==Ye&&Oe(n)}function Ic(n){const e=typeof n=="string"?n:n.data;return Oe(n)?e.slice(Ye):e}function Wk(n){n.document.on("arrowKey",qk,{priority:"low"})}function qk(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;Oe(i)&&s<=Ye&&t.collapse(i,0)}}}/**
|
|
276
276
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
277
277
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
278
|
-
*/class jk 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),L.isBlink&&!L.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&&!L.isAndroid)return;let e=null;const t=L.isBlink&&!L.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=
|
|
278
|
+
*/class jk 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),L.isBlink&&!L.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&&!L.isAndroid)return;let e=null;const t=L.isBlink&&!L.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;Oe(i.parent)?this._inlineFiller=i.parent:this._inlineFiller=Pc(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,Kk);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]),fc(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&&ue(t.parent)&&Oe(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Oe(e))throw new g("view-renderer-filler-was-lost",this);wn(e)?e.remove():e.data=e.data.substr(Ye),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")||!Gk(t)||i===t.getFillerOffset())return!1;const s=e.nodeBefore,o=e.nodeAfter;return!(s instanceof ie||o instanceof ie||L.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=Bn+o),Rc(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(L.isAndroid){let d=null;for(const h of Array.from(i.childNodes)){if(d&&ue(d)&&ue(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&&Pc(i.ownerDocument,r,s.offset);const a=this._diffNodeLists(o,r),l=this._findUpdateActions(a,o,r,Zk);let c=0;const u=new Set;for(const d of l)d==="delete"?(u.add(o[c]),fc(o[c])):(d==="equal"||d==="update")&&c++;c=0;for(const d of l)d==="insert"?(Nf(i,c,r[c]),c++):d==="update"?(Rc(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=Qk(e,this._fakeSelectionContainer),vn(e,t,Jk.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(vn(r,a,s).map(u=>u==="equal"?"update":u)),o.push("equal"),r=[],a=[]),l[c]++;return o.concat(vn(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(L.isBlink&&!L.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&&L.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=Xk(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),L.isGecko&&Yk(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 Gk(n){if(n.getAttribute("contenteditable")=="false")return!1;const e=n.findAncestor(t=>t.hasAttribute("contenteditable"));return!e||e.getAttribute("contenteditable")=="true"}function Pc(n,e,t){const i=e instanceof Array?e:e.childNodes,s=i[t];if(ue(s))return s.data=Bn+s.data,s;{const o=n.createTextNode(Bn);return Array.isArray(e)?i.splice(t,0,o):Nf(e,t,o),o}}function Kk(n,e){return Lt(n)&&Lt(e)&&!ue(n)&&!ue(e)&&!kn(n)&&!kn(e)&&n.tagName.toLowerCase()===e.tagName.toLowerCase()}function Zk(n,e){return Lt(n)&&Lt(e)&&ue(n)&&ue(e)}function Jk(n,e,t){return e===t?!0:ue(e)&&ue(t)?e.data===t.data:!!(n.isBlockFiller(e)&&n.isBlockFiller(t))}function Yk(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 Qk(n,e){const t=Array.from(n);return t.length==0||!e||t[t.length-1]==e&&t.pop(),t}function Xk(n){const e=n.createElement("div");return e.className="ck-fake-selection-container",Object.assign(e.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),e.textContent=" ",e}function Rc(n,e){const t=n.data;if(t==e)return;const i=Ah(t,e);for(const s of i)s.type==="insert"?n.insertData(s.index,s.values.join("")):n.deleteData(s.index,s.howMany)}/**
|
|
279
279
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
280
280
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
281
|
-
*/const eC=am(S.document),tC=om(S.document),iC=rm(S.document),ps="data-ck-unsafe-attribute-",Vc="data-ck-unsafe-element";class lm{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new ri,this._inlineObjectElementMatcher=new ri,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 vt(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)&&(Lc(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)?(Lc(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||U("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),!$f(t)){U("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});return}e.hasAttribute(t)&&!o?e.removeAttribute(t):e.hasAttribute(ps+t)&&o&&e.removeAttribute(ps+t),e.setAttribute(o?t:ps+t,i)}removeDomElementAttribute(e,t){t!=Vc&&(e.removeAttribute(t),e.removeAttribute(ps+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&&U("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 Le(i)&&(s+=Ye),{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(ue(o)&&Le(o))return{parent:o,offset:Ye};const r=s?ms(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(oC(e))return new vt([]);if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;ue(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 vt(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new F(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,ms(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return C._createBefore(i);if(ue(e)){if(wn(e))return this.domPositionToView(e.parentNode,ms(e));const s=this.findCorrespondingViewText(e);let o=t;return s?(Le(e)&&(o-=Ye,o=o<0?0:o),new C(s,o)):null}else{if(t===0){const s=this.mapDomToView(e);if(s)return new C(s,0)}else{const s=e.childNodes[t-1];if(ue(s)&&wn(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,ms(s));const o=ue(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(o&&o.parent)return new C(o.parent,o.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(wn(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 ie?o:null}}else{const s=this.mapDomToView(e.parentNode);if(s){const o=s.getChild(0);return o instanceof ie?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=[];Mc(t,r=>{const{scrollLeft:a,scrollTop:l}=r;o.push([a,l])}),t.focus(),Mc(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(eC):e.tagName==="BR"&&cm(e,this.blockElements)&&e.parentNode.childNodes.length===1?!0:e.isEqualNode(iC)||sC(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=B2(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 om(this._domDocument);case"markedNbsp":return rm(this._domDocument);case"br":return am(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(ue(e)&&Le(e)&&t<Ye||this.isElement(e)&&Le(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(kn(e)&&t.skipComments)return null;if(ue(e)){if(wn(e))return null;{const o=e.data;if(o==="")return null;const r=new ie(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 Qt(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(kn(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(nC(r,this.preElements))a=Ic(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:!Le(r.data);i.withChildren!==!1&&(d&&(a=a.replace(/^ /,"")),h&&(a=a.replace(/ $/,""))),a=Ic(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 Zt({startPosition:t?C._createAfter(e):C._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(kn(e))return new To(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new et(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(Vc,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const s of t.getAttributeNames())i.setAttribute(s,t.getAttribute(s))}return i}}function nC(n,e){return n.getAncestors().some(t=>t.is("element")&&e.includes(t.name))}function Mc(n,e){let t=n;for(;t;)e(t),t=t.parentElement}function sC(n,e){return n.isEqualNode(tC)&&cm(n,e)&&n.parentNode.childNodes.length===1}function cm(n,e){const t=n.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Lc(n){n==="script"&&U("domconverter-unsafe-script-element-detected"),n==="style"&&U("domconverter-unsafe-style-element-detected")}function oC(n){if(!L.isGecko||!n.rangeCount)return!1;const e=n.getRangeAt(0).startContainer;try{Object.prototype.toString.call(e)}catch{return!0}return!1}/**
|
|
281
|
+
*/const eC=am(S.document),tC=om(S.document),iC=rm(S.document),ps="data-ck-unsafe-attribute-",Vc="data-ck-unsafe-element";class lm{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new ri,this._inlineObjectElementMatcher=new ri,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 vt(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)&&(Lc(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)?(Lc(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||U("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),!$f(t)){U("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});return}e.hasAttribute(t)&&!o?e.removeAttribute(t):e.hasAttribute(ps+t)&&o&&e.removeAttribute(ps+t),e.setAttribute(o?t:ps+t,i)}removeDomElementAttribute(e,t){t!=Vc&&(e.removeAttribute(t),e.removeAttribute(ps+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&&U("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 Oe(i)&&(s+=Ye),{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(ue(o)&&Oe(o))return{parent:o,offset:Ye};const r=s?ms(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(oC(e))return new vt([]);if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;ue(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 vt(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new F(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,ms(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return E._createBefore(i);if(ue(e)){if(wn(e))return this.domPositionToView(e.parentNode,ms(e));const s=this.findCorrespondingViewText(e);let o=t;return s?(Oe(e)&&(o-=Ye,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(ue(s)&&wn(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,ms(s));const o=ue(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(wn(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 ie?o:null}}else{const s=this.mapDomToView(e.parentNode);if(s){const o=s.getChild(0);return o instanceof ie?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=[];Mc(t,r=>{const{scrollLeft:a,scrollTop:l}=r;o.push([a,l])}),t.focus(),Mc(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(eC):e.tagName==="BR"&&cm(e,this.blockElements)&&e.parentNode.childNodes.length===1?!0:e.isEqualNode(iC)||sC(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=B2(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 om(this._domDocument);case"markedNbsp":return rm(this._domDocument);case"br":return am(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(ue(e)&&Oe(e)&&t<Ye||this.isElement(e)&&Oe(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(kn(e)&&t.skipComments)return null;if(ue(e)){if(wn(e))return null;{const o=e.data;if(o==="")return null;const r=new ie(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 Qt(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(kn(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(nC(r,this.preElements))a=Ic(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:!Oe(r.data);i.withChildren!==!1&&(d&&(a=a.replace(/^ /,"")),h&&(a=a.replace(/ $/,""))),a=Ic(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 Zt({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(kn(e))return new To(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new et(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(Vc,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const s of t.getAttributeNames())i.setAttribute(s,t.getAttribute(s))}return i}}function nC(n,e){return n.getAncestors().some(t=>t.is("element")&&e.includes(t.name))}function Mc(n,e){let t=n;for(;t;)e(t),t=t.parentElement}function sC(n,e){return n.isEqualNode(tC)&&cm(n,e)&&n.parentNode.childNodes.length===1}function cm(n,e){const t=n.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Lc(n){n==="script"&&U("domconverter-unsafe-script-element-detected"),n==="style"&&U("domconverter-unsafe-style-element-detected")}function oC(n){if(!L.isGecko||!n.rangeCount)return!1;const e=n.getRangeAt(0).startContainer;try{Object.prototype.toString.call(e)}catch{return!0}return!1}/**
|
|
282
282
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
283
283
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
284
|
-
*/class ut extends
|
|
284
|
+
*/class ut extends He(){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
285
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
286
286
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
287
287
|
*/class Ui{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Hh(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}/**
|
|
@@ -296,7 +296,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
296
296
|
*/class aC extends ut{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=zi(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 vt(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
297
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
298
298
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
299
|
-
*/let um=class extends ut{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&&
|
|
299
|
+
*/let um=class extends ut{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&&Oe(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}));b2(l,c,lC)||(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 lC(n,e){if(!Array.isArray(n))return n===e?!0:n.is("$text")&&e.is("$text")?n.data===e.data:!1}/**
|
|
300
300
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
301
301
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
302
302
|
*/class Js extends Ft{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()}}/**
|
|
@@ -322,7 +322,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
322
322
|
*/class fC extends ut{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 en(t,"tab",t.selection.getFirstRange());t.fire(o,s),o.stop.called&&i.stop()})}observe(){}stopObserving(){}}/**
|
|
323
323
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
324
324
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
325
|
-
*/let mC=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 tm(e),this.domConverter=new lm(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new jk(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new nm(this.document),this.addObserver(um),this.addObserver(Js),this.addObserver(cC),this.addObserver(rC),this.addObserver(aC),this.addObserver(uC),this.addObserver(hC),this.addObserver(dC),this.addObserver(fC),Wk(this),Bk(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}),L.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=xt({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),H2(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(Js).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return
|
|
325
|
+
*/let mC=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 tm(e),this.domConverter=new lm(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new jk(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new nm(this.document),this.addObserver(um),this.addObserver(Js),this.addObserver(cC),this.addObserver(rC),this.addObserver(aC),this.addObserver(uC),this.addObserver(hC),this.addObserver(dC),this.addObserver(fC),Wk(this),Bk(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}),L.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=xt({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),H2(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(Js).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 F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new vt(...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
326
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
327
327
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
328
328
|
*/class Dt{is(){throw new Error("is() method is abstract")}}/**
|
|
@@ -340,7 +340,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
340
340
|
*/class Qe extends Dt{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()}}Qe.prototype.is=function(n){return n==="$textProxy"||n==="model:$textProxy"||n==="textProxy"||n==="model:textProxy"};/**
|
|
341
341
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
342
342
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
343
|
-
*/class q extends fi{constructor(e,t,i){super(t),this._children=new Cn,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=gC(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 gC(n){return typeof n=="string"?[new G(n)]:(
|
|
343
|
+
*/class q extends fi{constructor(e,t,i){super(t),this._children=new Cn,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=gC(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 gC(n){return typeof n=="string"?[new G(n)]:($e(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new G(e):e instanceof Qe?new G(e.data,e.getAttributes()):e))}/**
|
|
344
344
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
345
345
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
346
346
|
*/class _t{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=v._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=En(t,i),o=s||hm(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,zt("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 Qe(o,a,r);return t.offset+=r,this._position=t,zt("text",l,e,t,r)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():zt("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=En(t,s),r=o||fm(t,s,o);if(r instanceof q)return t.offset--,this.shallow?(this._position=t,zt("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this._position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():zt("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 Qe(r,l-a,a);return t.offset-=a,this._position=t,zt("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,zt("elementStart",i,e,t,1)}}function zt(n,e,t,i,s){return{done:!1,value:{type:n,item:e,previousPosition:t,nextPosition:i,length:s}}}/**
|
|
@@ -352,7 +352,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
352
352
|
*/class b extends Dt{constructor(e,t){super(),this.start=v._createAt(e),this.end=t?v._createAt(t):v._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new _t({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return Ce(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=v._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=v._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 _t(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new _t(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new _t(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=v._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(v._createAt(e,0),v._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(v._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=v._createAt(e[o].start);for(let o=i+1;o<e.length&&e[o].start.isEqual(s.end);o++)s.end=v._createAt(e[o].end);return s}static fromJSON(e,t){return new this(v.fromJSON(e.start,t),v.fromJSON(e.end,t))}}b.prototype.is=function(n){return n==="range"||n==="model:range"};/**
|
|
353
353
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
354
354
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
355
|
-
*/class mm 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=v._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 F(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
|
|
355
|
+
*/class mm 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=v._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 F(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 ie?new E(t,t.data.length):i instanceof ie?new E(i,0):e}}/**
|
|
356
356
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
357
357
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
358
358
|
*/class wC{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=ws(t),e instanceof Qe&&(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=ws(t),e instanceof Qe&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=ws(t),e instanceof Qe&&(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=ws(t),e instanceof Qe&&(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 ws(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]}/**
|
|
@@ -361,25 +361,25 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
361
361
|
*/class gm 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(!bC(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(Fc))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(Fc))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=_C(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 wC,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 bC(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 _C(n,e){const t=e.item.is("element")?e.item.name:"$text";return`${n}:${t}`}function Fc(n){const e=n.item,t=b._createFromPositionAndShift(n.previousPosition,n.length);return{item:e,range:t}}/**
|
|
362
362
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
363
363
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
364
|
-
*/class
|
|
364
|
+
*/class Be extends Z(Dt){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 Be)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 v)this._setRanges([new b(t)]);else if(t instanceof fi){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(v._createAt(t,i));else throw new g("model-selection-setto-required-second-parameter",[this,t]);this._setRanges([r],o)}else if($e(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=v._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=Dc(t.start,e);yC(i,t)&&(yield i);for(const o of t.getWalker()){const r=o.item;o.type=="elementEnd"&&vC(r,e,t)&&(yield r)}const s=Dc(t.end,e);kC(s,t)&&(yield s)}}containsEntireContent(e=this.anchor.root){const t=v._createAt(e,0),i=v._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()}}Be.prototype.is=function(n){return n==="selection"||n==="model:selection"};function pm(n,e){return e.has(n)?!1:(e.add(n),n.root.document.model.schema.isBlock(n)&&!!n.parent)}function vC(n,e,t){return pm(n,e)&&Ja(n,t)}function Dc(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&&pm(a,e)));return s.forEach(a=>e.add(a)),r}function Ja(n,e){const t=CC(n);return t?!e.containsRange(b._createOn(t),!0):!0}function yC(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.start.isTouching(v._createAt(n,n.maxOffset))?!1:Ja(n,e):!1}function kC(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.end.isTouching(v._createAt(n,0))?!1:Ja(n,e):!1}function CC(n){const e=n.root.document.model.schema;let t=n.parent;for(;t;){if(e.isBlock(t))return t;t=t.parent}}/**
|
|
365
365
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
366
366
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
367
|
-
*/class
|
|
367
|
+
*/class De extends Z(b){constructor(e,t){super(e,t),EC.call(this)}detach(){this.stopListening()}toRange(){return new b(this.start,this.end)}static fromRange(e){return new De(e.start,e.end)}}De.prototype.is=function(n){return n==="liveRange"||n==="model:liveRange"||n=="range"||n==="model:range"};function EC(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&TC.call(this,t)},{priority:"low"})}function TC(n){const e=this.getTransformedByOperation(n),t=b._createFromRanges(e),i=!t.isEqual(this),s=AC(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 AC(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
368
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
369
369
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
370
|
-
*/const Fn="selection:";class tt extends Z(Dt){constructor(e){super(),this._selection=new SC(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 Fn+e}static _isStoreAttributeKey(e){return e.startsWith(Fn)}}tt.prototype.is=function(n){return n==="selection"||n=="model:selection"||n=="documentSelection"||n=="model:documentSelection"};class SC extends
|
|
370
|
+
*/const Fn="selection:";class tt extends Z(Dt){constructor(e){super(),this._selection=new SC(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 Fn+e}static _isStoreAttributeKey(e){return e.startsWith(Fn)}}tt.prototype.is=function(n){return n==="selection"||n=="model:selection"||n=="documentSelection"||n=="model:documentSelection"};class SC extends Be{constructor(e){super(),this.markers=new ye({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)=>{xC(this._model,i)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const i=[e];this.fire("change:attribute",{attributeKeys:i,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=qe();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new 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=De.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=Ct(this._getSurroundingAttributes()),i=Ct(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(Fn)&&(yield[t.substr(Fn.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=un(s,t)),i||(i=un(o,t)),!this.isGravityOverridden&&!i){let r=s;for(;r&&!i;)r=r.previousSibling,i=un(r,t)}if(!i){let r=o;for(;r&&!i;)r=r.nextSibling,i=un(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=un(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 un(n,e){if(!n)return null;if(n instanceof Qe||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 xC(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(Fn));for(const l of a)r.removeAttribute(l,s)})}}/**
|
|
371
371
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
372
372
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
373
373
|
*/class wm{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}/**
|
|
374
374
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
375
375
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
376
|
-
*/class IC extends wm{elementToElement(e){return this.add(GC(e))}elementToStructure(e){return this.add(KC(e))}attributeToElement(e){return this.add(ZC(e))}attributeToAttribute(e){return this.add(JC(e))}markerToElement(e){return this.add(YC(e))}markerToHighlight(e){return this.add(XC(e))}markerToData(e){return this.add(QC(e))}}function bm(){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 _m(){return(n,e,t)=>{t.convertAttributes(e.item),!e.reconversion&&e.item.is("element")&&!e.item.isEmpty&&t.convertChildren(e.item)}}function PC(){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 vm(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 RC(){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 VC(){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 MC(){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 LC(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 Oe||t.item instanceof tt)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 OC(n,e=r5){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),Tm(o,i.item.getChildren(),s,{reconversion:i.reconversion})}}function BC(n,e){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const o=new Map;s.writer._registerSlotFactory(i5(i.item,o,s));const r=n(i.item,s,i);if(s.writer._clearSlotFactory(),!r)return;n5(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),s5(r,o,s,{reconversion:i.reconversion})}}function FC(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 DC(){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 NC(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const o=t.markerRange;i.consumable.consume(o,e.name)&&(Nc(o,!1,i,t,s),Nc(o,!0,i,t,s),e.stop())}}function Nc(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){$C(d,e,u,t,i,s);return}}const l=t.mapper.toViewPosition(o);zC(l,e,t,i,s)}function $C(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 zC(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 HC(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 UC(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 Zs(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 Zs(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 WC(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof Oe||t.item instanceof tt)&&!t.item.is("$textProxy"))return;const s=Ya(n,t,i);if(!s||!i.consumable.consume(t.item,e.name))return;const o=i.writer,r=vm(o,s),a=o.document.selection;if(t.item instanceof Oe||t.item instanceof tt)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 qC(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof q))return;const s=Ya(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 jC(n){return(e,t,i)=>{if(t.markerRange.isCollapsed)return;const s=Ya(n,t,i);if(!s)return;const o=vm(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 GC(n){const e=ym(n.model),t=Dn(n.view,"container");return e.attributes.length&&(e.children=!0),i=>{i.on(`insert:${e.name}`,OC(t,Em(e)),{priority:n.converterPriority||"normal"}),(e.children||e.attributes.length)&&i.on("reduceChanges",Cm(e),{priority:"low"})}}function KC(n){const e=ym(n.model),t=Dn(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}`,BC(t,Em(e)),{priority:n.converterPriority||"normal"}),i.on("reduceChanges",Cm(e),{priority:"low"})}}function ZC(n){n=xt(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]=Dn(n.view[s],"attribute");else n.view=Dn(n.view,"attribute");const i=km(n);return s=>{s.on(t,LC(i),{priority:n.converterPriority||"normal"})}}function JC(n){n=xt(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]=$c(n.view[s]);else n.view=$c(n.view);const i=km(n);return s=>{s.on(t,UC(i),{priority:n.converterPriority||"normal"})}}function YC(n){const e=Dn(n.view,"ui");return t=>{t.on(`addMarker:${n.model}`,FC(e),{priority:n.converterPriority||"normal"}),t.on(`removeMarker:${n.model}`,DC(),{priority:n.converterPriority||"normal"})}}function QC(n){n=xt(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}`,NC(t),{priority:n.converterPriority||"normal"}),i.on(`removeMarker:${e}`,HC(t),{priority:n.converterPriority||"normal"})}}function XC(n){return e=>{e.on(`addMarker:${n.model}`,WC(n.view),{priority:n.converterPriority||"normal"}),e.on(`addMarker:${n.model}`,qC(n.view),{priority:n.converterPriority||"normal"}),e.on(`removeMarker:${n.model}`,jC(n.view),{priority:n.converterPriority||"normal"})}}function ym(n){return typeof n=="string"&&(n={name:n}),{name:n.name,attributes:n.attributes?H(n.attributes):[],children:!!n.children}}function Dn(n,e){return typeof n=="function"?n:(t,i)=>e5(n,i,e)}function e5(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||Yt.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 km(n){return n.model.values?(e,t,i)=>{const s=n.view[e];return s?s(e,t,i):null}:n.view}function $c(n){return typeof n=="string"?e=>({key:n,value:e}):typeof n=="object"?n.value?()=>n:e=>({key:n.key,value:e}):n}function Ya(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 t5(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 Cm(n){const e=t5(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=v._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 Em(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 i5(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 n5(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 s5(n,e,t,i){t.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of e)Tm(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 Tm(n,e,t,i){for(const s of e)o5(n.root,s,t,i)||t.convertItem(s)}function o5(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(v._createBefore(e))),!0)}function r5(n,e,{preflight:t}={}){return t?e.test(n,"insert"):e.consume(n,"insert")}/**
|
|
376
|
+
*/class IC extends wm{elementToElement(e){return this.add(GC(e))}elementToStructure(e){return this.add(KC(e))}attributeToElement(e){return this.add(ZC(e))}attributeToAttribute(e){return this.add(JC(e))}markerToElement(e){return this.add(YC(e))}markerToHighlight(e){return this.add(XC(e))}markerToData(e){return this.add(QC(e))}}function bm(){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 _m(){return(n,e,t)=>{t.convertAttributes(e.item),!e.reconversion&&e.item.is("element")&&!e.item.isEmpty&&t.convertChildren(e.item)}}function PC(){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 vm(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 RC(){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 VC(){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 MC(){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 LC(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 Be||t.item instanceof tt)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 OC(n,e=r5){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),Tm(o,i.item.getChildren(),s,{reconversion:i.reconversion})}}function BC(n,e){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const o=new Map;s.writer._registerSlotFactory(i5(i.item,o,s));const r=n(i.item,s,i);if(s.writer._clearSlotFactory(),!r)return;n5(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),s5(r,o,s,{reconversion:i.reconversion})}}function FC(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 DC(){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 NC(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const o=t.markerRange;i.consumable.consume(o,e.name)&&(Nc(o,!1,i,t,s),Nc(o,!0,i,t,s),e.stop())}}function Nc(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){$C(d,e,u,t,i,s);return}}const l=t.mapper.toViewPosition(o);zC(l,e,t,i,s)}function $C(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 zC(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 HC(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 UC(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 Zs(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 Zs(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 WC(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof Be||t.item instanceof tt)&&!t.item.is("$textProxy"))return;const s=Ya(n,t,i);if(!s||!i.consumable.consume(t.item,e.name))return;const o=i.writer,r=vm(o,s),a=o.document.selection;if(t.item instanceof Be||t.item instanceof tt)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 qC(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof q))return;const s=Ya(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 jC(n){return(e,t,i)=>{if(t.markerRange.isCollapsed)return;const s=Ya(n,t,i);if(!s)return;const o=vm(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 GC(n){const e=ym(n.model),t=Dn(n.view,"container");return e.attributes.length&&(e.children=!0),i=>{i.on(`insert:${e.name}`,OC(t,Em(e)),{priority:n.converterPriority||"normal"}),(e.children||e.attributes.length)&&i.on("reduceChanges",Cm(e),{priority:"low"})}}function KC(n){const e=ym(n.model),t=Dn(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}`,BC(t,Em(e)),{priority:n.converterPriority||"normal"}),i.on("reduceChanges",Cm(e),{priority:"low"})}}function ZC(n){n=xt(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]=Dn(n.view[s],"attribute");else n.view=Dn(n.view,"attribute");const i=km(n);return s=>{s.on(t,LC(i),{priority:n.converterPriority||"normal"})}}function JC(n){n=xt(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]=$c(n.view[s]);else n.view=$c(n.view);const i=km(n);return s=>{s.on(t,UC(i),{priority:n.converterPriority||"normal"})}}function YC(n){const e=Dn(n.view,"ui");return t=>{t.on(`addMarker:${n.model}`,FC(e),{priority:n.converterPriority||"normal"}),t.on(`removeMarker:${n.model}`,DC(),{priority:n.converterPriority||"normal"})}}function QC(n){n=xt(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}`,NC(t),{priority:n.converterPriority||"normal"}),i.on(`removeMarker:${e}`,HC(t),{priority:n.converterPriority||"normal"})}}function XC(n){return e=>{e.on(`addMarker:${n.model}`,WC(n.view),{priority:n.converterPriority||"normal"}),e.on(`addMarker:${n.model}`,qC(n.view),{priority:n.converterPriority||"normal"}),e.on(`removeMarker:${n.model}`,jC(n.view),{priority:n.converterPriority||"normal"})}}function ym(n){return typeof n=="string"&&(n={name:n}),{name:n.name,attributes:n.attributes?H(n.attributes):[],children:!!n.children}}function Dn(n,e){return typeof n=="function"?n:(t,i)=>e5(n,i,e)}function e5(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||Yt.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 km(n){return n.model.values?(e,t,i)=>{const s=n.view[e];return s?s(e,t,i):null}:n.view}function $c(n){return typeof n=="string"?e=>({key:n,value:e}):typeof n=="object"?n.value?()=>n:e=>({key:n.key,value:e}):n}function Ya(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 t5(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 Cm(n){const e=t5(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=v._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 Em(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 i5(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 n5(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 s5(n,e,t,i){t.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of e)Tm(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 Tm(n,e,t,i){for(const s of e)o5(n.root,s,t,i)||t.convertItem(s)}function o5(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(v._createBefore(e))),!0)}function r5(n,e,{preflight:t}={}){return t?e.test(n,"insert"):e.consume(n,"insert")}/**
|
|
377
377
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
378
378
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
379
379
|
*/function Am(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 Sm(n,e,t){const i=t.createContext(n);return!(!t.checkChild(i,"paragraph")||!t.checkChild(i.push("paragraph"),e))}function xm(n,e){const t=e.createElement("paragraph");return e.insert(t,n),e.createPositionAt(t,0)}/**
|
|
380
380
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
381
381
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
382
|
-
*/class a5 extends wm{elementToElement(e){return this.add(Im(e))}elementToAttribute(e){return this.add(u5(e))}attributeToAttribute(e){return this.add(d5(e))}elementToMarker(e){return this.add(h5(e))}dataToMarker(e){return this.add(f5(e))}}function zc(){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 l5(){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(!Sm(o,"$text",t)||e.viewItem.data.trim().length==0)return;const a=o.nodeBefore;o=xm(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 c5(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 Im(n){n=xt(n);const e=qr(n),t=Qa(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"normal"})}}function u5(n){n=xt(n),Pm(n);const e=Rm(n,!1),t=Qa(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"low"})}}function d5(n){n=xt(n);let e=null;(typeof n.view=="string"||n.view.key)&&(e=p5(n)),Pm(n,e);const t=Rm(n,!0);return i=>{i.on("element",t,{priority:n.converterPriority||"low"})}}function h5(n){const e=_5(n.model);return Im({...n,model:e})}function f5(n){n=xt(n),n.model||(n.model=s=>s?n.view+":"+s:n.view);const e={view:n.view,model:n.model},t=qr(Hc(e,"start")),i=qr(Hc(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=
|
|
382
|
+
*/class a5 extends wm{elementToElement(e){return this.add(Im(e))}elementToAttribute(e){return this.add(u5(e))}attributeToAttribute(e){return this.add(d5(e))}elementToMarker(e){return this.add(h5(e))}dataToMarker(e){return this.add(f5(e))}}function zc(){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 l5(){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(!Sm(o,"$text",t)||e.viewItem.data.trim().length==0)return;const a=o.nodeBefore;o=xm(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 c5(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 Im(n){n=xt(n);const e=qr(n),t=Qa(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"normal"})}}function u5(n){n=xt(n),Pm(n);const e=Rm(n,!1),t=Qa(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"low"})}}function d5(n){n=xt(n);let e=null;(typeof n.view=="string"||n.view.key)&&(e=p5(n)),Pm(n,e);const t=Rm(n,!0);return i=>{i.on("element",t,{priority:n.converterPriority||"low"})}}function h5(n){const e=_5(n.model);return Im({...n,model:e})}function f5(n){n=xt(n),n.model||(n.model=s=>s?n.view+":"+s:n.view);const e={view:n.view,model:n.model},t=qr(Hc(e,"start")),i=qr(Hc(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=Fe.low,r=Fe.highest,a=Fe.get(n.converterPriority)/r;s.on("element",m5(e),{priority:o+a})}}function m5(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 Qa(n){return typeof n=="string"?n:typeof n=="object"&&typeof n.name=="string"?n.name:null}function qr(n){const e=new ri(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=g5(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 g5(n,e,t){return n instanceof Function?n(e,t):t.writer.createElement(n)}function p5(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 Pm(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 Rm(n,e){const t=new ri(n.view);return(i,s,o)=>{if(!s.modelRange&&e)return;const r=t.match(s.viewItem);if(!r||(w5(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)),b5(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 w5(n,e){const t=typeof n=="function"?n(e):n;return typeof t=="object"&&!Qa(t)?!1:!t.classes&&!t.attributes&&!t.styles}function b5(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 _5(n){return(e,t)=>{const i=typeof n=="string"?n:n(e,t);return t.writer.createElement("$marker",{"data-name":i})}}function Hc(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
383
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
384
384
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
385
385
|
*/function v5(n){n.document.registerPostFixer(e=>y5(e,n))}function y5(n,e){const t=e.document.selection,i=e.schema,s=[];let o=!1;for(const r of t.getRanges()){const a=Vm(r,i);a&&!a.isEqual(r)?(s.push(a),o=!0):s.push(r)}return o&&n.setSelection(T5(s),{backward:t.isBackward}),!1}function Vm(n,e){return n.isCollapsed?k5(n,e):C5(n,e)}function k5(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 C5(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(E5(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||!Wc(t.nodeAfter,e)),h=c&&(!u||!Wc(i.nodeBefore,e));let f=t,m=i;return d&&(f=v._createBefore(Uc(r,e))),h&&(m=v._createAfter(Uc(a,e))),new b(f,m)}return null}function Uc(n,e){let t=n,i=t;for(;e.isLimit(i)&&i.parent;)t=i,i=i.parent;return t}function E5(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 T5(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 Wc(n,e){return n&&e.isSelectable(n)}/**
|
|
@@ -409,43 +409,43 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
409
409
|
*/class X5{constructor(e,t){this._helpers=new Map,this._downcast=H(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=H(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 Ko(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 Ko(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 Ko(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 IC(t):new a5(t);this._helpers.set(e,s)}}function*Ko(n){if(n.model.values)for(const e of n.model.values){const t={key:n.model.key,value:e},i=n.view[e],s=n.upcastAlso?n.upcastAlso[e]:void 0;yield*jc(t,i,s)}else yield*jc(n.model,n.view,n.upcastAlso)}function*jc(n,e,t){if(yield{model:n,view:e},t)for(const i of H(t))yield{model:n,view:i}}/**
|
|
410
410
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
411
411
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
412
|
-
*/class
|
|
412
|
+
*/class ze{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
413
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
414
414
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
415
|
-
*/function Xa(n,e){const t=Lm(e),i=t.reduce((r,a)=>r+a.offsetSize,0),s=n.parent;zn(n);const o=n.index;return s._insertChild(o,t),$n(s,o+t.length),$n(s,o),new b(n,n.getShiftedBy(i))}function Mm(n){if(!n.isFlat)throw new g("operation-utils-remove-range-not-flat",this);const e=n.start.parent;zn(n.start),zn(n.end);const t=e._removeChildren(n.start.index,n.end.index-n.start.index);return $n(e,n.start.index),t}function Nn(n,e){if(!n.isFlat)throw new g("operation-utils-move-range-not-flat",this);const t=Mm(n);return e=e._getTransformedByDeletion(n.start,n.end.offset-n.start.offset),Xa(e,t)}function eE(n,e,t){zn(n.start),zn(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),$n(s.parent,s.index)}$n(n.end.parent,n.end.index)}function Lm(n){const e=[];function t(i){if(typeof i=="string")e.push(new G(i));else if(i instanceof Qe)e.push(new G(i.data,i.getAttributes()));else if(i instanceof fi)e.push(i);else if(
|
|
415
|
+
*/function Xa(n,e){const t=Lm(e),i=t.reduce((r,a)=>r+a.offsetSize,0),s=n.parent;zn(n);const o=n.index;return s._insertChild(o,t),$n(s,o+t.length),$n(s,o),new b(n,n.getShiftedBy(i))}function Mm(n){if(!n.isFlat)throw new g("operation-utils-remove-range-not-flat",this);const e=n.start.parent;zn(n.start),zn(n.end);const t=e._removeChildren(n.start.index,n.end.index-n.start.index);return $n(e,n.start.index),t}function Nn(n,e){if(!n.isFlat)throw new g("operation-utils-move-range-not-flat",this);const t=Mm(n);return e=e._getTransformedByDeletion(n.start,n.end.offset-n.start.offset),Xa(e,t)}function eE(n,e,t){zn(n.start),zn(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),$n(s.parent,s.index)}$n(n.end.parent,n.end.index)}function Lm(n){const e=[];function t(i){if(typeof i=="string")e.push(new G(i));else if(i instanceof Qe)e.push(new G(i.data,i.getAttributes()));else if(i instanceof fi)e.push(i);else if($e(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&&Om(s,o)&&(e.splice(i-1,2,new G(o.data+s.data,o.getAttributes())),i--)}return e}function $n(n,e){const t=n.getChild(e-1),i=n.getChild(e);if(t&&i&&t.is("$text")&&i.is("$text")&&Om(t,i)){const s=new G(t.data+i.data,t.getAttributes());n._removeChildren(e-1,2),n._insertChild(e-1,s)}}function zn(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 Om(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
416
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
417
417
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
418
|
-
*/class z extends
|
|
418
|
+
*/class z extends ze{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 z(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 z(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&&Ce(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(){Nn(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=v.fromJSON(e.sourcePosition,t),s=v.fromJSON(e.targetPosition,t);return new this(i,e.howMany,s,e.baseVersion)}}/**
|
|
419
419
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
420
420
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
421
|
-
*/class pe extends
|
|
421
|
+
*/class pe extends ze{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Cn(Lm(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new Cn([...this.nodes].map(i=>i._clone(!0))),t=new pe(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new v(e,[0]);return new z(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 Cn([...e].map(t=>t._clone(!0))),Xa(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 pe(v.fromJSON(e.position,t),i,e.baseVersion);return s.shouldReceiveAttributes=e.shouldReceiveAttributes,s}}/**
|
|
422
422
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
423
423
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
424
|
-
*/class K extends
|
|
424
|
+
*/class K extends ze{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 v(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 v(e,[0]);return new re(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)Nn(b._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const i=e._clone();Xa(this.insertionPosition,i)}const t=new b(v._createAt(e,this.splitPosition.offset),v._createAt(e,e.maxOffset));Nn(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 v(e.root,t,"toPrevious")}static fromJSON(e,t){const i=v.fromJSON(e.splitPosition,t),s=v.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?v.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,s,o,e.baseVersion)}}/**
|
|
425
425
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
426
426
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
427
|
-
*/class re extends
|
|
427
|
+
*/class re extends ze{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 v(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 re(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 v(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);Nn(t,this.targetPosition),Nn(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=v.fromJSON(e.sourcePosition,t),s=v.fromJSON(e.targetPosition,t),o=v.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,s,o,e.baseVersion)}}/**
|
|
428
428
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
429
429
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
430
|
-
*/class xe extends
|
|
430
|
+
*/class xe extends ze{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 xe(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new xe(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 xe(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
431
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
432
432
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
433
|
-
*/class le extends
|
|
433
|
+
*/class le extends ze{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 le(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new le(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&&!Ws(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(){Ws(this.oldValue,this.newValue)||eE(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new le(b.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
|
|
434
434
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
435
435
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
436
|
-
*/class de extends
|
|
436
|
+
*/class de extends ze{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new de(this.baseVersion)}getReversed(){return new de(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}/**
|
|
437
437
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
438
438
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
439
|
-
*/class Ie extends
|
|
439
|
+
*/class Ie extends ze{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 Ie(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ie(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 Ie(v.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}/**
|
|
440
440
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
441
441
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
442
|
-
*/class yt extends
|
|
442
|
+
*/class yt extends ze{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 yt(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new yt(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 yt(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
|
|
443
443
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
444
444
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
445
|
-
*/class at extends
|
|
445
|
+
*/class at extends ze{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 at(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new at(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 at(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}/**
|
|
446
446
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
447
447
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
448
|
-
*/const Ke={};Ke[le.className]=le;Ke[pe.className]=pe;Ke[xe.className]=xe;Ke[z.className]=z;Ke[de.className]=de;Ke[
|
|
448
|
+
*/const Ke={};Ke[le.className]=le;Ke[pe.className]=pe;Ke[xe.className]=xe;Ke[z.className]=z;Ke[de.className]=de;Ke[ze.className]=ze;Ke[Ie.className]=Ie;Ke[yt.className]=yt;Ke[at.className]=at;Ke[K.className]=K;Ke[re.className]=re;class tE{static fromJSON(e,t){return Ke[e.__className].fromJSON(e,t)}}/**
|
|
449
449
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
450
450
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
451
451
|
*/const jr=new Map;function $(n,e,t){let i=jr.get(n);i||(i=new Map,jr.set(n,i)),i.set(e,t)}function iE(n,e){const t=jr.get(n);return t&&t.has(e)?t.get(e):nE}function nE(n){return[n]}function Gc(n,e,t={}){const i=iE(n.constructor,e.constructor);try{return n=n.clone(),i(n,e,t)}catch(s){throw s}}function sE(n,e,t){n=n.slice(),e=e.slice();const i=new oE(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=Gc(l,u,i.getContext(l,u,!0)),h=Gc(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;Zc(n,c-l),Zc(e,l-c)}return Kc(n,r.nextBaseVersionB),Kc(e,r.nextBaseVersionA),{operationsA:n,operationsB:e,originalOperations:s}}class oE{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 z)t instanceof re?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 z&&(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 re)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof z)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 re)t instanceof re?(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 z&&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 xe){const i=e.newRange;if(!i)return;if(t instanceof z){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 re){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 Kc(n,e){for(const t of n)t.baseVersion=e++}function Zc(n,e){for(let t=0;t<e;t++)n.push(new de(0))}$(le,le,(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 le(o,n.key,n.oldValue,n.newValue,0)),s=n.range.getIntersection(e.range);return s&&t.aIsStrong&&i.push(new le(s,e.key,e.newValue,n.newValue,0)),i.length==0?[new de(0)]:i}else return[n]});$(le,pe,(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 le(s,n.key,n.oldValue,n.newValue,n.baseVersion));if(e.shouldReceiveAttributes){const s=Bm(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 Bm(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 le(o,e,s,t,0)}$(le,re,(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 le(s,n.key,n.oldValue,n.newValue,n.baseVersion))});$(le,z,(n,e)=>rE(n.range,e).map(i=>new le(i,n.key,n.oldValue,n.newValue,n.baseVersion)));function rE(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}$(le,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]});$(pe,le,(n,e)=>{const t=[n];if(n.shouldReceiveAttributes&&n.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(n.position)){const i=Bm(n,e.key,e.newValue);i&&t.push(i)}return t});$(pe,pe,(n,e,t)=>n.position.isEqual(e.position)&&t.aIsStrong?[n]:(n.position=n.position._getTransformedByInsertOperation(e),[n]));$(pe,z,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n]));$(pe,K,(n,e)=>(n.position=n.position._getTransformedBySplitOperation(e),[n]));$(pe,re,(n,e)=>(n.position=n.position._getTransformedByMergeOperation(e),[n]));$(xe,pe,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByInsertOperation(e)[0]),n.newRange&&(n.newRange=n.newRange._getTransformedByInsertOperation(e)[0]),[n]));$(xe,xe,(n,e,t)=>{if(n.name==e.name)if(t.aIsStrong)n.oldRange=e.newRange?e.newRange.clone():null;else return[new de(0)];return[n]});$(xe,re,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByMergeOperation(e)),n.newRange&&(n.newRange=n.newRange._getTransformedByMergeOperation(e)),[n]));$(xe,z,(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]});$(xe,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=v._createAt(e.insertionPosition):n.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(n.newRange.start=v._createAt(e.moveTargetPosition)),n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?n.newRange.end=v._createAt(e.moveTargetPosition):n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?n.newRange.end=v._createAt(e.insertionPosition):n.newRange.end=i.end,[n]}n.newRange=n.newRange._getTransformedBySplitOperation(e)}return[n]});$(re,pe,(n,e)=>(n.sourcePosition.hasSameParentAs(e.position)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByInsertOperation(e),n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e),[n]));$(re,re,(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 v(e.graveyardPosition.root,i),n.howMany=0,[n]}else return[new de(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 z(l,n.howMany,c,0)]}else return[new de(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]});$(re,z,(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 de(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])});$(re,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]});$(z,pe,(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]});$(z,z,(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),Jc(n,e)&&Jc(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),Bi([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()),Bi([i],a);const u=Ce(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),Bi([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=Ce(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 de(n.baseVersion)]:Bi(d,a)});$(z,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 Bi(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 Bi(r,i)});$(z,re,(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 z(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 z(a,1,c,0),d=u.getMovedRangeStart().path.slice();d.push(0);const h=new v(u.targetPosition.root,d);l=l._getTransformedByMove(a,c,1);const f=new z(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 de(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]});$(Ie,pe,(n,e)=>(n.position=n.position._getTransformedByInsertOperation(e),[n]));$(Ie,re,(n,e)=>n.position.isEqual(e.deletionPosition)?(n.position=e.graveyardPosition.clone(),n.position.stickiness="toNext",[n]):(n.position=n.position._getTransformedByMergeOperation(e),[n]));$(Ie,z,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n]));$(Ie,Ie,(n,e,t)=>{if(n.position.isEqual(e.position))if(t.aIsStrong)n.oldName=e.newName;else return[new de(0)];return[n]});$(Ie,K,(n,e)=>{const t=n.position.path,i=e.splitPosition.getParentPath();if(Ce(t,i)=="same"&&!e.graveyardPosition){const s=new Ie(n.position.getShiftedBy(1),n.oldName,n.newName,0);return[n,s]}return n.position=n.position._getTransformedBySplitOperation(e),[n]});$(yt,yt,(n,e,t)=>{if(n.root===e.root&&n.key===e.key){if(!t.aIsStrong||n.newValue===e.newValue)return[new de(0)];n.oldValue=e.newValue}return[n]});$(at,at,(n,e)=>n.rootName===e.rootName&&n.isAdd===e.isAdd?[new de(0)]:[n]);$(K,pe,(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,re,(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 v(e.graveyardPosition.root,i),o=K.getInsertionPosition(new v(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,z,(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 v(a.root,l);return[new z(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 de(0)];if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition))return[new de(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 z(e.moveTargetPosition,e.howMany,e.splitPosition,0)),n.howMany&&l.push(new z(n.splitPosition,n.howMany,n.moveTargetPosition,0)),l}else return[new de(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 v(e.insertionPosition.root,i),o=new z(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 Jc(n,e){return n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function Bi(n,e){const t=[];for(let i=0;i<n.length;i++){const s=n[i],o=new z(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}/**
|
|
@@ -469,13 +469,13 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
469
469
|
*/const Qc="$graveyard";class fE extends Z(){constructor(e){super(),this.model=e,this.history=new hE,this.selection=new tt(this),this.roots=new ye({idProperty:"rootName"}),this.differ=new cE(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Qc),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(Qc)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new g("model-document-createroot-name-exists",this,{name:t});const i=new Ys(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=Ef(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 Xc(e.start)&&Xc(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 Xc(n){const e=n.textNode;if(e){const t=e.data,i=n.offset-e.startOffset;return!Wa(t,i)&&!qa(t,i)}return!0}/**
|
|
470
470
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
471
471
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
472
|
-
*/class mE extends Z(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Vi?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 Vi?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(
|
|
472
|
+
*/class mE extends Z(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Vi?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 Vi?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(De.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=De.fromRange(t),l=new Vi(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 Vi?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 Vi?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 Vi extends Z(Dt){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}}Vi.prototype.is=function(n){return n==="marker"||n==="model:marker"};/**
|
|
473
473
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
474
474
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
475
|
-
*/class gE extends
|
|
475
|
+
*/class gE extends ze{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(){Mm(b._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}/**
|
|
476
476
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
477
477
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
478
|
-
*/class wt extends Dt{constructor(e){super(),this.markers=new Map,this._children=new Cn,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 wt(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=pE(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}}wt.prototype.is=function(n){return n==="documentFragment"||n==="model:documentFragment"};function pE(n){return typeof n=="string"?[new G(n)]:(
|
|
478
|
+
*/class wt extends Dt{constructor(e){super(),this.markers=new Map,this._children=new Cn,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 wt(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=pE(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}}wt.prototype.is=function(n){return n==="documentFragment"||n==="model:documentFragment"};function pE(n){return typeof n=="string"?[new G(n)]:($e(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new G(e):e instanceof Qe?new G(e.data,e.getAttributes()):e))}/**
|
|
479
479
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
480
480
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
481
481
|
*/class wE{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 wt}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof G&&e.data=="")return;const s=v._createAt(t,i);if(e.parent)if(iu(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 pe(s,e,o);if(e instanceof G&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof wt)for(const[a,l]of e.markers){const c=v._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 wt||t instanceof q||t instanceof v?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,s)}insertElement(e,t,i,s){t instanceof wt||t instanceof q||t instanceof v?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 wt||t instanceof q?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof wt||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)eu(this,e,t,o)}else tu(this,e,t,i)}setAttributes(e,t){for(const[i,s]of Ct(e))this.setAttribute(i,s,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof b){const i=t.getMinimalFlatRanges();for(const s of i)eu(this,e,null,s)}else tu(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=v._createAt(t,i);if(s.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!iu(e.root,s.root))throw new g("writer-move-different-document",this);const o=e.root.document?e.root.document.version:null,r=new z(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),bE(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),v._createAt(t,"end")),this.remove(i)}_merge(e){const t=v._createAt(e.nodeBefore,"end"),i=v._createAt(e.nodeAfter,0),s=e.root.document.graveyard,o=new v(s,[0]),r=e.root.document.version,a=new re(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 Ie(v._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(v._createAt(s,"end"),v._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,v._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?(dn(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){U("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?dn(this,i,null,c,a):(dn(this,i,l,null,a),this.model.markers._set(i,c,void 0,a));return}s.managedUsingOperations?dn(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();dn(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 at(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 at(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 Ct(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=tt._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=tt._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 eu(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 v&&a!=r&&l!=t&&u();function u(){const d=new b(r,a),h=d.root.document?o.version:null,f=new le(d,e,l,t,h);n.batch.addOperation(f),s.applyOperation(f)}}function tu(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 yt(i,e,r,t,u)}else{a=new b(v._createBefore(i),n.createPositionAfter(i));const u=a.root.document?o.version:null;l=new le(a,e,r,t,u)}n.batch.addOperation(l),s.applyOperation(l)}}function dn(n,e,t,i,s){const o=n.model,r=o.document,a=new xe(e,t,i,o.markers,!!s,r.version);n.batch.addOperation(a),o.applyOperation(a)}function bE(n,e,t,i){let s;if(n.root.document){const o=i.document,r=new v(o.graveyard,[0]);s=new z(n,e,r,o.version)}else s=new gE(n,e);t.addOperation(s),i.applyOperation(s)}function iu(n,e){return n===e||n instanceof Ys&&e instanceof Ys}/**
|
|
@@ -487,7 +487,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
487
487
|
*/function IE(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"));nu(h,t),nu(d,t)}return i})}function nu(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
488
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
489
489
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
490
|
-
*/function PE(n,e,t){return n.change(i=>{const s=t||n.document.selection;s.isCollapsed||n.deleteContent(s,{doNotAutoparagraph:!0});const o=new RE(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,y=d.parent===e&&d.isAtEnd;!_&&!y?(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?
|
|
490
|
+
*/function PE(n,e,t){return n.change(i=>{const s=t||n.document.selection;s.isCollapsed||n.deleteContent(s,{doNotAutoparagraph:!0});const o=new RE(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,y=d.parent===e&&d.isAtEnd;!_&&!y?(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?De.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 y=i.createPositionAt(m,"before");d[f].push(y),i.remove(m)}else{const y=o.getAffectedRange();if(!y){p&&d[f].push(o.position);continue}p?d[f].push(y[p]):d[f].push(_?y.start:y.end)}}for(const[h,[f,m]]of Object.entries(d))f&&m&&f.root===m.root&&f.root.document&&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 tt?i.setSelection(l):s.setTo(l));const c=o.getAffectedRange()||n.createRange(s.anchor);return o.destroy(),c})}class RE{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=we.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=we.fromPosition(e,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=we.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof q)||!this._canMergeLeft(e))return;const t=we._createBefore(e);t.stickiness="toNext";const i=we.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=we._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=we._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=we._createAfter(e);t.stickiness="toNext";/* istanbul ignore if -- @preserve */if(!this.position.isEqual(t))throw new g("insertcontent-invalid-insertion-position",this);this.position=v._createAt(t.nodeBefore,"end");const i=we.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=we._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=we._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
491
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
492
492
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
493
493
|
*/function VE(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&&ME(l,e,i.setSelection,a),d})}function ME(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)}/**
|
|
@@ -496,7 +496,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
496
496
|
*/const LE=' ,.?!:;"-()';function OE(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 _t({boundaries:NE(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=BE(c,u.value);if(d){e instanceof tt?n.change(h=>{h.setSelectionFocus(d)}):e.setFocus(d);return}}}function BE(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"?DE(i,t):FE(i,s,r);if(a==(t?"elementStart":"elementEnd")){if(o.isSelectable(l))return v._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 FE(n,e,t){const i=n.position.textNode;if(i){const s=i.data;let o=n.position.offset-i.startOffset;for(;Wa(s,o)||e=="character"&&qa(s,o)||t&&jf(s,o);)n.next(),o=n.position.offset-i.startOffset}return n.position}function DE(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(zE(t,i,e))t=e?n.position.nodeAfter:n.position.nodeBefore;else{if($E(t.data,i,e))break;n.next()}}return n.position}function NE(n,e){const t=n.root,i=v._createAt(t,e?"end":0);return e?new b(n,i):new b(i,n)}function $E(n,e,t){const i=e+(t?0:-1);return LE.includes(n.charAt(i))}function zE(n,e,t){return e===(t?n.offsetSize:0)}/**
|
|
497
497
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
498
498
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
499
|
-
*/let HE=class extends W(){constructor(){super(),this.markers=new mE,this.document=new fE(this),this.schema=new I5,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}),v5(this),this.document.registerPostFixer(Am),this.on("insertContent",(e,[t,i])=>{e.return=PE(this,t,i)}),this.on("insertObject",(e,[t,i,s])=>{e.return=VE(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 ki,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 ki):e instanceof ki||(e=new ki(e)):e=new ki,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=Zo(t,i);return this.fire("insertContent",[e,o,i,...s])}insertObject(e,t,i,s,...o){const r=Zo(t,i);return this.fire("insertObject",[e,r,s,s,...o])}deleteContent(e,t){_E(this,e,t)}modifySelection(e,t){OE(this,e,t)}getSelectedContent(e){return IE(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=Zo(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new v(e,t,i)}createPositionAt(e,t){return v._createAt(e,t)}createPositionAfter(e){return v._createAfter(e)}createPositionBefore(e){return v._createBefore(e)}createRange(e,t){return new b(e,t)}createRangeIn(e){return b._createIn(e)}createRangeOn(e){return b._createOn(e)}createSelection(...e){return new
|
|
499
|
+
*/let HE=class extends W(){constructor(){super(),this.markers=new mE,this.document=new fE(this),this.schema=new I5,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}),v5(this),this.document.registerPostFixer(Am),this.on("insertContent",(e,[t,i])=>{e.return=PE(this,t,i)}),this.on("insertObject",(e,[t,i,s])=>{e.return=VE(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 ki,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 ki):e instanceof ki||(e=new ki(e)):e=new ki,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=Zo(t,i);return this.fire("insertContent",[e,o,i,...s])}insertObject(e,t,i,s,...o){const r=Zo(t,i);return this.fire("insertObject",[e,r,s,s,...o])}deleteContent(e,t){_E(this,e,t)}modifySelection(e,t){OE(this,e,t)}getSelectedContent(e){return IE(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=Zo(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new v(e,t,i)}createPositionAt(e,t){return v._createAt(e,t)}createPositionAfter(e){return v._createAfter(e)}createPositionBefore(e){return v._createBefore(e)}createRange(e,t){return new b(e,t)}createRangeIn(e){return b._createIn(e)}createRangeOn(e){return b._createOn(e)}createSelection(...e){return new Be(...e)}createBatch(e){return new ki(e)}createOperationFromJSON(e){return tE.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 wE(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 Zo(n,e){if(n)return n instanceof Be||n instanceof tt?n:n instanceof fi?e||e===0?new Be(n,e):n.is("rootElement")?new Be(n,"in"):new Be(n,"on"):new Be(n)}/**
|
|
500
500
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
501
501
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
502
502
|
*/class UE extends Ft{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
@@ -505,7 +505,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
505
505
|
*/class Ao extends Ft{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
506
506
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
507
507
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
508
|
-
*/class tn{constructor(e){this.document=e}createDocumentFragment(e){return new Qt(this.document,e)}createElement(e,t,i){return new et(this.document,e,t,i)}createText(e){return new ie(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 et(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){Se(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return
|
|
508
|
+
*/class tn{constructor(e){this.document=e}createDocumentFragment(e){return new Qt(this.document,e)}createElement(e,t,i){return new et(this.document,e,t,i)}createText(e){return new ie(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 et(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){Se(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}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 F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new vt(...e)}}/**
|
|
509
509
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
510
510
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
511
511
|
*/const WE=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,qE=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,jE=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,GE=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,KE=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,ZE=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,JE=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 YE(n){return n.startsWith("#")?WE.test(n):n.startsWith("rgb")?qE.test(n)||jE.test(n):n.startsWith("hsl")?GE.test(n)||KE.test(n):JE.has(n.toLowerCase())}const QE=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function XE(n){return QE.test(n)}const eT=/^[+-]?[0-9]*([.][0-9]+)?%$/;function tT(n){return eT.test(n)}const iT=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function nT(n){return iT.includes(n)}const sT=["center","top","bottom","left","right"];function oT(n){return sT.includes(n)}const rT=["fixed","scroll","local"];function aT(n){return rT.includes(n)}const lT=/^url\(/;function cT(n){return lT.test(n)}function uT(n=""){if(n==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const e=zm(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 dT(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,hT(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 hT({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 fT(n){return e=>({path:n,value:uT(e)})}function zm(n){const e=n.matchAll(ZE);return Array.from(e).map(t=>t[0])}/**
|
|
@@ -538,28 +538,28 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
538
538
|
*/class Qs extends Zf{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new ye({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 TT='<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>',AT='<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>',ST='<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>',xT='<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>',IT='<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>',PT='<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>',RT='<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>',VT='<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>',MT='<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>',LT='<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>',OT='<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>',BT='<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>',FT='<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>',DT='<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>',NT='<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>',$T='<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>',zT='<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>',HT='<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>',UT='<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>',WT='<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>',qT='<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>',jT='<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>',GT='<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>',KT='<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>',ZT='<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>',JT='<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>',YT='<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>',QT='<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>',XT='<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>',eA='<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>',tA='<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>',iA='<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>',nA='<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>',sA='<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>',oA='<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>',rA='<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>',aA='<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>',lA='<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>',cA='<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>',dA='<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>',hA='<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>',fA='<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>',mA='<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>',gA='<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>',pA='<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>',wA='<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>',bA='<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>',_A='<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>',vA='<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>',yA='<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>',kA='<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>',CA='<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>',EA='<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>',TA='<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>',AA='<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>',SA='<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>',xA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',IA='<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>',PA='<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>',RA='<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>',VA='<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
539
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
540
540
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
541
|
-
*/const
|
|
541
|
+
*/const R={bold:uA,cancel:TT,caption:AT,check:ST,cog:xT,colorPalette:IT,eraser:PT,history:RT,image:FT,imageUpload:DT,imageAssetManager:NT,imageUrl:$T,lowVision:VT,textAlternative:MT,loupe:LT,previousArrow:OT,nextArrow:BT,importExport:mA,paragraph:dA,plus:hA,text:fA,alignBottom:zT,alignMiddle:HT,alignTop:UT,alignLeft:WT,alignCenter:qT,alignRight:jT,alignJustify:GT,objectLeft:XT,objectCenter:ZT,objectRight:eA,objectFullWidth:YT,objectInline:QT,objectBlockLeft:KT,objectBlockRight:JT,objectSizeFull:tA,objectSizeLarge:iA,objectSizeSmall:nA,objectSizeMedium:sA,pencil:oA,pilcrow:rA,quote:aA,threeVerticalDots:lA,dragIndicator:cA,redo:gA,undo:pA,bulletedList:wA,numberedList:bA,todoList:_A,codeBlock:vA,browseFiles:yA,heading1:kA,heading2:CA,heading3:EA,heading4:TA,heading5:AA,heading6:SA,horizontalLine:xA,html:IA,indent:PA,outdent:RA,table:VA};/**
|
|
542
542
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
543
543
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
544
544
|
*/class Ae extends ye{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||!MA(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 MA(n){return n.every(e=>typeof e=="string")}/**
|
|
545
545
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
546
546
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
547
|
-
*/const LA="http://www.w3.org/1999/xhtml";class Pe extends Z(){constructor(e){super(),Object.assign(this,ru(ou(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=cu(),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)Xs(i)?yield i:tl(i)&&(yield*e(i))}yield*e(this)}static bind(e,t){return{to(i,s){return new OA({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:s})},if(i,s,o){return new Hm({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]);jm(e,ru(ou(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||LA,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(""),Ls(this.text)?this._bindToObservable({schema:this.text,updater:FA(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=lu(r)?r[0].ns:null;if(Ls(r)){const l=lu(r)?r[0].value:r;i&&uu(s)&&l.unshift(o),this._bindToObservable({schema:l,updater:DA(t,s,a),data:e})}else if(s=="style"&&typeof r[0]!="string")this._renderStyleAttribute(r[0],e);else{i&&o&&uu(s)&&r.unshift(o);const l=r.map(c=>c&&(c.value||c)).reduce((c,u)=>c.concat(u),[]).reduce(qm,"");Wi(l)||t.setAttributeNS(a,s,l)}}}_renderStyleAttribute(e,t){const i=t.node;for(const s in e){const o=e[s];Ls(o)?this._bindToObservable({schema:[o],updater:NA(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(il(r)){if(!s){r.setParent(t);for(const a of r)i.appendChild(a.element)}}else if(Xs(r))s||(r.isRendered||r.render(),i.appendChild(r.element));else if(Lt(r))i.appendChild(r);else if(s){const a=e.revertData,l=cu();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;Um(e,t,i);const o=e.filter(r=>!Wi(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 is{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=()=>Um(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class OA extends is{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 Hm extends is{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return Wi(t)?!1:this.valueIfTrue||!0}}function Ls(n){return n?(n.value&&(n=n.value),Array.isArray(n)?n.some(Ls):n instanceof is):!1}function BA(n,e){return n.map(t=>t instanceof is?t.getValue(e):t)}function Um(n,e,{node:t}){const i=BA(n,t);let s;n.length==1&&n[0]instanceof Hm?s=i[0]:s=i.reduce(qm,""),Wi(s)?e.remove():e.set(s)}function FA(n){return{set(e){n.textContent=e},remove(){n.textContent=""}}}function DA(n,e,t){return{set(i){n.setAttributeNS(t,e,i)},remove(){n.removeAttributeNS(t,e)}}}function NA(n,e){return{set(t){n.style[e]=t},remove(){n.style[e]=null}}}function ou(n){return Fa(n,t=>{if(t&&(t instanceof is||tl(t)||Xs(t)||il(t)))return t})}function ru(n){if(typeof n=="string"?n=HA(n):n.text&&UA(n),n.on&&(n.eventListeners=zA(n.on),delete n.on),!n.text){n.attributes&&$A(n.attributes);const e=[];if(n.children)if(il(n.children))e.push(n.children);else for(const t of n.children)tl(t)||Xs(t)||Lt(t)?e.push(t):e.push(new Pe(t));n.children=e}return n}function $A(n){for(const e in n)n[e].value&&(n[e].value=H(n[e].value)),Wm(n,e)}function zA(n){for(const e in n)Wm(n,e);return n}function HA(n){return{text:[n]}}function UA(n){n.text=H(n.text)}function Wm(n,e){n[e]=H(n[e])}function qm(n,e){return Wi(e)?n:Wi(n)?e:`${n} ${e}`}function au(n,e){for(const t in e)n[t]?n[t].push(...e[t]):n[t]=e[t]}function jm(n,e){if(e.attributes&&(n.attributes||(n.attributes={}),au(n.attributes,e.attributes)),e.eventListeners&&(n.eventListeners||(n.eventListeners={}),au(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)jm(n.children[t++],i)}}function Wi(n){return!n&&n!==0}function Xs(n){return n instanceof A}function tl(n){return n instanceof Pe}function il(n){return n instanceof Ae}function lu(n){return
|
|
547
|
+
*/const LA="http://www.w3.org/1999/xhtml";class Pe extends Z(){constructor(e){super(),Object.assign(this,ru(ou(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=cu(),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)Xs(i)?yield i:tl(i)&&(yield*e(i))}yield*e(this)}static bind(e,t){return{to(i,s){return new OA({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:s})},if(i,s,o){return new Hm({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]);jm(e,ru(ou(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||LA,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(""),Ls(this.text)?this._bindToObservable({schema:this.text,updater:FA(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=lu(r)?r[0].ns:null;if(Ls(r)){const l=lu(r)?r[0].value:r;i&&uu(s)&&l.unshift(o),this._bindToObservable({schema:l,updater:DA(t,s,a),data:e})}else if(s=="style"&&typeof r[0]!="string")this._renderStyleAttribute(r[0],e);else{i&&o&&uu(s)&&r.unshift(o);const l=r.map(c=>c&&(c.value||c)).reduce((c,u)=>c.concat(u),[]).reduce(qm,"");Wi(l)||t.setAttributeNS(a,s,l)}}}_renderStyleAttribute(e,t){const i=t.node;for(const s in e){const o=e[s];Ls(o)?this._bindToObservable({schema:[o],updater:NA(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(il(r)){if(!s){r.setParent(t);for(const a of r)i.appendChild(a.element)}}else if(Xs(r))s||(r.isRendered||r.render(),i.appendChild(r.element));else if(Lt(r))i.appendChild(r);else if(s){const a=e.revertData,l=cu();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;Um(e,t,i);const o=e.filter(r=>!Wi(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 is{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=()=>Um(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class OA extends is{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 Hm extends is{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return Wi(t)?!1:this.valueIfTrue||!0}}function Ls(n){return n?(n.value&&(n=n.value),Array.isArray(n)?n.some(Ls):n instanceof is):!1}function BA(n,e){return n.map(t=>t instanceof is?t.getValue(e):t)}function Um(n,e,{node:t}){const i=BA(n,t);let s;n.length==1&&n[0]instanceof Hm?s=i[0]:s=i.reduce(qm,""),Wi(s)?e.remove():e.set(s)}function FA(n){return{set(e){n.textContent=e},remove(){n.textContent=""}}}function DA(n,e,t){return{set(i){n.setAttributeNS(t,e,i)},remove(){n.removeAttributeNS(t,e)}}}function NA(n,e){return{set(t){n.style[e]=t},remove(){n.style[e]=null}}}function ou(n){return Fa(n,t=>{if(t&&(t instanceof is||tl(t)||Xs(t)||il(t)))return t})}function ru(n){if(typeof n=="string"?n=HA(n):n.text&&UA(n),n.on&&(n.eventListeners=zA(n.on),delete n.on),!n.text){n.attributes&&$A(n.attributes);const e=[];if(n.children)if(il(n.children))e.push(n.children);else for(const t of n.children)tl(t)||Xs(t)||Lt(t)?e.push(t):e.push(new Pe(t));n.children=e}return n}function $A(n){for(const e in n)n[e].value&&(n[e].value=H(n[e].value)),Wm(n,e)}function zA(n){for(const e in n)Wm(n,e);return n}function HA(n){return{text:[n]}}function UA(n){n.text=H(n.text)}function Wm(n,e){n[e]=H(n[e])}function qm(n,e){return Wi(e)?n:Wi(n)?e:`${n} ${e}`}function au(n,e){for(const t in e)n[t]?n[t].push(...e[t]):n[t]=e[t]}function jm(n,e){if(e.attributes&&(n.attributes||(n.attributes={}),au(n.attributes,e.attributes)),e.eventListeners&&(n.eventListeners||(n.eventListeners={}),au(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)jm(n.children[t++],i)}}function Wi(n){return!n&&n!==0}function Xs(n){return n instanceof A}function tl(n){return n instanceof Pe}function il(n){return n instanceof Ae}function lu(n){return ee(n[0])&&n[0].ns}function cu(){return{children:[],bindings:[],attributes:{}}}function uu(n){return n=="class"||n=="style"}/**
|
|
548
548
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
549
549
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
550
|
-
*/class A extends
|
|
550
|
+
*/class A extends He(W()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new ye,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=Pe.bind(this,this)}createCollection(e){const t=new Ae(e);return this._viewCollections.add(t),t}registerChild(e){$e(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){$e(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Pe(e)}extendTemplate(e){Pe.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
551
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
552
552
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
553
553
|
*/class nn extends A{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${qe()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}/**
|
|
554
554
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
555
555
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
556
|
-
*/class WA extends A{constructor(e,t){super(e);const i=e.t,s=new nn;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:[
|
|
556
|
+
*/class WA extends A{constructor(e,t){super(e);const i=e.t,s=new nn;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:[Ve(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=[Ve(document,"h3",{},t.label),...Array.from(t.groups.values()).map(s=>this._createGroup(s)).flat()];return t.description&&i.splice(1,0,Ve(document,"p",{},t.description)),Ve(document,"section",{},i)})}_createGroup(e){const t=e.keystrokes.sort((s,o)=>s.label.localeCompare(o.label)).map(s=>this._createGroupRow(s)).flat(),i=[Ve(document,"dl",{},t)];return e.label&&i.unshift(Ve(document,"h4",{},e.label)),i}_createGroupRow(e){const t=this.locale.t,i=Ve(document,"dt"),s=Ve(document,"dd"),o=jA(e.keystroke),r=[];for(const a of o)r.push(a.map(qA).join(""));return i.innerHTML=e.label,s.innerHTML=r.join(", ")+(e.mayRequireFn&&L.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[i,s]}}function qA(n){return Ks(n).split("+").map(e=>`<kbd>${e}</kbd>`).join("+")}function jA(n){return typeof n=="string"?[[n]]:typeof n[0]=="string"?[n]:n}const du='<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
557
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
558
558
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
559
559
|
*/class GA extends w{constructor(){super(...arguments),this.contentView=null}static get requires(){return[pt]}static get pluginName(){return"AccessibilityHelp"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",i=>{const s=new O(i);return s.set({label:t("Accessibility help"),tooltip:!0,withText:!1,keystroke:"Alt+0",icon:du}),s.on("execute",()=>this._showDialog()),s}),e.keystrokes.set("Alt+0",(i,s)=>{this._showDialog(),s()}),this._setupRootLabels()}_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.",[Ks("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 WA(e.locale,e.accessibility.keystrokeInfos)),t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:i("Accessibility help"),icon:du,hasCloseButton:!0,content:this.contentView})}}/**
|
|
560
560
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
561
561
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
562
|
-
*/class KA extends Ae{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new Pe({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=
|
|
562
|
+
*/class KA extends Ae{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new Pe({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=Ve(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
563
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
564
564
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
565
565
|
*/class dt extends A{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))dt.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})}}dt.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];/**
|
|
@@ -583,7 +583,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
583
583
|
*/class Km extends O{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=XA,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%)"}}/**
|
|
584
584
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
585
585
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
586
|
-
*/class hu extends A{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 ne,this.keystrokes=new ae,this.items.on("add",(o,r)=>{r.isOn=r.color===this.selectedColor}),i.forEach(o=>{const r=new Km;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),Jn({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 Zm(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jm={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 fu=Zm(Jm);var mu={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function gu(n){var e,t=[],i=1,s;if(typeof n=="string")if(fu[n])t=fu[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(mu[h]!==void 0)return mu[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 Hn=Jm,Ym={};for(const n of Object.keys(Hn))Ym[Hn[n]]=n;const x={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 Qm=x;for(const n of Object.keys(x)){if(!("channels"in x[n]))throw new Error("missing channels property: "+n);if(!("labels"in x[n]))throw new Error("missing channel labels property: "+n);if(x[n].labels.length!==x[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:e,labels:t}=x[n];delete x[n].channels,delete x[n].labels,Object.defineProperty(x[n],"channels",{value:e}),Object.defineProperty(x[n],"labels",{value:t})}x.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]};x.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]};x.rgb.hwb=function(n){const e=n[0],t=n[1];let i=n[2];const s=x.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]};x.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 eS(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}x.rgb.keyword=function(n){const e=Ym[n];if(e)return e;let t=1/0,i;for(const s of Object.keys(Hn)){const o=Hn[s],r=eS(n,o);r<t&&(t=r,i=s)}return i};x.keyword.rgb=function(n){return Hn[n]};x.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]};x.rgb.lab=function(n){const e=x.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]};x.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};x.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]};x.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]}};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let o=e===null?x.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};x.hsv.ansi16=function(n){return x.rgb.ansi16(x.hsv.rgb(n),n[2])};x.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)};x.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]};x.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]};x.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};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.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]};x.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};x.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};x.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};x.gray.hsl=function(n){return[0,0,n[0]]};x.gray.hsv=x.gray.hsl;x.gray.hwb=function(n){return[0,100,n[0]]};x.gray.cmyk=function(n){return[0,0,0,n[0]]};x.gray.lab=function(n){return[n[0],0,0]};x.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};x.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};const eo=Qm;function tS(){const n={},e=Object.keys(eo);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function iS(n){const e=tS(),t=[n];for(e[n].distance=0;t.length;){const i=t.pop(),s=Object.keys(eo[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 nS(n,e){return function(t){return e(n(t))}}function sS(n,e){const t=[e[n].parent,n];let i=eo[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=nS(eo[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}var oS=function(n){const e=iS(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]=sS(r,e))}return t};const Kr=Qm,rS=oS,Mi={},aS=Object.keys(Kr);function lS(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 cS(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}aS.forEach(n=>{Mi[n]={},Object.defineProperty(Mi[n],"channels",{value:Kr[n].channels}),Object.defineProperty(Mi[n],"labels",{value:Kr[n].labels});const e=rS(n);Object.keys(e).forEach(i=>{const s=e[i];Mi[n][i]=cS(s),Mi[n][i].raw=lS(s)})});var Xm=Mi;const uS=Zm(Xm),eg=e1({__proto__:null,default:uS},[Xm]);/**
|
|
586
|
+
*/class hu extends A{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 ne,this.keystrokes=new ae,this.items.on("add",(o,r)=>{r.isOn=r.color===this.selectedColor}),i.forEach(o=>{const r=new Km;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),Jn({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 Zm(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jm={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 fu=Zm(Jm);var mu={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function gu(n){var e,t=[],i=1,s;if(typeof n=="string")if(fu[n])t=fu[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(mu[h]!==void 0)return mu[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 Hn=Jm,Ym={};for(const n of Object.keys(Hn))Ym[Hn[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 Qm=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 eS(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=Ym[n];if(e)return e;let t=1/0,i;for(const s of Object.keys(Hn)){const o=Hn[s],r=eS(n,o);r<t&&(t=r,i=s)}return i};I.keyword.rgb=function(n){return Hn[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 eo=Qm;function tS(){const n={},e=Object.keys(eo);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function iS(n){const e=tS(),t=[n];for(e[n].distance=0;t.length;){const i=t.pop(),s=Object.keys(eo[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 nS(n,e){return function(t){return e(n(t))}}function sS(n,e){const t=[e[n].parent,n];let i=eo[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=nS(eo[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}var oS=function(n){const e=iS(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]=sS(r,e))}return t};const Kr=Qm,rS=oS,Mi={},aS=Object.keys(Kr);function lS(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 cS(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}aS.forEach(n=>{Mi[n]={},Object.defineProperty(Mi[n],"channels",{value:Kr[n].channels}),Object.defineProperty(Mi[n],"labels",{value:Kr[n].labels});const e=rS(n);Object.keys(e).forEach(i=>{const s=e[i];Mi[n][i]=cS(s),Mi[n][i].raw=lS(s)})});var Xm=Mi;const uS=Zm(Xm),eg=e1({__proto__:null,default:uS},[Xm]);/**
|
|
587
587
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
588
588
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
589
589
|
*/function tg(n,e){if(!n)return"";const t=ig(n);if(!t)return"";if(t.space===e)return n;if(!mS(t))return"";const s=eg[t.space][e];if(!s)return"";const o=s(t.space==="hex"?t.hexValue:t.values);return fS(o,e)}function dS(n){if(!n)return"";const e=ig(n);return e?e.space==="hex"?e.hexValue:tg(n,"hex"):"#000"}function hS(n,e){customElements.get(n)===void 0&&customElements.define(n,e)}function fS(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 ig(n){if(n.startsWith("#")){const t=gu(n);return{space:"hex",values:t.values,hexValue:n,alpha:t.alpha}}const e=gu(n);return e.space?e:null}function mS(n){return Object.keys(eg).includes(n.space)}/**
|
|
@@ -628,7 +628,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
628
628
|
*/function rg(n){if(Array.isArray(n))return{items:n,removeItems:[]};const e={items:[],removeItems:[]};return n?{...e,...n}:e}/**
|
|
629
629
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
630
630
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
631
|
-
*/const{threeVerticalDots:ag}=
|
|
631
|
+
*/const{threeVerticalDots:ag}=R,CS={alignLeft:R.alignLeft,bold:R.bold,importExport:R.importExport,paragraph:R.paragraph,plus:R.plus,text:R.text,threeVerticalDots:R.threeVerticalDots,pilcrow:R.pilcrow,dragIndicator:R.dragIndicator};class sl extends A{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 ne,this.keystrokes=new ae,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new ES(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const o=e.uiLanguageDirection==="rtl";this._focusCycler=new Ee({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:kS(this)}}),this._behavior=this.options.shouldGroupWhenFull?new AS(this):new TS(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=rg(e),o=i||s.removeItems;return this._cleanItemsConfiguration(s.items,t,o).map(a=>ee(a)?this._createNestedToolbarDropdown(a,t,o):a==="|"?new og:a==="-"?new yS: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?(U("toolbarview-line-break-ignored-when-grouping-items",a),!1):!0:!ee(o)&&!t.has(o)?(U("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=fe(c);return s||U("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=CS[o]||o||ag:u.buttonView.withText=!0,So(u,()=>u.toolbarView._buildItemsFromConfig(r,t,i)),u}}class ES extends A{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class TS{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=>ss(i)?i:null),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class AS{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(!oi(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 B(e.lastChild),s=new B(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 X(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 og),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=fe(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",So(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:ag}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{ss(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}/**
|
|
632
632
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
633
633
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
634
634
|
*/class to extends A{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()}}/**
|
|
@@ -646,7 +646,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
646
646
|
*/class on extends A{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 ae,this.focusTracker=new ne,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 O;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 O,t=e.bindTemplate;return e.icon=nl,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}}/**
|
|
647
647
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
648
648
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
649
|
-
*/function fe(n,e=sg){const t=typeof e=="function"?new e(n):e,i=new _S(n),s=new qi(n,t,i);return t.bind("isEnabled").to(s),t instanceof on?t.arrowView.bind("isOn").to(s,"isOpen"):t.bind("isOn").to(s,"isOpen"),SS(s),s}function So(n,e,t={}){n.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),n.isOpen?pu(n,e,t):n.once("change:isOpen",()=>pu(n,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&xo(n,()=>n.toolbarView.items.find(i=>i.isOn))}function pu(n,e,t){const i=n.locale,s=i.t,o=n.toolbarView=new sl(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 Ae?o.items.bindTo(r).using(a=>a):o.items.addMany(r),n.panelView.children.add(o),o.items.delegate("execute").to(n)}function mi(n,e,t={}){n.isOpen?wu(n,e,t):n.once("change:isOpen",()=>wu(n,e,t),{priority:"highest"}),xo(n,()=>n.listView.items.find(i=>i instanceof to?i.children.first.isOn:!1))}function wu(n,e,t){const i=n.locale,s=n.listView=new cg(i),o=typeof e=="function"?e():e;s.ariaLabel=t.ariaLabel,s.role=t.role,ug(n,s.items,o,i),n.panelView.children.add(s),s.items.delegate("execute").to(n)}function xo(n,e){n.on("change:isOpen",()=>{if(!n.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():U("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:
|
|
649
|
+
*/function fe(n,e=sg){const t=typeof e=="function"?new e(n):e,i=new _S(n),s=new qi(n,t,i);return t.bind("isEnabled").to(s),t instanceof on?t.arrowView.bind("isOn").to(s,"isOpen"):t.bind("isOn").to(s,"isOpen"),SS(s),s}function So(n,e,t={}){n.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),n.isOpen?pu(n,e,t):n.once("change:isOpen",()=>pu(n,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&xo(n,()=>n.toolbarView.items.find(i=>i.isOn))}function pu(n,e,t){const i=n.locale,s=i.t,o=n.toolbarView=new sl(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 Ae?o.items.bindTo(r).using(a=>a):o.items.addMany(r),n.panelView.children.add(o),o.items.delegate("execute").to(n)}function mi(n,e,t={}){n.isOpen?wu(n,e,t):n.once("change:isOpen",()=>wu(n,e,t),{priority:"highest"}),xo(n,()=>n.listView.items.find(i=>i instanceof to?i.children.first.isOn:!1))}function wu(n,e,t){const i=n.locale,s=n.listView=new cg(i),o=typeof e=="function"?e():e;s.ariaLabel=t.ariaLabel,s.role=t.role,ug(n,s.items,o,i),n.panelView.children.add(s),s.items.delegate("execute").to(n)}function xo(n,e){n.on("change:isOpen",()=>{if(!n.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():U("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:Fe.low-10})}function SS(n){xS(n),IS(n),PS(n),RS(n),VS(n),MS(n)}function xS(n){n.on("render",()=>{Ca({emitter:n,activator:()=>n.isOpen,callback:()=>{n.isOpen=!1},contextElements:()=>[n.element,...n.focusTracker._elements]})})}function IS(n){n.on("execute",e=>{e.source instanceof ns||(n.isOpen=!1)})}function PS(n){n.focusTracker.on("change:isFocused",(e,t,i)=>{n.isOpen&&!i&&(n.isOpen=!1)})}function RS(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 VS(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 MS(n){n.on("change:isOpen",(e,t,i)=>{i&&n.panelView.focus()},{priority:"low"})}function ug(n,e,t,i){e.bindTo(t).using(s=>{if(s.type==="separator")return new lg(i);if(s.type==="group"){const o=new Os(i);return o.set({label:s.label}),ug(n,o.items,s.items,i),o.items.delegate("execute").to(n),o}else if(s.type==="button"||s.type==="switchbutton"){const o=new to(i);let r;return s.type==="button"?(r=new O(i),r.extendTemplate({attributes:{"aria-checked":r.bindTemplate.to("isOn")}})):r=new ns(i),r.bind(...Object.keys(s.model)).to(s.model),r.delegate("execute").to(o),o.children.add(r),o}return null})}/**
|
|
650
650
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
651
651
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
652
652
|
*/const os=(n,e,t)=>{const i=new wS(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},LS=(n,e,t)=>{const i=new bS(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},Un=(n,e=0,t=1)=>n>t?t:n<e?e:n,_e=(n,e=0,t=Math.pow(10,e))=>Math.round(t*n)/t,OS=n=>$S(Zr(n)),Zr=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?_e(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?_e(parseInt(n.substring(6,8),16)/255,2):1}),BS=n=>NS(DS(n)),FS=({h:n,s:e,v:t,a:i})=>{const s=(200-e)*t/100;return{h:_e(n),s:_e(s>0&&s<200?e*t/100/(s<=100?s:200-s)*100:0),l:_e(s/2),a:_e(i,2)}},Jr=n=>{const{h:e,s:t,l:i}=FS(n);return`hsl(${e}, ${t}%, ${i}%)`},DS=({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:_e([t,r,o,o,a,t][l]*255),g:_e([a,t,t,r,o,o][l]*255),b:_e([o,o,a,t,t,r][l]*255),a:_e(i,2)}},_s=n=>{const e=n.toString(16);return e.length<2?"0"+e:e},NS=({r:n,g:e,b:t,a:i})=>{const s=i<1?_s(_e(i*255)):"";return"#"+_s(n)+_s(e)+_s(t)+s},$S=({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:_e(60*(r<0?r+6:r)),s:_e(s?o/s*100:0),v:_e(s/255*100),a:i}},dg=(n,e)=>{if(n===e)return!0;for(const t in n)if(n[t]!==e[t])return!1;return!0},zS=(n,e)=>n.toLowerCase()===e.toLowerCase()?!0:dg(Zr(n),Zr(e)),bu={},hg=n=>{let e=bu[n];return e||(e=document.createElement("template"),e.innerHTML=n,bu[n]=e),e},ol=(n,e,t)=>{n.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))};let Ni=!1;const Yr=n=>"touches"in n,HS=n=>Ni&&!Yr(n)?!1:(Ni||(Ni=Yr(n)),!0),_u=(n,e)=>{const t=Yr(e)?e.touches[0]:e,i=n.el.getBoundingClientRect();ol(n.el,"move",n.getMove({x:Un((t.pageX-(i.left+window.pageXOffset))/i.width),y:Un((t.pageY-(i.top+window.pageYOffset))/i.height)}))},US=(n,e)=>{const t=e.keyCode;t>40||n.xy&&t<37||t<33||(e.preventDefault(),ol(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 fg{constructor(e,t,i,s){const o=hg(`<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(Ni?"touchmove":"mousemove",this),t(Ni?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!HS(e)||!Ni&&e.button!=0)return;this.el.focus(),_u(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),_u(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":US(this,e);break}}style(e){e.forEach((t,i)=>{for(const s in t)this.nodes[i].style.setProperty(s,t[s])})}}class WS extends fg{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:Jr({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${_e(e)}`)}getMove(e,t){return{h:t?Un(this.h+e.x*360,0,360):360*e.x}}}class qS extends fg{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:Jr(e)},{"background-color":Jr({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${_e(e.s)}%, Brightness ${_e(e.v)}%`)}getMove(e,t){return{s:t?Un(this.hsva.s+e.x*100,0,100):e.x*100,v:t?Un(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}}const jS=':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)}',GS="[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}",KS="[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}",vs=Symbol("same"),Qo=Symbol("color"),vu=Symbol("hsva"),Xo=Symbol("update"),yu=Symbol("parts"),ku=Symbol("css"),Cu=Symbol("sliders");class ZS extends HTMLElement{static get observedAttributes(){return["color"]}get[ku](){return[jS,GS,KS]}get[Cu](){return[qS,WS]}get color(){return this[Qo]}set color(e){if(!this[vs](e)){const t=this.colorModel.toHsva(e);this[Xo](t),this[Qo]=e}}constructor(){super();const e=hg(`<style>${this[ku].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[yu]=this[Cu].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[vs](s)||(this.color=s)}handleEvent(e){const t=this[vu],i={...t,...e.detail};this[Xo](i);let s;!dg(i,t)&&!this[vs](s=this.colorModel.fromHsva(i))&&(this[Qo]=s,ol(this,"color-changed",{value:s}))}[vs](e){return this.color&&this.colorModel.equal(e,this.color)}[Xo](e){this[vu]=e,this[yu].forEach(t=>t.update(e))}}const JS={defaultColor:"#000",toHsva:OS,fromHsva:({h:n,s:e,v:t})=>BS({h:n,s:e,v:t,a:1}),equal:zS,fromAttr:n=>n};class YS extends ZS{get colorModel(){return JS}}/**
|
|
@@ -658,10 +658,10 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
658
658
|
*/class nx extends W(ye){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)}}/**
|
|
659
659
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
660
660
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
661
|
-
*/const{eraser:sx,colorPalette:ox}=
|
|
661
|
+
*/const{eraser:sx,colorPalette:ox}=R;class rx extends A{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 nx,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=Pe.bind(this.documentColors,this.documentColors),t=new nn(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 O,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:ox,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show")})}_createRemoveColorButton(){const e=new O;return e.set({withText:!0,icon:sx,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 hu(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=Pe.bind(this.documentColors,this.documentColors),t=new hu(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 Km;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}})}}/**
|
|
662
662
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
663
663
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
664
|
-
*/class ax extends A{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 XS(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 A,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 O(e),s=new O(e);return i.set({icon:
|
|
664
|
+
*/class ax extends A{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 XS(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 A,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 O(e),s=new O(e);return i.set({icon:R.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),s.set({icon:R.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)})}}/**
|
|
665
665
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
666
666
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
667
667
|
*/class lx extends A{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 ne,this.keystrokes=new ae,this._focusables=new Ae,this._colorPickerViewConfig=l,this._focusCycler=new Ee({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new rx(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new ax(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))}}/**
|
|
@@ -682,7 +682,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
682
682
|
*/class hx extends A{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)}}/**
|
|
683
683
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
684
684
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
685
|
-
*/const Ze={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"},Eu=Xi("px");class ji extends ux(A){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",Ze.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 ae,this.focusTracker=new ne,this._focusables=new Ae,this._focusCycler=new Ee({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=>Eu(r)),left:s.to("_left",r=>Eu(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 mg(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 A&&(s=[s]),this.contentView=new hx(this.locale),this.contentView.children.addMany(s),this.parts.add(this.contentView)),o&&(this.actionsView=new dx(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=Ze.SCREEN_CENTER;const s=ji.defaultOffset,o=this._getDialogRect();switch(t){case Ze.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 Ze.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 Ze.SCREEN_CENTER:{this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break}case Ze.EDITOR_TOP_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top+s):this._moveOffScreen();break}case Ze.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 Ze.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 Ze.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 B(this._getCurrentDomRoot()).getVisible();if(t){if(t=e.getIntersection(t),!t)return null}else return null;return t}_getDialogRect(){return new B(this.element.firstElementChild)}_getViewportRect(){return fx(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)ss(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),vS(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 O(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:
|
|
685
|
+
*/const Ze={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"},Eu=Xi("px");class ji extends ux(A){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",Ze.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 ae,this.focusTracker=new ne,this._focusables=new Ae,this._focusCycler=new Ee({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=>Eu(r)),left:s.to("_left",r=>Eu(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 mg(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 A&&(s=[s]),this.contentView=new hx(this.locale),this.contentView.children.addMany(s),this.parts.add(this.contentView)),o&&(this.actionsView=new dx(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=Ze.SCREEN_CENTER;const s=ji.defaultOffset,o=this._getDialogRect();switch(t){case Ze.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 Ze.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 Ze.SCREEN_CENTER:{this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break}case Ze.EDITOR_TOP_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top+s):this._moveOffScreen();break}case Ze.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 Ze.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 Ze.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 B(this._getCurrentDomRoot()).getVisible();if(t){if(t=e.getIntersection(t),!t)return null}else return null;return t}_getDialogRect(){return new B(this.element.firstElementChild)}_getViewportRect(){return fx(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)ss(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),vS(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 O(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:R.cancel}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}}ji.defaultOffset=15;function fx(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const e=new B(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}/**
|
|
686
686
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
687
687
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
688
688
|
*/class pt 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",()=>{pt._visibleDialogPlugin&&pt._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 ji(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?Ze.SCREEN_CENTER:Ze.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,pt._visibleDialogPlugin=this}hide(){pt._visibleDialogPlugin&&pt._visibleDialogPlugin.fire(`hide:${pt._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,pt._visibleDialogPlugin=null}}/**
|
|
@@ -691,11 +691,11 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
691
691
|
*/const Tu=Xi("px"),Au=S.document.body,mx={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class ve extends A{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",Tu),left:t.to("left",Tu)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=ve.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:Au,fitInViewport:!0},e),s=ve._getOptimalPosition(i)||mx,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=Qr(e.target),i=e.limiter?Qr(e.limiter):Au;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")}}ve.arrowSideOffset=25;ve.arrowHeightOffset=10;ve.stickyVerticalOffset=20;ve._getOptimalPosition=$a;ve.defaultPositions=gg();function Qr(n){return si(n)?n:Co(n)?n.commonAncestorContainer:typeof n=="function"?Qr(n()):null}function gg(n={}){const{sideOffset:e=ve.arrowSideOffset,heightOffset:t=ve.arrowHeightOffset,stickyVerticalOffset:i=ve.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}}/**
|
|
692
692
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
693
693
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
694
|
-
*/const Su="ck-tooltip";class ge extends
|
|
694
|
+
*/const Su="ck-tooltip";class ge extends He(){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,this._mutationObserver=null,ge._editors.add(e),ge._instance)return ge._instance;ge._instance=this,this.tooltipTextView=new A(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 ve(e.locale),this.balloonPanelView.class=Su,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=gx(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=zi(this._pinTooltip,600),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;ge._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),ge._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),ge._instance=null)}static getPositioningFunctions(e){const t=ge.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onEnterOrFocus(e,{target:t}){const i=ir(t);i&&i!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(i,xu(i)))}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if(e.name==="mouseleave"){if(!si(t)||this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const s=ir(t),o=ir(i);s&&s!==o&&this._unpinTooltip()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltip()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:i,cssClass:s}){const o=J(ge._editors.values()).ui.view.body;o.has(this.balloonPanelView)||o.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.pin({target:e,positions:ge.getPositioningFunctions(i)}),this._resizeObserver=new X(e,()=>{oi(e)||this._unpinTooltip()}),this._mutationObserver.attach(e),this.balloonPanelView.class=[Su,s].filter(r=>r).join(" ");for(const r of ge._editors)this.listenTo(r.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i}_unpinTooltip(){this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of ge._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver&&this._resizeObserver.destroy(),this._mutationObserver.detach()}_updateTooltipPosition(){const e=xu(this._currentElementWithTooltip);if(!oi(this._currentElementWithTooltip)||!e.text){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:ge.getPositioningFunctions(e.position)})}}ge.defaultBalloonPositions=gg({heightOffset:5,sideOffset:13});ge._editors=new Set;ge._instance=null;function ir(n){return si(n)?n.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function xu(n){return{text:n.dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}}function gx(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 px=`<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>
|
|
695
695
|
`;/**
|
|
696
696
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
697
697
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
698
|
-
*/const wx=53,bx=10,_x=50,vx=350,yx="Powered by";class kx extends
|
|
698
|
+
*/const wx=53,bx=10,_x=50,vx=350,yx="Powered by";class kx extends He(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=Ln(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&&uk(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 ve,i=wg(e),s=new Cx(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=Ex(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 Cx extends A{constructor(e,t){super(e);const i=new dt,s=this.bindTemplate;i.set({content:px,isColorInherited:!1}),i.extendTemplate({attributes:{style:{width:wx+"px",height:bx+"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 Ex(n,e){const t=wg(n),i=t.side==="right"?Tx(e,t):Ax(e,t);return{target:e,positions:[i]}}function Tx(n,e){return pg(n,e,(t,i)=>t.left+t.width-i.width-e.horizontalOffset)}function Ax(n,e){return pg(n,e,t=>t.left+e.horizontalOffset)}function pg(n,e,t){return(i,s)=>{const o=new B(n);if(o.width<vx||o.height<_x)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 wg(n){const e=n.config.get("ui.poweredBy"),t=e&&e.position||"border";return{position:t,label:yx,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:n.locale.contentLanguageDirection==="ltr"?"right":"left",...e}}/**
|
|
699
699
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
700
700
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
701
701
|
*/const bg={POLITE:"polite",ASSERTIVE:"assertive"};class Sx{constructor(e){this.editor=e}announce(e,t,i=bg.POLITE){const s=this.editor;this.view||(this.view=new xx(s.locale),s.ui.view.body.add(this.view));let o=this.view.regionViews.find(r=>r.regionName===e);o||(o=new Ix(this.view.locale),this.view.regionViews.add(o)),o.set({regionName:e,text:t,politeness:i})}}class xx extends A{constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class Ix extends A{constructor(e){super(e);const t=this.bindTemplate;this.set("regionName",""),this.set("text",""),this.set("politeness",bg.POLITE),this.setTemplate({tag:"div",attributes:{role:"region","data-region":t.to("regionName"),"aria-live":t.to("politeness")},children:[{text:t.to("text")}]})}}/**
|
|
@@ -722,13 +722,13 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
722
722
|
*/class gi extends W(){constructor(e,t){super(),t&&Hh(this,t),e&&this.set(e)}}/**
|
|
723
723
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
724
724
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
725
|
-
*/const ys=Xi("px");class io 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 ve(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 Ox(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 Bx(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 Ox extends A{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new ne,this.buttonPrevView=this._createButtonView(t("Previous"),
|
|
725
|
+
*/const ys=Xi("px");class io 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 ve(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 Ox(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 Bx(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 Ox extends A{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new ne,this.buttonPrevView=this._createButtonView(t("Previous"),R.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),R.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 O(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class Bx extends A{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",ys),left:i.to("left",ys),width:i.to("width",ys),height:i.to("height",ys)}},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 A;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 B(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:s})}}}/**
|
|
726
726
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
727
727
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
728
728
|
*/const Ci=Xi("px");class Fx extends A{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 Pe({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",i=>i?"block":"none"),height:t.to("isSticky",i=>i?Ci(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new Pe({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?Ci(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",i=>i&&Ci(i)),bottom:t.to("_stickyBottomOffset",i=>i&&Ci(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 B(this.limiterElement);let t=e.getVisible();if(t){const i=new B(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=Ci(-S.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=Ci(-S.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new B(this.contentPanelElement)}}/**
|
|
729
729
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
730
730
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
731
|
-
*/class Dx extends sn{constructor(e,t){const i=e.t,s=Object.assign({},{showResetButton:!0,showIcon:!0,creator:os},t);super(e,s.creator),this.label=t.label,this._viewConfig=s,this._viewConfig.showIcon&&(this.iconView=new dt,this.iconView.content=
|
|
731
|
+
*/class Dx extends sn{constructor(e,t){const i=e.t,s=Object.assign({},{showResetButton:!0,showIcon:!0,creator:os},t);super(e,s.creator),this.label=t.label,this._viewConfig=s,this._viewConfig.showIcon&&(this.iconView=new dt,this.iconView.content=R.loupe,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new O(e),this.resetButtonView.set({label:i("Clear"),icon:R.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)}}/**
|
|
732
732
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
733
733
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
734
734
|
*/class Nx extends A{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()}}/**
|
|
@@ -776,7 +776,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
776
776
|
*/class Xx extends w{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:rl.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,i=e.model.schema,o=Eg(e.config.get("alignment.options")).filter(c=>kg(c.name)&&!Cg(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(nI(o)):e.conversion.for("downcast").attributeToAttribute(eI(o));const a=tI(o);for(const c of a)e.conversion.for("upcast").attributeToAttribute(c);const l=iI(o);for(const c of l)e.conversion.for("upcast").attributeToAttribute(c);e.commands.add("alignment",new Jx(e))}}function eI(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 tI(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 iI(n){const e=[];for(const{name:t}of n)e.push({view:{key:"align",value:t},model:{key:"alignment",value:t}});return e}function nI(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}}/**
|
|
777
777
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
778
778
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
779
|
-
*/const ks=new Map([["left",
|
|
779
|
+
*/const ks=new Map([["left",R.alignLeft],["right",R.alignRight],["center",R.alignCenter],["justify",R.alignJustify]]);class sI 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=e.ui.componentFactory,i=e.t,s=Eg(e.config.get("alignment.options"));s.map(o=>o.name).filter(kg).forEach(o=>this._addButton(o)),t.add("alignment",o=>{const r=fe(o);So(r,()=>s.map(c=>t.create(`alignment:${c.name}`)),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:i("Text alignment toolbar")}),r.buttonView.set({label:i("Text alignment"),tooltip:!0}),r.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const a=o.contentLanguageDirection==="rtl"?ks.get("right"):ks.get("left"),l=e.commands.get("alignment");return r.buttonView.bind("icon").to(l,"value",c=>ks.get(c)||a),r.bind("isEnabled").to(l,"isEnabled"),this.listenTo(r,"execute",()=>{e.editing.view.focus()}),r})}_addButton(e){const t=this.editor;t.ui.componentFactory.add(`alignment:${e}`,i=>{const s=t.commands.get("alignment"),o=new O(i);return o.set({label:this.localizedOptionTitles[e],icon:ks.get(e),tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(s),o.bind("isOn").to(s,"value",r=>r===e),this.listenTo(o,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),o})}}/**
|
|
780
780
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
781
781
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
782
782
|
*/class oI extends w{static get requires(){return[Xx,sI]}static get pluginName(){return"Alignment"}}/**
|
|
@@ -812,7 +812,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
812
812
|
*/class fI 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}=Ig(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)}}}/**
|
|
813
813
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
814
814
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
815
|
-
*/class no 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&&
|
|
815
|
+
*/class no 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&&Ue(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&&ft(s,t)?!1:Ue(o,t)?(fn(e),ft(s,t)&&Ue(o,t,!0)?hn(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?(fn(e),this._restoreGravity(),Ue(o,t,!0)?hn(i,t):Cs(i,t,o),!0):o.isAtStart?ft(s,t)?(fn(e),Cs(i,t,o),!0):!1:!ft(s,t)&&Ue(o,t,!0)?(fn(e),Cs(i,t,o),!0):Bu(o,t)?o.isAtEnd&&!ft(s,t)&&Ue(o,t)?(fn(e),Cs(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(Ao);let o=!1;this.listenTo(s,"mousedown",()=>{o=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!o||(o=!1,!i.isCollapsed)||!ft(i,r))return;const a=i.getFirstPosition();Ue(a,r)&&(a.isAtStart||Ue(a,r,!0)?hn(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();ft(i,s)&&Ue(o,s)&&hn(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=ft(i,this.attributes)&&!Bu(a,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{o&&(o=!1,!r&&e.model.enqueueChange(()=>{const a=i.getFirstPosition();ft(i,this.attributes)&&Ue(a,this.attributes)&&(a.isAtStart||Ue(a,this.attributes,!0)?hn(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 ft(n,e){for(const t of e)if(n.hasAttribute(t))return!0;return!1}function Cs(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 hn(n,e){n.change(t=>{t.removeSelectionAttribute(e)})}function fn(n){n.preventDefault()}function Bu(n,e){const t=n.getShiftedBy(-1);return Ue(t,e)}function Ue(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}/**
|
|
816
816
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
817
817
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
818
818
|
*/function rs(n,e,t,i){return i.createRange(ea(n,e,t,!0,i),ea(n,e,t,!1,i))}function ea(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}/**
|
|
@@ -821,10 +821,10 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
821
821
|
*/function Pg(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=rs(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)})}})}/**
|
|
822
822
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
823
823
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
824
|
-
*/function It(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),y=p.createPositionAt(d,m[0].length),T=new
|
|
824
|
+
*/function It(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),y=p.createPositionAt(d,m[0].length),T=new De(_,y);if(s({match:m})!==!1){p.remove(T);const k=n.model.document.selection.getFirstRange(),M=p.createRangeIn(d);d.isEmpty&&!M.isEqual(k)&&!M.containsRange(k,!0)&&p.remove(d)}T.detach(),n.model.enqueueChange(()=>{n.plugins.get("Delete").requestUndoOnBackspace()})})})}/**
|
|
825
825
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
826
826
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
827
|
-
*/function Ei(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}=mI(l.createRange(l.createPositionAt(f,0),h),l),_=o(m),y=Fu(p.start,_.format,l),T=Fu(p.start,_.remove,l);y.length&&T.length&&l.enqueueChange(
|
|
827
|
+
*/function Ei(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}=mI(l.createRange(l.createPositionAt(f,0),h),l),_=o(m),y=Fu(p.start,_.format,l),T=Fu(p.start,_.remove,l);y.length&&T.length&&l.enqueueChange(D=>{if(i(D,y)!==!1){for(const M of T.reverse())D.remove(M);l.enqueueChange(()=>{n.plugins.get("Delete").requestUndoOnBackspace()})}})})}function Fu(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 mI(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)}}/**
|
|
828
828
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
829
829
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
830
830
|
*/class gI extends w{static get requires(){return[Et]}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")&&It(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&It(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&It(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&It(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=Es(this.editor,"bold");Ei(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),Ei(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(e.get("italic")){const t=Es(this.editor,"italic");Ei(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),Ei(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(e.get("code")){const t=Es(this.editor,"code");Ei(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(e.get("strikethrough")){const t=Es(this.editor,"strikethrough");Ei(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$`);It(this.editor,this,s,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&It(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&It(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&It(this.editor,this,/^---$/,"horizontalLine")}}function Es(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)}}/**
|
|
@@ -836,7 +836,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
836
836
|
*/const Ti="bold";class pI extends w{static get pluginName(){return"BoldEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Ti}),e.model.schema.setAttributeProperties(Ti,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Ti,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(Ti,new as(e,Ti)),e.keystrokes.set("CTRL+B",Ti),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}/**
|
|
837
837
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
838
838
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
839
|
-
*/const nr="bold";class wI extends w{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(nr,i=>{const s=e.commands.get(nr),o=new O(i);return o.set({label:t("Bold"),icon:
|
|
839
|
+
*/const nr="bold";class wI extends w{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(nr,i=>{const s=e.commands.get(nr),o=new O(i);return o.set({label:t("Bold"),icon:R.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(nr),e.editing.view.focus()}),o})}}/**
|
|
840
840
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
841
841
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
842
842
|
*/class bI extends w{static get requires(){return[pI,wI]}static get pluginName(){return"Bold"}}/**
|
|
@@ -902,7 +902,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
902
902
|
*/class HI extends w{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[ls,Et]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new zI(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"})}}/**
|
|
903
903
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
904
904
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
905
|
-
*/class UI extends w{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const s=e.commands.get("blockQuote"),o=new O(i);return o.set({label:t("Block quote"),icon:
|
|
905
|
+
*/class UI extends w{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const s=e.commands.get("blockQuote"),o=new O(i);return o.set({label:t("Block quote"),icon:R.quote,tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),o})}}/**
|
|
906
906
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
907
907
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
908
908
|
*/class WI extends w{static get requires(){return[HI,UI]}static get pluginName(){return"BlockQuote"}}/**
|
|
@@ -962,19 +962,19 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
962
962
|
*/class Zu 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 E3(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 B(s),r=Math.round(o.width),a=Math.round(o.height),l=new B(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(!M3(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 B(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"];Ce(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=V3(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 Pe({tag:"div",attributes:{class:`ck-widget__resizer__handle ${R3(i)}`}}).render())}_appendSizeUI(e){this._sizeView=new P3,this._sizeView.render(),e.appendChild(this._sizeView.element)}}function R3(n){return`ck-widget__resizer__handle-${n}`}function V3(n){return{x:n.pageX,y:n.pageY}}function M3(n){return n&&n.ownerDocument&&n.ownerDocument.contains(n)}/**
|
|
963
963
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
964
964
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
965
|
-
*/class cr 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(Ao),this._observer=new(
|
|
965
|
+
*/class cr 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(Ao),this._observer=new(He()),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=Ln(()=>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 Zu(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;Zu.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)}}/**
|
|
966
966
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
967
967
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
968
968
|
*//* istanbul ignore file -- @preserve */const ur=Xi("px");class L3 extends A{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=>ur(t)),top:e.to("top",t=>ur(t)),width:e.to("width",t=>ur(t))}}})}}/**
|
|
969
969
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
970
970
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
971
|
-
*/class As extends w{constructor(){super(...arguments),this.removeDropMarkerDelayed=Ua(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=Ln(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=Ln(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new L3,this._domEmitter=new(
|
|
971
|
+
*/class As extends w{constructor(){super(...arguments),this.removeDropMarkerDelayed=Ua(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=Ln(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=Ln(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new L3,this._domEmitter=new(He()),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=Ju(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=Ju(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 B(a):null,_=c?new B(c):null,y=new B(d).excludeScrollbarsAndBorders(),T=p?p.bottom:y.top,D=_?_.top:y.bottom,k=S.window.getComputedStyle(d),M=T<=D?(T+D)/2:D;if(h.top<M&&M<h.bottom){const C=y.left+parseFloat(k.paddingLeft),P=y.right-parseFloat(k.paddingRight),x=Math.max(C+f,h.left),Y=Math.min(P+f,h.right);this._dropTargetLineView.set({isVisible:!0,left:x,top:M+m,width:Y-x})}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=B3(s),this._domEmitter.listenTo(i,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const o=new X(i,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:i,resizeObserver:o})}return new B(i).excludeScrollbarsAndBorders()}}function Ju(n,e,t,i,s,o,r){const a=n.model,l=n.editing.mapper;let u=Yu(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 Ss(n,Yu(n,d.parent),i,s)}}}else if(a.schema.isInline(u))return Ss(n,u,i,s)}if(a.schema.isBlock(u))return Ss(n,u,i,s);if(a.schema.checkChild(u,"$block")){const d=Array.from(u.getChildren()).filter(m=>m.is("element")&&!O3(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);Ng(n,d[m],i,s)=="before"?f=m:h=m}return Ss(n,d[h],i,s)}u=u.parent}return null}function O3(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 Ss(n,e,t,i){const s=n.model;return s.createRange(s.createPositionAt(e,Ng(n,e,t,i)))}function Ng(n,e,t,i){const s=n.editing.mapper,o=n.editing.view.domConverter,r=s.toViewElement(e),a=o.mapViewToDom(r),l=new B(a);return n.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":i<(l.top+l.bottom)/2?"before":"after"}function Yu(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 B3(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}/**
|
|
972
972
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
973
973
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
974
|
-
*/class F3 extends w{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(
|
|
974
|
+
*/class F3 extends w{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(He())}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")}),L.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(qn).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(qn).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:s,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}/**
|
|
975
975
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
976
976
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
977
|
-
*/class D3 extends w{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=Ua(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(
|
|
977
|
+
*/class D3 extends w{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=Ua(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(He())}static get pluginName(){return"DragDrop"}static get requires(){return[it,pi,As,F3]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(qn),t.addObserver(Ao),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)}),L.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(As);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=qe(),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"),L.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(As);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=""),Qu(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(it);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=Qu(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(L.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=Xu(o.target);if(L.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const a=i.selection.getSelectedElement();(!a||!he(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",()=>{L.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(As).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?Xu(e):null;if(o){const c=t.editing.mapper.toModelElement(o);this._draggedRange=De.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=De.fromRange(a);return}const l=$g(i,r);if(r.length>1)this._draggedRange=De.fromRange(l),this._blockMode=!0;else if(r.length==1){const c=a.start.isTouching(l.start)&&a.end.isTouching(l.end);this._draggedRange=De.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=Ve(S.document,"div",{style:"position: fixed; left: -999999px;"}),S.document.body.appendChild(this._previewContainer));const l=new B(r);if(r.contains(t))return;const c=parseFloat(a.paddingLeft),u=Ve(S.document,"div");u.className="ck ck-content",u.style.width=a.width,u.style.paddingLeft=`${l.left-i+c}px`,L.isiOS&&(u.style.backgroundColor="white"),u.innerHTML=e.getData("text/html"),e.setDragImage(u,0,0),this._previewContainer.appendChild(u)}}function Qu(n){return L.isGecko?n.dropEffect:["all","copyMove"].includes(n.effectAllowed)?"move":"copy"}function Xu(n){if(n.is("editableElement"))return null;if(n.hasClass("ck-widget__selection-handle"))return n.findAncestor(he);if(he(n))return n;const e=n.findAncestor(t=>he(t)||t.is("editableElement"));return he(e)?e:null}function $g(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 $g(n,[s])}return n.createRange(o,r)}/**
|
|
978
978
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
979
979
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
980
980
|
*/class N3 extends w{static get pluginName(){return"PastePlainText"}static get requires(){return[it]}init(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,o=t.document.selection;let r=!1;i.addObserver(qn),this.listenTo(s,"keydown",(a,l)=>{r=l.shiftKey}),e.plugins.get(it).on("contentInsertion",(a,l)=>{!r&&!$3(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 $3(n,e){if(n.childCount>1)return!1;const t=n.getChild(0);return e.isObject(t)?!1:Array.from(t.getAttributeKeys()).length==0}/**
|
|
@@ -1007,7 +1007,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1007
1007
|
*/class Y3 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 Z3(e),this._redoCommand=new J3(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"]]}]})}}/**
|
|
1008
1008
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1009
1009
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1010
|
-
*/class Q3 extends w{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?
|
|
1010
|
+
*/class Q3 extends w{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?R.undo:R.redo,o=t.uiLanguageDirection=="ltr"?R.redo:R.undo;this._addButton("undo",i("Undo"),"CTRL+Z",s),this._addButton("redo",i("Redo"),"CTRL+Y",o)}_addButton(e,t,i,s){const o=this.editor;o.ui.componentFactory.add(e,r=>{const a=o.commands.get(e),l=new O(r);return l.set({label:t,icon:s,keystroke:i,tooltip:!0}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{o.execute(e),o.editing.view.focus()}),l})}}/**
|
|
1011
1011
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1012
1012
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1013
1013
|
*/class Ug extends w{static get requires(){return[Y3,Q3]}static get pluginName(){return"Undo"}}/**
|
|
@@ -1028,7 +1028,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1028
1028
|
*/class iP extends V{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=>id(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=>id(a,s,t.schema));for(const a of r)a.is("element",s)||o.rename(a,s)})}}function id(n,e,t){return t.checkChild(n.parent,e)&&!t.isObject(n)}/**
|
|
1029
1029
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1030
1030
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1031
|
-
*/const nd="paragraph";class nP 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[cs]}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 iP(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",nd)&&r.childCount===0&&o.writer.rename(r,nd)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:
|
|
1031
|
+
*/const nd="paragraph";class nP 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[cs]}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 iP(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",nd)&&r.childCount===0&&o.writer.rename(r,nd)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:Fe.low+1})}}/**
|
|
1032
1032
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1033
1033
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1034
1034
|
*/function sP(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})}/**
|
|
@@ -1043,7 +1043,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1043
1043
|
*/function aP(n){return n.createContainerElement("span",{class:"image-inline"},n.createEmptyElement("img"))}function sd(n){return n.createContainerElement("figure",{class:"image"},[n.createEmptyElement("img"),n.createSlot("children")])}function Wg(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 cl(n,e){const t=J(e.getSelectedBlocks());return!t||n.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function ro(n){return n&&n.endsWith("px")?parseInt(n):null}function ao(n){const e=ro(n.getStyle("width")),t=ro(n.getStyle("height"));return!!(e&&t)}/**
|
|
1044
1044
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1045
1045
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1046
|
-
*/const lP=/^(image|image-inline)$/;class Te extends w{constructor(){super(...arguments),this._domEmitter=new(
|
|
1046
|
+
*/const lP=/^(image|image-inline)$/;class Te extends w{constructor(){super(...arguments),this._domEmitter=new(He())}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=qg(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:lP})}isImageAllowed(){const t=this.editor.model.document.selection;return cP(this.editor,t)&&uP(t)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),rn(e,t,{label:()=>{const r=this.findViewImgElement(e).getAttribute("alt");return r?`${r} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&he(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 cP(n,e){if(qg(n,e,null)=="imageBlock"){const i=dP(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 uP(n){return[...n.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function dP(n,e){const i=ll(n,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function qg(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")?cl(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}/**
|
|
1047
1047
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1048
1048
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1049
1049
|
*/class hP extends V{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)})}}/**
|
|
@@ -1052,13 +1052,13 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1052
1052
|
*/class fP extends w{static get requires(){return[Te]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new hP(this.editor))}}/**
|
|
1053
1053
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1054
1054
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1055
|
-
*/class mP extends A{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new ne,this.keystrokes=new ae,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),
|
|
1055
|
+
*/class mP extends A{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new ne,this.keystrokes=new ae,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),R.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),R.cancel,"ck-button-cancel","cancel"),this._focusables=new Ae,this._focusCycler=new Ee({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),mo({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 O(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 sn(this.locale,os);return t.label=e("Text alternative"),t}}/**
|
|
1056
1056
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1057
1057
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1058
1058
|
*/function gP(n){const e=n.plugins.get("ContextualBalloon");if(n.plugins.get("ImageUtils").getClosestSelectedImageWidget(n.editing.view.document.selection)){const i=jg(n);e.updatePosition(i)}}function jg(n){const e=n.editing.view,t=ve.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]}}/**
|
|
1059
1059
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1060
1060
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1061
|
-
*/class pP extends w{static get requires(){return[io]}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 O(i);return o.set({label:t("Change image text alternative"),icon:
|
|
1061
|
+
*/class pP extends w{static get requires(){return[io]}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 O(i);return o.set({label:t("Change image text alternative"),icon:R.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(Ea(mP))(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&&gP(e):this._hideForm(!0)}),Ca({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:jg(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)}}/**
|
|
1062
1062
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1063
1063
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1064
1064
|
*/class Gg extends w{static get requires(){return[fP,pP]}static get pluginName(){return"ImageTextAlternative"}}/**
|
|
@@ -1118,7 +1118,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1118
1118
|
*/class SP extends w{static get requires(){return[Te,tp]}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 AP(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"),Jf({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 Bg(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)}}})}}/**
|
|
1119
1119
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1120
1120
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1121
|
-
*/class xP extends w{static get requires(){return[tp]}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 O(o);return a.set({icon:
|
|
1121
|
+
*/class xP extends w{static get requires(){return[tp]}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 O(o);return a.set({icon:R.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})}}/**
|
|
1122
1122
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1123
1123
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1124
1124
|
*/class IP extends w{static get requires(){return[SP,xP]}static get pluginName(){return"ImageCaption"}}/**
|
|
@@ -1136,7 +1136,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1136
1136
|
*/function ip(n){const e=n.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function MP(n){return new Promise((e,t)=>{const i=n.getAttribute("src");fetch(i).then(s=>s.blob()).then(s=>{const o=np(s,i),a=`image.${o.replace("image/","")}`,l=new File([s],a,{type:o});e(l)}).catch(s=>s&&s.name==="TypeError"?OP(i).then(e).catch(t):t(s))})}function LP(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 np(n,e){return n.type?n.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function OP(n){return BP(n).then(e=>{const t=np(e,n),s=`image.${t.replace("image/","")}`;return new File([e],s,{type:t})})}function BP(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})}/**
|
|
1137
1137
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1138
1138
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1139
|
-
*/class FP extends w{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=s=>{const o=new RP(s),r=e.commands.get("uploadImage"),a=e.config.get("image.upload.types"),l=ip(a);return o.set({acceptedType:a.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:t("Upload image from computer"),icon:
|
|
1139
|
+
*/class FP extends w{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=s=>{const o=new RP(s),r=e.commands.get("uploadImage"),a=e.config.get("image.upload.types"),l=ip(a);return o.set({acceptedType:a.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:t("Upload image from computer"),icon:R.imageUpload,tooltip:!0}),o.bind("isEnabled").to(r),o.on("done",(c,u)=>{const d=Array.from(u).filter(h=>l.test(h.type));d.length&&(e.execute("uploadImage",{file:d}),e.editing.view.focus())}),o};if(e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i),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}})}}}/**
|
|
1140
1140
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1141
1141
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1142
1142
|
*/class DP 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(ei),u=a?i.attributeNewValue:null,d=this.placeholder,h=o.editing.mapper.toViewElement(r),f=s.writer;if(u=="reading"){rd(h,f),ad(l,d,h,f);return}if(u=="uploading"){const m=c.loaders.get(a);rd(h,f),m?(ld(h,f),$P(h,f,m,o.editing.view),qP(l,h,f,m)):ad(l,d,h,f);return}u=="complete"&&c.loaders.get(a)&&HP(h,f,o.editing.view),zP(h,f),ld(h,f),NP(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 rd(n,e){n.hasClass("ck-appear")||e.addClass("ck-appear",n)}function NP(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),sp(t,"placeholder")||i.insert(i.createPositionAfter(s),WP(i))}function ld(n,e){n.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",n),op(n,e,"placeholder")}function $P(n,e,t,i){const s=UP(e);e.insert(e.createPositionAt(n,"end"),s),t.on("change:uploadedPercent",(o,r,a)=>{i.change(l=>{l.setStyle("width",a+"%",s)})})}function zP(n,e){op(n,e,"progressBar")}function HP(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 UP(n){const e=n.createUIElement("div",{class:"ck-progress-bar"});return n.setCustomProperty("progressBar",!0,e),e}function WP(n){const e=n.createUIElement("div",{class:"ck-upload-placeholder-loader"});return n.setCustomProperty("placeholder",!0,e),e}function sp(n,e){for(const t of n.getChildren())if(t.getCustomProperty(e))return t}function op(n,e,t){const i=sp(n,t);i&&e.remove(e.createRangeOn(i))}function qP(n,e,t,i){if(i.data){const s=n.findViewImgElement(e);t.setAttribute("src",i.data,s)}}/**
|
|
@@ -1157,7 +1157,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1157
1157
|
*/class rp extends w{static get requires(){return[Te]}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 YP(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=>ao(s)?null:s.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:s=>ao(s)?null:s.getStyle("height")}})}}/**
|
|
1158
1158
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1159
1159
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1160
|
-
*/const dr={small:
|
|
1160
|
+
*/const dr={small:R.objectSizeSmall,medium:R.objectSizeMedium,large:R.objectSizeLarge,original:R.objectSizeFull};class QP extends w{static get requires(){return[rp]}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 O(a),c=t.commands.get("resizeImage"),u=this._getOptionLabelValue(e,!0);if(!dr[o])throw new g("imageresizebuttons-missing-icon",t,e);return l.set({label:u,icon:dr[o],tooltip:u,isToggleable:!0}),l.bind("isEnabled").to(this),l.bind("isOn").to(c,"value",cd(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=fe(r,sg),c=l.buttonView,u=i("Resize image");return c.set({tooltip:u,commandValue:s.value,icon:dr.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),mi(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 ye;return e.map(s=>{const o=s.value?s.value+this._resizeUnit:null,r={type:"button",model:new gi({commandName:"resizeImage",commandValue:o,label:this._getOptionLabelValue(s),role:"menuitemradio",withText:!0,icon:null})};r.model.bind("isOn").to(t,"value",cd(o)),i.add(r)}),i}}function cd(n){return e=>{const t=e;return n===null&&t===n?!0:t!==null&&t.width===n}}/**
|
|
1161
1161
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1162
1162
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1163
1163
|
*/const XP="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",hr="image_resized";class e4 extends w{static get requires(){return[cr,Te]}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(ul),this.listenTo(t.document,"imageLoaded",(s,o)=>{if(!o.target.matches(XP))return;const r=e.editing.view.domConverter,a=r.domToView(o.target),l=i.getImageWidgetFromImageView(a);let c=this.editor.plugins.get(cr).getResizerByViewElement(l);if(c){c.redraw();return}const u=e.editing.mapper,d=u.toModelElement(l);c=e.plugins.get(cr).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(hr,l)}),e.execute("resizeImage",{width:h})}}),c.on("updateSize",()=>{l.hasClass(hr)||t.change(f=>{f.addClass(hr,l)});const h=d.name==="imageInline"?a:l;h.getStyle("height")&&t.change(f=>{f.removeStyle("height",h)})}),c.bind("isEnabled").to(this)})}}/**
|
|
@@ -1169,7 +1169,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1169
1169
|
*/class i4 extends V{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)}}/**
|
|
1170
1170
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1171
1171
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1172
|
-
*/const{objectFullWidth:n4,objectInline:ap,objectLeft:lp,objectRight:ia,objectCenter:na,objectBlockLeft:cp,objectBlockRight:up}=
|
|
1172
|
+
*/const{objectFullWidth:n4,objectInline:ap,objectLeft:lp,objectRight:ia,objectCenter:na,objectBlockLeft:cp,objectBlockRight:up}=R,Fs={get inline(){return{name:"inline",title:"In line",icon:ap,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:lp,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:cp,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:na,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:ia,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:up,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:na,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:ia,modelElements:["imageBlock"],className:"image-style-side"}}},dp={full:n4,left:cp,right:up,center:na,inlineLeft:lp,inlineRight:ia,inline:ap},hp=[{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 s4(n){return(n.configuredStyles.options||[]).map(i=>a4(i)).filter(i=>l4(i,n))}function o4(n,e){return n&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:n?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function r4(n){return n.has("ImageBlockEditing")&&n.has("ImageInlineEditing")?[...hp]:[]}function a4(n){return typeof n=="string"?Fs[n]?n={...Fs[n]}:n={name:n}:n=c4(Fs[n.name],n),typeof n.icon=="string"&&(n.icon=dp[n.icon]||n.icon),n}function l4(n,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){const{modelElements:i,name:s}=n;if(!i||!i.length||!s)return fp({style:n}),!1;{const o=[e?"imageBlock":null,t?"imageInline":null];if(!i.some(r=>o.includes(r)))return U("image-style-missing-dependency",{style:n,missingPlugins:i.map(r=>r==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function c4(n,e){const t={...e};for(const i in n)Object.prototype.hasOwnProperty.call(e,i)||(t[i]=n[i]);return t}function fp(n){U("image-style-configuration-definition-invalid",n)}const sa={normalizeStyles:s4,getDefaultStylesConfiguration:o4,getDefaultDropdownDefinitions:r4,warnInvalidStyle:fp,DEFAULT_OPTIONS:Fs,DEFAULT_ICONS:dp,DEFAULT_DROPDOWN_DEFINITIONS:hp};/**
|
|
1173
1173
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1174
1174
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1175
1175
|
*/function u4(n){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const s=ud(t.attributeNewValue,n),o=ud(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 d4(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 ud(n,e){for(const t of e)if(t.name===n)return t}/**
|
|
@@ -1178,19 +1178,19 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1178
1178
|
*/class mp extends w{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Te]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=sa,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 i4(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,s=i.model.schema,o=u4(this.normalizedStyles),r=d4(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(Te),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})}}/**
|
|
1179
1179
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1180
1180
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1181
|
-
*/class h4 extends w{static get requires(){return[mp]}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=dd(i.normalizedStyles,this.localizedDefaultStylesTitles);for(const r of s)this._createButton(r);const o=dd([...t.filter(
|
|
1181
|
+
*/class h4 extends w{static get requires(){return[mp]}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=dd(i.normalizedStyles,this.localizedDefaultStylesTitles);for(const r of s)this._createButton(r);const o=dd([...t.filter(ee),...sa.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})=>hd(m)===f)).map(f=>{const m=i.create(f);return f===r&&(o=m),m});a.length!==c.length&&sa.warnInvalidStyle({dropdown:e});const u=fe(s,on),d=u.buttonView,h=d.arrowView;return So(u,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:fd(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(Vt);return m<0?o.icon:c[m].icon}),d.bind("label").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Vt);return fd(l,m<0?o.label:c[m].label)}),d.bind("isOn").toMany(c,"isOn",(...f)=>f.some(Vt)),d.bind("class").toMany(c,"isOn",(...f)=>f.some(Vt)?"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(Vt)),this.listenTo(u,"execute",()=>{this.editor.editing.view.focus()}),u})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(hd(t),i=>{const s=this.editor.commands.get("imageStyle"),o=new O(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 dd(n,e){for(const t of n)e[t.title]&&(t.title=e[t.title]);return n}function hd(n){return`imageStyle:${n}`}function fd(n,e){return(n?n+": ":"")+e}/**
|
|
1182
1182
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1183
1183
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1184
1184
|
*/class f4 extends w{static get requires(){return[mp,h4]}static get pluginName(){return"ImageStyle"}}/**
|
|
1185
1185
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1186
1186
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1187
|
-
*/class m4 extends w{static get requires(){return[oo,Te]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(oo),s=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:g4(e.config.get("image.toolbar")||[]),getRelatedElement:o=>s.getClosestSelectedImageWidget(o)})}}function g4(n){return n.map(e=>
|
|
1187
|
+
*/class m4 extends w{static get requires(){return[oo,Te]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(oo),s=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:g4(e.config.get("image.toolbar")||[]),getRelatedElement:o=>s.getClosestSelectedImageWidget(o)})}}function g4(n){return n.map(e=>ee(e)?e.name:e)}/**
|
|
1188
1188
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1189
1189
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1190
1190
|
*/class p4 extends w{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new vc(e)),e.commands.add("outdent",new vc(e))}}/**
|
|
1191
1191
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1192
1192
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1193
|
-
*/class w4 extends w{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?
|
|
1193
|
+
*/class w4 extends w{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?R.indent:R.outdent,o=t.uiLanguageDirection=="ltr"?R.outdent:R.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,o=>{const r=s.commands.get(e),a=new O(o);return a.set({label:t,icon:i,tooltip:!0}),a.bind("isEnabled").to(r,"isEnabled"),this.listenTo(a,"execute",()=>{s.execute(e),s.editing.view.focus()}),a})}}/**
|
|
1194
1194
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1195
1195
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1196
1196
|
*/class b4 extends w{static get pluginName(){return"Indent"}static get requires(){return[p4,w4]}}/**
|
|
@@ -1226,10 +1226,10 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1226
1226
|
*/const O4="ck-link_selected",_d="automatic",B4="manual",F4=/^(https?:)?\/\//;class wp extends w{static get pluginName(){return"LinkEditing"}static get requires(){return[no,Ag,it]}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:pd}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(o,r)=>pd(gp(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 V4(e)),e.commands.add("unlink",new M4(e));const i=I4(e.t,P4(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(o=>o.mode===_d)),this._enableManualDecorators(i.filter(o=>o.mode===B4)),e.plugins.get(no).registerAttribute("linkHref"),Pg(e,"linkHref","a",O4),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:_d,callback:o=>!!o&&F4.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 L4(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(!(L.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(),wd(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(),wd(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=>{D4(r,N4(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=dl(l.getAttribute("linkHref"),i);r.setAttribute("linkHref",c,l)}})})}}function D4(n,e){n.removeSelectionAttribute("linkHref");for(const t of e)n.removeSelectionAttribute(t)}function N4(n){return n.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}/**
|
|
1227
1227
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1228
1228
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1229
|
-
*/class $4 extends A{constructor(e,t){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),
|
|
1229
|
+
*/class $4 extends A{constructor(e,t){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),R.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),R.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new Ee({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(),mo({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 sn(this.locale,os);return t.label=e("Link URL"),t}_createButton(e,t,i,s){const o=new O(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 ns(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 A;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 z4='<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>';/**
|
|
1230
1230
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1231
1231
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1232
|
-
*/class H4 extends A{constructor(e,t={}){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae;const i=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),z4,"unlink"),this.editButtonView=this._createButton(i("Edit link"),
|
|
1232
|
+
*/class H4 extends A{constructor(e,t={}){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae;const i=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),z4,"unlink"),this.editButtonView=this._createButton(i("Edit link"),R.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new Ee({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 O(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s.delegate("execute").to(this,i),s}_createPreviewButton(){const e=new O(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&&gp(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 U4='<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>';/**
|
|
1233
1233
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1234
1234
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1235
1235
|
*/const st="link-ui";class W4 extends w{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[io]}static get pluginName(){return"LinkUI"}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver(UE),this._balloon=e.plugins.get(io),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:st,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:st,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:Is},{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 H4(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(Is,(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(Ea($4))(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=dl(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"),i=e.t;e.ui.componentFactory.add("link",s=>{const o=new O(s);return o.isEnabled=!0,o.label=i("Link"),o.icon=U4,o.keystroke=Is,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",r=>!!r),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(Is,(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())}),Ca({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(st)){const o=Array.from(this.editor.editing.mapper.markerNameToElements(st)),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&&he(i))return fr(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),o=fr(s.start),r=fr(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(st))t.updateMarker(st,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:i});t.addMarker(st,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(st,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(st)&&e.change(t=>{t.removeMarker(st)})}}function fr(n){return n.getAncestors().find(e=>S4(e))||null}/**
|
|
@@ -1277,7 +1277,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1277
1277
|
*/function Rd(n,e,t,i){n.ui.componentFactory.add(e,s=>{const o=n.commands.get(e),r=new O(s);return r.set({label:t,icon:i,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{n.execute(e),n.editing.view.focus()}),r})}/**
|
|
1278
1278
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1279
1279
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1280
|
-
*/class b7 extends w{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;Rd(this.editor,"numberedList",e("Numbered List"),
|
|
1280
|
+
*/class b7 extends w{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;Rd(this.editor,"numberedList",e("Numbered List"),R.numberedList),Rd(this.editor,"bulletedList",e("Bulleted List"),R.bulletedList)}}/**
|
|
1281
1281
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1282
1282
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1283
1283
|
*/class _7 extends w{static get requires(){return[la,b7]}static get pluginName(){return"List"}}/**
|
|
@@ -1307,7 +1307,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1307
1307
|
*/class A7 extends A{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 ne,this.keystrokes=new ae,this.focusables=new Ae;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Ee({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);Jn({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 A(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 ne,i.keystrokes=new ae,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 Gm(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 sn(this.locale,LS);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 ns(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 S7='<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>',x7='<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>',I7='<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>',P7='<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>',R7='<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>',V7='<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>',M7='<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>',L7='<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>',O7='<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>';/**
|
|
1308
1308
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1309
1309
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1310
|
-
*/class B7 extends w{static get pluginName(){return"ListPropertiesUI"}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties");i.styles&&e.ui.componentFactory.add("bulletedList",Md({editor:e,parentCommandName:"bulletedList",buttonLabel:t("Bulleted List"),buttonIcon:
|
|
1310
|
+
*/class B7 extends w{static get pluginName(){return"ListPropertiesUI"}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties");i.styles&&e.ui.componentFactory.add("bulletedList",Md({editor:e,parentCommandName:"bulletedList",buttonLabel:t("Bulleted List"),buttonIcon:R.bulletedList,styleGridAriaLabel:t("Bulleted list styles toolbar"),styleDefinitions:[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:S7},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:x7},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:I7}]})),(i.styles||i.startIndex||i.reversed)&&e.ui.componentFactory.add("numberedList",Md({editor:e,parentCommandName:"numberedList",buttonLabel:t("Numbered List"),buttonIcon:R.numberedList,styleGridAriaLabel:t("Numbered list styles toolbar"),styleDefinitions:[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:P7},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:R7},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:V7},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:M7},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:L7},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:O7}]}))}}function Md({editor:n,parentCommandName:e,buttonLabel:t,buttonIcon:i,styleGridAriaLabel:s,styleDefinitions:o}){const r=n.commands.get(e);return a=>{const l=fe(a,on),c=l.buttonView;return l.bind("isEnabled").to(r),l.class="ck-list-styles-dropdown",c.on("execute",()=>{n.execute(e),n.editing.view.focus()}),c.set({label:t,icon:i,tooltip:!0,isToggleable:!0}),c.bind("isOn").to(r,"value",u=>!!u),l.once("change:isOpen",()=>{const u=D7({editor:n,dropdownView:l,parentCommandName:e,styleGridAriaLabel:s,styleDefinitions:o});l.panelView.children.add(u)}),l.on("execute",()=>{n.editing.view.focus()}),l}}function F7({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 O(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("listStyle",{type:r}):n.execute("listStyle",{type:e.defaultType}):n.model.change(()=>{n.execute("listStyle",{type:r})})}),c}}function D7({editor:n,dropdownView:e,parentCommandName:t,styleDefinitions:i,styleGridAriaLabel:s}){const o=n.locale,r=n.config.get("list.properties");let a=null;if(t!="numberedList"&&(r.startIndex=!1,r.reversed=!1),r.styles){const c=n.commands.get("listStyle"),u=F7({editor:n,parentCommandName:t,listStyleCommand:c}),d=typeof c.isStyleTypeSupported=="function"?h=>c.isStyleTypeSupported(h.type):()=>!0;a=i.filter(d).map(u)}const l=new A7(o,{styleGridAriaLabel:s,enabledProperties:r,styleButtonViews:a});if(r.styles&&xo(e,()=>l.stylesView.children.find(c=>c.isOn)),r.startIndex){const c=n.commands.get("listStart");l.startIndexFieldView.bind("isEnabled").to(c),l.startIndexFieldView.fieldView.bind("value").to(c),l.on("listStart",(u,d)=>n.execute("listStart",d))}if(r.reversed){const c=n.commands.get("listReversed");l.reversedSwitchButtonView.bind("isEnabled").to(c),l.reversedSwitchButtonView.bind("isOn").to(c,"value",u=>!!u),l.on("listReversed",()=>{const u=c.value;n.execute("listReversed",{reversed:!u})})}return l.delegate("execute").to(e),l}/**
|
|
1311
1311
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1312
1312
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1313
1313
|
*/class N7 extends w{static get requires(){return[E7,B7]}static get pluginName(){return"ListProperties"}}/**
|
|
@@ -1343,7 +1343,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1343
1343
|
*/class $d extends V{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)}}/**
|
|
1344
1344
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1345
1345
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1346
|
-
*/function Vp(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,y=a.getChild(_);if(!f)(m<i||p<s)&&bi(t,t.createPositionAt(y,"end"));else{const T=t.cloneElement(h);t.append(T,y),Fp(T,u,d,o,r,t)}}return Q7(a,n,i,s,t),a}function Mp(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 Lp(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:y,column:T,cell:
|
|
1346
|
+
*/function Vp(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,y=a.getChild(_);if(!f)(m<i||p<s)&&bi(t,t.createPositionAt(y,"end"));else{const T=t.cloneElement(h);t.append(T,y),Fp(T,u,d,o,r,t)}}return Q7(a,n,i,s,t),a}function Mp(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 Lp(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:y,column:T,cell:D}=_;D===n&&p===void 0&&(p=T),p!==void 0&&p===T&&y===h&&(m=bi(t,_.getPositionBefore(),l))}return oe("rowspan",a,n,t),m}function Op(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 Bp(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=bi(i,i.createPositionAfter(n),r);return oe("colspan",o,n,i),c}function Fp(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;oe("colspan",u,n,o,1)}if(e+a-1>i){const u=i-e+1;oe("rowspan",u,n,o,1)}}function Q7(n,e,t,i,s){const o=parseInt(e.getAttribute("headingRows")||"0");if(o>0){const a=o-t;oe("headingRows",a,n,s,0)}const r=parseInt(e.getAttribute("headingColumns")||"0");if(r>0){const a=r-i;oe("headingColumns",a,n,s,0)}}function da(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 ha(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 gl(n,e){da(n,e)||ha(n,e)}function Dp(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 Np(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}/**
|
|
1347
1347
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1348
1348
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1349
1349
|
*/class Ps extends V{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;t6(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");gl(_,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?X7(s,this.direction,i):e6(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 X7(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=ua(t,a),f=ua(t,l);return r&&h!=f?void 0:c+d===u?o:void 0}function e6(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:y,column:T})=>T!==m?!1:e=="down"?_===d:d===_+y);return p&&p.cell?p.cell:null}function t6(n,e,t){zd(n)||(zd(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function zd(n){const e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}/**
|
|
@@ -1364,7 +1364,7 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1364
1364
|
*/function c6(n){if(n.is("element","tableColumnGroup"))return n;const e=n.getChildren();return Array.from(e).find(t=>t.is("element","tableColumnGroup"))}function u6(n){const e=c6(n);return e?Array.from(e.getChildren()):[]}/**
|
|
1365
1365
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1366
1366
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1367
|
-
*/class be 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 gr(e,i,0,s,o),t.headingRows&&oe("headingRows",Math.min(t.headingRows,s),i,e,0),t.headingColumns&&oe("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&&oe("headingRows",d+o,e,u,0),!r&&(s===0||s===l)){gr(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:y,cellWidth:T,cell:
|
|
1367
|
+
*/class be 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 gr(e,i,0,s,o),t.headingRows&&oe("headingRows",Math.min(t.headingRows,s),i,e,0),t.headingColumns&&oe("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&&oe("headingRows",d+o,e,u,0),!r&&(s===0||s===l)){gr(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:y,cellWidth:T,cell:D}of f){const k=p+y-1,M=p<s&&s<=k,C=p<=a&&a<=k;M?(u.setAttribute("rowspan",y+o,D),m[_]=-T):r&&C&&(m[_]=T)}for(let p=0;p<o;p++){const _=u.createElement("tableRow");u.insert(_,e,s);for(let y=0;y<m.length;y++){const T=m[y],D=u.createPositionAt(_,"end");T>0&&bi(u,D,T>1?{colspan:T}:void 0),y+=Math.abs(T)-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")&&Oi(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 y=m+_-1;for(let T=d;T<=y;T++)c.skipRow(T)}else Oi(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}=f6(e,c);if(u.size){const h=a+1;m6(e,h,u,l)}for(let h=a;h>=r;h--)l.remove(e.getChild(h));for(const{rowspan:h,cell:f}of d)oe("rowspan",h,f,l);h6(e,c,l),da(e,this)||ha(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=>{d6(e,{first:s,last:r},a);const l=u6(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?oe("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)}}ha(e,this)||da(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}=Hd(a,t);oe("colspan",u,e,l);const d={};c>1&&(d.colspan=c),r>1&&(d.rowspan=r);const h=a>t?t-1:a-1;Oi(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:y})=>{const T=p!==e&&y===d,D=y<d&&y+_>d;return T||D});for(const{cell:p,cellWidth:_}of h)l.setAttribute("colspan",_+c,p);const f={};r>1&&(f.rowspan=r),Oi(c,l,l.createPositionAfter(e),f);const m=o.getAttribute("headingColumns")||0;m>d&&oe("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}=Hd(a,t);oe("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:y}=p,T=y>=r+h,D=_===f,k=(y+r+h)%d===0;T&&D&&k&&Oi(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 y=p+u;c.setAttribute("rowspan",y,m)}const h={};l>1&&(h.colspan=l),gr(c,o,r+1,u,1,h);const f=o.getAttribute("headingRows")||0;f>r&&oe("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 p6(t,i)==s}sortRanges(e){return Array.from(e).sort(g6)}_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 gr(n,e,t,i,s,o={}){for(let r=0;r<i;r++){const a=n.createElement("tableRow");n.insert(a,e,t),Oi(s,n,n.createPositionAt(a,"end"),o)}}function Oi(n,e,t,i={}){for(let s=0;s<n;s++)bi(e,t,i)}function Hd(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 d6(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 h6(n,{first:e,last:t},i){const s=n.getAttribute("headingRows")||0;if(e<s){const o=t<s?s-(t-e+1):e;oe("headingRows",o,n,i,0)}}function f6(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 m6(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),oe("rowspan",h,d,i),a=d}else u&&(a=c)}function g6(n,e){const t=n.start,i=e.start;return t.isBefore(i)?-1:1}function p6(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)}/**
|
|
1368
1368
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1369
1369
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1370
1370
|
*/class w6 extends V{refresh(){const e=this.editor.plugins.get(be),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(be);e.change(i=>{const s=t.getSelectedTableCells(e.document.selection),o=s.shift(),{mergeWidth:r,mergeHeight:a}=_6(o,s,t);oe("colspan",r,o,i),oe("rowspan",a,o,i);for(const c of s)b6(c,o,i);const l=o.findAncestor("table");gl(l,t),i.setSelection(o,"in")})}}function b6(n,e,t){Ud(n)||(Ud(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function Ud(n){const e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function _6(n,e,t){let i=0,s=0;for(const c of e){const{row:u,column:d}=t.getCellLocation(c);i=Wd(c,d,i,"colspan"),s=Wd(c,u,s,"rowspan")}const{row:o,column:r}=t.getCellLocation(n),a=i-r,l=s-o;return{mergeWidth:a,mergeHeight:l}}function Wd(n,e,t,i){const s=parseInt(n.getAttribute(i)||"1");return Math.max(t,e+s)}/**
|
|
@@ -1394,16 +1394,16 @@ Read more: ${B1}#error-${n}`}function F1(n,e){const t=new WeakSet,s=e?` ${JSON.s
|
|
|
1394
1394
|
*/class F6 extends A{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new ae,this.focusTracker=new ne,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(),Jn({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)}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 O(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 D6='<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>',N6='<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>',$6='<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>';/**
|
|
1395
1395
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1396
1396
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1397
|
-
*/class z6 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=fe(o);a.bind("isEnabled").to(r),a.buttonView.set({icon:
|
|
1397
|
+
*/class z6 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=fe(o);a.bind("isEnabled").to(r),a.buttonView.set({icon:R.table,label:t("Insert table"),tooltip:!0});let l;return a.on("change:isOpen",()=>{l||(l=new F6(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("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"),D6,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"),N6,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"),$6,r,o)})}_prepareDropdown(e,t,i,s){const o=this.editor,r=fe(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 ns||o.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,i,s){const o=this.editor,r=fe(s,on),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 ye;for(const r of t)H6(r,i,s,o);return mi(e,o),s}}function H6(n,e,t,i){if(n.type==="button"||n.type==="switchbutton"){const s=n.model=new gi(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)}/**
|
|
1398
1398
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1399
1399
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1400
1400
|
*/class ti extends w{static get pluginName(){return"TableSelection"}static get requires(){return[be,be]}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(be),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return i.length==0?null:i}getSelectionAsFragment(){const e=this.editor.plugins.get(be),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=Dp(c,m),d=Np(c,m)}const f=Vp(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(be),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}}}/**
|
|
1401
1401
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1402
1402
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1403
|
-
*/class U6 extends w{static get pluginName(){return"TableClipboard"}static get requires(){return[Sn,it,ti,be]}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(ti),o=this.editor.plugins.get(Sn);if(!s.getSelectedTableCells()||e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;t.preventDefault(),e.stop();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(be),r=this.editor.plugins.get(Sn),a=this.getTableIfOnlyTableInContent(t,s);if(!a)return;const l=o.getSelectionAffectedTableCells(s.document.selection);if(!l.length){gl(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(be),o={width:s.getColumns(e),height:s.getRows(e)},r=W6(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=Vp(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=j6(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:y,column:T}=_;T===s.firstColumn&&(d=_.getPositionBefore());const
|
|
1403
|
+
*/class U6 extends w{static get pluginName(){return"TableClipboard"}static get requires(){return[Sn,it,ti,be]}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(ti),o=this.editor.plugins.get(Sn);if(!s.getSelectedTableCells()||e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;t.preventDefault(),e.stop();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(be),r=this.editor.plugins.get(Sn),a=this.getTableIfOnlyTableInContent(t,s);if(!a)return;const l=o.getSelectionAffectedTableCells(s.document.selection);if(!l.length){gl(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(be),o={width:s.getColumns(e),height:s.getRows(e)},r=W6(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=Vp(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=j6(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:y,column:T}=_;T===s.firstColumn&&(d=_.getPositionBefore());const D=y-s.firstRow,k=T-s.firstColumn,M=l[D%a][k%r],C=M?o.cloneElement(M):null,P=this._replaceTableSlotCell(_,C,d,o);P&&(Fp(P,y,T,s.lastRow,s.lastColumn,o),u.push(P),d=o.createPositionAfter(P))}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},y=ma(i,h,_,o,s.firstRow);u.push(...y)}if(p){const _={first:s.firstRow,last:s.lastRow},y=ga(i,f,_,o);u.push(...y)}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 W6(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,q6(s,a.lastRow+1,a.lastColumn+1,i)),l||!i.isSelectionRectangular(n)?G6(s,a,t):(a.lastRow=Dp(s,a),a.lastColumn=Np(s,a)),a}function q6(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 j6(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 G6(n,e,t){const{firstRow:i,lastRow:s,firstColumn:o,lastColumn:r}=e,a={first:i,last:s},l={first:o,last:r};ga(n,o,a,t),ga(n,r+1,a,t),ma(n,i,l,t),ma(n,s+1,l,t,i)}function ma(n,e,t,i,s=0){return e<1?void 0:Mp(n,e,s).filter(({column:a,cellWidth:l})=>zp(a,l,t)).map(({cell:a})=>Lp(a,e,i))}function ga(n,e,t,i){return e<1?void 0:Op(n,e).filter(({row:r,cellHeight:a})=>zp(r,a,t)).map(({cell:r,column:a})=>Bp(r,a,e,i))}function zp(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}/**
|
|
1404
1404
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1405
1405
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1406
|
-
*/class K6 extends w{static get pluginName(){return"TableKeyboard"}static get requires(){return[ti,be]}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(be),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(y=>{y.setSelection(y.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(y=>{y.setSelection(y.createRangeOn(u))});return}let _;if(a&&m)_=u.getChild(d+1).getChild(0);else if(!a&&f){const y=u.getChild(d-1);_=y.getChild(y.childCount-1)}else _=c.getChild(h+(a?1:-1));i.model.change(y=>{y.setSelection(y.createRangeIn(_))})}_onArrowKey(e,t){const i=this.editor,s=t.keyCode,o=Ha(s,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.plugins.get(be),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:T})=>T==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(T=>{T.setSelection(T.createRangeOn(o))});return}d<0?(d=i?0:l,u--):d>l&&(d=i?l:0,u++);const p=r.find(T=>T.row==u&&T.column==d).cell,_=["right","down"].includes(t),y=this.editor.plugins.get("TableSelection");if(i&&y.isEnabled){const T=y.getAnchorCell()||e;y.setCellSelection(T,p)}else{const T=s.createPositionAt(p,_?0:"end");s.change(
|
|
1406
|
+
*/class K6 extends w{static get pluginName(){return"TableKeyboard"}static get requires(){return[ti,be]}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(be),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(y=>{y.setSelection(y.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(y=>{y.setSelection(y.createRangeOn(u))});return}let _;if(a&&m)_=u.getChild(d+1).getChild(0);else if(!a&&f){const y=u.getChild(d-1);_=y.getChild(y.childCount-1)}else _=c.getChild(h+(a?1:-1));i.model.change(y=>{y.setSelection(y.createRangeIn(_))})}_onArrowKey(e,t){const i=this.editor,s=t.keyCode,o=Ha(s,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.plugins.get(be),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:T})=>T==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(T=>{T.setSelection(T.createRangeOn(o))});return}d<0?(d=i?0:l,u--):d>l&&(d=i?l:0,u++);const p=r.find(T=>T.row==u&&T.column==d).cell,_=["right","down"].includes(t),y=this.editor.plugins.get("TableSelection");if(i&&y.isEnabled){const T=y.getAnchorCell()||e;y.setCellSelection(T,p)}else{const T=s.createPositionAt(p,_?0:"end");s.change(D=>{D.setSelection(T)})}}}/**
|
|
1407
1407
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1408
1408
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1409
1409
|
*/class Z6 extends Ft{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
@@ -1432,7 +1432,7 @@ $&
|
|
|
1432
1432
|
`)}function iR(n,e){return e.some(t=>!(t.isVoid||!new RegExp(`<${t.name}( .*?)?>`).test(n)))}function nR(n,e){return e.some(t=>new RegExp(`</${t.name}>`).test(n))}function pr(n,e,t=" "){return`${t.repeat(Math.max(0,e))}${n}`}function sR(n,e){return new RegExp("<pre( .*?)?>").test(n)?"first":new RegExp("</pre>").test(n)?"last":e==="first"||e==="middle"?"middle":!1}const oR='<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>';/**
|
|
1433
1433
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1434
1434
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1435
|
-
*/const Gd="SourceEditingMode";class rR extends w{static get pluginName(){return"SourceEditing"}static get requires(){return[Qs]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new Vf,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();const e=this.editor,t=e.t;e.ui.componentFactory.add("sourceEditing",i=>{const s=new O(i);return s.set({label:t("Source"),icon:oR,tooltip:!0,withText:!0,class:"ck-source-editing-button"}),s.bind("isOn").to(this,"isSourceEditingMode"),s.bind("isEnabled").to(this,"isEnabled",e,"isReadOnly",e.plugins.get(Qs),"hasAny",(o,r,a)=>!(!o||r||a)),this.listenTo(s,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),s}),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=aR(e.data.get({rootName:s})),a=
|
|
1435
|
+
*/const Gd="SourceEditingMode";class rR extends w{static get pluginName(){return"SourceEditing"}static get requires(){return[Qs]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new Vf,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();const e=this.editor,t=e.t;e.ui.componentFactory.add("sourceEditing",i=>{const s=new O(i);return s.set({label:t("Source"),icon:oR,tooltip:!0,withText:!0,class:"ck-source-editing-button"}),s.bind("isOn").to(this,"isSourceEditingMode"),s.bind("isEnabled").to(this,"isEnabled",e,"isReadOnly",e.plugins.get(Qs),"hasAny",(o,r,a)=>!(!o||r||a)),this.listenTo(s,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),s}),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=aR(e.data.get({rootName:s})),a=Ve(o.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),l=Ve(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(Gd)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(Gd)}_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()}}}function aR(n){return lR(n)?tR(n):n}function lR(n){return n.startsWith("<")}/**
|
|
1436
1436
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1437
1437
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1438
1438
|
*/function li(n,e,t,i){e&&cR(n,e,i),t&<(n,t,i)}function lt(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 cR(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 uR(n,e){const t=xt(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 Si(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 dR(n){return C2(n).replace(/ /g,"")}function We(n){return`html${dR(n)}Attributes`}/**
|
|
@@ -1447,13 +1447,13 @@ $&
|
|
|
1447
1447
|
*/class Ki extends w{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const e of Zd.block)this.registerBlockElement(e);for(const e of Zd.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&&gR(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 H(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]=h2({},s,e,(o,r)=>Array.isArray(o)?o.concat(r):void 0)}}function gR(n,e){return typeof n=="string"?n===e:n instanceof RegExp?n.test(e):!1}/**
|
|
1448
1448
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1449
1449
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1450
|
-
*/class ce extends w{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new ri,this._disallowedAttributes=new ri,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[Ki,pi]}loadAllowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=Yd(t);this.allowElement(i),s.forEach(o=>this.allowAttributes(o))}}loadDisallowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=Yd(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 Jd(e,this._disallowedAttributes,i),pR(e,Jd(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:
|
|
1450
|
+
*/class ce extends w{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new ri,this._disallowedAttributes=new ri,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[Ki,pi]}loadAllowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=Yd(t);this.allowElement(i),s.forEach(o=>this.allowAttributes(o))}}loadDisallowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=Yd(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 Jd(e,this._disallowedAttributes,i),pR(e,Jd(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:Fe.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:Fe.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:[We(o),"htmlContent"]}),t.data.registerRawContentMatcher({name:o}),s.for("upcast").elementToElement({view:o,model:pl(e),converterPriority:Fe.low+2}),s.for("upcast").add(Kn(e,this)),s.for("editingDowncast").elementToStructure({model:{name:r,attributes:[We(o)]},view:hR(t,e)}),s.for("dataDowncast").elementToElement({model:r,view:(a,{writer:l})=>Vo(o,a,l)}),s.for("dataDowncast").add(Zn(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:Fe.low+2}),s.for("downcast").elementToElement({model:r,view:o})}o&&(i.extend(e.model,{allowAttributes:We(o)}),s.for("upcast").add(Kn(e,this)),s.for("downcast").add(Zn(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(fR(e,this)),s.for("downcast").attributeToElement({model:o,view:mR(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:Kd(e,!0)}),s.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:Kd(e)})))}}function Jd(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 pR(n,{attributes:e,classes:t,styles:i}){return!e.length&&!t.length&&!i.length?null:{...e.length&&{attributes:wR(n,e)},...i.length&&{styles:bR(n,i)},...t.length&&{classes:t}}}function wR(n,e){const t={};for(const i of e){const s=n.getAttribute(i);s!==void 0&&$f(i)&&(t[i]=s)}return t}function bR(n,e){const t=new Zs(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 wr(n,e){const{name:t}=n,i=n[e];return Se(i)?Object.entries(i).map(([s,o])=>({name:t,[e]:{[s]:o}})):Array.isArray(i)?i.map(s=>({name:t,[e]:[s]})):[n]}function Yd(n){const{name:e,attributes:t,classes:i,styles:s}=n,o=[];return t&&o.push(...wr({name:e,attributes:t},"attributes")),i&&o.push(...wr({name:e,classes:i},"classes")),s&&o.push(...wr({name:e,styles:s},"styles")),o}/**
|
|
1451
1451
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1452
1452
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1453
1453
|
*/class _R extends w{static get requires(){return[ce]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(ce);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(vR(e)),r.for("downcast").add(yR()),t.stop()})}}function vR(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 yR(){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;li(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);li(i.writer,s,o,r)})}}/**
|
|
1454
1454
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1455
1455
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1456
|
-
*/class kR extends w{static get requires(){return[ce]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(ce).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:
|
|
1456
|
+
*/class kR extends w{static get requires(){return[ce]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(ce).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:Fe.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(ce);t.model.schema.extend(e.model,{allowAttributes:We(e.view)}),i.for("upcast").add(Kn(e,s)),i.for("downcast").add(Zn(e))}}/**
|
|
1457
1457
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1458
1458
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1459
1459
|
*/class CR extends w{static get requires(){return[Ki,ls]}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(Ki),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}})}}/**
|
|
@@ -1489,34 +1489,34 @@ $&
|
|
|
1489
1489
|
*/class Mo extends V{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)})}}/**
|
|
1490
1490
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1491
1491
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1492
|
-
*/const
|
|
1492
|
+
*/const Me="fontSize",Le="fontFamily",rt="fontColor",bt="fontBackgroundColor";function Up(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 Wp(n){return e=>jR(e.getStyle(n))}function qp(n){return(e,{writer:t})=>t.createAttributeElement("span",{style:`${n}:${e}`},{priority:7})}function qR({dropdownView:n,colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a}){const l=n.locale,c=new lx(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 jR(n){return n.replace(/\s/g,"")}/**
|
|
1493
1493
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1494
1494
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1495
|
-
*/class GR extends Mo{constructor(e){super(e,
|
|
1495
|
+
*/class GR extends Mo{constructor(e){super(e,Le)}}/**
|
|
1496
1496
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1497
1497
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1498
1498
|
*/function jp(n){return n.map(KR).filter(e=>e!==void 0)}function KR(n){if(typeof n=="object")return n;if(n==="default")return{title:"Default",model:void 0};if(typeof n=="string")return ZR(n)}function ZR(n){const e=n.replace(/"|'/g,"").split(","),t=e[0],i=e.map(JR).join(", ");return{title:t,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}function JR(n){return n=n.trim(),n.indexOf(" ")>0&&(n=`'${n}'`),n}/**
|
|
1499
1499
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1500
1500
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1501
|
-
*/class YR extends w{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(
|
|
1501
|
+
*/class YR extends w{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(Le,{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:Le}),e.model.schema.setAttributeProperties(Le,{isFormatting:!0,copyOnEnter:!0});const t=jp(e.config.get("fontFamily.options")).filter(s=>s.model),i=Up(Le,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(Le,new GR(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:Le,view:(t,{writer:i})=>i.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:Le,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:Le,value:t=>t.getAttribute("face")}})}}const QR='<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>';/**
|
|
1502
1502
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1503
1503
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1504
|
-
*/class XR extends w{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(
|
|
1504
|
+
*/class XR extends w{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(Le),o=t("Font Family");e.ui.componentFactory.add(Le,r=>{const a=fe(r);return mi(a,()=>e8(i,s),{role:"menu",ariaLabel:o}),a.buttonView.set({label:o,icon:QR,tooltip:!0}),a.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),a.bind("isEnabled").to(s),this.listenTo(a,"execute",l=>{e.execute(l.source.commandName,{value:l.source.commandParam}),e.editing.view.focus()}),a})}_getLocalizedOptions(){const e=this.editor,t=e.t;return jp(e.config.get(Le).options).map(s=>(s.title==="Default"&&(s.title=t("Default")),s))}}function e8(n,e){const t=new ye;for(const i of n){const s={type:"button",model:new gi({commandName:Le,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}/**
|
|
1505
1505
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1506
1506
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1507
1507
|
*/class t8 extends w{static get requires(){return[YR,XR]}static get pluginName(){return"FontFamily"}}/**
|
|
1508
1508
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1509
1509
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1510
|
-
*/class i8 extends Mo{constructor(e){super(e,
|
|
1510
|
+
*/class i8 extends Mo{constructor(e){super(e,Me)}}/**
|
|
1511
1511
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1512
1512
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1513
1513
|
*/function wl(n){return n.map(e=>n8(e)).filter(e=>e!==void 0)}const Xd={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 n8(n){if(typeof n=="number"&&(n=String(n)),typeof n=="object"&&r8(n))return pa(n);const e=o8(n);if(e)return pa(e);if(n==="default")return{model:void 0,title:"Default"};if(!a8(n))return s8(n)}function s8(n){return typeof n=="string"&&(n={title:n,model:`${parseFloat(n)}px`}),n.view={name:"span",styles:{"font-size":n.model}},pa(n)}function pa(n){return n.view&&typeof n.view!="string"&&!n.view.priority&&(n.view.priority=7),n}function o8(n){return typeof n=="string"?Xd[n]:Xd[n.model]}function r8(n){return n.title&&n.model&&n.view}function a8(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)}/**
|
|
1514
1514
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1515
1515
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1516
|
-
*/const eh=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class l8 extends w{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(
|
|
1516
|
+
*/const eh=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class l8 extends w{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(Me,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Me}),e.model.schema.setAttributeProperties(Me,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=wl(this.editor.config.get("fontSize.options")).filter(o=>o.model),s=Up(Me,i);t?(this._prepareAnyValueConverters(s),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(s),e.commands.add(Me,new i8(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter(s=>!XE(String(s))&&!tT(String(s)));if(i.length)throw new g("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:Me,view:(s,{writer:o})=>{if(s)return o.createAttributeElement("span",{style:"font-size:"+s},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:Me,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:Me,value:t=>{const i=t.getAttribute("size"),s=i[0]==="-"||i[0]==="+";let o=parseInt(i,10);s&&(o=3+o);const r=eh.length-1,a=Math.min(Math.max(o,0),r);return eh[a]}}})}}const c8='<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>';/**
|
|
1517
1517
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1518
1518
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1519
|
-
*/class u8 extends w{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(
|
|
1519
|
+
*/class u8 extends w{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(Me),o=t("Font Size");e.ui.componentFactory.add(Me,r=>{const a=fe(r);return mi(a,()=>d8(i,s),{role:"menu",ariaLabel:o}),a.buttonView.set({label:o,icon:c8,tooltip:!0}),a.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),a.bind("isEnabled").to(s),this.listenTo(a,"execute",l=>{e.execute(l.source.commandName,{value:l.source.commandParam}),e.editing.view.focus()}),a})}_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 wl(e.config.get(Me).options).map(o=>{const r=i[o.title];return r&&r!=o.title&&(o=Object.assign({},o,{title:r})),o})}}function d8(n,e){const t=new ye;for(const i of n){const s={type:"button",model:new gi({commandName:Me,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}/**
|
|
1520
1520
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1521
1521
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1522
1522
|
*/class h8 extends w{static get requires(){return[l8,u8]}static get pluginName(){return"FontSize"}normalizeSizeOptions(e){return wl(e)}}/**
|
|
@@ -1564,7 +1564,7 @@ $&
|
|
|
1564
1564
|
*/class A8 extends A{constructor(e,t){super(e);const i=e.t;this.focusTracker=new ne,this.keystrokes=new ae,this.children=this.createCollection(),this.blockStylesGroupView=new th(e,i("Block styles"),t.block),this.inlineStylesGroupView=new th(e,i("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new Ae,this._focusCycler=new Ee({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()}}/**
|
|
1565
1565
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1566
1566
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1567
|
-
*/const S8=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class Tt 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:I8(i)?i:"div",attributes:{class:s},children:t}}hasAllClasses(e,t){return
|
|
1567
|
+
*/const S8=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class Tt 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:I8(i)?i:"div",attributes:{class:s},children:t}}hasAllClasses(e,t){return ee(e)&&x8(e)&&t.every(i=>e.classes.includes(i))}configureGHSDataFilter({block:e,inline:t}){const i=this.editor.plugins.get("DataFilter");i.loadAllowedConfig(e.map(ih)),i.loadAllowedConfig(t.map(ih))}_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 x8(n){return!!n.classes&&Array.isArray(n.classes)}function I8(n){return!S8.includes(n)}function ih({element:n,classes:e}){return{name:n,classes:e}}/**
|
|
1568
1568
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1569
1569
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1570
1570
|
*/class P8 extends w{static get pluginName(){return"StyleUI"}static get requires(){return[Tt]}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=fe(r),c=e.commands.get("style");return l.once("change:isOpen",()=>{const u=new A8(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})}}/**
|
|
@@ -1609,7 +1609,7 @@ $&
|
|
|
1609
1609
|
*/const Zp="paragraph";class Y8 extends w{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[Mg]}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=bl(e);e.commands.add("codeBlock",new H8(e)),e.commands.add("indentCodeBlock",new W8(e)),e.commands.add("outdentCodeBlock",new q8(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",rh(i,r,!0)),e.data.downcastDispatcher.on("insert:codeBlock",rh(i,r)),e.data.downcastDispatcher.on("insert:softBreak",G8(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",K8(s,r)),e.data.upcastDispatcher.on("text",Z8()),e.data.upcastDispatcher.on("element:pre",J8(),{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 tn(e.editing.view.document);l.content=z8(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")&&(!X8(e,r.isSoft)&&!eV(e,r.isSoft)&&Q8(e),r.preventDefault(),o.stop())},{context:"pre"})}}function Q8(n){const t=n.model.document,i=t.selection.getLastPosition(),s=i.nodeBefore||i.textNode;let o;s&&s.is("$text")&&(o=_l(s)),n.model.change(r=>{n.execute("shiftEnter"),o&&r.insertText(o,t.selection.anchor)})}function X8(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||!Gt(r)?!1:(n.model.change(a=>{n.execute("enter");const l=i.selection.anchor.parent.previousSibling;a.rename(l,Zp),a.setSelection(l,"in"),n.model.schema.removeDisallowedAttributes([l],a),a.remove(r)}),s.scrollToTheSelection(),!0)}function eV(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(Gt(r)&&Gt(r.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling),t.createPositionAfter(r));else if(_r(r)&&Gt(r.previousSibling)&&Gt(r.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling),t.createPositionAfter(r));else if(_r(r)&&Gt(r.previousSibling)&&_r(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&Gt(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,Zp),n.model.schema.removeDisallowedAttributes([c],l)}),s.scrollToTheSelection(),!0}function _r(n){return n&&n.is("$text")&&!n.data.match(/\S/)}function Gt(n){return n&&n.is("element","softBreak")}/**
|
|
1610
1610
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1611
1611
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1612
|
-
*/class tV extends w{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,s=bl(e);i.add("codeBlock",o=>{const r=e.commands.get("codeBlock"),a=fe(o,on),l=a.buttonView,c=t("Insert code block");return l.set({label:c,tooltip:!0,icon:
|
|
1612
|
+
*/class tV extends w{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,s=bl(e);i.add("codeBlock",o=>{const r=e.commands.get("codeBlock"),a=fe(o,on),l=a.buttonView,c=t("Insert code block");return l.set({label:c,tooltip:!0,icon:R.codeBlock,isToggleable:!0}),l.bind("isOn").to(r,"value",u=>!!u),l.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),a.on("execute",u=>{e.execute("codeBlock",{language:u.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),a.class="ck-code-block-dropdown",a.bind("isEnabled").to(r),mi(a,()=>this._getLanguageListItemDefinitions(s),{role:"menu",ariaLabel:c}),a})}_getLanguageListItemDefinitions(e){const i=this.editor.commands.get("codeBlock"),s=new ye;for(const o of e){const r={type:"button",model:new gi({_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}}/**
|
|
1613
1613
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1614
1614
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1615
1615
|
*/class iV extends w{static get requires(){return[Y8,tV]}static get pluginName(){return"CodeBlock"}}/**
|
|
@@ -1621,7 +1621,7 @@ $&
|
|
|
1621
1621
|
*/class rV 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),aV(l,r,a)}}),s.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new nV(e))}}function aV(n,e,t){return e.setCustomProperty("horizontalLine",!0,n),rn(n,e,{label:t})}/**
|
|
1622
1622
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1623
1623
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1624
|
-
*/class lV extends w{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("horizontalLine",i=>{const s=e.commands.get("horizontalLine"),o=new O(i);return o.set({label:t("Horizontal line"),icon:
|
|
1624
|
+
*/class lV extends w{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("horizontalLine",i=>{const s=e.commands.get("horizontalLine"),o=new O(i);return o.set({label:t("Horizontal line"),icon:R.horizontalLine,tooltip:!0}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),o})}}/**
|
|
1625
1625
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1626
1626
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1627
1627
|
*/class cV extends w{static get requires(){return[rV,lV,pi]}static get pluginName(){return"HorizontalLine"}}const uV='<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>';/**
|
|
@@ -1687,10 +1687,10 @@ $&
|
|
|
1687
1687
|
*/class ho 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 LV(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 IV(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),s.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url");return lh(c,a,u,{elementName:r,renderMediaPreview:!!u&&o})}}),s.for("dataDowncast").add(ah(a,{elementName:r,renderMediaPreview:o})),s.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url"),d=lh(c,a,u,{elementName:r,renderForEditingView:!0});return xV(d,c,i("media widget"))}}),s.for("editingDowncast").add(ah(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)})}}/**
|
|
1688
1688
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1689
1689
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1690
|
-
*/const OV=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class BV extends w{static get requires(){return[zg,Et,Ug]}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=we.fromPosition(o.start);r.stickiness="toPrevious";const a=we.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(ho).registry,o=new
|
|
1690
|
+
*/const OV=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class BV extends w{static get requires(){return[zg,Et,Ug]}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=we.fromPosition(o.start);r.stickiness="toPrevious";const a=we.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(ho).registry,o=new De(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(OV)){o.detach();return}if(!s.hasMedia(a)){o.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=we.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),Jp(i.model,a,u,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(Et).requestUndoOnBackspace()},100)}}/**
|
|
1691
1691
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1692
1692
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1693
|
-
*/class FV extends A{constructor(e,t){super(t);const i=t.t;this.focusTracker=new ne,this.keystrokes=new ae,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),
|
|
1693
|
+
*/class FV extends A{constructor(e,t){super(t);const i=t.t;this.focusTracker=new ne,this.keystrokes=new ae,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),R.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",s=>!!s),this.cancelButtonView=this._createButton(i("Cancel"),R.cancel,"ck-button-cancel","cancel"),this._focusables=new Ae,this._focusCycler=new Ee({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(),mo({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 sn(this.locale,os),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 O(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 DV='<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>';/**
|
|
1694
1694
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1695
1695
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1696
1696
|
*/class NV extends w{static get requires(){return[ho]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",i=>{const s=fe(i);return this._setUpDropdown(s,t),s})}_setUpDropdown(e,t){const i=this.editor,s=i.t,o=e.buttonView,r=i.plugins.get(ho).registry;e.once("change:isOpen",()=>{const a=new(Ea(FV))($V(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:DV,tooltip:!0})}}function $V(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.")}]}/**
|
|
@@ -1702,4 +1702,4 @@ $&
|
|
|
1702
1702
|
*/const dh="ckCsrfToken",hh=40,fh="abcdefghijklmnopqrstuvwxyz0123456789";function HV(){let n=UV(dh);return(!n||n.length!=hh)&&(n=qV(hh),WV(dh,n)),n}function UV(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 WV(n,e){document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(e)+";path=/"}function qV(n){let e="";const t=new Uint8Array(n);window.crypto.getRandomValues(t);for(let i=0;i<t.length;i++){const s=fh.charAt(t[i]%fh.length);e+=Math.random()>.5?s.toUpperCase():s}return e}/**
|
|
1703
1703
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1704
1704
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1705
|
-
*/class jV extends w{static get requires(){return[ei]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(ei).createUploadAdapter=t=>new GV(t,e,this.editor.t))}}class GV{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",HV()),this.xhr.send(t)}}class _a extends Io{}me(_a,"builtinPlugins",[rP,oI,gI,WI,bI,X3,TP,IP,t4,f4,m4,JP,b4,v4,SI,J4,_p,_7,N7,cs,Y6,eR,rR,UR,C8,RI,OI,CI,$8,iV,cV,mV,yV,SV,zV,jV]),me(_a,"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 KV{constructor(e,t,i){me(this,"loader");me(this,"xhr");me(this,"insertImageServiceUrl");me(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 ZV(n){let e;return{c(){e=ka("div")},m(t,i){ya(t,e,i),n[14](e)},p:Jt,i:Jt,o:Jt,d(t){t&&fo(e),n[14](null)}}}function JV(n){const e=n.editing.view.domConverter.unsafeElements,t=e.indexOf("style");t>-1&&e.splice(t,1)}function YV(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 QV(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=(k,M)=>{}}=e,{stateChange:d=(k,M)=>{}}=e;const h=()=>f;let f=null,m=null;function p(k){k.plugins.get("FileRepository").createUploadAdapter=M=>new KV(M,i,s)}const _=k=>{f!=null&&(f.focus(),f.model.change(M=>{if(f==null)return;let D=f.model.document.getRoot();if(D==null)return;const E=YV(k,M,D);if(E!=null){M.setSelection(M.createPositionBefore(E)),M.remove(E);const R=E.data.split(k);M.insertText(R[0],f.model.document.selection.getFirstPosition()??void 0);const I=f.model.document.selection.getFirstPosition();M.insertText(R[1],f.model.document.selection.getFirstPosition()??void 0),M.setSelection(I)}}))},y=k=>{f!=null&&(f.focus(),f.model.change(M=>{if(f==null)return;let D=JSON.parse(k);if(D.root==null||D.path==null||D.stickiness==null)return;let E=f.model.document.getRoot(D.root);E!=null&&M.setSelection(M.createPositionFromPath(E,D.path,D.stickiness))}))};_a.create(a,{placeholder:l,toolbar:o,extraPlugins:[p,JV],htmlSupport:{allow:r?[{name:/.*/,attributes:!0,classes:!0,styles:!0}]:[{name:"a",attributes:["href","target"],classes:!0,styles:!0},{name:/^(b|i|br|center|hr|nav|s|strong|style|u)$/},{name:/^(div|p|span)$/,classes:!0,styles:!0},{name:/^(figure|figcaption)$/,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(k=>{t(13,f=k),m!=null&&k.ui.view.element!=null&&m.appendChild(k.ui.view.element),k.model.document.on("change:data",(M,D)=>{t(1,a=k.getData()),u(M,D)}),k.on("change:state",(M,D,E,R)=>{d(M,E)}),d(null,"ready")}).catch(k=>{console.error(k.stack)});function T(k){Ns[k?"unshift":"push"](()=>{m=k,t(0,m)})}return n.$$set=k=>{"insertImageServiceUrl"in k&&t(2,i=k.insertImageServiceUrl),"getImageServiceUrl"in k&&t(3,s=k.getImageServiceUrl),"items"in k&&t(4,o=k.items),"allowHtmlSupport"in k&&t(5,r=k.allowHtmlSupport),"value"in k&&t(1,a=k.value),"placeHolder"in k&&t(6,l=k.placeHolder),"lang"in k&&t(7,c=k.lang),"valueChange"in k&&t(8,u=k.valueChange),"stateChange"in k&&t(9,d=k.stateChange)},n.$$.update=()=>{if(n.$$.dirty&8256){let k;f!=null&&(k=f.editing.view.document.getRoot("main"))!=null&&k.placeholder!=l&&(k.placeholder=l)}},[m,a,i,s,o,r,l,c,u,d,h,_,y,f,T]}class Yp extends Eh{constructor(e){super(),yh(this,e,QV,ZV,gh,{insertImageServiceUrl:2,getImageServiceUrl:3,items:4,allowHtmlSupport:5,value:1,placeHolder:6,lang:7,valueChange:8,stateChange:9,getEditor:10,setCursorPositionAtPlaceholder:11,setCursorPositionFromJSONString:12})}get insertImageServiceUrl(){return this.$$.ctx[2]}set insertImageServiceUrl(e){this.$$set({insertImageServiceUrl:e}),Ue()}get getImageServiceUrl(){return this.$$.ctx[3]}set getImageServiceUrl(e){this.$$set({getImageServiceUrl:e}),Ue()}get items(){return this.$$.ctx[4]}set items(e){this.$$set({items:e}),Ue()}get allowHtmlSupport(){return this.$$.ctx[5]}set allowHtmlSupport(e){this.$$set({allowHtmlSupport:e}),Ue()}get value(){return this.$$.ctx[1]}set value(e){this.$$set({value:e}),Ue()}get placeHolder(){return this.$$.ctx[6]}set placeHolder(e){this.$$set({placeHolder:e}),Ue()}get lang(){return this.$$.ctx[7]}set lang(e){this.$$set({lang:e}),Ue()}get valueChange(){return this.$$.ctx[8]}set valueChange(e){this.$$set({valueChange:e}),Ue()}get stateChange(){return this.$$.ctx[9]}set stateChange(e){this.$$set({stateChange:e}),Ue()}get getEditor(){return this.$$.ctx[10]}get setCursorPositionAtPlaceholder(){return this.$$.ctx[11]}get setCursorPositionFromJSONString(){return this.$$.ctx[12]}}customElements.define("ckeditor5-classic",Ch(Yp,{insertImageServiceUrl:{},getImageServiceUrl:{},items:{},allowHtmlSupport:{type:"Boolean"},value:{},placeHolder:{},lang:{},valueChange:{},stateChange:{}},[],["getEditor","setCursorPositionAtPlaceholder","setCursorPositionFromJSONString"],!1));exports.CKEditor5Classic_1=Yp;exports.SvelteComponent=Eh;exports.add_flush_callback=g1;exports.append=i1;exports.attr=wh;exports.bind=y1;exports.binding_callbacks=Ns;exports.check_outros=_1;exports.createEventDispatcher=h1;exports.create_component=k1;exports.create_custom_element=Ch;exports.destroy_component=vh;exports.destroy_each=n1;exports.detach=fo;exports.element=ka;exports.flush=Ue;exports.group_outros=b1;exports.init=yh;exports.insert=ya;exports.is_function=va;exports.listen=o1;exports.mount_component=_h;exports.noop=Jt;exports.run_all=Zi;exports.safe_not_equal=gh;exports.set_data=a1;exports.set_input_value=l1;exports.space=s1;exports.text=ph;exports.transition_in=bh;exports.transition_out=v1;
|
|
1705
|
+
*/class jV extends w{static get requires(){return[ei]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(ei).createUploadAdapter=t=>new GV(t,e,this.editor.t))}}class GV{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",HV()),this.xhr.send(t)}}class _a extends Io{}me(_a,"builtinPlugins",[rP,oI,gI,WI,bI,X3,TP,IP,t4,f4,m4,JP,b4,v4,SI,J4,_p,_7,N7,cs,Y6,eR,rR,UR,C8,RI,OI,CI,$8,iV,cV,mV,yV,SV,zV,jV]),me(_a,"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 KV{constructor(e,t,i){me(this,"loader");me(this,"xhr");me(this,"insertImageServiceUrl");me(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 ZV(n){let e;return{c(){e=ka("div")},m(t,i){ya(t,e,i),n[15](e)},p:Jt,i:Jt,o:Jt,d(t){t&&fo(e),n[15](null)}}}function JV(n){const e=n.editing.view.domConverter.unsafeElements,t=e.indexOf("style");t>-1&&e.splice(t,1)}function YV(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 QV(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=(k,M)=>{}}=e,{stateChange:d=(k,M)=>{}}=e,{sourceEditingModeChange:h=(k,M)=>{}}=e;const f=()=>m;let m=null,p=null;function _(k){k.plugins.get("FileRepository").createUploadAdapter=M=>new KV(M,i,s)}const y=k=>{m!=null&&(m.focus(),m.model.change(M=>{if(m==null)return;let C=m.model.document.getRoot();if(C==null)return;const P=YV(k,M,C);if(P!=null){M.setSelection(M.createPositionBefore(P)),M.remove(P);const x=P.data.split(k);M.insertText(x[0],m.model.document.selection.getFirstPosition()??void 0);const Y=m.model.document.selection.getFirstPosition();M.insertText(x[1],m.model.document.selection.getFirstPosition()??void 0),M.setSelection(Y)}}))},T=k=>{m!=null&&(m.focus(),m.model.change(M=>{if(m==null)return;let C=JSON.parse(k);if(C.root==null||C.path==null||C.stickiness==null)return;let P=m.model.document.getRoot(C.root);P!=null&&M.setSelection(M.createPositionFromPath(P,C.path,C.stickiness))}))};_a.create(a,{placeholder:l,toolbar:o,extraPlugins:[_,JV],htmlSupport:{allow:r?[{name:/.*/,attributes:!0,classes:!0,styles:!0}]:[{name:"a",attributes:["href","target"],classes:!0,styles:!0},{name:/^(b|i|br|center|hr|nav|s|strong|style|u)$/},{name:/^(div|p|span)$/,classes:!0,styles:!0},{name:/^(figure|figcaption)$/,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(k=>{t(14,m=k),p!=null&&k.ui.view.element!=null&&p.appendChild(k.ui.view.element),k.model.document.on("change:data",(M,C)=>{t(1,a=k.getData()),u(M,C)}),k.on("change:state",(M,C,P,x)=>{d(M,P)}),k.plugins.has("SourceEditing")&&k.plugins.get("SourceEditing").isEnabled&&k.plugins.get("SourceEditing").on("change:isSourceEditingMode",(M,C,P,x)=>{h(M,P)}),d(null,"ready")}).catch(k=>{console.error(k.stack)});function D(k){Ns[k?"unshift":"push"](()=>{p=k,t(0,p)})}return n.$$set=k=>{"insertImageServiceUrl"in k&&t(2,i=k.insertImageServiceUrl),"getImageServiceUrl"in k&&t(3,s=k.getImageServiceUrl),"items"in k&&t(4,o=k.items),"allowHtmlSupport"in k&&t(5,r=k.allowHtmlSupport),"value"in k&&t(1,a=k.value),"placeHolder"in k&&t(6,l=k.placeHolder),"lang"in k&&t(7,c=k.lang),"valueChange"in k&&t(8,u=k.valueChange),"stateChange"in k&&t(9,d=k.stateChange),"sourceEditingModeChange"in k&&t(10,h=k.sourceEditingModeChange)},n.$$.update=()=>{if(n.$$.dirty&16448){let k;m!=null&&(k=m.editing.view.document.getRoot("main"))!=null&&k.placeholder!=l&&(k.placeholder=l)}},[p,a,i,s,o,r,l,c,u,d,h,f,y,T,m,D]}class Yp extends Eh{constructor(e){super(),yh(this,e,QV,ZV,gh,{insertImageServiceUrl:2,getImageServiceUrl:3,items:4,allowHtmlSupport:5,value:1,placeHolder:6,lang:7,valueChange:8,stateChange:9,sourceEditingModeChange:10,getEditor:11,setCursorPositionAtPlaceholder:12,setCursorPositionFromJSONString:13})}get insertImageServiceUrl(){return this.$$.ctx[2]}set insertImageServiceUrl(e){this.$$set({insertImageServiceUrl:e}),Re()}get getImageServiceUrl(){return this.$$.ctx[3]}set getImageServiceUrl(e){this.$$set({getImageServiceUrl:e}),Re()}get items(){return this.$$.ctx[4]}set items(e){this.$$set({items:e}),Re()}get allowHtmlSupport(){return this.$$.ctx[5]}set allowHtmlSupport(e){this.$$set({allowHtmlSupport:e}),Re()}get value(){return this.$$.ctx[1]}set value(e){this.$$set({value:e}),Re()}get placeHolder(){return this.$$.ctx[6]}set placeHolder(e){this.$$set({placeHolder:e}),Re()}get lang(){return this.$$.ctx[7]}set lang(e){this.$$set({lang:e}),Re()}get valueChange(){return this.$$.ctx[8]}set valueChange(e){this.$$set({valueChange:e}),Re()}get stateChange(){return this.$$.ctx[9]}set stateChange(e){this.$$set({stateChange:e}),Re()}get sourceEditingModeChange(){return this.$$.ctx[10]}set sourceEditingModeChange(e){this.$$set({sourceEditingModeChange:e}),Re()}get getEditor(){return this.$$.ctx[11]}get setCursorPositionAtPlaceholder(){return this.$$.ctx[12]}get setCursorPositionFromJSONString(){return this.$$.ctx[13]}}customElements.define("ckeditor5-classic",Ch(Yp,{insertImageServiceUrl:{},getImageServiceUrl:{},items:{},allowHtmlSupport:{type:"Boolean"},value:{},placeHolder:{},lang:{},valueChange:{},stateChange:{},sourceEditingModeChange:{}},[],["getEditor","setCursorPositionAtPlaceholder","setCursorPositionFromJSONString"],!1));exports.CKEditor5Classic_1=Yp;exports.SvelteComponent=Eh;exports.add_flush_callback=g1;exports.append=i1;exports.attr=wh;exports.bind=y1;exports.binding_callbacks=Ns;exports.check_outros=_1;exports.createEventDispatcher=h1;exports.create_component=k1;exports.create_custom_element=Ch;exports.destroy_component=vh;exports.destroy_each=n1;exports.detach=fo;exports.element=ka;exports.flush=Re;exports.group_outros=b1;exports.init=yh;exports.insert=ya;exports.is_function=va;exports.listen=o1;exports.mount_component=_h;exports.noop=Jt;exports.run_all=Zi;exports.safe_not_equal=gh;exports.set_data=a1;exports.set_input_value=l1;exports.space=s1;exports.text=ph;exports.transition_in=bh;exports.transition_out=v1;
|