PageSourceSearch

https://4juh.de/chunk-OIDNVQN3.js

js 4juh.de collected 2026-10-06 20:18:11 UTC 802,614 bytes, 84 lines download raw bytes

1import{$f as Tt,$h as wn,Ab as Og,Af as Ae,Ah as pp,Ba as Ag,Ca as Eg,Cf as gn,Ch as bp,Ec as Wr,Ef as y,Eg as mp,Ff as Oe,Gf as me,Ha as xg,Hb as Ct,Hf as rp,Hg as is,Hi as ze,If as lp,Ih as wp,Ii as ft,Ja as vt,Jb as Dg,Jc as zg,Jg as Ue,K as _g,Ka as qn,La as Gn,Ld as It,Lf as zi,Lg as ht,Me as ve,Mf as cl,Mg as X,Mi as as,Nf as Nt,Nh as Ie,Ni as zt,Oa as Kn,Ob as Ng,Oc as un,Og as ki,Oh as He,P as yt,Pg as be,Ph as _p,Q as Le,Qa as Sg,Qc as pi,Qf as x,Qg as ns,Qh as gt,Ra as Ve,Re as Fv,Rf as ap,Rg as ce,Rh as z,Sc as Go,Se as f,Sf as cp,Sg as os,Si as cs,T as S,Te as v,Tf as tt,Ti as ct,Tj as Dv,U as Q,Ue as $r,Ug as yi,Uh as kp,V as zo,W as kg,Wf as si,Xa as ne,Xe as jr,Xf as ul,Xh as it,Y as yg,Ya as O,Yh as $i,Zh as yp,Zi as yn,_a as J,_f as fn,_h as ss,_i as Ci,a as Ni,aa as an,ab as K,af as Ot,ag as At,ah as lo,ba as $o,bf as dn,bi as _n,ca as vg,cb as ni,ce as qg,cf as bi,ci as vp,cj as Cp,d as hg,da as Cg,dc as Mg,df as wi,di as rs,dj as Ip,e as gg,ef as oi,eh as De,ei as at,fb as Vg,ff as U,g as ln,ga as Te,ge as Ft,he as Gg,hf as Ke,hg as H,i as kt,ib as Pg,ii as li,j as Ho,je as Xn,jj as vn,k as fi,ka as cn,ke as Ko,kf as Jn,kg as up,ki as ls,kj as us,l as fg,la as Ig,lf as ye,lh as Mt,li as kn,m as pg,mb as Bg,mf as Zo,mh as vi,na as Rt,nc as Ug,nd as $g,nh as hp,nj as Tp,o as Ur,oc as Hg,og as dp,p as dt,pc as Wg,pd as jg,pg as es,ph as Ut,pi as Ht,pj as Ap,qf as P,qh as q,qi as We,r as Wo,rc as qo,rh as gp,s as bg,sg as pn,tb as Lg,tg as ts,u as wg,ua as ie,ub as Rg,ue as Yn,uh as ri,ui as ao,v as Me,va as jo,vb as j,ve as zr,vf as Xe,vg as bn,vh as we,vi as Wt,vj as Ov,w as W,wa as Tg,wb as Ge,we as Qn,wf as mt,wh as Ce,xa as Mi,xe as Kg,xi as dl,y as Je,yb as Fg,yf as Fe,yh as fp,zb as Hr,zf as Dt}from"./chunk-Z2NKA3OS.js";import{$ as Zr,$c as Zf,Aa as gf,Ac as no,Ba as ff,Bb as Ff,Bc as Qo,Ca as pf,Cb as Of,Cc as oo,Da as bf,E as Xr,Ea as wf,F as Yr,Fa as _f,Fb as tl,Gb as Df,Gc as qf,Hb as Nf,Hc as nl,Jb as Xo,Ka as kf,Kb as Mf,Kc as Gf,L as Yg,Lb as il,Lc as Kf,Ma as yf,Mc as ol,Na as vf,Nc as Xf,Oc as Yf,Pc as sl,Qa as Cf,Qc as Qf,R as Qg,Rc as rl,S as Qr,Sa as If,Sc as Jo,Ta as hn,Tb as Uf,Tc as Hi,Ua as Ui,Uc as so,Va as el,Vc as ro,Wa as Tf,Wc as ll,Xa as Af,Xc as Wi,Ya as Ef,Za as xf,Zc as Jf,_ as Jr,_a as Sf,ad as ep,ba as Jg,bb as Vf,bd as tp,ca as Zg,cd as ip,dd as al,fa as ef,ga as tf,gd as np,ha as nf,hd as op,ia as of,ib as Pf,ja as sf,jd as sp,ka as rf,kd as re,ma as lf,mb as xe,na as _i,nc as Zn,oa as af,oc as eo,pa as cf,pc as to,q as qr,qc as io,r as Gr,rb as Bf,s as Kr,tc as Hf,vc as Wf,w as mn,wa as uf,wc as zf,xa as df,xb as Lf,xc as $f,ya as mf,yb as Rf,yc as jf,z as Xg,za as hf,zc as Yo}from"./chunk-5QRUKV5H.js";import{a as I,b as N,g as M,h as Lt,j as mg,l as de,o as rn}from"./chunk-KXVZN7QR.js";function Nv(){let s=Mv(Ep);return(!s||s.length!=xp)&&(s=Hv(xp),Uv(Ep,s)),s}function Mv(s){s=s.toLowerCase();let e=document.cookie.split(";");for(let t of e){let i=t.split("=");if(decodeURIComponent(i[0].trim().toLowerCase())===s)return decodeURIComponent(i[1])}return null}function Uv(s,e){document.cookie=encodeURIComponent(s)+"="+encodeURIComponent(e)+";path=/"}function Hv(s){let e="",t=new Uint8Array(s);window.crypto.getRandomValues(t);for(let i=0;i<t.length;i++){let n=Sp.charAt(t[i]%Sp.length);e+=Math.random()>.5?n.toUpperCase():n}return e}var Ep,xp,Sp,Vp,ml,Pp=M(()=>{U();Jn();Ep="ckCsrfToken",xp=40,Sp="abcdefghijklmnopqrstuvwxyz0123456789";Vp=class extends f{static get requires(){return[Ke]}static get pluginName(){return"CKFinderUploadAdapter"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(Ke).createUploadAdapter=t=>new ml(t,e,this.editor.t))}},ml=class{loader;url;t;xhr;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(){let e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){let n=this.xhr,o=this.loader,r=this.t,l=r("Cannot upload file:")+` ${i.name}.`;n.addEventListener("error",()=>t(l)),n.addEventListener("abort",()=>t()),n.addEventListener("load",()=>{let a=n.response;if(!a||!a.uploaded)return t(a&&a.error&&a.error.message?a.error.message:l);e({default:a.url})});n.upload&&n.upload.addEventListener("progress",a=>{a.lengthComputable&&(o.uploadTotal=a.total,o.uploaded=a.loaded)})}_sendRequest(e){let t=new FormData;t.append("upload",e),t.append("ckCsrfToken",Nv()),this.xhr.send(t)}}});function Lp(s){return pl.includes(s)}function Rp(s,e){return e.contentLanguageDirection=="rtl"?s==="right":s==="left"}function Fp(s){let e=s.map(i=>{let n;return typeof i=="string"?n={name:i}:n=i,n}).filter(i=>{let n=pl.includes(i.name);return n||Q("alignment-config-name-not-recognized",{option:i}),n}),t=e.filter(i=>!!i.className).length;if(t&&t<e.length)throw new S("alignment-config-classnames-are-missing",{configuredOptions:s});return e.forEach((i,n,o)=>{let r=o.slice(n+1);if(r.some(a=>a.name==i.name))throw new S("alignment-config-name-already-defined",{option:i,configuredOptions:s});
1if(i.className&&r.some(c=>c.className==i.className))throw new S("alignment-config-classname-already-defined",{option:i,configuredOptions:s})}),e}function Wv(s,e){for(let t of s)e.removeAttribute(bl,t)}function zv(s,e,t){for(let i of s)e.setAttribute(bl,t,i)}function $v(s){let e={};for(let{name:i}of s)e[i]={key:"style",value:{"text-align":i}};return{model:{key:"alignment",values:s.map(i=>i.name)},view:e}}function jv(s){let e=[];for(let{name:t}of s)e.push({view:{key:"style",value:{"text-align":t}},model:{key:"alignment",value:t}});return e}function qv(s){let e=[];for(let{name:t}of s)e.push({view:{key:"align",value:t},model:{key:"alignment",value:t}});return e}function Gv(s){let e={};for(let i of s)e[i.name]={key:"class",value:i.className};return{model:{key:"alignment",values:s.map(i=>i.name)},view:e}}var pl,bl,hl,gl,co,fl,Bp,Op=M(()=>{U();j();z();re();pl=["left","right","center","justify"];bl="alignment",hl=class extends v{refresh(){let t=this.editor.locale,i=O(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!i&&this._canBeAligned(i),this.isEnabled&&i.hasAttribute("alignment")?this.value=i.getAttribute("alignment"):this.value=t.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){let t=this.editor,i=t.locale,n=t.model,o=n.document,r=e.value;n.change(l=>{let a=Array.from(o.selection.getSelectedBlocks()).filter(d=>this._canBeAligned(d)),c=a[0].getAttribute("alignment");Rp(r,i)||c===r||!r?Wv(a,l):zv(a,l,r)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,bl)}};gl=class extends f{static get pluginName(){return"AlignmentEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("alignment",{options:pl.map(t=>({name:t}))})}init(){let e=this.editor,t=e.locale,i=e.model.schema,o=Fp(e.config.get("alignment.options")).filter(c=>Lp(c.name)&&!Rp(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(Gv(o)):e.conversion.for("downcast").attributeToAttribute($v(o));let l=jv(o);for(let c of l)e.conversion.for("upcast").attributeToAttribute(c);let a=qv(o);for(let c of a)e.conversion.for("upcast").attributeToAttribute(c);e.commands.add("alignment",new hl(e))}};co=new Map([["left",to],["right",io],["center",Zn],["justify",eo]]),fl=class extends f{get localizedOptionTitles(){let 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"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=Fp(e.config.get("alignment.options"));t.map(i=>i.name).filter(Lp).forEach(i=>this._addButton(i)),this._addToolbarDropdown(t),this._addMenuBarMenu(t)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,i=>this._createButton(i,e))}_createButton(e,t,i={}){let n=this.editor,o=n.commands.get("alignment"),r=new y(e);return r.set(I({label:this.localizedOptionTitles[t],icon:co.get(t),tooltip:!0,isToggleable:!0},i)),r.bind("isEnabled").to(o),r.bind("isOn").to(o,"value",l=>l===t),this.listenTo(r,"execute",()=>{n.execute("alignment",{value:t}),n.editing.view.focus()}),r}_addToolbarDropdown(e){let t=this.editor;t.ui.componentFactory.add("alignment",n=>{let o=X(n),r=n.uiLanguageDirection==="rtl"?"w":"e",l=n.t;ki(o,()=>e.map(u=>this._createButton(n,u.name,{tooltipPosition:r})),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:l("Text alignment toolbar")}),o.buttonView.set({label:l("Text alignment"),tooltip:!0}),o.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});let a=n.contentLanguageDirection==="rtl"?co.get("right"):co.get("left"),c=t.commands.get("alignment");return o.buttonView.bind("icon").to(c,"value",u=>co.get(u)||a),o.bind("isEnabled").to(c,"isEnabled"),this.listenTo(o,"execute",()=>{t.editing.view.focus()}),o})}_addMenuBarMenu(e){let t=this.editor;t.ui.componentFactory.add("menuBar:alignment",i=>{let n=t.commands.get("alignment"),o=i.t,r=new Ie(i),l=new He(i);r.bind("isEnabled").to(n),l.set({ariaLabel:o("Text alignment"),role:"menu"}),r.buttonView.set({label:o("Text alignment")});for(let a of e){let c=new De(i,r),u=new x(i);u.delegate("execute").to(r),u.set({label:this.localizedOptionTitles[a.name],icon:co.get(a.name),role:"menuitemcheckbox",isToggleable:!0}),u.on("execute",()=>{t.execute("alignment",{value:a.name}),t.editing.view.focus()}),u.bind("isOn").to(n,"value",d=>d===a.name),u.bind("isEnabled").to(n,"isEnabled"),c.children.add(u),l.items.add(c)}return r.panelView.children.add(l),r})}},Bp=class extends f{static get requires(){return[gl,fl]}static get pluginName(){return"Alignment"}static get isOfficialPlugin(){return!0}}});function Ii(s,e,t,i){let n,o=null;typeof i=="function"?n=i:(o=s.commands.get(i),n=()=>{s.execute(i)}),s.model.document.on("change:data",(r,l)=>{if(o&&!o.isEnabled||!e.isEnabled)return;let a=O(s.model.document.selection.getRanges());if(!a.isCollapsed||l.isUndo||!l.isLocal)return;let c=Array.from(s.model.document.differ.getChanges()),u=c[0];if(c.length!=1||u.type!=="insert"||u.name!="$text"||u.length!=1)return;let d=u.position.parent;
1if(d.is("element","codeBlock")||d.is("element","listItem")&&typeof i!="function"&&!["numberedList","bulletedList","todoList"].includes(i)||o&&o.value===!0)return;let m=d.getChild(0),h=s.model.createRangeOn(m);if(!h.containsRange(a)&&!a.end.isEqual(h.end))return;let g=t.exec(m.data.substr(0,a.end.offset));g&&s.model.enqueueChange(p=>{let b=s.model.document.selection,w=p.createPositionAt(d,0),k=p.createPositionAt(d,g[0].length),T=new un(w,k);if(n({match:g})!==!1){let Z=Array.from(b.getAttributes());p.remove(T);let _e=b.getFirstRange(),ke=p.createRangeIn(d);d.isEmpty&&!ke.isEqual(_e)&&!ke.containsRange(_e,!0)&&p.remove(d),Kv(p,b,Z)}T.detach(),s.model.enqueueChange(()=>{s.plugins.get("Delete").requestUndoOnBackspace()})})})}function Kv(s,e,t){let i=s.model.schema,n=e.getFirstPosition(),o=new $g(n);i.checkChild(o,"$text")&&(o=o.push("$text"));for(let[r,l]of t)i.checkAttribute(o,r)&&s.setSelectionAttribute(r,l)}function Cn(s,e,t,i){let n,o;t instanceof RegExp?n=t:o=t,o=o||(r=>{let l,a=[],c=[];for(;(l=n.exec(r))!==null&&!(l&&l.length<4);){let{index:u,"1":d,"2":m,"3":h}=l,g=d+m+h;u+=l[0].length-g.length;let p=[u,u+d.length],b=[u+d.length+m.length,u+d.length+m.length+h.length];a.push(p),a.push(b),c.push([u+d.length,u+d.length+m.length])}return{remove:a,format:c}}),s.model.document.on("change:data",(r,l)=>{if(l.isUndo||!l.isLocal||!e.isEnabled)return;let a=s.model,c=a.document.selection;if(!c.isCollapsed)return;let u=Array.from(a.document.differ.getChanges()),d=u[0];if(u.length!=1||d.type!=="insert"||d.name!="$text"||d.length!=1)return;let m=c.focus,h=m.parent,{text:g,range:p}=Xv(a.createRange(a.createPositionAt(h,0),m),a),b=o(g),w=Dp(p.start,b.format,a),k=Dp(p.start,b.remove,a);w.length&&k.length&&a.enqueueChange(T=>{if(i(T,w)!==!1){for(let Z of k.reverse())T.remove(Z);a.enqueueChange(()=>{s.plugins.get("Delete").requestUndoOnBackspace()})}})})}function Dp(s,e,t){return e.filter(i=>i[0]!==void 0&&i[1]!==void 0).map(i=>t.createRange(s.getShiftedBy(i[0]),s.getShiftedBy(i[1])))}function Xv(s,e){let t=s.start;return{text:Array.from(s.getItems()).reduce((n,o)=>!(o.is("$text")||o.is("$textProxy"))||o.getAttribute("code")?(t=e.createPositionAfter(o),""):n+o.data,""),range:e.createRange(t,s.end)}}function ds(s,e){return(t,i)=>{if(!s.commands.get(e).isEnabled)return!1;let o=s.model.schema.getValidRanges(i,e);for(let r of o)t.setAttribute(e,!0,r);t.removeSelectionAttribute(e)}}var Np,Mp=M(()=>{U();at();ve();j();Np=class extends f{static get requires(){return[it]}static get pluginName(){return"Autoformat"}static get isOfficialPlugin(){return!0}afterInit(){let 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(){let e=this.editor.commands;e.get("bulletedList")&&Ii(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&Ii(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&Ii(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&Ii(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){let e=this.editor.commands;if(e.get("bold")){let t=ds(this.editor,"bold");Cn(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),Cn(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(e.get("italic")){let t=ds(this.editor,"italic");Cn(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),Cn(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(e.get("code")){let t=ds(this.editor,"code");Cn(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(e.get("strikethrough")){let t=ds(this.editor,"strikethrough");Cn(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){let e=this.editor.commands.get("heading");e&&e.modelElements.filter(t=>t.match(/^heading[1-6]$/)).forEach(t=>{let i=t[7],n=new RegExp(`^(#{${i}})\\s$`);Ii(this.editor,this,n,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&Ii(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){let e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&Ii(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&Ii(this.editor,this,/^---$/,"horizontalLine")}}});var Up,Hp=M(()=>{U();j();Me();Up=class extends f{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return"Autosave"}static get isOfficialPlugin(){return!0}static get requires(){return[oi]}constructor(e){super(e);let t=e.config.get("autosave")||{},i=t.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=kt(this._save.bind(this),i),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new(cn()),this._config=t,this._pendingActions=e.plugins.get(oi),this._makeImmediateSave=!1}init(){let e=this.editor,t=e.model.document;this.listenTo(e,"ready",()=>{this.listenTo(t,"change:data",(i,n)=>{this._saveCallbacks.length&&n.isLocal&&(this.state==="synchronized"&&(this.state="waiting",this._setPendingAction()),this.state==="waiting"&&this._debouncedSave())})}),this.listenTo(e,"destroy",()=>this._flush(),{priority:"highest"});this._domEmitter.listenTo(window,"beforeunload",(i,n)=>
1{this._pendingActions.hasAny&&(n.returnValue=this._pendingActions.first.message)})}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then(()=>Promise.all(this._saveCallbacks.map(e=>e(this.editor)))).finally(()=>{this._savePromise=null}).then(()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)}).catch(e=>{throw this.state="error",this.state="saving",this._debouncedSave(),e}),this._savePromise)}_setPendingAction(){let e=this.editor.t;this._action||(this._action=this._pendingActions.add(e("Saving changes")))}get _saveCallbacks(){let e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}}});function qi({editor:s,commandName:e,plugin:t,icon:i,label:n,keystroke:o}){return r=>{let l=s.commands.get(e),a=new r(s.locale);return a.set({label:n,icon:i,keystroke:o,isToggleable:!0}),a.bind("isEnabled").to(l,"isEnabled"),a.bind("isOn").to(l,"value"),a instanceof x?a.set({role:"menuitemcheckbox"}):a.set({tooltip:!0}),t.listenTo(a,"execute",()=>{s.execute(e),s.editing.view.focus()}),a}}var ai,In,Tl,wl,Al,Wp,ji,Yv,El,_l,xl,zp,Tn,Sl,kl,Vl,$p,uo,Pl,yl,Bl,jp,mo,Ll,vl,Rl,qp,ho,Fl,Cl,Ol,Gp,go,Dl,Il,Nl,Kp,Xp=M(()=>{U();ve();re();z();
vendor: 8,367 bytes, line 1
1at();ai=class extends v{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){let t=this.editor.model,n=t.document.selection,o=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{if(n.isCollapsed)o?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{let l=t.schema.getValidRanges(n.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(let a of l){let c=a,u=this.attributeKey;a.isCollapsed&&(c=a.start.parent,u=pi._getStoreAttributeKey(this.attributeKey)),o?r.setAttribute(u,o,c):r.removeAttribute(u,c)}}})}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(let n of i.getRanges())for(let o of n.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}},In="bold",Tl=class extends f{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:In}),e.model.schema.setAttributeProperties(In,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:In,view:"strong",upcastAlso:["b",i=>{let n=i.getStyle("font-weight");return n&&(n=="bold"||Number(n)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(In,new ai(e,In)),e.keystrokes.set("CTRL+B",In),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}};wl="bold",Al=class extends f{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:wl,plugin:this,icon:Hf,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(wl,()=>i(y)),e.ui.componentFactory.add("menuBar:"+wl,()=>i(x))}},Wp=class extends f{static get requires(){return[Tl,Al]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}},ji="code",Yv="ck-code_selected",El=class extends f{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[wn]}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:ji}),e.model.schema.setAttributeProperties(ji,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:ji,view:"code"}),e.commands.add(ji,new ai(e,ji)),e.plugins.get(wn).registerAttribute(ji),rs(e,ji,"code",Yv),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}},_l="code",xl=class extends f{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:_l,plugin:this,icon:qf,label:t("Code")});e.ui.componentFactory.add(_l,()=>i(y)),e.ui.componentFactory.add("menuBar:"+_l,()=>i(x))}},zp=class extends f{static get requires(){return[El,xl]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}},Tn="italic",Sl=class extends f{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Tn}),e.model.schema.setAttributeProperties(Tn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Tn,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Tn,new ai(e,Tn)),e.keystrokes.set("CTRL+I",Tn),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}},kl="italic",Vl=class extends f{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:kl,plugin:this,icon:Qf,keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(kl,()=>i(y)),e.ui.componentFactory.add("menuBar:"+kl,()=>i(x))}},$p=class extends f{static get requires(){return[Sl,Vl]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}},uo="strikethrough",Pl=class extends f{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:uo}),e.model.schema.setAttributeProperties(uo,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:uo,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(uo,new ai(e,uo)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}},yl="strikethrough",Bl=class extends f{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:yl,plugin:this,icon:ep,keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(yl,()=>i(y)),e.ui.componentFactory.add("menuBar:"+yl,()=>i(x))}},jp=class extends f{static get requires(){return[Pl,Bl]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}},mo="subscript",Ll=class extends f{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:mo}),e.model.schema.setAttributeProperties(mo,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:mo,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(mo,new ai(e,mo))}},vl="subscript",Rl=class extends f{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:vl,plugin:this,icon:tp,label:t("Subscript")});e.ui.componentFactory.add(vl,()=>i(y)),e.ui.componentFactory.add("menuBar:"+vl,()=>i(x))}},qp=class extends f{static get requires(){return[Ll,Rl]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}},ho="superscript",Fl=class extends f{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:ho}),e.model.schema.setAttributeProperties(ho,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ho,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(ho,new ai(e,ho))}},Cl="superscript",Ol=class extends f{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:Cl,plugin:this,icon:ip,label:t("Superscript")});e.ui.componentFactory.add(Cl,()=>i(y)),e.ui.componentFactory.add("menuBar:"+Cl,()=>i(x))}},Gp=class extends f{static get requires(){return[Fl,Ol]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}},go="underline",Dl=class extends f{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:go}),e.model.schema.setAttributeProperties(go,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:go,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(go,new ai(e,go)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}},Il="underline",Nl=class extends f{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=qi({editor:e,commandName:Il,plugin:this,icon:op,label:t("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(Il,()=>i(y)),e.ui.componentFactory.add("menuBar:"+Il,()=>i(x))}},Kp=class extends f{static get requires(){return[Dl,Nl]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}});function ms(s){return s.parent.name=="blockQuote"?s.parent:null}function Yp(s,e){let t,i=0,n=[];for(;i<e.length;){let o=e[i],r=e[i+1];t||(t=s.createPositionBefore(o)),(!r||o.nextSibling!=r)&&(n.push(s.createRange(t,s.createPositionAfter(o
1))),t=null),i++}return n}function Qp(s,e){let t=s.checkChild(e.parent,"blockQuote"),i=s.checkChild(["$root","blockQuote"],e);return t&&i}var Ml,Ul,Hl,Jp,Zp=M(()=>{U();kn();at();j();re();z();Ml=class extends v{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,i=t.schema,n=t.document.selection,o=Array.from(n.getSelectedBlocks()),r=e.forceValue===void 0?!this.value:e.forceValue;t.change(l=>{if(!r)this._removeQuote(l,o.filter(ms));else{let a=o.filter(c=>ms(c)||Qp(i,c));this._applyQuote(l,a)}})}_getValue(){let e=this.editor.model.document.selection,t=O(e.getSelectedBlocks());return!!(t&&ms(t))}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,i=O(e.getSelectedBlocks());return i?Qp(t,i):!1}_removeQuote(e,t){Yp(e,t).reverse().forEach(i=>{if(i.start.isAtStart&&i.end.isAtEnd){e.unwrap(i.start.parent);return}if(i.start.isAtStart){let o=e.createPositionBefore(i.start.parent);e.move(i,o);return}i.end.isAtEnd||e.split(i.end);let n=e.createPositionAfter(i.end.parent);e.move(i,n)})}_applyQuote(e,t){let i=[];Yp(e,t).reverse().forEach(n=>{let o=ms(n.start);o||(o=e.createElement("blockQuote"),e.wrap(n,o)),i.push(o)}),i.reverse().reduce((n,o)=>n.nextSibling==o?(e.merge(e.createPositionAfter(n)),n):o)}};Ul=class extends f{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[li,it]}init(){let e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new Ml(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(r=>{let l=e.model.document.differ.getChanges();for(let a of l)if(a.type=="insert"){let c=a.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(a.position,c))return r.unwrap(c),!0;if(c.is("element")){let u=r.createRangeIn(c);for(let d of u.getItems())if(d.is("element","blockQuote")&&!t.checkChild(r.createPositionBefore(d),d))return r.unwrap(d),!0}}else if(a.type=="remove"){let c=a.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0}return!1});let i=this.editor.editing.view.document,n=e.model.document.selection,o=e.commands.get("blockQuote");this.listenTo(i,"enter",(r,l)=>{if(!n.isCollapsed||!o.value)return;n.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),l.preventDefault(),r.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(r,l)=>{if(l.direction!="backward"||!n.isCollapsed||!o.value)return;let a=n.getLastPosition().parent;a.isEmpty&&!a.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),l.preventDefault(),r.stop())},{context:"blockquote"})}},Hl=class extends f{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("blockQuote",()=>{let t=this._createButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:blockQuote",()=>{let t=this._createButton(x);return t.set({role:"menuitemcheckbox"}),t})}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get("blockQuote"),o=new e(t.locale),r=i.t;return o.set({label:r("Block quote"),icon:Jf,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value"),this.listenTo(o,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),o}},Jp=class extends f{static get requires(){return[Ul,Hl]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}});function ib(s){return!(!s||typeof s!="string"||/\s/.test(s))}function Wl(s,e){return e.checkChild(s,"bookmark")?!0:e.checkChild(s,"paragraph")?e.checkChild("paragraph","bookmark"):!1}function eb(s){let e=s.getSelectedElement();return e&&e.is("element","bookmark")?e:null}function ql(s,e=!0){if(!(s.name==="a")||e&&!s.isEmpty)return null;let i=s.hasAttribute("id"),n=s.hasAttribute("name"),o=s.hasAttribute("href");return i&&!o?{name:!0,attributes:["id"]}:n&&!o?{name:!0,attributes:["name"]}:null}function Qv(s){return(e,t,i)=>{let n=t.viewItem,o=ql(n,!1);
vendor: 14,827 bytes, line 1
1if(!o||!i.consumable.test(n,o)||!Jv(s)&&!n.isEmpty)return;let l=i.writer,a=n.getAttribute("id"),c=n.getAttribute("name"),u=a||c,d=l.createElement("bookmark",{bookmarkId:u});if(!i.safeInsert(d,t.modelCursor))return;i.consumable.consume(n,o),a===c&&i.consumable.consume(n,{attributes:["name"]}),i.updateConversionResult(d,t);let{modelCursor:m,modelRange:h}=i.convertChildren(n,t.modelCursor);t.modelCursor=m,t.modelRange=l.createRange(t.modelRange.start,h.end)}}function Jv(s){let e=s.config.get("bookmark.enableNonEmptyAnchorConversion");return e!==void 0?e:!0}function Zv(s){let{t:e}=s,t=s.plugins.get(Gi);return[i=>{if(!i.id)return e("Bookmark must not be empty.")},i=>{if(i.id&&/\s/.test(i.id))return e("Bookmark name cannot contain space characters.")},i=>{let n=s.model.document.selection.getSelectedElement(),o=t.getElementForBookmarkId(i.id);if(n!==o&&o)return e("Bookmark name already exists.")}]}function eC(s){let e=s.getSelectedElement();return!e||!Ht(e)||!e.getCustomProperty("bookmark")?null:e}var zl,$l,jl,Gi,$t,Gl,tb,nb=M(()=>{U();zt();z();re();j();re();zl=class extends P{focusTracker=new J;keystrokes=new K;idInputView;backButtonView;saveButtonView;children;_validators;_focusables=new ye;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.idInputView=this._createIdInput(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new q(e,{children:[this.idInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this.keystrokes.set("Esc",(i,n)=>{this.fire("cancel"),n()}),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-bookmark-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.backButtonView,this.idInputView,this.saveButtonView].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.idInputView.focus()}isValid(){this.resetFormStatus();for(let e of this._validators){let t=e(this);if(t)return this.idInputView.errorText=t,!1}return!0}resetFormStatus(){this.idInputView.errorText=null}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){let e=this.locale.t,t=new y(this.locale);return t.set({label:e("Save"),withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){let e=this.locale.t,t=new Oe(this.locale,{label:e("Bookmark")});return t.children.add(this.backButtonView,0),t}_createIdInput(){let e=this.locale.t,t=new H(this.locale,ce);return t.label=e("Bookmark name"),t.infoText=e("Enter the bookmark name without spaces."),t.class="ck-labeled-field-view_full-width",t}get id(){let{element:e}=this.idInputView.fieldView;return e?e.value.trim():null}};$l=class extends v{refresh(){let t=this.editor.model.document.selection,i=this._getPositionToInsertBookmark(t);this.isEnabled=!!i}execute(e){if(!e)return;let{bookmarkId:t}=e;if(!ib(t)){Q("insert-bookmark-command-executed-with-invalid-name");return}let i=this.editor,n=i.model,o=n.document.selection;n.change(r=>{let l=this._getPositionToInsertBookmark(o);if(!n.schema.checkChild(l,"bookmark")){let u=i.execute("insertParagraph",{position:l});if(!u)return;l=u}let c=r.createElement("bookmark",N(I({},Object.fromEntries(o.getAttributes())),{bookmarkId:t}));n.insertObject(c,l,null,{setSelection:"on"})})}_getPositionToInsertBookmark(e){let t=this.editor.model,i=t.schema,n=e.getFirstRange(),o=n.start;if(Wl(o,i))return o;for(let{previousPosition:r,item:l}of n){if(l.is("element")&&i.checkChild(l,"$text")&&Wl(l,i))return t.createPositionAt(l,0);if(Wl(r,i))return r}return null}};jl=class extends v{refresh(){let t=this.editor.model.document.selection,i=eb(t);this.isEnabled=!!i,this.value=i?i.getAttribute("bookmarkId"):void 0}execute(e){if(!e)return;let{bookmarkId:t}=e;if(!ib(t)){Q("update-bookmark-command-executed-with-invalid-name");return}let i=this.editor.model,n=i.document.selection,o=eb(n);o&&i.change(r=>{r.setAttribute("bookmarkId",t,o)})}};Gi=class extends f{_bookmarkElements=new Map;static get pluginName(){return"BookmarkEditing"}static get licenseFeatureCode(){return"BKM"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("bookmark",{toolbar:["bookmarkPreview","|","editBookmark","removeBookmark"]})}init(){let{editor:e}=this;this._defineSchema(),this._defineConverters(),e.commands.add("insertBookmark",new $l(e)),e.commands.add("updateBookmark",new jl(e)),this.listenTo(e.model.document,"change:data",()=>{this._trackBookmarkElements()})}getElementForBookmarkId(e){for(let[t,i]of this._bookmarkElements)if(i==e)return t;return null}getAllBookmarkNames(){return new Set(this._bookmarkElements.values())}_defineSchema(){this.editor.model.schema.register("bookmark",{inheritAllFrom:"$inlineObject",allowAttributes:"bookmarkId",disallowAttributes:["linkHref","htmlA"]})}_defineConverters(){let{editor:e}=this,{conversion:t,t:i}=e;e.data.htmlProcessor.domConverter.registerInlineObjectMatcher(n=>ql(n)),e.editing.view.domConverter.registerInlineObjectMatcher(n=>ql(n,!1)),t.for("dataDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(n,{writer:o})=>o.createEmptyElement("a",{id:n.getAttribute("bookmarkId")})}),t.for("editingDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(n,{writer:o})=>{let r=n.getAttribute("bookmarkId"),l=o.createContainerElement("a",{id:r,class:"ck-bookmark"},[this._createBookmarkUIElement(o)]);return o.setCustomProperty("bookmark",!0,l),this._bookmarkElements.set(n,r),We(l,o,{label:()=>`${r} ${i("bookmark widget")}`})}}),t.for("upcast").add(n=>n.on("element:a",Qv(e)))}_createBookmarkUIElement(e){return e.createUIElement("span",{class:"ck-bookmark__icon"},function(t){let i=this.toDomElement(t),n=new gn;return n.set({content:zf,isColorInherited:!1}),n.render(),i.appendChild(n.element),i})}_trackBookmarkElements(){this._bookmarkElements.forEach((e,t)=>{t.root.rootName==="$graveyard"&&this._bookmarkElements.delete(t)})}};$t="bookmark-ui",Gl=class extends f{formView=null;_balloon;static get requires(){return[Gi,Ce,ft]}static get pluginName(){return"BookmarkUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;this._balloon=e.plugins.get(Ce),e.plugins.has("LinkUI")&&this._registerLinkProvider(),this._registerComponents(),e.conversion.for("editingDowncast").markerToHighlight({model:$t,view:{classes:["ck-fake-bookmark-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:$t,view:(t,{writer:i})=>{if(!t.markerRange.isCollapsed)return null;let n=i.createUIElement("span");return i.addClass(["ck-fake-bookmark-selection","ck-fake-bookmark-selection_collapsed"],n),n}})}afterInit(){let e=this.editor,t=e.locale.t,i=this.editor.plugins.get(ft),n=tt.defaultPositions;i.register("bookmark",{ariaLabel:t("Bookmark toolbar"),items:e.config.get("bookmark.toolbar"),getRelatedElement:eC,balloonClassName:"ck-bookmark-balloon ck-toolbar-container",positions:[n.southArrowNorth,n.southArrowNorthMiddleWest,n.southArrowNorthMiddleEast,n.southArrowNorthWest,n.southArrowNorthEast,n.northArrowSouth,n.northArrowSouthMiddleWest,n.northArrowSouthMiddleEast,n.northArrowSouthWest,n.northArrowSouthEast,n.viewportStickyNorth]})}destroy(){super.destroy(),this.formView&&this.formView.destroy()}_createViews(){this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createFormView(){let e=this.editor,t=e.locale,i=t.t,n=e.commands.get("insertBookmark"),o=e.commands.get("updateBookmark"),r=[n,o],l=new(mt(zl))(t,Zv(e));return l.idInputView.fieldView.bind("value").to(o,"value"),l.saveButtonView.bind("label").to(o,"value",a=>i(a?"Save":"Insert")),l.idInputView.bind("isEnabled").toMany(r,"isEnabled",(...a)=>a.some(c=>c)),l.saveButtonView.bind("isEnabled").toMany(r,"isEnabled",(...a)=>a.some(c=>c)),this.listenTo(l,"cancel",()=>{this._hideFormView()}),this.listenTo(l,"submit",()=>{if(l.isValid()){let a=l.id;this._getSelectedBookmarkElement()?e.execute("updateBookmark",{bookmarkId:a}):e.execute("insertBookmark",{bookmarkId:a}),this._hideFormView()}}),this.listenTo(l.idInputView,"change:errorText",()=>{e.ui.update()}),l}_registerLinkProvider(){let e=this.editor.locale.t,t=this.editor.plugins.get("LinkUI"),i=this.editor.plugins.get(Gi),n=()=>Array.from(i.getAllBookmarkNames()).sort((r,l)=>r.localeCompare(l)).map(r=>({id:r,href:`#${r}`,label:r,icon:$f})),o=r=>{let l=[...i.getAllBookmarkNames()].find(a=>`#${a}`===r);return l?{href:r,label:l,icon:jf,tooltip:e("Scroll to bookmark")}:null};t.registerLinksListProvider({label:e("Bookmarks"),emptyListPlaceholder:e("No bookmarks available."),navigate:({href:r})=>this._scrollToBookmark(r),getListItems:n,getItem:o})}_scrollToBookmark(e){let i=this.editor.plugins.get(Gi).getElementForBookmarkId(e.slice(1));return i?(this.editor.model.change(n=>{n.setSelection(i,"on")}),this.editor.editing.view.scrollToTheSelection({alignToTop:!0,forceScroll:!0}),!0):!1}_registerComponents(){let e=this.editor;e.ui.componentFactory.add("bookmark",()=>{let t=this._createBookmarkButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:bookmark",()=>this._createBookmarkButton(x)),e.ui.componentFactory.add("bookmarkPreview",t=>{let i=e.commands.get("updateBookmark"),n=new Ae(t);return n.extendTemplate({attributes:{class:["ck-bookmark-toolbar__preview"]}}),n.bind("text").to(i,"value"),n}),e.ui.componentFactory.add("editBookmark",t=>{let i=e.commands.get("updateBookmark"),n=new y(t),o=t.t;return n.set({label:o("Edit bookmark"),icon:Wi,tooltip:!0}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{this._showFormView()}),n}),e.ui.componentFactory.add("removeBookmark",t=>{let i=e.commands.get("delete"),n=new y(t),o=t.t;return n.set({label:o("Remove bookmark"),icon:Bf,tooltip:!0}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{e.execute("delete"),e.editing.view.focus()}),n})}_createBookmarkButton(e){let t=this.editor,i=t.locale,n=new e(i),o=t.commands.get("insertBookmark"),r=t.commands.get("updateBookmark"),l=i.t;return n.set({label:l("Bookmark"),icon:Wf}),this.listenTo(n,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showFormView()}),n.bind("isEnabled").toMany([o,r],"isEnabled",(...a)=>a.some(c=>c)),n.bind("isOn").to(r,"value",a=>!!a),n}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Esc",(e,t)=>{this._isFormVisible&&(this._hideFormView(),t())}),Xe({emitter:this.formView,activator:()=>this._isFormInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideFormView(!1)}})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let e=this.editor.commands.get("updateBookmark");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.backButtonView.isVisible=e.isEnabled,this.formView.idInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.idInputView.fieldView.select(),this.formView.enableCssTransitions()}_removeFormView(e=!0){this.formView.saveButtonView.focus(),this.formView.idInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection()}_showFormView(){this.formView||this._createViews(),this._getSelectedBookmarkElement()||this._showFakeVisualSelection(),this._addFormView(),this._balloon.showStack("main"),this._startUpdatingUI()}_hideFormView(e=!0){if(!this._isFormInPanel)return;let t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeFormView(e),this._hideFakeVisualSelection()}_startUpdatingUI(){let e=this.editor,t=e.editing.view.document,i=this._getSelectedBookmarkElement(),n=r(),o=()=>{let l=this._getSelectedBookmarkElement(),a=r();i&&!l||!i&&a!==n?this._hideFormView():this._isFormVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=l,n=a};function r(){return t.selection.focus.getAncestors().reverse().find(l=>l.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 _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}_getBalloonPositionData(){let e=this.editor.editing.view,t=this.editor.model,i,n=this._getSelectedBookmarkElement();if(t.markers.has($t)){let o=Array.from(this.editor.editing.mapper.markerNameToElements($t)),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));i=e.domConverter.viewRangeToDom(r)}else n&&(i=()=>{let o=this.editor.editing.mapper,r=e.domConverter,l=o.toViewElement(n);return r.mapViewToDom(l)});if(i)return{target:i}}_getSelectedBookmarkElement(){let t=this.editor.model.document.selection.getSelectedElement();return t&&t.is("element","bookmark")?t:null}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let i=e.document.selection.getFirstRange();if(e.markers.has($t))t.updateMarker($t,{range:i});else if(i.start.isAtEnd){let n=i.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:i});t.addMarker($t,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker($t,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has($t)&&e.change(t=>{t.removeMarker($t)})}};tb=class extends f{static get pluginName(){return"Bookmark"}static get requires(){return[Gi,Gl,ze]}static get isOfficialPlugin(){return!0}}});var tC,fo,Kl,Xl,iC,Yl,ob,nC,oC,sC,rC,sb,rb=M(()=>{tC=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],fo=s=>{let e=0;for(let t=0;t<s.length;t++){let i=s[t],n=tC.indexOf(i);e=e*83+n}return e},Kl=s=>{let e=s/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},Xl=s=>{let e=Math.max(0,Math.min(1,s));return e<=.0031308?Math.trunc(e*12.92*255+.5):Math.trunc((1.055*Math.pow(e,.4166666666666667)-.055)*255+.5)},iC=s=>s<0?-1:1,Yl=(s,e)=>
1iC(s)*Math.pow(Math.abs(s),e),ob=class extends Error{constructor(s){super(s),this.name="ValidationError",this.message=s}},nC=s=>{if(!s||s.length<6)throw new ob("The blurhash string must be at least 6 characters");let e=fo(s[0]),t=Math.floor(e/9)+1,i=e%9+1;if(s.length!==4+2*i*t)throw new ob(`blurhash length mismatch: length is ${s.length} but it should be ${4+2*i*t}`)},oC=s=>{let e=s>>16,t=s>>8&255,i=s&255;return[Kl(e),Kl(t),Kl(i)]},sC=(s,e)=>{let t=Math.floor(s/361),i=Math.floor(s/19)%19,n=s%19;return[Yl((t-9)/9,2)*e,Yl((i-9)/9,2)*e,Yl((n-9)/9,2)*e]},rC=(s,e,t,i)=>{nC(s),i=i|1;let n=fo(s[0]),o=Math.floor(n/9)+1,r=n%9+1,l=(fo(s[1])+1)/166,a=new Array(r*o);for(let d=0;d<a.length;d++)if(d===0){let m=fo(s.substring(2,6));a[d]=oC(m)}else{let m=fo(s.substring(4+d*2,6+d*2));a[d]=sC(m,l*i)}let c=e*4,u=new Uint8ClampedArray(c*t);for(let d=0;d<t;d++)for(let m=0;m<e;m++){let h=0,g=0,p=0;for(let T=0;T<o;T++)for(let B=0;B<r;B++){let Z=Math.cos(Math.PI*m*B/e)*Math.cos(Math.PI*d*T/t),_e=a[B+T*r];h+=_e[0]*Z,g+=_e[1]*Z,p+=_e[2]*Z}let b=Xl(h),w=Xl(g),k=Xl(p);u[4*m+0+d*c]=b,u[4*m+1+d*c]=w,u[4*m+2+d*c]=k,u[4*m+3+d*c]=255}return u},sb=rC});function mb(s){let e=[],t=0;for(let n in s){let o=parseInt(n,10);isNaN(o)||(o>t&&(t=o),e.push(`${s[n]} ${n}w`))}let i=[{srcset:e.join(","),sizes:`(max-width: ${t}px) 100vw, ${t}px`,type:"image/webp"}];return{imageFallbackUrl:s.default,imageSources:i}}function lC(s,e){let[,t]=s.value.split("."),i=JSON.parse(atob(t)),n=i.auth?.ckbox?.workspaces||[i.aud];return e?i.auth?.ckbox?.role=="superadmin"||n.includes(e)?e:null:n[0]}function aC(s){if(s)try{let e=`${po}px`,t=document.createElement("canvas");t.setAttribute("width",e),t.setAttribute("height",e);let i=t.getContext("2d");if(!i)return;let n=i.createImageData(po,po),o=sb(s,po,po);return n.data.set(o),i.putImageData(n,0,0),t.toDataURL()}catch(e){return}}function hs({url:s,method:e="GET",data:t,onUploadProgress:i,signal:n,authorization:o}){let r=new XMLHttpRequest;r.open(e,s.toString()),r.setRequestHeader("Authorization",o),r.setRequestHeader("CKBox-Version","CKEditor 5"),r.responseType="json";let l=()=>{r.abort()};return new Promise((a,c)=>{n.throwIfAborted(),n.addEventListener("abort",l),r.addEventListener("loadstart",()=>{n.addEventListener("abort",l)}),r.addEventListener("loadend",()=>{n.removeEventListener("abort",l)}),r.addEventListener("error",()=>{c()}),r.addEventListener("abort",()=>{c()}),r.addEventListener("load",()=>{let u=r.response;if(!u||u.statusCode>=400)return c(u&&u.message);a(u)});i&&r.upload.addEventListener("progress",u=>{i(u)}),r.send(t)})}function uC(s){return cC[s]}function dC(s,e){return de(this,null,function*(){try{let t=yield fetch(s,I({method:"HEAD",cache:"force-cache"},e));return t.ok&&t.headers.get("content-type")||""}catch(t){return""}})}function mC(s){let e=s.name,t=/\.(?<ext>[^.]+)$/;return e.match(t).groups.ext.toLowerCase()}function gC({downloadableFilesConfig:s,assets:e,isImageAllowed:t,isLinkAllowed:i}){return e.map(n=>pC(n)?{id:n.data.id,type:"image",attributes:hb(n)}:{id:n.data.id,type:"link",attributes:fC(n,s)}).filter(n=>n.type==="image"?t:i)}function hb(s){let{imageFallbackUrl:e,imageSources:t}=mb(s.data.imageUrls),{description:i,width:n,height:o,blurHash:r}=s.data.metadata,l=aC(r);return I({imageFallbackUrl:e,imageSources:t,imageTextAlternative:i||"",imageWidth:n,imageHeight:o},l?{imagePlaceholder:l}:null)}function fC(s,e){return{linkName:s.data.name,linkHref:bC(s,e)}}function pC(s){let e=s.data.metadata;return e?e.width&&e.height:!1}function bC(s,e){let t=new URL(s.data.url);return wC(s,e)&&t.searchParams.set("download","true"),t.toString()}function wC(s,e){return typeof e=="function"?e(s):!0}function kC(s){return e=>{let t=!1,i=s.model,n=s.commands.get("ckbox");if(!n)return t;for(let o of i.document.differ.getChanges()){if(o.type!=="insert"&&o.type!=="attribute")continue;let r=o.type==="insert"?new zg(o.position,o.position.getShiftedBy(o.length)):o.range,l=o.type==="attribute"&&o.attributeKey==="linkHref"&&o.attributeNewValue===null;for(let a of r.getItems()){if(l&&a.hasAttribute("ckboxLinkId")){e.removeAttribute("ckboxLinkId",a),t=!0;continue}let c=vC(a,n._chosenAssets);for(let u of c){let d=u.type==="image"?"ckboxImageId":"ckboxLinkId";
1u.id!==a.getAttribute(d)&&(e.setAttribute(d,u.id,a),t=!0)}}}return t}}function yC(s){return e=>!s.hasAttribute("linkHref")&&s.hasAttribute("ckboxLinkId")?(e.removeSelectionAttribute("ckboxLinkId"),!0):!1}function vC(s,e){let t=s.is("element","imageInline")||s.is("element","imageBlock"),i=s.hasAttribute("linkHref");return[...e].filter(n=>{if(n.type==="image"&&t)return n.attributes.imageFallbackUrl===s.getAttribute("src");if(n.type==="link"&&i)return n.attributes.linkHref===s.getAttribute("linkHref")})}function ab(s,e){let t=s.createAttributeElement("a",{"data-ckbox-resource-id":e},{priority:5});return s.setCustomProperty("link",!0,t),t}function CC(s){return!!(s.is("$text")||s.is("element","imageInline")||s.is("element","imageBlock"))}function cb(){return!!window.CKBox}function IC(s){return de(this,null,function*(){let e=s.plugins.get(Ti),t=s.config.get("ckbox.serviceOrigin"),i=new URL("permissions",t),{value:n}=yield e.getToken(),o=yield hs({url:i,authorization:n,signal:new AbortController().signal});return Object.values(o).some(r=>r["asset:create"])})}function TC(s){let e=gb(s);return t=>t.is("element","imageInline")||t.is("element","imageBlock")?t.hasAttribute("ckboxImageId")?!0:t.hasAttribute("src")?e(t.getAttribute("src")):!1:!1}function gb(s){if(Array.isArray(s)){let e=s.map(gb);return t=>e.some(i=>i(t))}if(s=="origin"){let e=W.window.location.origin;return t=>new URL(t,W.document.baseURI).origin==e}return typeof s=="function"?s:s instanceof RegExp?e=>!!(e.match(s)||e.replace(/^https?:\/\//,"").match(s)):()=>!1}var Ql,po,cC,hC,Jl,_C,Ti,Zl,ea,lb,bo,ub,ta,ia,na,db,fb=M(()=>{U();z();re();ve();j();rb();Jn();Me();Ql=class extends f{static get pluginName(){return"CKBoxUI"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor;e.commands.get("ckbox")&&(e.ui.componentFactory.add("ckbox",()=>this._createFileToolbarButton()),e.ui.componentFactory.add("menuBar:ckbox",()=>this._createFileMenuBarButton()),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"assetManager",observable:()=>e.commands.get("ckbox"),buttonViewCreator:()=>this._createImageToolbarButton(),formViewCreator:()=>this._createImageDropdownButton(),menuBarButtonViewCreator:t=>this._createImageMenuBarButton(t?"insertOnly":"insertNested")}))}_createButton(e){let t=this.editor,i=t.locale,n=new e(i),o=t.commands.get("ckbox");return n.bind("isOn","isEnabled").to(o,"value","isEnabled"),n.on("execute",()=>{t.execute("ckbox")}),n}_createFileToolbarButton(){let e=this.editor.locale.t,t=this._createButton(y);return t.icon=mn,t.label=e("Open file manager"),t.tooltip=!0,t}_createImageToolbarButton(){let e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(y);return i.icon=_i,i.bind("label").to(t,"isImageSelected",n=>e(n?"Replace image with file manager":"Insert image with file manager")),i.tooltip=!0,i}_createImageDropdownButton(){let e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(y);return i.icon=_i,i.withText=!0,i.bind("label").to(t,"isImageSelected",n=>e(n?"Replace with file manager":"Insert with file manager")),i.on("execute",()=>{t.dropdownView.isOpen=!1}),i}_createFileMenuBarButton(){let e=this.editor.locale.t,t=this._createButton(x);return t.icon=mn,t.withText=!0,t.label=e("File"),t}_createImageMenuBarButton(e){let t=this.editor.locale.t,i=this.editor.locale.t,n=this._createButton(x);switch(n.icon=_i,n.withText=!0,e){case"insertOnly":n.label=t("Image");break;case"insertNested":n.label=i("With file manager");break}return n}};po=32;cC={"image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"};hC=1e3,Jl=class extends v{_chosenAssets=new Set;_wrapper=null;constructor(e){super(e),this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return this._wrapper!==null}_checkEnabled(){let e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){let t=this.editor.config.get("ckbox"),i=t.dialog,n=t.categories,o=t.view,r=t.upload;return{theme:t.theme,language:t.language,tokenUrl:t.tokenUrl,serviceOrigin:t.serviceOrigin,forceDemoLabel:t.forceDemoLabel,choosableFileExtensions:t.choosableFileExtensions,assets:{onChoose:l=>this.fire("ckbox:choose",l)},dialog:{onClose:()=>this.fire("ckbox:close"),width:i&&i.width,height:i&&i.height},categories:n&&{icons:n.icons},view:o&&{openLastView:o.openLastView,startupFolderId:o.startupFolderId,startupCategoryId:o.startupCategoryId,hideMaximizeButton:o.hideMaximizeButton},upload:r&&{componentsHideTimeout:r.componentsHideTimeout,dialogMinimizeTimeout:r.dialogMinimizeTimeout}}}_initListeners(){let e=this.editor,t=e.model,i=!e.config.get("ckbox.ignoreDataId"),n=e.config.get("ckbox.downloadableFiles");this.on("ckbox",()=>{this.refresh()},{priority:"low"}),this.on("ckbox:open",()=>{!this.isEnabled||this.value||(this._wrapper=Te(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))}),this.on("ckbox:close",()=>{this.value&&(this._wrapper.remove(),this._wrapper=null,e.editing.view.focus())}),this.on("ckbox:choose",(o,r)=>{if(!this.isEnabled)return;
1let l=e.commands.get("insertImage"),a=e.commands.get("link"),c=gC({assets:r,downloadableFilesConfig:n,isImageAllowed:l.isEnabled,isLinkAllowed:a.isEnabled}),u=c.length;u!==0&&(t.change(d=>{for(let m of c){let h=m===c[u-1],g=u===1;this._insertAsset(m,h,d,g),i&&(setTimeout(()=>this._chosenAssets.delete(m),hC),this._chosenAssets.add(m))}}),e.editing.view.focus())}),this.listenTo(e,"destroy",()=>{this.fire("ckbox:close"),this._chosenAssets.clear()})}_insertAsset(e,t,i,n){let l=this.editor.model.document.selection;i.removeSelectionAttribute("linkHref"),e.type==="image"?this._insertImage(e):this._insertLink(e,i,n),t||i.setSelection(l.getLastPosition())}_insertImage(e){let t=this.editor,{imageFallbackUrl:i,imageSources:n,imageTextAlternative:o,imageWidth:r,imageHeight:l,imagePlaceholder:a}=e.attributes;t.execute("insertImage",{source:I({src:i,sources:n,alt:o,width:r,height:l},a?{placeholder:a}:null)})}_insertLink(e,t,i){let n=this.editor,o=n.model,r=o.document.selection,{linkName:l,linkHref:a}=e.attributes;if(r.isCollapsed){let c=ni(r.getAttributes()),u=t.createText(l,c);if(!i){let m=r.getLastPosition(),h=m.parent;h.name==="paragraph"&&h.isEmpty||n.execute("insertParagraph",{position:m});let g=o.insertContent(u);t.setSelection(g),n.execute("link",a);return}let d=o.insertContent(u);t.setSelection(d)}n.execute("link",a)}};_C="lark",Ti=class extends f{_token;static get pluginName(){return"CKBoxUtils"}static get isOfficialPlugin(){return!0}static get requires(){return["CloudServices"]}init(){let e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:_C,tokenUrl:e.config.get("cloudServices.tokenUrl")});let n=e.plugins.get("CloudServices"),o=e.config.get("cloudServices.tokenUrl"),r=e.config.get("ckbox.tokenUrl");if(!r)throw new S("ckbox-plugin-missing-token-url",this);r==o?this._token=Promise.resolve(n.token):this._token=n.registerTokenUrl(r),this._token=this._token.then(l=>de(this,null,function*(){return yield this._authorizePrivateCategoriesAccess(l.value),l}))}getToken(){return this._token}getWorkspaceId(){return de(this,null,function*(){let e=this.editor.t,t=e("Cannot access default workspace."),i=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),n=lC(yield this._token,i);if(n==null)throw zo("ckbox-access-default-workspace-error"),t;return n})}getCategoryIdForFile(e,t){return de(this,null,function*(){let i=this.editor.t,n=i("Cannot determine a category for the uploaded file."),o=this.editor.config.get("ckbox.defaultUploadCategories"),r=this._getAvailableCategories(t),l=typeof e=="string"?uC(yield dC(e,t)):mC(e),a=yield r;if(!a)throw n;if(o){let u=Object.keys(o).find(d=>o[d].find(m=>m.toLowerCase()==l));if(u){let d=a.find(m=>m.id===u||m.name===u);if(!d)throw n;return d.id}}let c=a.find(u=>u.extensions.find(d=>d.toLowerCase()==l));if(!c)throw n;return c.id})}_getAvailableCategories(e){return de(this,null,function*(){let i=this.editor,n=this._token,{signal:o}=e,r=i.config.get("ckbox.serviceOrigin"),l=yield this.getWorkspaceId();try{let c=[],u=0,d;do{let m=yield a(u);c.push(...m.items),d=m.totalCount-(u+50),u+=50}while(d>0);return c}catch(c){o.throwIfAborted(),zo("ckbox-fetch-category-http-error");return}function a(c){return de(this,null,function*(){let u=new URL("categories",r);return u.searchParams.set("limit",String(50)),u.searchParams.set("offset",String(c)),u.searchParams.set("workspaceId",l),hs({url:u,signal:o,authorization:(yield n).value})})}})}_authorizePrivateCategoriesAccess(e){return de(this,null,function*(){let t=this.editor.config.get("ckbox.serviceOrigin"),i=new FormData;i.set("token",e),yield fetch(`${t}/categories/authorizePrivateAccess`,{method:"POST",credentials:"include",mode:"no-cors",body:i})})}},Zl=class extends f{static get requires(){return["ImageUploadEditing","ImageUploadProgress",Ke,bo]}static get pluginName(){return"CKBoxUploadAdapter"}static get isOfficialPlugin(){return!0}afterInit(){return de(this,null,function*(){let e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;let n=e.plugins.get(Ke),o=e.plugins.get(Ti);n.createUploadAdapter=a=>new ea(a,e,o);let r=!e.config.get("ckbox.ignoreDataId"),l=e.plugins.get("ImageUploadEditing");r&&l.on("uploadComplete",(a,{imageElement:c,data:u})=>{e.model.change(d=>{d.setAttribute("ckboxImageId",u.ckboxImageId,c)})})})}},ea=class{loader;token;editor;controller;serviceOrigin;ckboxUtils;constructor(e,t,i){this.loader=e,this.token=i.getToken(),this.ckboxUtils=i,this.editor=t,this.controller=new AbortController,this.serviceOrigin=t.config.get("ckbox.serviceOrigin")}upload(){return de(this,null,function*(){let e=this.ckboxUtils,t=this.editor.t,i=yield this.loader.file,n=yield e.getCategoryIdForFile(i,{signal:this.controller.signal}),o=new URL("assets",this.serviceOrigin),r=new FormData;o.searchParams.set("workspaceId",yield e.getWorkspaceId()),r.append("categoryId",n),r.append("file",i);let l={method:"POST",url:o,data:r,onUploadProgress:a=>{a.lengthComputable&&(this.loader.uploadTotal=a.total,this.loader.uploaded=a.loaded)},signal:this.controller.signal,authorization:(yield this.token).value};return hs(l).then(a=>de(this,null,function*(){let c=mb(a.imageUrls);
vendor: 5,464 bytes, line 1
1return{ckboxImageId:a.id,default:c.imageFallbackUrl,sources:c.imageSources}})).catch(()=>{let a=t("Cannot upload file:")+` ${i.name}.`;return Promise.reject(a)})})}abort(){this.controller.abort()}},lb="NoPermission",bo=class extends f{static get pluginName(){return"CKBoxEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["LinkEditing","PictureEditing",Zl,Ti]}init(){let e=this.editor;this._shouldBeInitialised()&&(this._checkImagePlugins(),cb()&&e.commands.add("ckbox",new Jl(e)),IC(e).then(t=>{t||this._blockImageCommands()}))}afterInit(){let e=this.editor;this._shouldBeInitialised()&&(e.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()))}_shouldBeInitialised(){return!!this.editor.config.get("ckbox")||cb()}_blockImageCommands(){let e=this.editor,t=e.commands.get("uploadImage"),i=e.commands.get("ckboxImageEdit");t&&(t.isAccessAllowed=!1,t.forceDisabled(lb)),i&&i.forceDisabled(lb)}_checkImagePlugins(){let e=this.editor;!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing")&&zo("ckbox-plugin-image-feature-missing",e)}_initSchema(){let t=this.editor.model.schema;t.extend("$text",{allowAttributes:"ckboxLinkId"}),t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),t.addAttributeCheck(i=>{if(!i.last.getAttribute("linkHref"))return!1},"ckboxLinkId")}_initConversion(){let e=this.editor;e.conversion.for("downcast").add(i=>{i.on("attribute:ckboxLinkId:imageBlock",(n,o,r)=>{let{writer:l,mapper:a,consumable:c}=r;if(!c.consume(o.item,n.name))return;let d=[...a.toViewElement(o.item).getChildren()].find(m=>m.name==="a");d&&(o.item.hasAttribute("ckboxLinkId")?l.setAttribute("data-ckbox-resource-id",o.item.getAttribute("ckboxLinkId"),d):l.removeAttribute("data-ckbox-resource-id",d))},{priority:"low"}),i.on("attribute:ckboxLinkId",(n,o,r)=>{let{writer:l,mapper:a,consumable:c}=r;if(c.consume(o.item,n.name)){if(o.attributeOldValue){let u=ab(l,o.attributeOldValue);l.unwrap(a.toViewRange(o.range),u)}if(o.attributeNewValue){let u=ab(l,o.attributeNewValue);if(o.item.is("selection")){let d=l.document.selection;l.wrap(d.getFirstRange(),u)}else l.wrap(a.toViewRange(o.range),u)}}},{priority:"low"})}),e.conversion.for("upcast").add(i=>{i.on("element:a",(n,o,r)=>{let{writer:l,consumable:a}=r;if(!o.viewItem.getAttribute("href"))return;let c={attributes:["data-ckbox-resource-id"]};if(!a.consume(o.viewItem,c))return;let u=o.viewItem.getAttribute("data-ckbox-resource-id");if(u)if(o.modelRange)for(let d of o.modelRange.getItems())d.is("$textProxy")&&(d=d.textNode),CC(d)&&l.setAttribute("ckboxLinkId",u,d);else{let d=o.modelCursor.nodeBefore||o.modelCursor.parent;l.setAttribute("ckboxLinkId",u,d)}},{priority:"low"})}),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:i=>i.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}});let t=e.commands.get("replaceImageSource");t&&this.listenTo(t,"cleanupImage",(i,[n,o])=>{n.removeAttribute("ckboxImageId",o)})}_initFixers(){let e=this.editor,t=e.model,i=t.document.selection;t.document.registerPostFixer(kC(e)),t.document.registerPostFixer(yC(i))}};ub=class extends f{static get pluginName(){return"CKBox"}static get isOfficialPlugin(){return!0}static get requires(){return[bo,Ql]}};ta=class extends v{_wrapper=null;_processInProgress=new Set;_canEdit;_prepareOptions;_updateUiDelayed=Pg(()=>this.editor.ui.update(),0);constructor(e){super(e),this.value=!1,this._canEdit=TC(e.config.get("ckbox.allowExternalImagesEditing")),this._prepareOptions=vg((t,i)=>this._prepareOptionsAbortable(t,i)),this._prepareListeners()}refresh(){let e=this.editor;this.value=this._getValue();let t=e.model.document.selection.getSelectedElement();this.isEnabled=!!t&&this._canEdit(t)&&!this._checkIfElementIsBeingProcessed(t)}execute(){if(this._getValue())return;let e=Te(document,"div",{class:"ck ckbox-wrapper"});this._wrapper=e,this.value=!0,document.body.appendChild(this._wrapper);let i={element:this.editor.model.document.selection.getSelectedElement(),controller:new AbortController};this._prepareOptions(i).then(n=>window.CKBox.mountImageEditor(e,n),n=>{let o=this.editor,r=o.t;o.plugins.get(ri).showWarning(r("Failed to determine category of edited image."),{namespace:"ckbox"}),console.error(n),this._handleImageEditorClose()})}destroy(){this._handleImageEditorClose(),this._prepareOptions.abort(),this._updateUiDelayed.cancel();for(let e of this._processInProgress.values())e.controller.abort();super.destroy()}_getValue(){return this._wrapper!==null}_prepareOptionsAbortable(e,t){return de(this,null,function*(){let i=this.editor,n=i.config.get("ckbox"),o=i.plugins.get(Ti),{element:r}=t,l,a=r.getAttribute("ckboxImageId");if(a)l={assetId:a};else{let c=new URL(r.getAttribute("src"),document.baseURI).href,u=yield o.getCategoryIdForFile(c,{signal:e});l={imageUrl:c,uploadCategoryId:u}}return N(I(N(I({},l),{imageEditing:{allowOverwrite:!1},tokenUrl:n.tokenUrl,language:n.language}),n.serviceOrigin&&{serviceOrigin:n.serviceOrigin}),{onClose:()=>this._handleImageEditorClose(),onSave:c=>this._handleImageEditorSave(t,c)})})}_prepareListeners(){this.listenTo(this.editor.model.document,"change:data",()=>
1{this._getProcessingStatesOfDeletedImages().forEach(t=>{t.controller.abort()})})}_getProcessingStatesOfDeletedImages(){let e=[];for(let t of this._processInProgress.values())t.element.root.rootName=="$graveyard"&&e.push(t);return e}_checkIfElementIsBeingProcessed(e){for(let{element:t}of this._processInProgress)if(fi(t,e))return!0;return!1}_handleImageEditorClose(){this._wrapper&&(this._wrapper.remove(),this._wrapper=null,this.editor.editing.view.focus(),this._updateUiDelayed(),this.refresh())}_handleImageEditorSave(e,t){let i=this.editor.locale.t,n=this.editor.plugins.get(ri),o=this.editor.plugins.get(oi),r=o.add(i("Processing the edited image."));this._processInProgress.add(e),this._showImageProcessingIndicator(e.element,t),this.refresh(),this._waitForAssetProcessed(t.data.id,e.controller.signal).then(l=>{this._replaceImage(e.element,l)},l=>{this.editor.editing.reconvertItem(e.element),!e.controller.signal.aborted&&(!l||l instanceof S?n.showWarning(i("Server failed to process the image."),{namespace:"ckbox"}):console.error(l))}).finally(()=>{this._processInProgress.delete(e),o.remove(r),this.refresh()})}_getAssetStatusFromServer(e,t){return de(this,null,function*(){let i=this.editor.plugins.get(Ti),n=new URL("assets/"+e,this.editor.config.get("ckbox.serviceOrigin")),o=yield hs({url:n,signal:t,authorization:(yield i.getToken()).value}),r=o.metadata.metadataProcessingStatus;if(!r||r=="queued")throw new S("ckbox-image-not-processed");return{data:I({},o)}})}_waitForAssetProcessed(e,t){return de(this,null,function*(){let i=yield Vg(()=>this._getAssetStatusFromServer(e,t),{signal:t,maxAttempts:5});if(i.data.metadata.metadataProcessingStatus!="success")throw new S("ckbox-image-processing-failed");return i})}_showImageProcessingIndicator(e,t){let i=this.editor;i.editing.view.change(n=>{let o=i.editing.mapper.toViewElement(e),l=this.editor.plugins.get("ImageUtils").findViewImgElement(o);n.removeStyle("aspect-ratio",l),n.setAttribute("width",t.data.metadata.width,l),n.setAttribute("height",t.data.metadata.height,l),n.setStyle("width",`${t.data.metadata.width}px`,l),n.setStyle("height",`${t.data.metadata.height}px`,l),n.addClass("image-processing",o)})}_replaceImage(e,t){let i=this.editor,{imageFallbackUrl:n,imageSources:o,imageWidth:r,imageHeight:l,imagePlaceholder:a}=hb(t),c=Array.from(i.model.document.selection.getRanges());i.model.change(u=>{u.setSelection(e,"on"),i.execute("insertImage",{imageType:e.is("element","imageInline")?"imageInline":null,source:I(I({src:n,sources:o,width:r,height:l},a?{placeholder:a}:null),e.hasAttribute("alt")?{alt:e.getAttribute("alt")}:null)});let d=e.getChildren();e=i.model.document.selection.getSelectedElement();for(let m of d)u.append(u.cloneElement(m),e);u.setAttribute("ckboxImageId",t.data.id,e),u.setSelection(c)})}},ia=class extends f{static get pluginName(){return"CKBoxImageEditEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[bo,Ti,oi,ri,"ImageUtils","ImageEditing"]}init(){let{editor:e}=this;e.commands.add("ckboxImageEdit",new ta(e))}},na=class extends f{static get pluginName(){return"CKBoxImageEditUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("ckboxImageEdit",t=>{let i=e.commands.get("ckboxImageEdit"),n=e.commands.get("uploadImage"),o=new y(t),r=t.t;return o.set({icon:Xg,tooltip:!0}),o.bind("label").to(n,"isAccessAllowed",l=>r(l?"Edit image":"You have no image editing permissions.")),o.bind("isOn").to(i,"value",i,"isEnabled",(l,a)=>l&&a),o.bind("isEnabled").to(i),this.listenTo(o,"execute",()=>{e.execute("ckboxImageEdit"),e.editing.view.focus()}),o})}},db=class extends f{static get pluginName(){return"CKBoxImageEdit"}static get isOfficialPlugin(){return!0}static get requires(){return[ia,na]}}});function pb(s,e){if(!s.commands.get("insertImage").isEnabled){let i=s.plugins.get("Notification"),n=s.locale.t;i.showWarning(n("Could not insert image at the current position."),{title:n("Inserting image failed"),namespace:"ckfinder"});return}s.execute("insertImage",{source:e})}var oa,sa,ra,bb,wb=M(()=>{U();z();re();j();oa=class extends f{static get pluginName(){return"CKFinderUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("ckfinder",()=>this._createFileToolbarButton()),e.ui.componentFactory.add("menuBar:ckfinder",()=>this._createFileMenuBarButton()),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"assetManager",observable:()=>e.commands.get("ckfinder"),buttonViewCreator:()=>this._createImageToolbarButton(),formViewCreator:()=>this._createImageDropdownButton(),menuBarButtonViewCreator:t=>this._createImageMenuBarButton(t?"insertOnly":"insertNested")})}_createButton(e){let t=this.editor,i=t.locale,n=new e(i),o=t.commands.get("ckfinder");return n.bind("isEnabled").to(o),n.on("execute",()=>{t.execute("ckfinder"),t.editing.view.focus()}),n}_createFileToolbarButton(){let e=this.editor.locale.t,t=this._createButton(y);return t.icon=mn,t.label=e("Insert image or file"),t.tooltip=!0,t}_createImageToolbarButton(){let e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(y);return i.icon=_i,i.bind("label").to(t,"isImageSelected",n=>e(n?"Replace image with file manager":"Insert image with file manager")),i.tooltip=!0,i}_createImageDropdownButton(){let e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(y);return i.icon=_i,i.withText=!0,i.bind("label").to(t,"isImageSelected",n=>e(n?"Replace with file manager":"Insert with file manager")),i.on("execute",()=>{t.dropdownView.isOpen=!1}),i}_createFileMenuBarButton(){let e=this.editor.locale.t,t=this._createButton(x);return t.icon=mn,t.withText=!0,t.label=e("File"),t}_createImageMenuBarButton(e){let t=this.editor.locale.t,i=this.editor.locale.t,n=this._createButton(x);switch(n.icon=_i,n.withText=!0,e){case"insertOnly":n.label=t("Image");break;case"insertNested":n.label=i("With file manager");break}return n}},sa=class extends v{constructor(e){super(e),this.affectsData=!1,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){let e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled}execute(){let e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if(t!="popup"&&t!="modal")throw new S("ckfinder-unknown-openermethod",e);let i=this.editor.config.get("ckfinder.options")||{};i.chooseFiles=!0;let n=i.onInit;i.language||(i.language=e.locale.uiLanguage),i.onInit=o=>{n&&n(o),o.on("files:choose",r=>{let l=r.data.files.toArray(),a=l.filter(d=>!d.isImage()),c=l.filter(d=>d.isImage());for(let d of a)e.execute("link",d.getUrl());let u=[];for(let d of c){let m=d.getUrl();u.push(m||o.request("file:getProxyUrl",{file:d}))}u.length&&pb(e,u)}),o.on("file:choose:resizedImage",r=>{let l=r.data.resizedUrl;if(!l){let a=e.plugins.get("Notification"),c=e.locale.t;a.showWarning(c("Could not obtain resized image URL."),{title:c("Selecting resized image failed"),namespace:"ckfinder"});return}pb(e,[l])})},window.CKFinder[t](i)}};ra=class extends f{static get pluginName(){return"CKFinderEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ri,"LinkEditing"]}init(){let e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new S("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new sa(e))}},bb=class extends f{static get pluginName(){return"CKFinder"}static get isOfficialPlugin(){return!0}static get requires(){return["Link","CKFinderUploadAdapter",ra,oa]}}});function xC(s){return new Promise((e,t)=>
1{let i=new XMLHttpRequest;i.open("GET",s),i.addEventListener("load",()=>{let n=i.status,o=i.response;return n<200||n>299?t(new S("token-cannot-download-new-token",null)):e(o)}),i.addEventListener("error",()=>t(new Error("Network Error"))),i.addEventListener("abort",()=>t(new Error("Abort"))),i.send()})}function SC(s,e=512){try{let t=s.match(aa)[1],i=atob(s.replace(aa,"")),n=[];for(let o=0;o<i.length;o+=e){let r=i.slice(o,o+e),l=new Array(r.length);for(let a=0;a<r.length;a++)l[a]=r.charCodeAt(a);n.push(new Uint8Array(l))}return new Blob(n,{type:t})}catch(t){throw new S("fileuploader-decoding-image-data-error",null)}}function VC(s){return typeof s!="string"?!1:!!s.match(aa)?.length}var AC,_b,EC,la,aa,ca,ua,da,kb,yb=M(()=>{U();j();AC={autoRefresh:!0},_b=36e5,EC=5e3,la=class s extends an(){_refresh;_options;_tokenRefreshTimeout;_isDestroyed=!1;constructor(e,t={}){if(super(),!e)throw new S("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),typeof e=="function"?this._refresh=e:this._refresh=()=>xC(e),this._options=I(I({},AC),t)}init(){return new Promise((e,t)=>{if(!this.value){this.refreshToken().then(e).catch(t);return}this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)})}refreshToken(){let e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set("value",t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw Q("token-refresh-failed",{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(EC),t})}destroy(){this._isDestroyed=!0,clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){let t=typeof e=="string",i=!/^".*"$/.test(e),n=t&&e.split(".").length===3;if(!(i&&n))throw new S("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;let t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},t)}_getTokenRefreshTimeoutTime(){try{let[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));return t?(t>2147483647&&console.warn("Token expiration time exceeds 32-bit integer range. This might cause unpredictable token refresh timing. Token expiration time should always be provided in seconds.",{tokenExpireTime:t}),Math.floor((t*1e3-Date.now())/2)):_b}catch(e){return _b}}static create(e,t={}){return new s(e,t).init()}};aa=/^data:(\S*?);base64,/,ca=class extends yg(){file;xhr;_token;_apiAddress;constructor(e,t,i){if(super(),!e)throw new S("fileuploader-missing-file",null);if(!t)throw new S("fileuploader-missing-token",null);if(!i)throw new S("fileuploader-missing-api-address",null);this.file=VC(e)?SC(e):e,this._token=t,this._apiAddress=i}onProgress(e){return this.on("progress",(t,i)=>e(i)),this}onError(e){return this.once("error",(t,i)=>e(i)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){let e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){let e=this.xhr,t=i=>()=>this.fire("error",i);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort"));e.upload&&e.upload.addEventListener("progress",i=>{i.lengthComputable&&this.fire("progress",{total:i.total,uploaded:i.loaded})}),e.addEventListener("load",()=>{let i=e.status,n=e.response;if(i<200||i>299)return this.fire("error",n.message||n.error)})}_sendRequest(){let e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((i,n)=>{t.addEventListener("load",()=>{let o=t.status,r=t.response;return o<200||o>299?r.message?n(new S("fileuploader-uploading-data-failed",this,{message:r.message})):n(r.error):i(r)}),t.addEventListener("error",()=>n(new Error("Network Error"))),t.addEventListener("abort",()=>n(new Error("Abort"))),t.send(e)})}};ua=class{_token;_apiAddress;constructor(e,t){if(!e)throw new S("uploadgateway-missing-token",null);if(!t)throw new S("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new ca(e,this._token,this._apiAddress)}},da=class extends jr{static get pluginName(){return"CloudServicesCore"}static get isOfficialPlugin(){return!0}createToken(e,t){return new la(e,t)}createUploadGateway(e,t){return new ua(e,t)}},kb=class extends jr{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;autoRefresh=!0;token=null;_tokens=new Map;static get pluginName(){return"CloudServices"}static get isOfficialPlugin(){return!0}static get requires(){return[da]}init(){return de(this,null,function*(){let t=this.context.config.get("cloudServices")||{};for(let[o,r]of Object.entries(t))this[o]=r;if(!this.tokenUrl){this.token=null;return}let n=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl,{autoRefresh:this.autoRefresh});try{this.token=yield n.init(),this._tokens.set(this.tokenUrl,this.token)}catch(o){throw n.destroy(),o}})}registerTokenUrl(e){return de(this,null,function*(){if(this._tokens.has(e))return this.getTokenFor(e);let i=yield this.context.plugins.get("CloudServicesCore").createToken(e,{autoRefresh:this.autoRefresh}).init();return this._tokens.set(e,i),i})}getTokenFor(e){let t=this._tokens.get(e);if(!t)throw new S("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(let e of this._tokens.values())e.destroy()}}});function gs(s){let e=s.t,t=s.config.get("codeBlock.languages");for(let i of t)i.label==="Plain text"&&(i.label=e("Plain text")),i.class===void 0&&(i.class=`language-${i.language}`);return t}function fs(s,e,t){let i={};for(let n of s)if(e==="class"){let o=n[e].split(" ").shift();i[o]=n[t]}else i[n[e]]=n[t];return i}function _a(s){return s.data.match(/^(\s*)/)[0]}function PC(s,e){let t=s.createDocumentFragment(),i=e.split(`
2`),n=i.reduce((o,r,l)=>(o.push(r),l<i.length-1&&o.push(s.createElement("br")),o),[]);return s.appendChild(n,t),t}function ha(s){let e=s.document.selection,t=[];if(e.isCollapsed)return[e.anchor];let i=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(let{item:n}of i){let o=n.is("$textProxy")?n.textNode:n,r=o.parent;if(!r.is("element","codeBlock")||o.is("element","softBreak"))continue;for(;o.previousSibling&&!o.previousSibling.is("element","softBreak");)o=o.previousSibling;let l=o.is("$text")?o.startOffset+_a(o).length:o.startOffset,a=s.createPositionAt(r,l);t.every(c=>
vendor: 13,790 bytes, lines 2-4
2!c.isEqual(a))&&t.push(a)}return t}function Eb(s){let e=O(s.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function vb(s,e){return e.is("rootElement")||s.isLimit(e)?!1:s.checkChild(e.parent,"codeBlock")}function Cb(s,e,t,i){let n=fs(e,"language","label"),o=t.getAttribute("language");if(o in n){let r=n[o];return s(i==="enter"?"Entering %0 code snippet":"Leaving %0 code snippet",r)}return s(i==="enter"?"Entering code snippet":"Leaving code snippet")}function xb(s,e){for(s.textNode&&(s=e.createPositionBefore(s.textNode));s.nodeBefore&&!s.nodeBefore.is("element","softBreak");)s=e.createPositionBefore(s.nodeBefore);let t=s.nodeAfter;return t&&t.is("$text")?t:null}function BC(s,e,t){return s.language?s.language:s.usePreviousLanguageChoice&&e?e:t}function Ib(s,e,t){let i=xb(e,s);if(!i)return null;let n=_a(i),o=n.lastIndexOf(t);if(o+t.length!==n.length||o===-1)return null;let{parent:r,startOffset:l}=i;return s.createRange(s.createPositionAt(r,l+o),s.createPositionAt(r,l+o+t.length))}function Tb(s,e,t=!1){let i=fs(e,"language","class"),n=fs(e,"language","label");return(o,r,l)=>{let{writer:a,mapper:c,consumable:u}=l;if(!u.consume(r.item,"insert"))return;let d=r.item.getAttribute("language"),m=c.toViewPosition(s.createPositionBefore(r.item)),h={};t&&(h["data-language"]=n[d],h.spellcheck="false");let g=i[d]?{class:i[d]}:void 0,p=a.createContainerElement("code",g),b=a.createContainerElement("pre",h,p);a.insert(m,b),c.bindElements(r.item,p)}}function LC(s){return(e,t,i)=>{if(t.item.parent.name!=="codeBlock")return;let{writer:n,mapper:o,consumable:r}=i;if(!r.consume(t.item,"insert"))return;let l=o.toViewPosition(s.createPositionBefore(t.item));n.insert(l,n.createText(`
3`))}}function RC(s,e){let t=fs(e,"class","language"),i=e[0].language;return(n,o,r)=>{let l=o.viewItem,a=l.parent;if(!a||!a.is("element","pre")||o.modelCursor.findAncestor("codeBlock"))return;let{consumable:c,writer:u}=r;if(!c.test(l,{name:!0}))return;let d=u.createElement("codeBlock"),m=[...l.getClassNames()];m.length||m.push("");for(let h of m){let g=t[h];if(g){c.consume(l,{classes:[h]}),u.setAttribute("language",g,d);break}}d.hasAttribute("language")||u.setAttribute("language",i,d),r.convertChildren(l,d),r.safeInsert(d,o.modelCursor)&&(c.consume(l,{name:!0}),r.updateConversionResult(d,o))}}function FC(){return(s,e,{consumable:t,writer:i})=>{let n=e.modelCursor;if(!t.test(e.viewItem)||!n.findAncestor("codeBlock"))return;t.consume(e.viewItem);let r=e.viewItem.data.split(`
4`).map(a=>i.createText(a)),l=r[r.length-1];for(let a of r)if(i.insert(a,n),n=n.getShiftedBy(a.offsetSize),a!==l){let c=i.createElement("softBreak");i.insert(c,n),n=i.createPositionAfter(c)}e.modelRange=i.createRange(e.modelCursor,n),e.modelCursor=n}}function OC(){return(s,e,{consumable:t})=>{let i=e.viewItem;if(i.findAncestor("pre"))return;let n=Array.from(i.getChildren()),o=n.find(r=>r.is("element","code"));if(o)for(let r of n)r===o||!r.is("$text")||t.consume(r,{name:!0})}}function DC(s){let e=s.model,t=e.document,i=t.selection.getLastPosition(),n,o=xb(i,e);o&&o.is("$text")&&(n=_a(o)),s.model.change(r=>{s.execute("shiftEnter"),n&&r.insertText(n,t.selection.anchor)})}function NC(s,e){let i=s.model.document,n=s.editing.view,o=i.selection.getLastPosition(),r=o.nodeAfter;return e||!i.selection.isCollapsed||!o.isAtStart||!Ki(r)?!1:(s.model.change(l=>{s.execute("enter");let a=i.selection.anchor.parent.previousSibling;l.rename(a,Sb),l.setSelection(a,"in"),s.model.schema.removeDisallowedAttributes([a],l),l.remove(r)}),n.scrollToTheSelection(),!0)}function MC(s,e){let t=s.model,i=t.document,n=s.editing.view,o=i.selection.getLastPosition(),r=o.nodeBefore,l;if(e||!i.selection.isCollapsed||!o.isAtEnd||!r||!r.previousSibling)return!1;if(Ki(r)&&Ki(r.previousSibling))l=t.createRange(t.createPositionBefore(r.previousSibling),t.createPositionAfter(r));else if(ma(r)&&Ki(r.previousSibling)&&Ki(r.previousSibling.previousSibling))l=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling),t.createPositionAfter(r));else if(ma(r)&&Ki(r.previousSibling)&&ma(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&Ki(r.previousSibling.previousSibling.previousSibling))l=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling.previousSibling),t.createPositionAfter(r));else return!1;return s.model.change(a=>{a.remove(l),s.execute("enter");let c=i.selection.anchor.parent;a.rename(c,Sb),s.model.schema.removeDisallowedAttributes([c],a)}),n.scrollToTheSelection(),!0}function ma(s){return s&&s.is("$text")&&!s.data.match(/\S/)}function Ki(s){return s&&s.is("element","softBreak")}var ga,fa,pa,Sb,ba,wa,Ab,Vb=M(()=>{U();kn();ve();Ci();j();z();re();ga=class extends v{_lastLanguage;constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor,i=t.model,n=i.document.selection,r=gs(t)[0],l=Array.from(n.getSelectedBlocks()),a=e.forceValue==null?!this.value:e.forceValue,c=BC(e,this._lastLanguage,r.language);i.change(u=>{a?this._applyCodeBlock(u,l,c):this._removeCodeBlock(u,l)})}_getValue(){let e=this.editor.model.document.selection,t=O(e.getSelectedBlocks());return!!t?.is("element","codeBlock")?t.getAttribute("language"):!1}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,i=O(e.getSelectedBlocks());return i?vb(t,i):!1}_applyCodeBlock(e,t,i){this._lastLanguage=i;let n=this.editor.model.schema,o=t.filter(r=>vb(n,r));for(let r of o)e.rename(r,"codeBlock"),e.setAttribute("language",i,r),n.removeDisallowedAttributes([r],e),Array.from(r.getChildren()).filter(l=>!n.checkChild(r,l)).forEach(l=>e.remove(l));o.reverse().forEach((r,l)=>{let a=o[l+1];r.previousSibling===a&&(e.appendElement("softBreak",a),e.merge(e.createPositionBefore(r)))})}_removeCodeBlock(e,t){let i=t.filter(n=>n.is("element","codeBlock"));for(let n of i){let o=e.createRangeOn(n);for(let r of Array.from(o.getItems()).reverse())if(r.is("element","softBreak")&&r.parent.is("element","codeBlock")){let{position:l}=e.split(e.createPositionBefore(r)),a=l.nodeAfter;e.rename(a,"paragraph"),e.removeAttribute("language",a),e.remove(r)}e.rename(n,"paragraph"),e.removeAttribute("language",n)}}};fa=class extends v{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){let t=this.editor.model;t.change(i=>{let n=ha(t);for(let o of n){let r=i.createText(this._indentSequence);t.insertContent(r,o)}})}_checkEnabled(){return this._indentSequence?Eb(this.editor.model.document.selection):!1}},pa=class extends v{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){let t=this.editor.model;t.change(()=>{let i=ha(t);for(let n of i){let o=Ib(t,n,this._indentSequence);o&&t.deleteContent(t.createSelection(o))}})}_checkEnabled(){if(!this._indentSequence)return!1;let e=this.editor.model;return Eb(e.document.selection)?ha(e).some(t=>Ib(e,t,this._indentSequence)):!1}};Sb="paragraph",ba=class extends f{static get pluginName(){return"CodeBlockEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[ls]}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:"go",label:"Go"},{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(){let e=this.editor,t=e.model.schema,i=e.model,n=e.editing.view,o=gs(e);e.commands.add("codeBlock",new ga(e)),e.commands.add("indentCodeBlock",new fa(e)),e.commands.add("outdentCodeBlock",new pa(e)),this.listenTo(n.document,"tab",(r,l)=>{let a=l.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(a).isEnabled&&(e.execute(a),l.stopPropagation(),l.preventDefault(),r.stop())},{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:!0}),t.addAttributeCheck((r,l)=>{let a=r.getItem(r.length-2);if(t.getAttributeProperties(l).isFormatting&&a&&a.name=="codeBlock")return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",Tb(i,o,!0)),e.data.downcastDispatcher.on("insert:codeBlock",Tb(i,o)),e.data.downcastDispatcher.on("insert:softBreak",LC(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",RC(n,o)),e.data.upcastDispatcher.on("text",FC()),e.data.upcastDispatcher.on("element:pre",OC(),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",(r,l)=>{let a=i.createRange(i.document.selection.anchor);if(l.targetRanges&&(a=e.editing.mapper.toModelRange(l.targetRanges[0])),!a.start.parent.is("element","codeBlock"))return;let c=l.dataTransfer.getData("text/plain"),u=new Ft(e.editing.view.document);l.content=PC(u,c)}),e.plugins.has("ClipboardPipeline")&&e.plugins.get(ct).on("contentInsertion",(r,l)=>{let a=e.model,c=a.document.selection;c.anchor.parent.is("element","codeBlock")&&a.change(u=>{let d=u.createRangeIn(l.content);for(let m of[...d.getItems()])m.is("node")&&!t.checkChild(c.anchor,m)&&u.remove(m)})}),this.listenTo(i,"getSelectedContent",(r,[l])=>{let a=l.anchor;l.isCollapsed||!a.parent.is("element","codeBlock")||!a.hasSameParentAs(l.focus)||i.change(c=>{let u=r.return;if(a.parent.is("element")&&(u.childCount>1||l.containsEntireContent(a.parent))){let m=c.createElement("codeBlock",a.parent.getAttributes());c.append(u,m);let h=c.createDocumentFragment();c.append(m,h),r.return=h;return}let d=u.getChild(0);t.checkAttribute(d,"code")&&c.setAttribute("code",!0,d)})})}afterInit(){let e=this.editor,t=e.commands,i=t.get("indent"),n=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),n&&n.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(o,r)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(!NC(e,r.isSoft)&&!MC(e,r.isSoft)&&DC(e),r.preventDefault(),o.stop())},{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){let{model:e,ui:t,t:i}=this.editor,n=gs(this.editor),o=null;e.document.selection.on("change:range",()=>{let r=e.document.selection.focus.parent;!t||o===r||!r.is("element")||(o&&o.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce(Cb(i,n,o,"leave")),r.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce(Cb(i,n,r,"enter")),o=r)})}};wa=class extends f{static get pluginName(){return"CodeBlockUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,i=e.ui.componentFactory,n=gs(e),o=this._getLanguageListItemDefinitions(n),r=e.commands.get("codeBlock");i.add("codeBlock",l=>{let a=X(l,ht),c=a.buttonView,u=t("Insert code block");return c.set({label:u,tooltip:!0,icon:nl,isToggleable:!0}),c.bind("isOn").to(r,"value",d=>!!d),c.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),a.on("execute",d=>{e.execute("codeBlock",{language:d.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),a.class="ck-code-block-dropdown",a.bind("isEnabled").to(r),be(a,o,{role:"menu",ariaLabel:u}),a}),i.add("menuBar:codeBlock",l=>{let a=new Ie(l);a.buttonView.set({role:"menuitem",label:t("Code block"),icon:nl}),a.bind("isEnabled").to(r);let c=new He(l);c.set({ariaLabel:t("Insert code block")});for(let u of o){let d=new De(l,a),m=new x(l);m.bind(...Object.keys(u.model)).to(u.model),m.set({isToggleable:!0,role:"menuitemcheckbox"}),m.delegate("execute").to(a),m.on("execute",()=>{e.execute("codeBlock",{language:u.model._codeBlockLanguage,forceValue:r.value!=u.model._codeBlockLanguage}),e.editing.view.focus()}),d.children.add(m),c.items.add(d)}return a.panelView.children.add(c),a})}_getLanguageListItemDefinitions(e){let i=this.editor.commands.get("codeBlock"),n=new ne;for(let o of e){let r={type:"button",model:new we({_codeBlockLanguage:o.language,label:o.label,role:"menuitemradio",withText:!0})};r.model.bind("isOn").to(i,"value",l=>l===r.model._codeBlockLanguage),n.add(r)}return n}},Ab=class extends f{static get requires(){return[ba,wa]}static get pluginName(){return"CodeBlock"}static get isOfficialPlugin(){return!0}}});var ka,ya,Pb,Bb=M(()=>{U();j();Jn();ka=class extends f{_uploadGateway;static get pluginName(){return"CloudServicesUploadAdapter"}static get isOfficialPlugin(){return!0}static get requires(){return["CloudServices",Ke]}init(){let e=this.editor,t=e.plugins.get("CloudServices"),i=t.token,n=t.uploadUrl;if(!i)return;let o=e.plugins.get("CloudServicesCore");this._uploadGateway=o.createUploadGateway(i,n),e.plugins.get(Ke).createUploadAdapter=r=>new ya(this._uploadGateway,r)}},ya=class{uploadGateway;loader;fileUploader;constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(t,i)=>{this.loader.uploadTotal=i.total,this.loader.uploaded=i.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}},Pb=class extends f{static get pluginName(){return"EasyImage"}static get isOfficialPlugin(){return!0}static get requires(){return[ka,"ImageUpload"]}init(){let e=this.editor;!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing")&&Q("easy-image-image-feature-missing",e)}}});function UC(s){return ps(s)?Rt(s):s}function ps(s){return dt(s)}var va,Ca,Lb,Rb=M(()=>{U();z();j();
4ve();Me();va=class extends Mt{view;constructor(e,t){super(e),this.view=t}get element(){return this.view.editable.element}init(){let e=this.editor,t=this.view,i=e.editing.view,n=t.editable,o=i.document.getRoot();n.name=o.rootName,t.render();let r=n.element;this.setEditableElement(n.name,r),n.bind("isFocused").to(this.focusTracker),i.attachDomRoot(r),this._initPlaceholder(),this.initMenuBar(this.view.menuBarView),this.fire("ready")}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initPlaceholder(){let e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.config.get("placeholder");if(n){let o=typeof n=="string"?n:n[i.rootName];o&&(i.placeholder=o)}Ge({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}},Ca=class extends vi{editable;menuBarView;constructor(e,t,i,n){super(e),this.editable=new Ut(e,t,i,{label:n}),this.menuBarView=new gt(e),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}render(){super.render(),this.registerChild(this.editable),this.registerChild(this.menuBarView)}},Lb=class extends bi(Ot){static get editorName(){return"BalloonEditor"}ui;constructor(e,t={}){if(!ps(e)&&t.initialData!==void 0)throw new S("editor-create-initial-data",null);super(t),this.config.get("initialData")===void 0&&this.config.set("initialData",UC(e)),ps(e)&&(this.sourceElement=e,wi(this,e));let i=this.config.get("plugins");i.push(wp),this.config.set("plugins",i),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();let n=new Ca(this.locale,this.editing.view,this.sourceElement,this.config.get("label"));this.ui=new va(this,n),dn(this)}destroy(){let e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,t={}){return new Promise(i=>{if(ps(e)&&e.tagName==="TEXTAREA")throw new S("editor-wrong-element",null);let n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}});function HC(s){return bs(s)?Rt(s):s}function bs(s){return dt(s)}var Ia,Ta,Fb,Ob=M(()=>{z();ve();j();U();Me();Ia=class extends Mt{view;_toolbarConfig;_elementReplacer;constructor(e,t){super(e),this.view=t,this._toolbarConfig=is(e.config.get("toolbar")),this._elementReplacer=new $o,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){let t=this.editor,i=this.view,n=t.editing.view,o=i.editable,r=n.document.getRoot();o.name=r.rootName,i.render();let l=o.element;this.setEditableElement(o.name,l),i.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(l),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&this.initMenuBar(i.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){let e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.sourceElement,o,r=e.config.get("placeholder");r&&(o=typeof r=="string"?r:r[this.view.editable.name]),!o&&n&&n.tagName.toLowerCase()==="textarea"&&(o=n.getAttribute("placeholder")),o&&(i.placeholder=o),Ge({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;let{stickyPanel:e}=this.view,t=this.editor.plugins.get("ContextualBalloon");t.on("getPositionOptions",n=>{let o=n.return;if(!o||!e.isSticky||!e.element)return;let r=new ie(e.element).height,l=typeof o.target=="function"?o.target():o.target,a=typeof o.limiter=="function"?o.limiter():o.limiter;if(l&&a&&new ie(l).height>=new ie(a).height-r)return;let c=I({},o.viewportOffsetConfig),u=(c.top||0)+r;n.return=N(I({},o),{viewportOffsetConfig:N(I({},c),{top:u})})},{priority:"low"});let i=()=>{t.visibleView&&t.updatePosition()};this.listenTo(e,"change:isSticky",i),this.listenTo(this.editor.ui,"change:viewportOffset",i)}_handleScrollToTheSelectionWithStickyPanel(e,t,i){let n=this.view.stickyPanel;if(n.isSticky){let o=new ie(n.element).height;t.viewportOffset.top+=o}else{let o=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(n,"change:isSticky",o),setTimeout(()=>{this.stopListening(n,"change:isSticky",o)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;let e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",()=>{let i=t.view;i.on("moveTo",(n,o)=>
4{if(!e.isSticky||i.wasMoved||i.isModal)return;let r=new ie(e.contentPanelElement);o[1]<r.bottom+cl.defaultOffset&&(o[1]=r.bottom+cl.defaultOffset)},{priority:"high"})},{priority:"low"})}},Ta=class extends hp{stickyPanel;toolbar;editable;constructor(e,t,i={}){super(e),this.stickyPanel=new fp(e),this.toolbar=new Ue(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new gt(e)),this.editable=new Ut(e,t,void 0,{label:i.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}},Fb=class extends bi(Ot){static get editorName(){return"ClassicEditor"}ui;constructor(e,t={}){if(!bs(e)&&t.initialData!==void 0)throw new S("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",HC(e)),bs(e)&&(this.sourceElement=e),this.model.document.createRoot();let i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),o=new Ta(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i,useMenuBar:n.isVisible,label:this.config.get("label")});this.ui=new Ia(this,o),dn(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(i=>{let n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init(bs(e)?e:null)).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}});function WC(s){return ws(s)?Rt(s):s}function ws(s){return dt(s)}var Aa,Ea,Db,Nb=M(()=>{U();j();z();ve();Me();Aa=class extends Mt{view;constructor(e,t){super(e),this.view=t}init(){let e=this.editor,t=this.view,i=e.editing.view,n=t.editable,o=i.document.getRoot();n.name=o.rootName,t.render();let r=n.element;this.setEditableElement(n.name,r),t.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(r),this._initPlaceholder(),this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire("ready")}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get("toolbar"),this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){let e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.config.get("placeholder");if(n){let o=typeof n=="string"?n:n[i.rootName];o&&(i.placeholder=o)}Ge({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}},Ea=class extends vi{toolbar;editable;menuBarView;constructor(e,t,i={}){super(e),this.toolbar=new Ue(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),this.menuBarView=new gt(e),this.editable=new Ut(e,t,i.editableElement,{label:i.label}),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}}),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.menuBarView,this.toolbar,this.editable])}},Db=class extends bi(Ot){static get editorName(){return"DecoupledEditor"}ui;constructor(e,t={}){if(!ws(e)&&t.initialData!==void 0)throw new S("editor-create-initial-data",null);super(t),this.config.get("initialData")===void 0&&this.config.set("initialData",WC(e)),ws(e)&&(this.sourceElement=e,wi(this,e)),this.model.document.createRoot();let i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new Ea(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:i,label:this.config.get("label")});this.ui=new Aa(this,n)}destroy(){let e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,t={}){return new Promise(i=>{if(ws(e)&&e.tagName==="TEXTAREA")throw new S("editor-wrong-element",null);let n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}});function $C(s){return _s(s)?Rt(s):s}function _s(s){return dt(s)}var xa,zC,Sa,Mb,Ub=M(()=>{U();j();z();ve();Me();xa=class extends Mt{view;_toolbarConfig;constructor(e,t){super(e),this.view=t,this._toolbarConfig=is(e.config.get("toolbar"))}
4get element(){return this.view.editable.element}init(){let e=this.editor,t=this.view,i=e.editing.view,n=t.editable,o=i.document.getRoot();n.name=o.rootName,t.render();let r=n.element;this.setEditableElement(n.name,r),n.bind("isFocused").to(this.focusTracker),i.attachDomRoot(r),this._initPlaceholder(),this._initToolbar(),t.menuBarView&&this.initMenuBar(t.menuBarView),this.fire("ready")}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let e=this.editor,t=this.view,i=t.editable.element,n=t.toolbar;t.panel.bind("isVisible").to(this.focusTracker,"isFocused"),t.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:o})=>o||0),t.listenTo(e.ui,"update",()=>{t.panel.isVisible&&t.panel.pin({target:i,positions:t.panelPositions})}),n.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(n)}_initPlaceholder(){let e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.config.get("placeholder");if(n){let o=typeof n=="string"?n:n[i.rootName];o&&(i.placeholder=o)}Ge({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}},zC=Mi("px"),Sa=class extends vi{toolbar;panel;panelPositions;editable;_resizeObserver;constructor(e,t,i,n={}){super(e),this.toolbar=new Ue(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull,isFloating:!0}),n.useMenuBar&&(this.menuBarView=new gt(e)),this.set("viewportTopOffset",0),this.panel=new tt(e),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new Ut(e,t,i,{label:n.label}),this._resizeObserver=null}render(){if(super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.menuBarView?this.panel.content.addMany([this.menuBarView,this.toolbar]):this.panel.content.add(this.toolbar),this.toolbar.options.shouldGroupWhenFull){let t=this.editable.element;this._resizeObserver=new jo(t,()=>{this.toolbar.maxWidth=zC(new ie(t).width)})}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(e,t){let i;return e.top>t.height+this.viewportTopOffset?i=e.top-t.height:e.bottom>t.height+this.viewportTopOffset+50?i=this.viewportTopOffset:i=e.bottom,i}_getPanelPositions(){let e=[(t,i)=>({top:this._getPanelPositionTop(t,i),left:t.left,name:"toolbar_west",config:{withArrow:!1}}),(t,i)=>({top:this._getPanelPositionTop(t,i),left:t.left+t.width-i.width,name:"toolbar_east",config:{withArrow:!1}})];return this.locale.uiLanguageDirection==="ltr"?e:e.reverse()}},Mb=class extends bi(Ot){static get editorName(){return"InlineEditor"}ui;constructor(e,t={}){if(!_s(e)&&t.initialData!==void 0)throw new S("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",$C(e)),this.model.document.createRoot(),_s(e)&&(this.sourceElement=e,wi(this,e));let i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),o=new Sa(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:i,useMenuBar:n.isVisible,label:this.config.get("label")});this.ui=new xa(this,o),dn(this)}destroy(){let e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,t={}){return new Promise(i=>{if(_s(e)&&e.tagName==="TEXTAREA")throw new S("editor-wrong-element",null);let n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}});function jC(s){return Wb(s)?Rt(s):s}function Wb(s){return dt(s)}var Va,Pa,Hb,zb=M(()=>{U();j();z();ve();Me();Va=class extends Mt{view;_lastFocusedEditableElement;constructor(e,t){super(e),this.view=t,this._lastFocusedEditableElement=null}init(){this.view.render(),this.focusTracker.on("change:focusedElement",(t,i,n)=>{for(let o of Object.values(this.view.editables))n===o.element&&(this._lastFocusedEditableElement=o.element)}),this.focusTracker.on("change:isFocused",(t,i,n)=>{n||(this._lastFocusedEditableElement=null)});for(let t of Object.values(this.view.editables))this.addEditable(t);this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire("ready")}addEditable(e,t){let i=e.element;this.editor.editing.view.attachDomRoot(i,e.name),this.setEditableElement(e.name,i),e.bind("isFocused").to(this.focusTracker,"isFocused",this.focusTracker,"focusedElement",(n,o)=>n?o===i?!0:this._lastFocusedEditableElement===i:!1),this._initPlaceholder(e,t)}removeEditable(e){let t=this.editor.editing.view;t.getDomRoot(e.name)&&t.detachDomRoot(e.name),e.unbind("isFocused"),this.removeEditableElement(e.name)}
4destroy(){super.destroy();for(let e of Object.values(this.view.editables))this.removeEditable(e);this.view.destroy()}_initToolbar(){let e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get("toolbar"),this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(e,t){if(!t){let o=this.editor.config.get("placeholder");o&&(t=typeof o=="string"?o:o[e.name])}let i=this.editor.editing.view,n=i.document.getRoot(e.name);t&&(n.placeholder=t),Ge({view:i,element:n,isDirectHost:!1,keepOnFocus:!0})}},Pa=class extends vi{toolbar;editables;editable;menuBarView;_editingView;constructor(e,t,i,n={}){super(e),this._editingView=t,this.toolbar=new Ue(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.menuBarView=new gt(e),this.editables={};for(let o of i){let r=n.editableElements?n.editableElements[o]:void 0,{label:l}=n;typeof l=="object"&&(l=l[o]),this.createEditable(o,r,l)}this.editable=Object.values(this.editables)[0],this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}}),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}createEditable(e,t,i){let n=new Ut(this.locale,this._editingView,t,{label:i});return this.editables[e]=n,n.name=e,this.isRendered&&this.registerChild(n),n}removeEditable(e){let t=this.editables[e];this.isRendered&&this.deregisterChild(t),delete this.editables[e],t.destroy()}render(){super.render(),this.registerChild(Object.values(this.editables)),this.registerChild(this.toolbar),this.registerChild(this.menuBarView)}},Hb=class extends Ot{static get editorName(){return"MultiRootEditor"}ui;sourceElements;_registeredRootsAttributesKeys=new Set;_readOnlyRootLocks=new Map;constructor(e,t={}){let i=Object.keys(e),n=i.length===0||typeof e[i[0]]=="string";if(n&&t.initialData!==void 0&&Object.keys(t.initialData).length>0)throw new S("editor-create-initial-data",null);if(super(t),n?this.sourceElements={}:this.sourceElements=e,this.config.get("initialData")===void 0){let a={};for(let c of i)a[c]=jC(e[c]);this.config.set("initialData",a)}if(!n)for(let a of i)wi(this,e[a]);this.editing.view.document.roots.on("add",(a,c)=>{c.unbind("isReadOnly"),c.bind("isReadOnly").to(this.editing.view.document,"isReadOnly",u=>u||this._readOnlyRootLocks.has(c.rootName)),c.on("change:isReadOnly",(u,d,m)=>{let h=this.editing.view.createRangeIn(c);for(let g of h.getItems())g.is("editableElement")&&(g.unbind("isReadOnly"),g.isReadOnly=m)})});for(let a of i)this.model.document.createRoot("$root",a);if(this.config.get("lazyRoots"))for(let a of this.config.get("lazyRoots")){let c=this.model.document.createRoot("$root",a);c._isLoaded=!1}if(this.config.get("rootsAttributes")){let a=this.config.get("rootsAttributes");for(let[c,u]of Object.entries(a)){if(!this.model.document.getRoot(c))throw new S("multi-root-editor-root-attributes-no-root",null);for(let d of Object.keys(u))this.registerRootAttribute(d)}this.data.on("init",()=>{this.model.enqueueChange({isUndoable:!1},c=>{for(let[u,d]of Object.entries(a)){let m=this.model.document.getRoot(u);for(let[h,g]of Object.entries(d))g!==null&&c.setAttribute(h,g,m)}})})}let o={shouldToolbarGroupWhenFull:!this.config.get("toolbar.shouldNotGroupWhenFull"),editableElements:n?void 0:e,label:this.config.get("label")},r=new Pa(this.locale,this.editing.view,i,o);this.ui=new Va(this,r),this.model.document.on("change:data",()=>{let a=this.model.document.differ.getChangedRoots();for(let c of a){let u=this.model.document.getRoot(c.name);c.state=="detached"&&this.fire("detachRoot",u)}for(let c of a){let u=this.model.document.getRoot(c.name);c.state=="attached"&&this.fire("addRoot",u)}}),this.listenTo(this.model,"canEditAt",(a,[c])=>{if(!c)return;let u=!1;for(let d of c.getRanges()){let m=d.root;if(this._readOnlyRootLocks.has(m.rootName)){u=!0;break}}u&&(a.return=!1,a.stop())},{priority:"high"}),this.decorate("loadRoot"),this.on("loadRoot",(a,[c])=>{let u=this.model.document.getRoot(c);if(!u)throw new S("multi-root-editor-load-root-no-root",this,{rootName:c});u._isLoaded&&(Q("multi-root-editor-load-root-already-loaded"),a.stop())},{priority:"highest"}),l(this);function l(a){let c=a.config.get("licenseKey"),u=Lg(c);u&&Rg(u,"MRE")&&(a.enableReadOnlyMode(Symbol("invalidLicense")),a._showLicenseError("featureNotAllowed","Multi-root editor"))}}destroy(){let e=this.config.get("updateSourceElementOnDestroy"),t={};for(let i of Object.keys(this.sourceElements))t[i]=e?this.getData({rootName:i}):"";return this.ui.destroy(),super.destroy().then(()=>{for(let i of Object.keys(this.sourceElements))Tg(this.sourceElements[i],t[i])})}addRoot(e,{data:t="",attributes:i={},elementName:n="$root",isUndoable:o=!1}={}){let r=l=>{let a=l.addRoot(e,n);t&&l.insert(this.data.parse(t,a),a,0);for(let c of Object.keys(i))this.registerRootAttribute(c),l.setAttribute(c,i[c],a)};o?this.model.change(r):this.model.enqueueChange({isUndoable:!1},r)}detachRoot(e,t=!1){t?this.model.change(i=>i.detachRoot(e)):this.model.enqueueChange({isUndoable:!1},i=>i.detachRoot(e))}createEditable(e,t,i){let n=this.ui.view.createEditable(e.rootName,void 0,i);return this.ui.addEditable(n,t),this.editing.view.forceRender(),n.element}detachEditable(e){let t=e.rootName,i=this.ui.view.editables[t];return this.ui.removeEditable(i),this.ui.view.removeEditable(t),i.element}loadRoot(e,{data:t="",attributes:i={}}={}){let n=this.model.document.getRoot(e);this.model.enqueueChange({isUndoable:!1},o=>{t&&o.insert(this.data.parse(t,n),n,0);for(let r of Object.keys(i))this.registerRootAttribute(r),o.setAttribute(r,i[r],n);n._isLoaded=!0,this.model.document.differ._bufferRootLoad(n)})}getFullData(e){let t={};for(let i of this.model.document.getRootNames())t[i]=this.data.get(N(I({},e),{rootName:i}));return t}getRootsAttributes(){let e={};for(let t of this.model.document.getRootNames())e[t]=this.getRootAttributes(t);return e}getRootAttributes(e){let t={},i=this.model.document.getRoot(e);for(let n of this._registeredRootsAttributesKeys)t[n]=i.hasAttribute(n)?i.getAttribute(n):null;return t}registerRootAttribute(e){this._registeredRootsAttributesKeys.has(e)||(this._registeredRootsAttributesKeys.add(e),this.editing.model.schema.extend("$root",{allowAttributes:e}))}disableRoot(e,t){if(e=="$graveyard")throw new S("multi-root-editor-cannot-disable-graveyard-root",this);let i=this._readOnlyRootLocks.get(e);if(i)i.add(t);else{this._readOnlyRootLocks.set(e,new Set([t]));let n=this.editing.view.document.getRoot(e);
4n.isReadOnly=!0,Array.from(this.commands.commands()).forEach(o=>o.affectsData&&o.refresh())}}enableRoot(e,t){let i=this._readOnlyRootLocks.get(e);if(!(!i||!i.has(t)))if(i.size===1){this._readOnlyRootLocks.delete(e);let n=this.editing.view.document.getRoot(e);n.isReadOnly=this.isReadOnly,Array.from(this.commands.commands()).forEach(o=>o.affectsData&&o.refresh())}else i.delete(t)}static create(e,t={}){return new Promise(i=>{for(let o of Object.values(e))if(Wb(o)&&o.tagName==="TEXTAREA")throw new S("editor-wrong-element",null);let n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>(n._verifyRootsWithInitialData(),n.data.init(n.config.get("initialData")))).then(()=>n.fire("ready")).then(()=>n))})}_verifyRootsWithInitialData(){let e=this.config.get("initialData");for(let t of this.model.document.getRootNames())if(!(t in e))throw new S("multi-root-editor-root-initial-data-mismatch",null);for(let t of Object.keys(e)){let i=this.model.document.getRoot(t);if(!i||!i.isAttached())throw new S("multi-root-editor-root-initial-data-mismatch",null)}}}});var jb=Lt(($b,ks)=>{((s,e)=>{typeof define=="function"&&define.amd?define([],e):typeof ks=="object"&&ks.exports?ks.exports=e():s.fuzzysort=e()})($b,s=>{"use strict";var e=(C,_)=>{if(!C||!_)return Re;var A=h(C);Oi(_)||(_=m(_));var L=A.bitflags;return(L&_._bitflags)!==L?Re:p(A,_)},t=(C,_,A)=>{if(!C)return A?.all?g(_,A):Nr;var L=h(C),R=L.bitflags,V=L.containsSpace,E=u(A?.threshold||0),D=A?.limit||Dr,F=0,oe=0,ee=_.length;function et(Di){F<D?(Mo.add(Di),++F):(++oe,Di._score>Mo.peek()._score&&Mo.replaceTop(Di))}if(A?.key)for(var je=A.key,se=0;se<ee;++se){var Qe=_[se],le=sn(Qe,je);if(le&&(Oi(le)||(le=m(le)),(R&le._bitflags)===R)){var ge=p(L,le);ge!==Re&&(ge._score<E||(ge.obj=Qe,et(ge)))}}else if(A?.keys){var hi=A.keys,ut=hi.length;e:for(var se=0;se<ee;++se){var Qe=_[se];{for(var qe=0,te=0;te<ut;++te){var je=hi[te],le=sn(Qe,je);if(!le){$n[te]=jn;continue}Oi(le)||(le=m(le)),$n[te]=le,qe|=le._bitflags}if((R&qe)!==R)continue}if(V)for(let ae=0;ae<L.spaceSearches.length;ae++)Bt[ae]=rt;for(var te=0;te<ut;++te){if(le=$n[te],le===jn){ti[te]=jn;continue}if(ti[te]=p(L,le,!1,V),ti[te]===Re){ti[te]=jn;continue}if(V)for(let fe=0;fe<L.spaceSearches.length;fe++){if(ei[fe]>-1e3&&Bt[fe]>rt){var Ne=(Bt[fe]+ei[fe])/4;Ne>Bt[fe]&&(Bt[fe]=Ne)}ei[fe]>Bt[fe]&&(Bt[fe]=ei[fe])}}if(V){for(let ae=0;ae<L.spaceSearches.length;ae++)if(Bt[ae]===rt)continue e}else{var Y=!1;for(let ae=0;ae<ut;ae++)if(ti[ae]._score!==rt){Y=!0;break}if(!Y)continue}var lt=new l(ut);for(let ae=0;ae<ut;ae++)lt[ae]=ti[ae];if(V){var Be=0;for(let ae=0;ae<L.spaceSearches.length;ae++)Be+=Bt[ae]}else{var Be=rt;for(let fe=0;fe<ut;fe++){var ge=lt[fe];if(ge._score>-1e3&&Be>rt){var Ne=(Be+ge._score)/4;Ne>Be&&(Be=Ne)}ge._score>Be&&(Be=ge._score)}}if(lt.obj=Qe,lt._score=Be,A?.scoreFn){if(Be=A.scoreFn(lt),!Be)continue;Be=u(Be),lt._score=Be}Be<E||et(lt)}}else for(var se=0;se<ee;++se){var le=_[se];if(le&&(Oi(le)||(le=m(le)),(R&le._bitflags)===R)){var ge=p(L,le);ge!==Re&&(ge._score<E||et(ge))}}if(F===0)return Nr;for(var gi=new Array(F),se=F-1;se>=0;--se)gi[se]=Mo.poll();return gi.total=F+oe,gi},i=(C,_="<b>",A="</b>")=>{for(var L=typeof _=="function"?_:void 0,R=C.target,V=R.length,E=C.indexes,D="",F=0,oe=0,ee=!1,et=[],je=0;je<V;++je){var se=R[je];if(E[oe]===je){if(++oe,ee||(ee=!0,L?(et.push(D),D=""):D+=_),oe===E.length){L?(D+=se,et.push(L(D,F++)),D="",et.push(R.substr(je+1))):D+=se+A+R.substr(je+1);break}}else ee&&(ee=!1,L?(et.push(L(D,F++)),D=""):D+=A);D+=se}return L?et:D},n=C=>{typeof C=="number"?C=""+C:typeof C!="string"&&(C="");var _=k(C);return a(C,{_targetLower:_._lower,_targetLowerCodes:_.lowerCodes,_bitflags:_.bitflags})},o=()=>{Z.clear(),_e.clear()};class r{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((_,A)=>_-A)}set indexes(_){return this._indexes=_}highlight(_,A){return i(this,_,A)}get score(){return c(this._score)}set score(_){this._score=u(_)}}class l extends Array{get score(){return c(this._score)}set score(_){this._score=u(_)}}var a=(C,_)=>{let A=new r;return A.target=C,A.obj=_.obj??Re,A._score=_._score??rt,A._indexes=_._indexes??[],A._targetL
vendor: 5,431 bytes, line 4
4ower=_._targetLower??"",A._targetLowerCodes=_._targetLowerCodes??Re,A._nextBeginningIndexes=_._nextBeginningIndexes??Re,A._bitflags=_._bitflags??0,A},c=C=>C===rt?0:C>1?C:Math.E**(((-C+1)**.04307-1)*-2),u=C=>C===0?rt:C>1?C:1-Math.pow(Math.log(C)/-2+1,1/.04307),d=C=>{typeof C=="number"?C=""+C:typeof C!="string"&&(C=""),C=C.trim();var _=k(C),A=[];if(_.containsSpace){var L=C.split(/\s+/);L=[...new Set(L)];for(var R=0;R<L.length;R++)if(L[R]!==""){var V=k(L[R]);A.push({lowerCodes:V.lowerCodes,_lower:L[R].toLowerCase(),containsSpace:!1})}}return{lowerCodes:_.lowerCodes,_lower:_._lower,containsSpace:_.containsSpace,bitflags:_.bitflags,spaceSearches:A}},m=C=>{if(C.length>999)return n(C);var _=Z.get(C);return _!==void 0||(_=n(C),Z.set(C,_)),_},h=C=>{if(C.length>999)return d(C);var _=_e.get(C);return _!==void 0||(_=d(C),_e.set(C,_)),_},g=(C,_)=>{var A=[];A.total=C.length;var L=_?.limit||Dr;if(_?.key)for(var R=0;R<C.length;R++){var V=C[R],E=sn(V,_.key);if(E!=Re){Oi(E)||(E=m(E));var D=a(E.target,{_score:E._score,obj:V});if(A.push(D),A.length>=L)return A}}else if(_?.keys)for(var R=0;R<C.length;R++){for(var V=C[R],F=new l(_.keys.length),oe=_.keys.length-1;oe>=0;--oe){var E=sn(V,_.keys[oe]);if(!E){F[oe]=jn;continue}Oi(E)||(E=m(E)),E._score=rt,E._indexes.len=0,F[oe]=E}if(F.obj=V,F._score=rt,A.push(F),A.length>=L)return A}else for(var R=0;R<C.length;R++){var E=C[R];if(E!=Re&&(Oi(E)||(E=m(E)),E._score=rt,E._indexes.len=0,A.push(E),A.length>=L))return A}return A},p=(C,_,A=!1,L=!1)=>{if(A===!1&&C.containsSpace)return b(C,_,L);for(var R=C._lower,V=C.lowerCodes,E=V[0],D=_._targetLowerCodes,F=V.length,oe=D.length,se=0,ee=0,et=0;;){var je=E===D[ee];if(je){if(ke[et++]=ee,++se,se===F)break;E=V[se]}if(++ee,ee>=oe)return Re}var se=0,Qe=!1,le=0,ge=_._nextBeginningIndexes;ge===Re&&(ge=_._nextBeginningIndexes=B(_.target)),ee=ke[0]===0?0:ge[ke[0]-1];var hi=0;if(ee!==oe)for(;;)if(ee>=oe){if(se<=0||(++hi,hi>200))break;--se;var ut=_t[--le];ee=ge[ut]}else{var je=V[se]===D[ee];if(je){if(_t[le++]=ee,++se,se===F){Qe=!0;break}++ee}else ee=ge[ee]}var qe=F<=1?-1:_._targetLower.indexOf(R,ke[0]),te=!!~qe,Ne=te?qe===0||_._nextBeginningIndexes[qe-1]===qe:!1;if(te&&!Ne){for(var Y=0;Y<ge.length;Y=ge[Y])if(!(Y<=qe)){for(var lt=0;lt<F&&V[lt]===_._targetLowerCodes[Y+lt];lt++);if(lt===F){qe=Y,Ne=!0;break}}}var Be=ae=>{for(var fe=0,dg=0,ii=1;ii<F;++ii)ae[ii]-ae[ii-1]!==1&&(fe-=ae[ii],++dg);var Rv=ae[F-1]-ae[0]-(F-1);if(fe-=(12+Rv)*dg,ae[0]!==0&&(fe-=ae[0]*ae[0]*.2),!Qe)fe*=1e3;else{for(var Mr=1,ii=ge[0];ii<oe;ii=ge[ii])++Mr;Mr>24&&(fe*=(Mr-24)*10)}return fe-=(oe-F)/2,te&&(fe/=1+F*F*1),Ne&&(fe/=1+F*F*1),fe-=(oe-F)/2,fe};if(Qe)if(Ne){for(var Y=0;Y<F;++Y)ke[Y]=qe+Y;var gi=ke,Di=Be(ke)}else var gi=_t,Di=Be(_t);else{if(te)for(var Y=0;Y<F;++Y)ke[Y]=qe+Y;var gi=ke,Di=Be(gi)}_._score=Di;for(var Y=0;Y<F;++Y)_._indexes[Y]=gi[Y];_._indexes.len=F;let Uo=new r;return Uo.target=_.target,Uo._score=_._score,Uo._indexes=_._indexes,Uo},b=(C,_,A)=>{for(var L=new Set,R=0,V=Re,E=0,D=C.spaceSearches,F=D.length,oe=0,ee=()=>{for(let Ne=oe-1;Ne>=0;Ne--)_._nextBeginningIndexes[Pt[Ne*2+0]]=Pt[Ne*2+1]},et=!1,te=0;te<F;++te){ei[te]=rt;var je=D[te];if(V=p(je,_),A){if(V===Re)continue;et=!0}else if(V===Re)return ee(),Re;var se=te===F-1;if(!se){var Qe=V._indexes,le=!0;for(let Y=0;Y<Qe.len-1;Y++)if(Qe[Y+1]-Qe[Y]!==1){le=!1;break}if(le){var ge=Qe[Qe.len-1]+1,hi=_._nextBeginningIndexes[ge-1];for(let Y=ge-1;Y>=0&&hi===_._nextBeginningIndexes[Y];Y--)_._nextBeginningIndexes[Y]=ge,Pt[oe*2+0]=Y,Pt[oe*2+1]=hi,oe++}}R+=V._score/F,ei[te]=V._score/F,V._indexes[0]<E&&(R-=(E-V._indexes[0])*2),E=V._indexes[0];for(var ut=0;ut<V._indexes.len;++ut)L.add(V._indexes[ut])}if(A&&!et)return Re;ee();var qe=p(C,_,!0);if(qe!==Re&&qe._score>R){if(A)for(var te=0;te<F;++te)ei[te]=qe._score/F;return qe}A&&(V=_),V._score=R;var te=0;for(let Ne of L)V._indexes[te++]=Ne;return V._indexes.len=te,V},w=C=>C.replace(new RegExp("\\p{Script=Latin}+","gu"),_=>_.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),k=C=>{C=w(C);for(var _=C.length,A=C.toLowerCase(),L=[],R=0,V=!1,E=0;E<_;++E){var D=L[E]=A.charCodeAt(E);if(D===32){V=!0;continue}var F=D>=97&&D<=122?D-97:D>=48&&D<=57?26:D<=127?30:31;R|=1<<F}return{lowerCodes:L,bitflags:R,containsSpace:V,_lower:A}},T=C=>{for(var _=C.length,A=[],L=0,R=!1,V=!1,E=0;E<_;++E){var D=C.charCodeAt(E),F=D>=65&&D<=90,oe=F||D>=97&&D<=122||D>=48&&D<=57,ee=F&&!R||!V||!oe;R=F,V=oe,ee&&(A[L++]=E)}return A},B=C=>{C=w(C);for(var _=C.length,A=T(C),L=[],R=A[0],V=0,E=0;E<_;++E)R>E?L[E]=R:(R=A[++V],L[E]=R===void 0?_:R);return L},Z=new Map,_e=new Map,ke=[],_t=[],Pt=[],Bt=[],ei=[],$n=[],ti=[],sn=(C,_)=>{var A=C[_];if(A!==void 0)return A;if(typeof _=="function")return _(C);var L=_;Array.isArray(_)||(L=_.split("."));for(var R=L.length,V=-1;C&&++V<R;)C=C[L[V]];return C},Oi=C=>typeof C=="object"&&typeof C._bitflags=="number",Dr=1/0,rt=-Dr,Nr=[];Nr.total=0;var Re=null,jn=n(""),Lv=C=>{var _=[],A=0,L={},R=V=>{for(var E=0,D=_[E],F=1;F<A;){var oe=F+1;E=F,oe<A&&_[oe]._score<_[F]._score&&(E=oe),_[E-1>>1]=_[E],F=1+(E<<1)}for(var ee=E-1>>1;E>0&&D._score<_[ee]._score;ee=(E=ee)-1>>1)_[E]=_[ee];_[E]=D};return L.add=V=>{var E=A;_[A++]=V;for(var D=E-1>>1;E>0&&V._score<_[D]._score;D=(E=D)-1>>1)_[E]=_[D];_[E]=V},L.poll=V=>{if(A!==0){var E=_[0];return _[0]=_[--A],R(),E}},L.peek=V=>{if(A!==0)return _[0]},L.replaceTop=V=>{_[0]=V,R()},L},Mo=Lv();return{single:e,go:t,prepare:n,cleanup:o}})});function qC(s){let e=GC();if(!e)return!1;let t=25,i=20,n=Math.floor(t/2);
4e.font=n+"px Arial, Sans-Serif",e.textBaseline="top",e.canvas.width=i*2,e.canvas.height=t,e.clearRect(0,0,i*2,t),e.fillStyle="#FF0000",e.fillText(s,0,22),e.fillStyle="#0000FF",e.fillText(s,i,22);let o=e.getImageData(0,0,i,t).data,r=o.length,l=0;for(;l<r&&!o[l+3];l+=4);if(l>=r)return!1;let a=i+l/4%i,c=Math.floor(l/4/i),u=e.getImageData(a,c,1,1).data;if(o[l]!==u[0]||o[l+2]!==u[2])return!1;return!(e.measureText(s).width>=i)}function GC(){try{return document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch(s){return null}}var Gb,KC,XC,ys,YC,QC,JC,Kb,An,Ba,La,Ra,Fa,Oa,Da,Na,Ma,Ua,Ha,Ai,Wa,qb,Xb=M(()=>{U();j();at();Gb=mg(jb(),1);Me();z();re();KC={0:"default",1:"light",2:"medium-light",3:"medium",4:"medium-dark",5:"dark"},XC={"\u{1FA8E}":17,"\u{1FAE9}":16,"\u{1FAE8}":15.1,"\u{1FAE0}":14,"\u{1F636}\u200D\u{1F32B}\uFE0F":13.1,"\u{1F9D1}\u200D\u{1F4BB}":12.1,"\u{1F970}":11,"\u{1F92A}":5,"\u2695\uFE0F":4,"\u{1F923}":3,"\u{1F44B}\u{1F3FD}":2,"\u{1F600}":1,"\u{1F610}":.7,"\u{1F602}":.6},ys=24,YC=(()=>{class s extends f{_emojiCanvas=null;static get pluginName(){return"EmojiUtils"}static get isOfficialPlugin(){return!0}init(){this._emojiCanvas=document.createElement("canvas").getContext("2d")}isEmojiSupported(t,i,n){return t.version<=i?this.hasZwj(t.emoji)?this.isEmojiZwjSupported(t,n):!0:!1}getEmojiSupportedVersionByOs(){for(let[t,i]of Object.entries(XC))if(s._isEmojiSupported(t))return i;return 0}hasZwj(t){return t.includes("\u200D")}isEmojiZwjSupported(t,i){return this.getNodeWidthUsingCanvas(i,t.emoji)<ys*1.8?!0:this.getNodeWidth(i,t.emoji)<ys*1.8}getNodeWidth(t,i){let n=document.createElement("span");n.textContent=i,t.appendChild(n);let o=n.offsetWidth;return t.removeChild(n),o}getNodeWidthUsingCanvas(t,i){let n=getComputedStyle(t);return this._emojiCanvas.font=[n.fontStyle,n.fontVariant,n.fontWeight,`${ys}px`,`"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", ${n.fontFamily}`].join(" "),Math.ceil(this._emojiCanvas.measureText(i).width)}createEmojiWidthTestingContainer(){let t=document.createElement("div");return t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.whiteSpace="nowrap",t.style.fontSize=ys+"px",t}normalizeEmojiSkinTone(t){let i=N(I({},t),{skins:{default:t.emoji}});return t.skins&&t.skins.forEach(n=>{let o=KC[n.tone];i.skins[o]=n.emoji}),i}isEmojiCategoryAllowed(t){return t.group!==2}static _isEmojiSupported=qC}return s})(),QC="https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json",JC=16,Kb=(()=>{class s extends f{_items;_url;_repositoryPromise;static get requires(){return[YC]}static get pluginName(){return"EmojiRepository"}static get isOfficialPlugin(){return!0}constructor(t){super(t),t.config.define("emoji",{version:void 0,skinTone:"default",definitionsUrl:void 0,useCustomFont:!1}),this._url=this._getUrl(),this._repositoryPromise=new Promise(i=>{this._repositoryPromiseResolveCallback=i}),this._items=null}init(){return de(this,null,function*(){return this._warnAboutCdnUse(),yield this._loadAndCacheEmoji(),this._items=this._getItems(),this._items?this._repositoryPromiseResolveCallback(!0):(Q("emoji-repository-empty"),this._repositoryPromiseResolveCallback(!1))})}getEmojiByQuery(t){return this._items?t.split(/\s/).filter(Boolean).some(o=>o.length>=2)?Gb.default.go(t,this._items,{threshold:.6,keys:["emoticon","annotation",o=>t.split(/\s/).filter(Boolean).flatMap(a=>o.tags?.filter(c=>c.startsWith(a))).join()]}).map(o=>o.obj):[]:[]}getEmojiCategories(){let t=this._getItems();if(!t)return[];let{t:i}=this.editor.locale,n=[{title:i("Smileys & Expressions"),icon:"\u{1F604}",groupId:0},{title:i("Gestures & People"),icon:"\u{1F44B}",groupId:1},{title:i("Animals & Nature"),icon:"\u{1F43B}",groupId:3},{title:i("Food & Drinks"),icon:"\u{1F34E}",groupId:4},{title:i("Travel & Places"),icon:"\u{1F698}",groupId:5},{title:i("Activities"),icon:"\u{1F3C0}",groupId:6},{title:i("Objects"),icon:"\u{1F4A1}",groupId:7},{title:i("Symbols"),icon:"\u{1F535}",groupId:8},{title:i("Flags"),icon:"\u{1F3C1}",groupId:9}],o=gg(t,r=>r.group);return n.map(r=>N(I({},r),{items:o[r.groupId]}))}
4getSkinTones(){let{t}=this.editor.locale;return[{id:"default",icon:"\u{1F44B}",tooltip:t("Default skin tone")},{id:"light",icon:"\u{1F44B}\u{1F3FB}",tooltip:t("Light skin tone")},{id:"medium-light",icon:"\u{1F44B}\u{1F3FC}",tooltip:t("Medium Light skin tone")},{id:"medium",icon:"\u{1F44B}\u{1F3FD}",tooltip:t("Medium skin tone")},{id:"medium-dark",icon:"\u{1F44B}\u{1F3FE}",tooltip:t("Medium Dark skin tone")},{id:"dark",icon:"\u{1F44B}\u{1F3FF}",tooltip:t("Dark skin tone")}]}isReady(){return this._repositoryPromise}_getUrl(){let{definitionsUrl:t,version:i}=this.editor.config.get("emoji");if(!t||t==="cdn"){let n=i||JC,o=new URL(QC.replace("{version}",n.toString()));return o.searchParams.set("editorVersion",kg),o}return i&&Q("emoji-repository-redundant-version"),new URL(t)}_warnAboutCdnUse(){let t=this.editor,i=t.config.get("emoji"),n=t.config.get("licenseKey"),o=window[Symbol.for("cke distribution")];n!=="GPL"&&o!=="cloud"&&(i&&i.definitionsUrl||Q("emoji-repository-cdn-use"))}_getItems(){let t=s._results[this._url.href];return t&&t.length?t:null}_loadAndCacheEmoji(){return de(this,null,function*(){if(s._results[this._url.href])return;let t=yield fetch(this._url,{cache:"force-cache"}).then(i=>i.ok?i.json():[]).catch(()=>[]);s._results[this._url.href]=this._normalizeEmoji(t)})}_normalizeEmoji(t){let i=this.editor,n=i.config.get("emoji.useCustomFont"),o=i.plugins.get("EmojiUtils"),r=t.filter(u=>o.isEmojiCategoryAllowed(u));if(n)return r.map(u=>o.normalizeEmojiSkinTone(u));let l=o.getEmojiSupportedVersionByOs(),a=o.createEmojiWidthTestingContainer();document.body.appendChild(a);let c=r.filter(u=>o.isEmojiSupported(u,l,a)).map(u=>o.normalizeEmojiSkinTone(u));return a.remove(),c}static _results={}}return s})(),An=":",Ba=":__EMOJI_SHOW_ALL:",La=":__EMOJI_HINT:",Ra=class extends f{_emojiDropdownLimit;_skinTone;static get requires(){return[Kb,$i,"Mention"]}static get pluginName(){return"EmojiMention"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.editor.config.define("emoji",{dropdownLimit:6}),this._emojiDropdownLimit=e.config.get("emoji.dropdownLimit"),this._skinTone=e.config.get("emoji.skinTone"),this._setupMentionConfiguration(e)}_setupMentionConfiguration(e){let t=e.config.get("mergeFields.prefix"),i=e.config.get("mention.feeds"),n=t?t[0]===An:!1;if(i.filter(a=>!a._isEmojiMarker).some(a=>a.marker===An)||n){Q("emoji-config-marker-already-used",{marker:An});return}if(i.some(a=>a._isEmojiMarker))return;let l={_isEmojiMarker:!0,marker:An,dropdownLimit:this._emojiDropdownLimit,itemRenderer:this._customItemRendererFactory(this.editor.t),feed:this._queryEmojiCallbackFactory()};this.editor.config.set("mention.feeds",[...i,l])}init(){return de(this,null,function*(){let e=this.editor;this.emojiPickerPlugin=e.plugins.has("EmojiPicker")?e.plugins.get("EmojiPicker"):null,this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),this._isEmojiRepositoryAvailable=yield this.emojiRepositoryPlugin.isReady(),this._isEmojiRepositoryAvailable&&e.once("ready",this._overrideMentionExecuteListener.bind(this))})}_customItemRendererFactory(e){return t=>{let i=document.createElement("button");i.classList.add("ck"),i.classList.add("ck-button"),i.classList.add("ck-button_with-text"),i.id=`mention-list-item-id${t.id.slice(0,-1)}`,i.type="button",i.tabIndex=-1;let n=document.createElement("span");return n.classList.add("ck"),n.classList.add("ck-button__label"),i.appendChild(n),t.id===La?(i.classList.add("ck-list-item-button"),i.classList.add("ck-disabled"),n.textContent=e("Keep on typing to see the emoji.")):t.id===Ba?n.textContent=e("Show all emoji..."):n.textContent=`${t.text} ${t.id}`,i}}_overrideMentionExecuteListener(){let e=this.editor;e.commands.get("mention").on("execute",(t,i)=>{let n=i[0];if(n.marker===An&&(t.stop(),n.mention.id!==La))if(n.mention.id===Ba){let o=[...n.range.getItems()].filter(l=>
vendor: 8,740 bytes, line 4
4l.is("$textProxy")).map(l=>l.data).reduce((l,a)=>l+a,"");e.model.change(l=>{e.model.deleteContent(l.createSelection(n.range))});let r=this.emojiPickerPlugin;r.showUI(o.slice(1)),setTimeout(()=>{r.emojiPickerView.focus()})}else e.execute("insertText",{text:n.mention.text,range:n.range})},{priority:"high"})}_queryEmojiCallbackFactory(){return e=>{if(e.startsWith(" "))return[];if(e.startsWith(An))return[];if(!this._isEmojiRepositoryAvailable)return[];let t=this.emojiRepositoryPlugin.getEmojiByQuery(e).map(n=>{let o=n.skins[this._skinTone]||n.skins.default;return this.emojiPickerPlugin&&(o=n.skins[this.emojiPickerPlugin.skinTone]||n.skins.default),{id:`:${n.annotation}:`,text:o}});if(!this.emojiPickerPlugin)return t.slice(0,this._emojiDropdownLimit);let i={id:e.length>1?Ba:La};return[...t.slice(0,this._emojiDropdownLimit-1),i]}}},Fa=class extends v{refresh(){let t=this.editor.model,i=t.schema,n=t.document.selection;this.isEnabled=i.checkChild(n.getFirstPosition(),"$text")}execute(e=""){this.editor.plugins.get("EmojiPicker").showUI(e)}},Oa=class extends P{tiles;focusTracker;keystrokes;emojiCategories;cachedTiles;_getEmojiByQuery;constructor(e,{categoryName:t,emojiCategories:i,getEmojiByQuery:n,skinTone:o}){super(e),this.set("isEmpty",!0),this.set("categoryName",t),this.set("skinTone",o),this.tiles=this.createCollection(),this.cachedTiles=this.createCollection(),this.focusTracker=new J,this.keystrokes=new K,this._getEmojiByQuery=n,this.emojiCategories=i;let r=this.bindTemplate;this.setTemplate({tag:"div",children:[{tag:"div",attributes:{role:"grid",class:["ck","ck-emoji__grid"]},children:this.tiles}],attributes:{role:"tabpanel",class:["ck","ck-emoji__tiles",r.if("isEmpty","ck-hidden",l=>l)]}}),Dt({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>W.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy(),this.focusTracker.destroy()}focus(){let e=this.tiles.first;e&&e.focus()}filter(e){let{matchingItems:t,allItems:i}=e?this._getItemsByQuery(e.source):this._getItemsByCategory();return this._updateGrid(t),this.set("isEmpty",t.length===0),{resultsCount:t.length,totalItemsCount:i.length}}_getItemsByQuery(e){return{matchingItems:this._getEmojiByQuery(e),allItems:this.emojiCategories.flatMap(t=>t.items)}}_getItemsByCategory(){let e=this.emojiCategories.find(i=>i.title===this.categoryName),{items:t}=e;return{matchingItems:t,allItems:t}}_updateGrid(e){[...this.tiles].forEach(t=>{this.focusTracker.remove(t),this.tiles.remove(t)}),e.map(t=>{let i=t.skins[this.skinTone]||t.skins.default;return this.cachedTiles.get(i)||this._createTile(i,t.annotation)}).forEach(t=>{this.tiles.add(t),this.focusTracker.add(t)})}_createTile(e,t){let i=new y(this.locale);return i.viewUid=e,i.extendTemplate({attributes:{class:["ck-emoji__tile"]}}),i.set({label:e,tooltip:t,withText:!0,ariaLabel:t,ariaLabelledBy:void 0}),i.on("execute",()=>{this.fire("execute",{name:t,emoji:e})}),this.cachedTiles.add(i),i}},Da=class extends P{focusTracker;keystrokes;focusCycler;buttonViews;constructor(e,{emojiCategories:t,categoryName:i}){super(e),this.buttonViews=this.createCollection(t.map(n=>this._createCategoryButton(n))),this.focusTracker=new J,this.keystrokes=new K,this.focusCycler=new me({focusables:this.buttonViews,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__categories-list"],role:"tablist"},children:this.buttonViews}),this.on("change:categoryName",(n,o,r,l)=>{let a=this.buttonViews.find(u=>u.tooltip===l);a&&(a.isOn=!1);let c=this.buttonViews.find(u=>u.tooltip===r);c.isOn=!0}),this.set("categoryName",i)}render(){super.render(),this.buttonViews.forEach(e=>{this.focusTracker.add(e)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),this.buttonViews.destroy()}focus(){this.buttonViews.first.focus()}enableCategories(){this.buttonViews.forEach(e=>{e.isEnabled=!0})}disableCategories(){this.buttonViews.forEach(e=>{e.set({class:"",isEnabled:!1,isOn:!1})})}_createCategoryButton(e){let t=new y,i=t.bindTemplate;return t.extendTemplate({attributes:{"aria-selected":i.to("isOn",n=>n.toString()),class:["ck-emoji__category-item"]}}),t.set({ariaLabel:e.title,label:e.icon,role:"tab",tooltip:e.title,withText:!0,ariaLabelledBy:void 0}),t.on("execute",()=>{this.categoryName=e.title}),t.on("change:isEnabled",()=>{t.isEnabled&&t.tooltip===this.categoryName&&(t.isOn=!0)}),t}},Na=class extends P{inputView;gridView;constructor(e,{gridView:t,resultsView:i}){super(e),this.gridView=t;let n=e.t;this.inputView=new bp(this.locale,{queryView:{label:n("Find an emoji (min. 2 characters)"),creator:ce},filteredView:this.gridView,infoView:{instance:i}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search"],tabindex:"-1"},children:[this.inputView.queryView]}),this.inputView.delegate("search").to(this)}destroy(){super.destroy(),this.inputView.destroy()}search(e){let t=e?new RegExp(Wo(e),"ig"):null,i=this.gridView.filter(t);this.inputView.fire("search",I({query:e},i))}setInputValue(e){e?this.inputView.queryView.fieldView.value=e:this.inputView.queryView.fieldView.reset()}getInputValue(){return this.inputView.queryView.fieldView.element.value}focus(){this.inputView.focus()}},Ma=class extends P{dropdownView;_skinTones;constructor(e,{skinTone:t,skinTones:i}){super(e),this.set("skinTone",t),this._skinTones=i;let n=e.t,o=n("Select skin tone"),r=X(e),l=new ne;for(let{id:a,icon:c,tooltip:u}of this._skinTones){let d={type:"button",model:new we({value:a,label:c,ariaLabel:u,tooltip:u,tooltipPosition:"e",role:"menuitemradio",withText:!0,ariaLabelledBy:void 0})};d.model.bind("isOn").to(this,"skinTone",m=>m===a),l.add(d)}be(r,l,{ariaLabel:o,role:"menu"}),r.buttonView.set({label:this._getSkinTone().icon,ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),this.dropdownView=r,this.listenTo(r,"execute",a=>{this.skinTone=a.source.value}),r.buttonView.bind("label").to(this,"skinTone",()=>this._getSkinTone().icon),r.buttonView.bind("ariaLabel").to(this,"skinTone",()=>`${this._getSkinTone().tooltip}, ${o}`),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__skin-tone"]},children:[r]})}focus(){this.dropdownView.buttonView.focus()}_getSkinTone(){return this._skinTones.find(e=>e.id===this.skinTone)}},Ua=class extends P{items;focusTracker;keystrokes;focusCycler;searchView;toneView;categoriesView;gridView;infoView;constructor(e,{emojiCategories:t,getEmojiByQuery:i,skinTone:n,skinTones:o}){super(e);let r=t[0].title;this.gridView=new Oa(e,{categoryName:r,emojiCategories:t,getEmojiByQuery:i,skinTone:n}),this.infoView=new pp,this.searchView=new Na(e,{gridView:this.gridView,resultsView:this.infoView}),this.categoriesView=new Da(e,{emojiCategories:t,categoryName:r}),this.toneView=new Ma(e,{skinTone:n,skinTones:o}),this.items=this.createCollection([this.searchView,this.toneView,this.categoriesView,this.gridView,this.infoView]),this.focusTracker=new J,this.keystrokes=new K,this.focusCycler=new me({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[{tag:"div",children:[this.searchView,this.toneView],attributes:{class:["ck","ck-emoji__search"]}},this.categoriesView,this.gridView,{tag:"div",children:[this.infoView],attributes:{class:["ck","ck-search__results"]}}],attributes:{tabindex:"-1",class:["ck","ck-emoji","ck-search"]}}),this._setupEventListeners()}render(){super.render(),this.focusTracker.add(this.searchView.element),this.focusTracker.add(this.toneView.element),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.focusTracker.add(this.infoView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.searchView.focus()}_setupEventListeners(){let e=this.locale.t;this.searchView.on("search",(t,i)=>{i.query?this.categoriesView.disableCategories():this.categoriesView.enableCategories()}),this.searchView.on("search",(t,i)=>{i.query.length===1?this.infoView.set({primaryText:e("Keep on typing to see the emoji."),secondaryText:e("The query must contain at least two characters."),isVisible:!0}):i.resultsCount?this.infoView.set({isVisible:!1}):this.infoView.set({primaryText:e('No emojis were found matching "%0".',i.query
4),secondaryText:e("Please try a different phrase or check the spelling."),isVisible:!0})}),this.searchView.on("search",()=>{this.fire("update"),this.gridView.element.scrollTo(0,0)}),this.categoriesView.on("change:categoryName",(t,i,n)=>{this.gridView.categoryName=n,this.searchView.search("")}),this.toneView.on("change:skinTone",(t,i,n)=>{this.gridView.skinTone=n,this.searchView.search(this.searchView.getInputValue())})}},Ha=class extends P{backButtonView;focusTracker=new J;keystrokes=new K;children;_focusables=new ye;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.children=this.createCollection([this._createHeaderView()]),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form","ck-emoji-picker-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),[...this.children.filter(rp),this.backButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element),lp(t)&&this._focusCycler.chain(t.focusCycler)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){let e=this.locale.t,t=new Oe(this.locale,{label:e("Emoji picker")});return t.children.add(this.backButtonView,0),t}},Ai="emoji-picker",Wa=class extends f{static get requires(){return[Kb,Ce,Nt,$i]}static get pluginName(){return"EmojiPicker"}static get isOfficialPlugin(){return!0}init(){return de(this,null,function*(){let e=this.editor;if(this.balloonPlugin=e.plugins.get("ContextualBalloon"),this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),!(yield this.emojiRepositoryPlugin.isReady()))return;let t=new Fa(e);e.commands.add("emoji",t),e.ui.componentFactory.add("emoji",()=>{let i=this._createButton(y,t);return i.set({tooltip:!0}),i}),e.ui.componentFactory.add("menuBar:emoji",()=>this._createButton(x,t)),this._setupConversion()})}destroy(){super.destroy(),this.emojiPickerView&&this.emojiPickerView.destroy()}get skinTone(){return this.emojiPickerView?this.emojiPickerView.gridView.skinTone:this.editor.config.get("emoji.skinTone")}showUI(e=""){this._showFakeVisualSelection(),this.emojiPickerView||(this.emojiPickerView=this._createEmojiPickerView()),e&&this.emojiPickerView.searchView.setInputValue(e),this.emojiPickerView.searchView.search(e),this.emojiPickerFormView||(this.emojiPickerFormView=this._createEmojiPickerFormView()),this.balloonPlugin.hasView(this.emojiPickerFormView)||(this.emojiPickerFormView.backButtonView.isVisible=!!this.balloonPlugin.visibleView,this.balloonPlugin.add({view:this.emojiPickerFormView,position:this._getBalloonPositionData(),balloonClassName:"ck-emoji-picker-balloon"})),this.emojiPickerView.focus()}_createButton(e,t){let i=new e(this.editor.locale),n=this.editor.locale.t;return i.bind("isEnabled").to(t,"isEnabled"),i.set({label:n("Emoji"),icon:Qg,isToggleable:!0}),i.on("execute",()=>{this.editor.editing.view.scrollToTheSelection(),this.showUI()}),i}_createEmojiPickerView(){let e=new Ua(this.editor.locale,{emojiCategories:this.emojiRepositoryPlugin.getEmojiCategories(),skinTone:this.editor.config.get("emoji.skinTone"),skinTones:this.emojiRepositoryPlugin.getSkinTones(),getEmojiByQuery:t=>this.emojiRepositoryPlugin.getEmojiByQuery(t)});return this.listenTo(e.gridView,"execute",(t,i)=>{let n=this.editor,o=i.emoji;this._hideUI(),n.execute("insertText",{text:o})}),e}_createEmojiPickerFormView(){let e=new Ha(this.editor.locale);return e.children.add(this.emojiPickerView),this.listenTo(this.emojiPickerView,"update",()=>{this.balloonPlugin.visibleView===e&&this.balloonPlugin.updatePosition()}),this.listenTo(e,"cancel",()=>{this._hideUI()}),e.keystrokes.set("Esc",(t,i)=>{this._hideUI(),i()}),Xe({emitter:e,contextElements:[this.balloonPlugin.view.element],callback:()=>{this._hideUI(!1)},activator:()=>this.balloonPlugin.visibleView===e}),e}_hideUI(e=!0){this.balloonPlugin.remove(this.emojiPickerFormView),this.emojiPickerView.searchView.setInputValue(""),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection()}_setupConversion(){let e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:Ai,view:{classes:["ck-fake-emoji-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Ai,view:(t,{writer
vendor: 14,213 bytes, line 4
4:i})=>{if(!t.markerRange.isCollapsed)return null;let n=i.createUIElement("span");return i.addClass(["ck-fake-emoji-selection","ck-fake-emoji-selection_collapsed"],n),n}})}_getBalloonPositionData(){let e=this.editor.editing.view,t=e.document;return{target:()=>e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let i=e.document.selection.getFirstRange();if(e.markers.has(Ai))t.updateMarker(Ai,{range:i});else if(i.start.isAtEnd){let n=i.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:i});t.addMarker(Ai,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(Ai,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(Ai)&&e.change(t=>{t.removeMarker(Ai)})}},qb=class extends f{static get requires(){return[Ra,Wa]}static get pluginName(){return"Emoji"}static get isOfficialPlugin(){return!0}}});var Yb,Qb=M(()=>{U();Ci();kn();Ip();at();us();z();Yb=class extends f{static get requires(){return[ap,yn,li,Cp,ls,$i,vn]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}});function Zb(s,e){let t={before:-1,same:0,after:1,different:1};return s.document.getRootNames().flatMap(i=>e.filter(n=>n.marker.getStart().root.rootName===i).sort((n,o)=>t[n.marker.getStart().compareWith(o.marker.getStart())]))}function ZC(s,e){let t=s.find(({marker:i})=>e.getStart().isBefore(i.getStart()));return t?s.getIndex(t):s.length}function eI(s){let e=s.length-1,t=s.index;return s.length===3&&(t+=s[1].length),{label:s[e],start:t,end:t+s[e].length}}var za,$a,ja,qa,vs,Ga,Ka,Cs,Xa,Ya,tI,Qa,Jb,ew=M(()=>{U();re();z();j();Me();za=class extends P{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(e){super(e);let t=e.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(i,n)=>i>0&&!n),this._findInputView=this._createInputField(t("Find in text\u2026")),this._findPrevButtonView=this._createButton({label:t("Previous result"),class:"ck-button-prev",icon:xe,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:t("Next result"),class:"ck-button-next",icon:xe,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(t("Replace with\u2026"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:t("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:t("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:t("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new J,this._keystrokes=new K,this._focusables=new ye,this.focusCycler=new me({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){let e=this.locale,t=e.t,i=new P(e);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:n})=>n),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:n})=>n),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:n},o)=>n&&o),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(n,o)=>n||!o?"":t("Tip: Find some text first in order to replace it.")),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(!this._textToFind){let e=this.t;this._findInputView.errorText=e("Text to find must not be empty.");return}this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){let e=this.locale,t=e.t,i=this.bindTemplate,n=new P(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(r,l)=>t("%0 of %1",[r,l])),n.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});let o=()=>{let r=this._findInputView.fieldView.element;if(!r||!Eg(r))return;let l=new ie(n.element).width,a=e.uiLanguageDirection==="ltr"?"paddingRight":"paddingLeft";l?r.style[a]=`calc( 2 * var(--ck-spacing-standard) + ${l}px )`:r.style[a]=""};this.on("change:_resultsCounterText",o,{priority:"low"}),this.on("change:isDirty",o,{priority:"low"}),this._findInputView.template.children[0].children.push(n)}_createAdvancedOptionsCollapsible(){let e=this.locale.t,t=new fn(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e("Advanced options"),isCollapsed:!0}),t}_createActionButtonsDiv(){let e=new P(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:t},i)=>t&&i),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:t},i)=>t&&i),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),e.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),e}_createMatchCaseSwitch(){let e=this.locale.t,t=new si(this.locale);return t.set({label:e("Match case"),withText:!0}),t.bind("isOn").to(this,"_matchCase"),t.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),t}_createWholeWordsOnlySwitch(){let e=this.locale.t,t=new si(this.locale);return t.set({label:e("Whole words only"),withText:!0}),t.bind("isOn").to(this,"_wholeWordsOnly"),t.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),t}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(t=>{this._focusables.add(t),this._focusTracker.add(t.element)})}_initKeystrokeHandling(){let e=i=>i.stopPropagation(),t=i=>{i.stopPropagation(),i.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",i=>{t(i),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",i=>{t(i),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",i=>{let n=i.target;n===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(i)):n===this._replaceInputView.fieldView.element&&!this.isDirty&&(this._replaceButtonView.fire("execute"),t(i))}),this._keystrokes.set("shift+enter",i=>{i.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(i))}),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e)}_createButton(e){let t=new y(this.locale);return t.set(e),t}_createInputField(e,t){let i=new H(this.locale,ce);return i.label=e,i.class=t,i}},$a=class extends f{static get requires(){return[Nt]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}formView;constructor(e){super(e),e.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){let e=this.editor,t=e.config.get("findAndReplace.uiType")==="dropdown",i=e.commands.get("find"),n=this.editor.t;e.ui.componentFactory.add("findAndReplace",()=>{let o;return t?(o=this._createDropdown(),o.bind("isEnabled").to(i)):o=this._createDialogButtonForToolbar(),e.keystrokes.set("Ctrl+F",(r,l)=>{if(i.isEnabled){if(o instanceof dp){let a=o.buttonView;a.isOn||a.fire("execute")}else o.isOn?e.plugins.get("Dialog").view.focus():o.fire("execute");l()}}),o}),t||e.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){let e=this.editor,t=e.locale.t,i=X(e.locale);return i.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new Oe(e.locale,{label:t("Find and replace")}),0),i.panelView.children.add(this.formView)}),i.on("change:isOpen",(n,o,r)=>{r?this._setupFormView():this.fire("searchReseted")},{priority:"low"}),i.buttonView.set({icon:Jr,label:t("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),i}_createDialogButtonForToolbar(){let e=this.editor,t=this._createButton(y),i=e.plugins.get("Dialog");return t.set({tooltip:!0}),t.bind("isOn").to(i,"id",n=>n==="findAndReplace"),t.on("execute",()=>{t.isOn?i.hide():this._showDialog()}),t}_createDialogButtonForMenuBar(){let e=this._createButton(x),t=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return e.set({role:"menuitemcheckbox",isToggleable:!0}),e.bind("isOn").to(i,"id",n=>n==="findAndReplace"),e.on("execute",()=>{if(t.id==="findAndReplace"){t.hide();return}this._showDialog()}),e}_createButton(e){let t=this.editor,i=t.commands.get("find"),n=new e(t.locale),o=t.locale.t;return n.bind("isEnabled").to(i),n.set({icon:Jr,label:o("Find and replace"),keystroke:"CTRL+F"}),n}_showDialog(){let e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.formView||(this.formView=this._createFormView()),t.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:zi.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){let e=this.editor,t=new(mt(za))(e.locale),i=e.commands,o=this.editor.plugins.get("FindAndReplaceEditing").state;t.bind("highlightOffset").to(o,"highlightedOffset"),t.listenTo(o.results,"change",()=>{t.matchCount=o.results.length});let r=i.get("findNext"),l=i.get("findPrevious"),a=i.get("replace"),c=i.get("replaceAll");return t.bind("_areCommandsEnabled").to(r,"isEnabled",l,"isEnabled",a,"isEnabled",c,"isEnabled",(u,d,m,h)=>({findNext:u,findPrevious:d,replace:m,replaceAll:h})),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",(u,d,m)=>{m&&this.fire("searchReseted")}),t}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}},ja=class extends v{_state;constructor(e,t){super(e),this.isEnabled=!0,this.affectsData=!1,this._state=t}execute(e,{matchCase:t,wholeWords:i}={}){let{editor:n}=this,{model:o}=n,r=n.plugins.get("FindAndReplaceUtils"),l,a="";typeof e=="string"?l=(...d)=>({results:r.findByTextCallback(e,{matchCase:t,wholeWords:i})(...d),searchText:e}):l=e;let c=l;l=(...d)=>{let m=c(...d);return m&&"searchText"in m&&(a=m.searchText),m};let u=o.document.getRootNames().reduce((d,m)=>r.updateFindResultFromRange(o.createRangeIn(o.document.getRoot(m)),o,l,d),null);return this._state.clear(o),this._state.results.addMany(u),this._state.highlightedResult=u.get(0),this._state.searchText=a,l&&(this._state.lastSearchCallback=l),this._state.matchCase=!!t,this._state.matchWholeWords=!!i,{results:u,findCallback:l}}},qa=class extends an(){constructor(e){super(),this.set("results",new ne),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(t,{removed:i,index:n})=>{if(Array.from(i).length){let o=!1;if(e.change(r=>{for(let l of i)this.highlightedResult===l&&(o=!0),e.markers.has(l.marker.name)&&r.removeMarker(l.marker)}),o){let r=n>=this.results.length?0:n;this.highlightedResult=this.results.get(r)}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset(e)})}clear(e){this.searchText="",e.change(t=>{if(this.highlightedResult){let i=this.highlightedResult.marker.name.split(":")[1],n=e.markers.get(`findResultHighlighted:${i}`);n&&t.removeMarker(n)}
4[...this.results].forEach(({marker:i})=>{t.removeMarker(i)})}),this.results.clear()}refreshHighlightOffset(e){let{highlightedResult:t,results:i}=this;t?this.highlightedOffset=Zb(e,[...i]).indexOf(t)+1:this.highlightedOffset=0}};vs=class extends v{_state;constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this._isEnabledBasedOnSelection=!1}_replace(e,t){let{model:i}=this.editor,n=t.marker.getRange();i.canEditAt(n)&&i.change(o=>{if(n.root.rootName==="$graveyard"){this._state.results.remove(t);return}let r={};for(let l of n.getItems())if(l.is("$text")||l.is("$textProxy")){r=l.getAttributes();break}i.insertContent(o.createText(e,r),n),this._state.results.has(t)&&this._state.results.remove(t)})}},Ga=class extends vs{execute(e,t){let i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){let n=Zb(this.editor.model,[...this._state.results]);this._state.highlightedResult=n[i%n.length]}}},Ka=class extends vs{execute(e,t){let{editor:i}=this,{model:n}=i,o=i.plugins.get("FindAndReplaceUtils"),r=t instanceof ne?t:n.document.getRootNames().reduce((l,a)=>o.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(a)),n,o.findByTextCallback(t,this._state),l),null);r.length&&n.change(()=>{[...r].forEach(l=>{this._replace(e,l)})})}},Cs=class extends v{_state;constructor(e,t){super(e),this.affectsData=!1,this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){let e=this._state.results,t=e.getIndex(this._state.highlightedResult),i=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(i)}},Xa=class extends Cs{execute(){let t=this._state.results.getIndex(this._state.highlightedResult),i=t-1<0?this._state.results.length-1:t-1;this._state.highlightedResult=this._state.results.get(i)}},Ya=class extends f{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(e,t,i,n){let o=n||new ne,r=l=>o.find(a=>{let{marker:c}=a,u=c.getRange(),d=l.getRange();return u.isEqual(d)});return t.change(l=>{[...e].forEach(({type:a,item:c})=>{if(a==="elementStart"&&t.schema.checkChild(c,"$text")){let u=i({item:c,text:this.rangeToText(t.createRangeIn(c))});if(!u)return;"results"in u&&(u=u.results),u.forEach(d=>{let m=`findResult:${yt()}`,h=l.addMarker(m,{usingOperation:!1,affectsData:!1,range:l.createRange(l.createPositionAt(c,d.start),l.createPositionAt(c,d.end))}),g=ZC(o,h);r(h)||o.add({id:m,label:d.label,marker:h},g)})}})}),o}rangeToText(e){return Array.from(e.getItems({shallow:!0})).reduce((t,i)=>i.is("$text")||i.is("$textProxy")?t+i.data:`${t}
5`,"")}findByTextCallback(e,t){let i="gu";t.matchCase||(i+="i");let n=`(${Wo(e)})`;if(t.wholeWords){let l="[^a-zA-Z\xC0-\u024F\u1E00-\u1EFF]";new RegExp("^"+l).test(e)||(n=`(^|${l}|_)${n}`),new RegExp(l+"$").test(e)||(n=`${n}(?=_|${l}|$)`)}let o=new RegExp(n,i);function r({text:l}){return[...l.matchAll(o)].map(eI)}return r}};tI="ck-find-result_selected",Qa=class extends f{static get requires(){return[Ya]}static get pluginName(){return"FindAndReplaceEditing"}static get licenseFeatureCode(){return"FAR"}static get isPremiumPlugin(){return!0}static get isOfficialPlugin(){return!0}state;init(){this.state=new qa(this.editor.model),this.set("_isSearchActive",!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",(i,n,o,r)=>{let{model:l}=this.editor;l.change(a=>{if(r){let c=r.marker.name.split(":")[1],u=l.markers.get(`findResultHighlighted:${c}`);u&&a.removeMarker(u)}if(o){let c=o.marker.name.split(":")[1];a.addMarker(`findResultHighlighted:${c}`,{usingOperation:!1,affectsData:!1,range:o.marker.getRange()})}})});let t=kt(((i,n,o)=>{if(o){let r=this.editor.editing.view.domConverter,l=this.editor.editing.mapper.toViewRange(o.marker.getRange());xg({target:r.viewRangeToDom(l),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",t,{priority:"low"}),this.listenTo(this.editor,"destroy",t.cancel),this.on("change:_isSearchActive",(i,n,o)=>{o?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange)})}find(e,t){return this._isSearchActive=!0,this.editor.execute("find",e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add("find",new ja(this.editor,this.state)),this.editor.commands.add("findNext",new Cs(this.editor,this.state)),this.editor.commands.add("findPrevious",new Xa(this.editor,this.state)),this.editor.commands.add("replace",new Ga(this.editor,this.state)),this.editor.commands.add("replaceAll",new Ka(this.editor,this.state))}_defineConverters(){let{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:t})=>{let[,i]=t.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":i}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:t})=>{let[,i]=t.split(":");return{name:"span",classes:[tI],attributes:{"data-find-result":i}}}})}_onDocumentChange=()=>{let e=new Set,t=new Set,i=this.editor.model,{results:n}=this.state,o=i.document.differ.getChanges(),r=i.document.differ.getChangedMarkers();o.forEach(c=>{c.position&&(c.name==="$text"||c.position.nodeAfter&&i.schema.isInline(c.position.nodeAfter)?(e.add(c.position.parent),[...i.markers.getMarkersAtPosition(c.position)].forEac
5h(u=>{t.add(u.name)})):c.type==="insert"&&c.position.nodeAfter&&e.add(c.position.nodeAfter))}),r.forEach(({name:c,data:{newRange:u}})=>{u&&u.start.root.rootName==="$graveyard"&&t.add(c)}),e.forEach(c=>{[...i.markers.getMarkersIntersectingRange(i.createRangeIn(c))].forEach(d=>t.add(d.name))}),t.forEach(c=>{n.has(c)&&(n.get(c)===this.state.highlightedResult&&(this.state.highlightedResult=null),n.remove(c))});let l=[],a=this.editor.plugins.get("FindAndReplaceUtils");e.forEach(c=>{let u=a.updateFindResultFromRange(i.createRangeOn(c),i,this.state.lastSearchCallback,n);l.push(...u)}),r.forEach(c=>{if(c.data.newRange){let u=a.updateFindResultFromRange(c.data.newRange,i,this.state.lastSearchCallback,n);l.push(...u)}}),!this.state.highlightedResult&&l.length?this.state.highlightedResult=l[0]:this.state.refreshHighlightOffset(i)}},Jb=class extends f{static get requires(){return[Qa,$a]}static get pluginName(){return"FindAndReplace"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),i=t.state;e.on("findNext",(n,o)=>{o?(i.searchText=o.searchText,t.find(o.searchText,o)):this.editor.execute("findNext")}),e.on("findPrevious",(n,o)=>{o&&i.searchText!==o.searchText?t.find(o.searchText):this.editor.execute("findPrevious")}),e.on("replace",(n,o)=>{i.searchText!==o.searchText&&t.find(o.searchText);let r=i.highlightedResult;r&&this.editor.execute("replace",o.replaceText,r)}),e.on("replaceAll",(n,o)=>{i.searchText!==o.searchText&&t.find(o.searchText),this.editor.execute("replaceAll",o.replaceText,i.results)}),e.on("searchReseted",()=>{i.clear(this.editor.model),t.stop()})}}});function ow(s,e){let t={model:{key:s,values:[]},view:{},upcastAlso:{}};for(let 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 sw(s){return e=>nI(e.getStyle(s))}function rw(s){return(e,{writer:t})=>t.createAttributeElement("span",{style:`${s}:${e}`},{priority:7})}function iI({dropdownView:s,colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:n,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:l}){let a=s.locale,c=new lo(a,{colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:n,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:l});return s.colorSelectorView=c,s.panelView.children.add(c),c}function nI(s){return s.replace(/\s/g,"")}function lw(s){return s.map(oI).filter(e=>e!==void 0)}function Za(s){return s.replace(/["']/g,"").split(",").map(e=>e.trim())}function oI(s){if(typeof s=="object")return s;if(s==="default")return{title:"Default",model:void 0};if(typeof s=="string")return sI(s)}function sI(s){let e=Za(s),t=e[0],i=e.map(rI).join(", ");return{title:t,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}function rI(s){return s=s.trim(),s.indexOf(" ")>0&&(s=`'${s}'`),s}function lI(s,e){let t=new ne;for(let i of s){let n={type:"button",model:new we({commandName:ot,commandParam:i.model,label:i.title,role:"menuitemradio",withText:!0})};n.model.bind("isOn").to(e,"value",o=>{if(o===i.model)return!0;if(!o||!i.model)return!1;let r=Za(o)[0].toLowerCase(),l=Za(i.model)[0].toLowerCase();return r===l}),i.view&&typeof i.view!="string"&&i.view.styles&&n.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),t.add(n)}return t}function xn(s){return s.map(e=>aI(e)).filter(e=>e!==void 0)}function aI(s){if(typeof s=="number"&&(s=String(s)),typeof s=="object"&&dI(s))return oc(s);let e=uI(s);if(e)return oc(e);if(s==="default")return{model:void 0,title:"Default"};if(!mI(s))return cI(s)}function cI(s){return typeof s=="string"&&(s={title:s,model:`${parseFloat(s)}px`}),s.view={name:"span",styles:{"font-size":s.model}},oc(s)}function oc(s){return s.view&&typeof s.view!="string"&&!s.view.priority&&(s.view.priority=7),s}function uI(s){return typeof s=="string"?tw[s]:tw[s.model]}function dI(s){return s.title&&s.model&&s.view}function mI(s){let e;if(typeof s=="object")if(s.model)e=parseFloat(s.model);else throw new S("font-size-invalid-definition",null,s);else e=parseFloat(s);return isNaN(e)}function hI(s,e){let t=new ne;for(let i of s){let n={type:"button",model:new we({commandName:nt,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&typeof i.view!="string"&&(i.view.styles&&n.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view.classes&&n.model.set("class",`${n.model.class} ${i.view.classes}`)),n.model.bind("isOn").to(e,"value",o=>o===i.model),t.add(n)}return t}var En,nt,ot,jt,ci,Ja,ec,tc,ic,nc,tw,iw,sc,rc,lc,ac,cc,Is,uc,dc,mc,hc,gc,fc,nw,pc=M(()=>{U();
vendor: 15,415 bytes, lines 5-8
5ve();z();j();re();En=class extends v{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){let 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={}){let t=this.editor.model,n=t.document.selection,o=e.value,r=e.batch,l=a=>{if(n.isCollapsed)o?a.setSelectionAttribute(this.attributeKey,o):a.removeSelectionAttribute(this.attributeKey);else{let c=t.schema.getValidRanges(n.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(let u of c){let d=u,m=this.attributeKey;u.isCollapsed&&(d=u.start.parent,m=pi._getStoreAttributeKey(this.attributeKey)),o?a.setAttribute(m,o,d):a.removeAttribute(m,d)}}};r?t.enqueueChange(r,a=>{l(a)}):t.change(a=>{l(a)})}},nt="fontSize",ot="fontFamily",jt="fontColor",ci="fontBackgroundColor";Ja=class extends En{constructor(e){super(e,ot)}};ec=class extends f{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(ot,{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(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:ot}),e.model.schema.setAttributeProperties(ot,{isFormatting:!0,copyOnEnter:!0});let t=lw(e.config.get("fontFamily.options")).filter(n=>n.model),i=ow(ot,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(ot,new Ja(e))}_prepareAnyValueConverters(){let e=this.editor;e.conversion.for("downcast").attributeToElement({model:ot,view:(t,{writer:i})=>i.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:ot,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:ot,value:t=>t.getAttribute("face")}})}},tc=class extends f{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(ot),o=t("Font Family"),r=lI(i,n);e.ui.componentFactory.add(ot,l=>{let a=X(l);return be(a,r,{role:"menu",ariaLabel:o}),a.buttonView.set({label:o,icon:Zr,tooltip:!0}),a.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),a.bind("isEnabled").to(n),this.listenTo(a,"execute",c=>{e.execute(c.source.commandName,{value:c.source.commandParam}),e.editing.view.focus()}),a}),e.ui.componentFactory.add(`menuBar:${ot}`,l=>{let a=new Ie(l);a.buttonView.set({label:o,icon:Zr}),a.bind("isEnabled").to(n);let c=new He(l);for(let u of r){let d=new De(l,a),m=new x(l);m.set({role:"menuitemradio",isToggleable:!0}),m.bind(...Object.keys(u.model)).to(u.model),m.delegate("execute").to(a),m.on("execute",()=>{e.execute(u.model.commandName,{value:u.model.commandParam}),e.editing.view.focus()}),d.children.add(m),c.items.add(d)}return a.panelView.children.add(c),a})}_getLocalizedOptions(){let e=this.editor,t=e.t;return lw(e.config.get(ot).options).map(n=>(n.title==="Default"&&(n.title=t("Default")),n))}};ic=class extends f{static get requires(){return[ec,tc]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}},nc=class extends En{constructor(e){super(e,nt)}};tw={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}}}};iw=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"],sc=class extends f{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(nt,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:nt}),e.model.schema.setAttributeProperties(nt,{isFormatting:!0,copyOnEnter:!0});let t=e.config.get("fontSize.supportAllValues"),i=xn(this.editor.config.get("fontSize.options")).filter(o=>o.model),n=ow(nt,i);t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(nt,new nc(e))}_prepareAnyValueConverters(e){let t=this.editor,i=e.model.values.filter(n=>!Xn(String(n))&&!Ko(String(n)));if(i.length)throw new S("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:nt,view:(n,{writer:o})=>{if(n)return o.createAttributeElement("span",{style:"font-size:"+n},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:nt,value:n=>n.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:nt,value:t=>{let i=t.getAttribute("size"),n=i[0]==="-"||i[0]==="+",o=parseInt(i,10);n&&(o=3+o);let r=iw.length-1,l=Math.min(Math.max(o,0),r);return iw[l]}}})}},rc=class extends f{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(nt),o=t("Font Size"),r=hI(i,n);e.ui.componentFactory.add(nt,l=>{let a=X(l);return be(a,r,{role:"menu",ariaLabel:o}),a.buttonView.set({label:o,icon:ol,tooltip:!0}),a.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),a.bind("isEnabled").to(n),this.listenTo(a,"execute",c=>{e.execute(c.source.commandName,{value:c.source.commandParam}),e.editing.view.focus()}),a}),e.ui.componentFactory.add(`menuBar:${nt}`,l=>{let a=new Ie(l);a.buttonView.set({label:o,icon:ol}),a.bind("isEnabled").to(n);let c=new He(l);for(let u of r){let d=new De(l,a),m=new x(l);m.set({role:"menuitemradio",isToggleable:!0}),m.bind(...Object.keys(u.model)).to(u.model),m.delegate("execute").to(a),m.on("execute",()=>{e.execute(u.model.commandName,{value:u.model.commandParam}),e.editing.view.focus()}),d.children.add(m),c.items.add(d)}return a.panelView.children.add(c),a})}_getLocalizedOptions(){let e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return xn(e.config.get(nt).options).map(o=>{let r=i[o.title];return r&&r!=o.title&&(o=Object.assign({},o,{title:r})),o})}};lc=class extends f{static get requires(){return[sc,rc]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return xn(e)}},ac=class extends En{constructor(e){super(e,jt)}},cc=class extends f{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(jt,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:jt,value:sw("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:jt,value:t=>t.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:jt,view:rw("color")}),e.commands.add(jt,new ac(e)),e.model.schema.extend("$text",{allowAttributes:jt}),e.model.schema.setAttributeProperties(jt,{isFormatting:!0,copyOnEnter:!0})}},Is=class extends f{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:t,componentName:i,icon:n,dropdownLabel:o}){super(e),this.commandName=t,this.componentName=i,this.icon=n,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){let e=this.editor,t=e.locale,i=t.t,n=e.commands.get(this.commandName),o=e.config.get(this.componentName),r=At(o.colors),l=Tt(t,r),a=o.documentColors,c=o.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,u=>{let d=X(u),m=!1,h=iI({dropdownView:d,colors:l.map(g=>({label:g.label,color:g.model,options:{hasBorder:g.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:a!==0?i("Document colors"):"",documentColorsCount:a===void 0?this.columns:a,colorPickerViewConfig:c?o.colorPicker||{}:!1});return h.bind("selectedColor").to(n,"value"),d.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),d.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),d.bind("isEnabled").to(n),h.on("execute",(g,p)=>{d.isOpen&&e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),p.source!=="colorPicker"&&e.editing.view.focus(),p.source==="colorPickerSaveButton"&&(d.isOpen=!1)}),h.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),h.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(d.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),d.on("change:isOpen",(g,p,b)=>{m||(m=!0,d.colorSelectorView.appendUI()),b&&(a!==0&&h.updateDocumentColors(e.model,this.componentName),h.updateSelectedColors(),h.showColorGridsFragment())}),ns(d,()=>d.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(g=>g.isOn)),d}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,u=>{let d=new Ie(u);d.buttonView.set({label:this.dropdownLabel,icon:this.icon}),d.bind("isEnabled").to(n);let m=!1,h=new lo(u,{colors:l.map(g=>({label:g.label,color:g.model,options:{hasBorder:g.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:a!==0?i("Document colors"):"",documentColorsCount:a===void 0?this.columns:a,colorPickerViewConfig:!1});return h.bind("selectedColor").to(n,"value"),h.delegate("execute").to(d),h.on("execute",(g,p)=>{e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),e.editing.view.focus()}),d.on("change:isOpen",(g,p,b)=>{m||(m=!0,h.appendUI()),b&&(a!==0&&h.updateDocumentColors(e.model,this.componentName),h.updateSelectedColors(),h.showColorGridsFragment())}),d.panelView.children.add(h),d})}},uc=class extends Is{constructor(e){let t=e.locale.t;super(e,{commandName:jt,componentName:jt,icon:Gf,dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}},dc=class extends f{static get requires(){return[cc,uc]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}},mc=class extends En{constructor(e){super(e,ci)}},hc=class extends f{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(ci,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(Yn),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:ci,value:sw("background-color")}}),e.conversion.for("downcast").attributeToElement({model:ci,view:rw("background-color")}),e.commands.add(ci,new mc(e)),e.model.schema.extend("$text",{allowAttributes:ci}),e.model.schema.setAttributeProperties(ci,{isFormatting:!0,copyOnEnter:!0})}},gc=class extends Is{constructor(e){let t=e.locale.t;super(e,{commandName:ci,componentName:ci,icon:Kf,dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}},fc=class extends f{static get requires(){return[hc,gc]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}},nw=class extends f{static get requires(){return[ic,lc,dc,fc]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}}});function gI(s){return s.constructor.editorName==="ClassicEditor"}function fI(s){return s.constructor.editorName==="DecoupledEditor"}var aw,wo,bc,wc,_c,Ts,cw,kc,uw,dw=M(()=>{U();j();z();re();re();aw=28,wo=class{_placeholderMap;_wrapper=null;_document;_annotationsUIsData=null;_paginationBodyCollection=null;_hasLeftCollapseButton=!1;_collapseLeftSidebarButton=null;_resizeObserver=null;_sidebarsWidths={left:0,right:0};_keepLeftSidebarHidden=!1;_forceShowLeftSidebar=!1;_sourceEditingCallback=(e,t,i)=>{this.getWrapper().querySelector(".ck-fullscreen__document-outline-header").style.display=i?"none":""};_hiddenElements=new Map;_savedAncestorsScrollPositions=new Map;_showRevisionViewerCallback=null;_closeRevisionViewerCallback=null;_aiTabsData=null;constructor(e){this._placeholderMap=new Map,e.plugins.has("RevisionHistory")&&(this._showRevisionViewerCallback=e.config.get("revisionHistory").showRevisionViewerCallback,this._closeRevisionViewerCallback=e.config.get("revisionHistory").closeRevisionViewerCallback),this._editor=e,this._document=this._editor.sourceElement?this._editor.sourceElement.ownerDocument:W.document,this._editor.config.define("fullscreen.container",this._document.body),e.on("destroy",()=>{this._wrapper&&this.destroy(),this._resizeObserver&&this._resizeObserver.destroy()})}moveToFullscreen(e,t){let i=Te(this._document,"div");i.setAttribute("data-ck-fullscreen-placeholder",t),e.replaceWith(i),this.getWrapper().querySelector(`[data-ck-fullscreen="${t}"]`).append(e),this._placeholderMap.set(t,{placeholderElement:i,movedElement:e})}restoreMovedElementLocation(e){if(!this._placeholderMap.has(e))return;let{placeholderElement:t,movedElement:i}=this._placeholderMap.get(e);t.replaceWith(i),t.remove(),this._placeholderMap.delete(e),this._placeholderMap.size===0&&this._destroyContainer()}getWrapper(){return this._wrapper||(this._wrapper=Te(this._document,"div",{class:"ck ck-fullscreen__main-wrapper"}),this._wrapper.innerHTML=`
6				<div class="ck ck-fullscreen__top-wrapper ck-reset_all">
7					<div class="ck ck-fullscreen__menu-bar" data-ck-fullscreen="menu-bar"></div>
8					<div class="ck ck-fullscreen__toolbar" data-ck-fullscreen="toolbar"></div>
9				</div>
10				<div class="ck ck-fullscreen__editable-wrapper">
11					<div class="ck ck-fullscreen__sidebar ck-fullscreen__left-sidebar" data-ck-fullscreen="left-sidebar"></div>
12					<div class="ck ck-fullscreen__editable" data-ck-fullscreen="editable">
13						<div class="ck ck-fullscreen__pagination-view" data-ck-fullscreen="pagination-view"></div>
14					</div>
15					<div class="ck ck-fullscreen__sidebar ck-fullscreen__right-sidebar" data-ck-fullscreen="right-sidebar"></div>
16					<div class="ck ck-fullscreen__right-edge" data-ck-fullscreen="right-edge"></div>
17				</div>
18				<div class="ck ck-fullscreen__bottom-wrapper">
19					<div class="ck ck-fullscreen__body-wrapper" data-ck-fullscreen="body-wrapper"></div>
20				</div>
21			`,this._editor.config.get("fullscreen.container").appendChild(this._wrapper)),this._wrapper}enable(){this._saveAncestorsScrollPositions(this._editor.ui.getEditableElement()),this.defaultOnEnter(),this._editor.config.get("fullscreen.container")===this._document.body&&(this._document.body.classList.add("ck-fullscreen"),this._document.body.parentElement.classList.add("ck-fullscreen"));this._editor.plugins.has("PresenceListUI")&&this._generatePresenceListContainer();this._editor.plugins.has("DocumentOutlineUI")&&this._generateDocumentOutlineContainer(),this._hasLeftCollapseButton&&this._generateCollapseButton();if(this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled){let e=this._editor.plugins.get("PaginationRenderer");e.setupScrollableAncestor(),this._paginationBodyCollection=new cp(this._editor.locale),this._paginationBodyCollection.attachToDom(),e.linesRepository.setViewCollection(this._paginationBodyCollection),this._editor.once("destroy",()=>{this._paginationBodyCollection.detachFromDom()}),this.moveToFullscreen(this._paginationBodyCollection.bodyCollectionContainer,"body-wrapper")}if(this._editor.plugins.has("AnnotationsUIs")&&this._overrideAnnotationsUIs(),this._editor.plugins.has("RevisionHistory")){this._editor.plugins.get("RevisionHistory").isRevisionViewerOpen&&this._editor.config.get("revisionHistory.closeRevisionViewerCallback")(),this._overrideRevisionHistoryCallbacks()}this._editor.plugins.has("AITabs")&&this._handleAITabsTransfer(),this._editor.plugins.has("SourceEditing")&&this._editor.plugins.has("DocumentOutlineUI")&&this._editor.plugins.get("SourceEditing").on("change:isSourceEditingMode",this._sourceEditingCallback),this._editor.plugins.has("Dialog")&&this._registerFullscreenDialogPositionAdjustments();for(let e of this._editor.config.get("fullscreen.container").children)e!==this._wrapper&&!e.classList.contains("ck-body-wrapper")&&!e.classList.contains("ckbox-wrapper")&&e.style.display!=="none"&&(this._hiddenElements.set(e,e.style.display),e.style.display="none");this._sidebarsWidths={left:this._wrapper.querySelector(".ck-fullscreen__left-sidebar").scrollWidth,right:this._wrapper.querySelector(".ck-fullscreen__right-sidebar").scrollWidth},this._adjustVisibleElements(),this._setupResizeObserver(),this._editor.config.get("fullscreen.onEnterCallback")&&this._editor.config.get("fullscreen.onEnterCallback")(this.getWrapper())}disable(){this._editor.config.get("fullscreen.onLeaveCallback")&&this._editor.config.get("fullscreen.onLeaveCallback")(this.getWrapper()),this._document.body.classList.remove("ck-fullscreen"),this._document.body.parentElement.classList.remove("ck-fullscreen");this._editor.plugins.has("DocumentOutlineUI")&&this._restoreDocumentOutlineDefaultContainer();this._annotationsUIsData&&this._restoreAnnotationsUIs(),this._editor.plugins.has("RevisionHistory")&&this._restoreRevisionHistoryCallbacks();this._editor.plugins.has("AITabs")&&this._restoreAITabs(),this._editor.plugins.has("SourceEditing")&&this._editor.plugins.has("DocumentOutlineUI")&&this._editor.plugins.get("SourceEditing").off("change:isSourceEditingMode",this._sourceEditingCallback);for(let e of this._placeholderMap.keys())this.restoreMovedElementLocation(e);this._destroyContainer(),this._editor.ui.view.toolbar&&this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get("toolbar.shouldNotGroupWhenFull")===!0?"static":"dynamic");for(let[e,t]of this._savedAncestorsScrollPositions)e.scrollTo({left:t.scrollLeft,top:t.scrollTop,behavior:"instant"});this._savedAncestorsScrollPositions.clear();if(this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled){let e=this._editor.plugins.get("PaginationRenderer");
vendor: 5,247 bytes, lines 21-28
21e.setupScrollableAncestor(),e.linesRepository.setViewCollection(this._editor.ui.view.body),this._paginationBodyCollection.detachFromDom(),this._paginationBodyCollection?.destroy()}this._editor.plugins.has("Dialog")&&this._unregisterFullscreenDialogPositionAdjustments(),this._keepLeftSidebarHidden=!1,this._resizeObserver?.destroy()}destroy(){for(let{placeholderElement:e,movedElement:t}of this._placeholderMap.values())e.remove(),t.remove();this._destroyContainer(),this._document.body.classList.remove("ck-fullscreen"),this._document.body.parentElement.classList.remove("ck-fullscreen")}defaultOnEnter(){return this.getWrapper()}_destroyContainer(){if(this._wrapper){this._wrapper.remove(),this._wrapper=null;for(let[e,t]of this._hiddenElements)e.style.display=t;this._hiddenElements.clear()}}_generatePresenceListContainer(){let e=this._editor.t,t=Te(document,"div",{class:"ck ck-fullscreen__left-sidebar-item"});t.innerHTML=`
22			<div class="ck ck-fullscreen__left-sidebar-header"></div>
23			<div class="ck ck-fullscreen__presence-list" data-ck-fullscreen="presence-list"></div>
24		`,t.firstElementChild.innerText=e("Connected users"),document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]')||document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(Te(document,"div",{class:"ck ck-fullscreen__left-sidebar-sticky","data-ck-fullscreen":"left-sidebar-sticky"})),document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]').appendChild(t);let i=this._editor.plugins.get("PresenceListUI");this.moveToFullscreen(i.view.element,"presence-list"),this._hasLeftCollapseButton=!0}_generateDocumentOutlineContainer(){let e=this._editor.t,t=Te(document,"div",{class:"ck-fullscreen__left-sidebar-item ck-fullscreen__left-sidebar-item--no-margin"});t.innerHTML=`
25			<div class="ck ck-fullscreen__left-sidebar-header ck-fullscreen__document-outline-header"></div>
26		`,t.firstElementChild.innerText=e("Document outline");let i=Te(document,"div",{class:"ck ck-fullscreen__left-sidebar-item ck-fullscreen__document-outline-wrapper"});i.innerHTML=`
27			<div class="ck ck-fullscreen__document-outline" data-ck-fullscreen="document-outline"></div>
28		`,document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]')||document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(Te(document,"div",{class:"ck ck-fullscreen__left-sidebar-sticky","data-ck-fullscreen":"left-sidebar-sticky"})),document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(i),document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]').appendChild(t);let n=this._editor.plugins.get("DocumentOutlineUI");n.view.documentOutlineContainer=document.querySelector('[data-ck-fullscreen="left-sidebar"]'),this.moveToFullscreen(n.view.element,"document-outline"),this._hasLeftCollapseButton=!0}_restoreDocumentOutlineDefaultContainer(){let e=this._editor.plugins.get("DocumentOutlineUI");e.view.documentOutlineContainer=e.view.element}_generateCollapseButton(){let e=new y(this._editor.locale),t=document.querySelector(".ck-fullscreen__left-sidebar"),i=this._editor.t;e.set({label:i("Toggle sidebar"),class:"ck-fullscreen__left-sidebar-toggle-button",tooltip:i("Hide left sidebar"),tooltipPosition:"se",icon:xe}),e.on("execute",()=>{t.classList.contains("ck-fullscreen__left-sidebar--collapsed")?(this._forceShowLeftSidebar=!0,this._keepLeftSidebarHidden=!1,this._showLeftSidebar()):(this._keepLeftSidebarHidden=!0,this._hideLeftSidebar()),this._editor.editing.view.focus()}),e.render(),this._collapseLeftSidebarButton=e,t.prepend(e.element)}_overrideAnnotationsUIs(){let e=this._editor.plugins.get("AnnotationsUIs");this._annotationsUIsData=new Map(e.uisData),e.deactivateAll();let t=this._editor.plugins.get("Sidebar");t.container?(this._switchAnnotationsUI("wideSidebar"),this.moveToFullscreen(t.container.firstElementChild,"right-sidebar"),t.setContainer(this.getWrapper().querySelector('[data-ck-fullscreen="right-sidebar"]'))):(t.setContainer(this.getWrapper().querySelector('[data-ck-fullscreen="right-sidebar"]')),this._switchAnnotationsUI("wideSidebar"),this.moveToFullscreen(t.container.firstElementChild,"right-sidebar"))}_restoreAnnotationsUIs(){let e=this._editor.plugins.get("Sidebar"),t=e.context.config.get("sidebar.container");t&&e.setContainer(t);let i=this._editor.plugins.get("AnnotationsUIs");i.deactivateAll();for(let[n,o]of[...this._annotationsUIsData])i.activate(n,o.filter);this._annotationsUIsData=null}_overrideRevisionHistoryCallbacks(){this._editor.config.set("revisionHistory.showRevisionViewerCallback",()=>de(this,null,function*(){let e=yield this._showRevisionViewerCallback();return this._editor.plugins.has("DocumentOutlineUI")&&(this.getWrapper().querySelector(".ck-fullscreen__document-outline-header").style.display="none"),this.restoreMovedElementLocation("editable"),this.restoreMovedElementLocation("toolbar"),this.restoreMovedElementLocation("right-sidebar"),this._annotationsUIsData&&this._restoreAnnotationsUIs(),this._editor.ui.view.menuBarView&&this._editor.ui.view.menuBarView.disable(),this.moveToFullscreen(e.ui.getEditableElement(),"editable"),this.moveToFullscreen(e.ui.view.toolbar.element,"toolbar"),this.moveToFullscreen(this._editor.config.get("revisionHistory.viewer
28SidebarContainer"),"right-sidebar"),e}));this._editor.config.set("revisionHistory.closeRevisionViewerCallback",()=>de(this,null,function*(){this.restoreMovedElementLocation("toolbar"),this.restoreMovedElementLocation("editable"),this.restoreMovedElementLocation("right-sidebar"),this._editor.plugins.has("DocumentOutlineUI")&&(this.getWrapper().querySelector(".ck-fullscreen__document-outline-header").style.display=""),this.moveToFullscreen(this._editor.ui.getEditableElement(),"editable"),this.moveToFullscreen(this._editor.ui.view.toolbar.element,"toolbar"),yield this._closeRevisionViewerCallback(),this._editor.plugins.has("AnnotationsUIs")&&this._overrideAnnotationsUIs(),this._editor.ui.view.menuBarView&&this._editor.ui.view.menuBarView.enable()}))}_restoreRevisionHistoryCallbacks(){this._editor.config.set("revisionHistory.showRevisionViewerCallback",()=>de(this,null,function*(){return this._showRevisionViewerCallback()}));this._editor.config.set("revisionHistory.closeRevisionViewerCallback",()=>de(this,null,function*(){return this._closeRevisionViewerCallback()}))}_registerFullscreenDialogPositionAdjustments(){let e=this._editor.plugins.get("Dialog");this._setNewDialogPosition(),e.on("change:isOpen",this.updateDialogPositionCallback,{priority:"highest"})}_unregisterFullscreenDialogPositionAdjustments(){let e=this._editor.plugins.get("Dialog"),t=e.view;t&&t.position===null&&(t.position=zi.EDITOR_TOP_SIDE),t&&t.updatePosition(),e.off("change:isOpen",this.updateDialogPositionCallback)}updateDialogPositionCallback=this._updateDialogPosition.bind(this);_updateDialogPosition(e,t,i){i&&this._setNewDialogPosition()}_setNewDialogPosition(){let t=this._editor.plugins.get("Dialog").view;if(!t||t.position!==zi.EDITOR_TOP_SIDE)return;let i=new ie(this._wrapper.querySelector(".ck-fullscreen__right-edge")).getVisible(),n=i?this._wrapper.querySelector(".ck-fullscreen__right-edge"):this._wrapper,o=new ie(n).getVisible(),r=new ie(document.querySelector(".ck-fullscreen__editable")).getVisible(),l=new ie(t.element.querySelector(".ck-dialog")).getVisible(),a=new ie(document.querySelector(".ck-fullscreen__editable-wrapper")).excludeScrollbarsAndBorders().getVisible().width-new ie(document.querySelector(".ck-fullscreen__editable-wrapper")).getVisible().width;if(o&&r&&l){t.position=null;let c=i?o.left-l.width-aw:o.left+o.width-l.width-aw+a;t.moveTo(c,r.top)}}_saveAncestorsScrollPositions(e){let t=e.parentElement;if(t)for(;t;){let i=t.style.overflowY||W.window.getComputedStyle(t).overflowY,n=t.style.overflowX||W.window.getComputedStyle(t).overflowX;i==="auto"||i==="scroll"||n==="auto"||n==="scroll"?this._savedAncestorsScrollPositions.set(t,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}):t.tagName==="HTML"&&this._savedAncestorsScrollPositions.set(t,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}),t=t.parentElement}}_handleAITabsTransfer(){let e=this._editor.plugins.get("AITabs");this._aiTabsData={side:e.side,type:e.type},this.moveToFullscreen(e.view.element,"right-edge"),e.side="right",e.type="sidebar",e.view.element.addEventListener("transitionend",t=>this._handleAISidebarTransitions(t))}_handleAISidebarTransitions(e){let t=this._editor.plugins.get("AITabs");e.target===t.view.element&&e.propertyName.includes("width")&&this._adjustVisibleElements()}_restoreAITabs(){let e=this._editor.plugins.get("AITabs");e.side=this._aiTabsData?.side,e.type=this._aiTabsData?.type,this._aiTabsData=null,e.view.element.removeEventListener("transitionend",this._handleAISidebarTransitions)}_adjustVisibleElements(){let e=this._wrapper.querySelector(".ck-fullscreen__editable-wrapper");if(this._forceShowLeftSidebar){this._forceShowLeftSidebar=!1;return}if(e.scrollWidth>e.clientWidth)this._hideLeftSidebar(),e.scrollWidth>e.clientWidth&&this._hideRightSidebar();else{let t=[...e.children].reduce((i,n)=>i+n.scrollWidth,0);t+this._sidebarsWidths.right<e.clientWidth&&(this._showRightSidebar(),t=[...e.children].reduce((i,n)=>i+n.scrollWidth,0)),t+this._sidebarsWidths.left<e.clientWidth&&!this._keepLeftSidebarHidden&&this._showLeftSidebar()}}_switchAnnotationsUI(e){let t=this._editor.plugins.get("AnnotationsUIs");t.deactivateAll();let i=new Map;for(let[n,o]of[...this._annotationsUIsData])o.filter!==t.defaultFilter&&i.set(n,o.filter);i.has(e)?t.activate(e,i.get(e)):i.size?t.activate(e,n=>[...i.values()].some(o=>o(n))):t.switchTo(e)}_setupResizeObserver(){let e=this._wrapper.querySelector(".ck-fullscreen__editable-wrapper");this._resizeObserver&&this._resizeObserver.destroy(),this._resizeObserver=new jo(e,()=>{this._adjustVisibleElements()})}_hideLeftSidebar(){let e=this._editor.t;this._collapseLeftSidebarButton&&(this._wrapper.querySelector(".ck-fullscreen__left-sidebar").classList.add("ck-fullscreen__left-sidebar--collapsed"),this._collapseLeftSidebarButton.icon=Yg,this._collapseLeftSidebarButton.tooltip=e("Show left sidebar"))}_showLeftSidebar(){let e=this._editor.t;this._collapseLeftSidebarButton&&(this._wrapper.querySelector(".ck-fullscreen__left-sidebar").classList.remove("ck-fullscreen__left-sidebar--collapsed"),this._collapseLeftSidebarButton.icon=xe,this._collapseLeftSidebarButton.tooltip=e("Hide left sidebar"))}_hideRightSidebar(){this._wrapper.querySelector(".ck-fullscreen__right-sidebar").firstChild&&(this._switchAnnotationsUI("narrowSidebar"),this._wrapper.querySelector(".ck-fullscreen__right-sidebar").classList.add("ck-fullscreen__right-sidebar--collapsed"))}_showRightSidebar(){this._wrapper.querySelector(".ck-fullscreen__right-sidebar").firstChild&&(this._switchAnnotationsUI("wideSidebar"),this._wrapper.querySelector(".ck-fullscreen__right-sidebar").classList.remove("ck-fullscreen__right-sidebar--collapsed"))}},bc=class extends wo{_editor;constructor(e){super(e),this._editor=e}defaultOnEnter(){let e=this._editor.ui,t=e.view;return this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled&&this.moveToFullscreen(e.getEditableElement().parentElement.querySelector(".ck-pagination-view"),"pagination-view"),this.moveToFullscreen(e.getEditableElement(),"editable"),this.moveToFullscreen(t.toolbar.element,"toolbar"),t.toolbar.switchBehavior(this._editor.config.get("fullscreen.toolbar.shouldNotGroupWhenFull")===!0?"static":"dynamic"),this.getWrapper().setAttribute("dir",t.element.getAttribute("dir")),this.getWrapper().classList.add("ck-rounded-corners"),this._editor.config.get("fullscreen.menuBar.isVisible")&&(t.menuBarView||(t.menuBarView=new gt(this._editor.locale),t.menuBarView.render(),e.initMenuBar(t.menuBarView)),this.moveToFullscreen(t.menuBarView.element,"menu-bar")),this.getWrapper()}},wc=class extends wo{_editor;constructor(e){super(e),this._editor=e}defaultOnEnter(){return this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled&&this.moveToFullscreen(this._editor.ui.getEditableElement().parentElement.querySelector(".ck-pagination-view"),"pagination-view"),this.moveToFullscreen(this._editor.ui.getEditableElement(),"editable"),this.moveToFullscreen(this._editor.ui.view.toolbar.element,"toolbar"),this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get("fullscreen.toolbar.shouldNotGroupWhenFull")===!0?"static":"dynamic"),this._editor.config.get("fullscreen.menuBar.isVisible")&&this.moveToFullscreen(this._editor.ui.view.menuBarView.element,"menu-bar"),this.getWrapper()}},_c=class extends v{fullscreenHandler;constructor(e){super(e),this.affectsData=!1,this.isEnabled=!0,this.value=!1,gI(e)?this.fullscreenHandler=new bc(e):fI(e)?this.fullscreenHandler=new wc(e):this.fullscreenHandler=new wo(e)}execute(){this.value?this._disableFullscreenMode():this._enableFullscreenMode()}_enableFullscreenMode(){this.fullscreenHandler.enable(),this.value=!0}_disableFullscreenMode(){this.fullscreenHandler.disable(),this.value=!1}};Ts=class extends f{static get pluginName(){return"FullscreenEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("fullscreen.menuBar.isVisible",!0),e.config.define("fullscreen.toolbar.shouldNotGroupWhenFull",e.config.get("toolbar.shouldNotGroupWhenFull")===!0)}init(){this.editor.commands.add("toggleFullscreen",new _c(this.editor));let e=this.editor.locale.t;
vendor: 8,446 bytes, line 28
28this.editor.keystrokes.set("Ctrl+Shift+F",(t,i)=>{this.editor.execute("toggleFullscreen"),Je.isBlink||(this.editor.editing.view.document.isFocused=!1,this.editor.ui.view.toolbar.focusTracker.focusedElement=null),this.editor.editing.view.scrollToTheSelection(),this.editor.editing.view.focus(),i()}),this.editor.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Toggle fullscreen mode"),keystroke:"CTRL+SHIFT+F"}],categoryId:"navigation"})}},cw="toggleFullscreen",kc=class extends f{static get requires(){return[Ts]}static get pluginName(){return"FullscreenUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("fullscreen",()=>this._createButton(y)),e.ui.componentFactory.add("menuBar:fullscreen",()=>this._createButton(x))}_createButton(e){let t=this.editor,i=t.t,n=t.commands.get(cw),o=new e(t.locale);return o.set({isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value"),o instanceof x?o.set({role:"menuitemcheckbox",label:i("Fullscreen mode")}):(o.bind("icon").to(n,"value",r=>r?Zg:Jg),o.bind("label").to(n,"value",r=>i(r?"Leave fullscreen mode":"Enter fullscreen mode")),o.set({tooltip:!0})),this.listenTo(o,"execute",()=>{t.execute(cw),Je.isBlink||(this.editor.ui.view.toolbar.focusTracker.focusedElement=null),t.editing.view.scrollToTheSelection(),t.editing.view.focus()}),o}},uw=class extends f{static get requires(){return[Ts,kc]}static get pluginName(){return"Fullscreen"}static get isOfficialPlugin(){return!0}}});function mw(s,e,t){return t.checkChild(s.parent,e)&&!t.isObject(s)}function yw(s){let e=s.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 s.config.get("heading.options").map(i=>{let n=t[i.title];return n&&n!=i.title&&(i.title=n),i})}function yc(s,e,t){let i=e.modelCursor,n=e.viewItem;if(!i.isAtStart||!i.parent.is("element","$root")||!t.consumable.consume(n,{name:!0}))return;let o=t.writer,r=o.createElement("title"),l=o.createElement("title-content");o.append(l,r),o.insert(r,i),t.convertChildren(n,l),t.updateConversionResult(r,e)}function ww(s){return(e,t)=>{let i=t.modelPosition.parent;if(!i.is("element","title"))return;let n=i.parent,o=t.mapper.toViewElement(n);t.viewPosition=s.createPositionAt(o,0),e.stop()}}function _w(s){return s.is("element","title")}function bI(s,e,t){let i=e.createElement("title");e.insert(i,s,"before"),e.insert(s,i,0),e.rename(s,"title-content"),t.schema.removeDisallowedAttributes([s],e)}function kw(s,e,t){let i=!1;for(let n of s)n.index!==0&&(wI(n,e,t),i=!0);return i}function wI(s,e,t){let i=s.getChild(0);if(i.isEmpty){e.remove(s);return}e.move(e.createRangeOn(i),s,"before"),e.rename(i,"paragraph"),e.remove(s),t.schema.removeDisallowedAttributes([i],e)}function _I(s,e){return!(!s||!s.is("element","paragraph")||s.childCount||e.childCount<=2||e.getChild(e.childCount-1)!==s)}var vc,hw,Cc,Ic,gw,pI,fw,pw,bw,vw=M(()=>{U();Ap();j();z();re();ve();vc=class extends v{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){let e=O(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>mw(e,t,this.editor.model.schema))}execute(e){let t=this.editor.model,i=t.document,n=e.value;t.change(o=>{let r=Array.from(i.selection.getSelectedBlocks()).filter(l=>mw(l,n,t.schema));for(let l of r)l.is("element",n)||o.rename(l,n)})}};hw="paragraph",Cc=class extends f{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}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[Tp]}init(){let e=this.editor,t=e.config.get("heading.options"),i=[];for(let n of t)n.model!=="paragraph"&&(e.model.schema.register(n.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(n),i.push(n.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new vc(e,i))}afterInit(){let e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(n,o)=>{let r=e.model.document.selection.getFirstPosition().parent;i.some(a=>r.is("element",a.model))&&!r.is("element",hw)&&r.childCount===0&&o.writer.rename(r,hw)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:Le.low+1})}};Ic=class extends f{static get pluginName(){return"HeadingUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,i=yw(e),n=t("Choose heading"),o=t("Heading");e.ui.componentFactory.add("heading",r=>{let l={},a=new ne,c=e.commands.get("heading"),u=e.commands.get("paragraph"),d=[c];for(let h of i){let g={type:"button",model:new we({label:h.title,class:h.class,role:"menuitemradio",withText:!0})};h.model==="paragraph"?(g.model.bind("isOn").to(u,"value"),g.model.set("commandName","paragraph"),d.push(u)):(g.model.bind("isOn").to(c,"value",p=>p===h.model),g.model.set({commandName:"heading",commandValue:h.model})),a.add(g),l[h.model]=h.title}let m=X(r);return be(m,a,{ariaLabel:o,role:"menu"}),m.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),m.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),m.bind("isEnabled").toMany(d,"isEnabled",(...h)=>h.some(g=>g)),m.buttonView.bind("label").to(c,"value",u,"value",(h,g)=>{let p=g?"paragraph":h;return typeof p=="boolean"||!l[p]?n:l[p]}),m.buttonView.bind("ariaLabel").to(c,"value",u,"value",(h,g)=>{let p=g?"paragraph":h;return typeof p=="boolean"||!l[p]?o:`${l[p]}, ${o}`}),this.listenTo(m,"execute",h=>{let{commandName:g,commandValue:p}=h.source;e.execute(g,p?{value:p}:void 0),e.editing.view.focus()}),m}),e.ui.componentFactory.add("menuBar:heading",r=>{let l=new Ie(r),a=e.commands.get("heading"),c=e.commands.get("paragraph"),u=[a],d=new He(r);l.set({class:"ck-heading-dropdown"}),d.set({ariaLabel:t("Heading"),role:"menu"}),l.buttonView.set({label:t("Heading")}),l.panelView.children.add(d);for(let m of i){let h=new De(r,l),g=new x(r);h.children.add(g),d.items.add(h),g.set({isToggleable:!0,label:m.title,role:"menuitemradio",class:m.class}),g.delegate("execute").to(l),g.on("execute",()=>{let p=m.model==="paragraph"?"paragraph":"heading";e.execute(p,{value:m.model}),e.editing.view.focus()}),m.model==="paragraph"?(g.bind("isOn").to(c,"value"),u.push(c)):g.bind("isOn").to(a,"value",p=>p===m.model)}return l.bind("isEnabled").toMany(u,"isEnabled",(...m)=>m.some(h=>h)),l})}},gw=class extends f{static get requires(){return[Cc,Ic]}static get pluginName(){return"Heading"}static get isOfficialPlugin(){return!0}},pI={heading1:ef,heading2:tf,heading3:nf,heading4:of,heading5:sf,heading6:rf},fw=class extends f{init(){yw(this.editor).filter(t=>t.model!=="paragraph").map(t=>this._createButton(t))}_createButton(e){let t=this.editor;t.ui.componentFactory.add(e.model,i=>{let n=new y(i),o=t.commands.get("heading");return n.label=e.title,n.icon=e.icon||pI[e.model],n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(o),n.bind("isOn").to(o,"value",r=>r==e.model),n.on("execute",()=>{t.execute("heading",{value:e.model}),t.editing.view.focus()}),n})}},pw=new Set(["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"]),bw=class extends f{_bodyPlaceholder=new Map;static get pluginName(){return"Title"}static get isOfficialPlugin(){return!0}static get requires(){return["Paragraph"]}init(){let e=this.editor,t=e.model;t.schema.register("title",{isBlock:!0,allowIn:"$root"}),t.schema.register("title-content",{isBlock:!0,allowIn:"title",allowAttributes:["alignment"]}),t.schema.extend("$text",{allowIn:"title-content"}),t.schema.addAttributeCheck(i=>{if(i.endsWith("title-content $text"))return!1}),e.editing.mapper.on("modelToViewPosition",ww(e.editing.view)),e.data.mapper.on("modelToViewPosition",ww(e.editing.view)),e.conversion.for("downcast").elementToElement({model:"title-content",view:"h1"}),e.conversion.for("downcast").add(i=>i.on("insert:title",(n,o,r)=>{r.consumable.consume(o.item,n.name)})),e.data.upcastDispatcher.on("element:h1",yc,{priority:"high"}
28),e.data.upcastDispatcher.on("element:h2",yc,{priority:"high"}),e.data.upcastDispatcher.on("element:h3",yc,{priority:"high"}),t.document.registerPostFixer(i=>this._fixTitleContent(i)),t.document.registerPostFixer(i=>this._fixTitleElement(i)),t.document.registerPostFixer(i=>this._fixBodyElement(i)),t.document.registerPostFixer(i=>this._fixExtraParagraph(i)),this._attachPlaceholders(),this._attachTabPressHandling()}getTitle(e={}){let t=e.rootName?e.rootName:void 0,n=this._getTitleElement(t).getChild(0);return this.editor.data.stringify(n,e)}getBody(e={}){let t=this.editor,i=t.data,n=t.model,o=e.rootName?e.rootName:void 0,r=t.model.document.getRoot(o),l=t.editing.view,a=new Mg(l.document),c=n.createRangeIn(r),u=a.createDocumentFragment(),d=n.createPositionAfter(r.getChild(0)),m=n.createRange(d,n.createPositionAt(r,"end")),h=new Map;for(let g of n.markers){let p=m.getIntersection(g.getRange());p&&h.set(g.name,p)}return i.mapper.clearBindings(),i.mapper.bindElements(r,u),i.downcastDispatcher.convert(c,h,a,e),a.remove(a.createRangeOn(u.getChild(0))),t.data.processor.toData(u)}_getTitleElement(e){let t=this.editor.model.document.getRoot(e);for(let i of t.getChildren())if(_w(i))return i}_fixTitleContent(e){let t=!1;for(let i of this.editor.model.document.getRootNames()){let n=this._getTitleElement(i);if(!n||n.maxOffset===1)continue;let o=Array.from(n.getChildren());o.shift();for(let r of o)e.move(e.createRangeOn(r),n,"after"),e.rename(r,"paragraph");t=!0}return t}_fixTitleElement(e){let t=!1,i=this.editor.model;for(let n of this.editor.model.document.getRoots()){let o=Array.from(n.getChildren()).filter(_w),r=o[0],l=n.getChild(0);if(l.is("element","title")){o.length>1&&(kw(o,e,i),t=!0);continue}if(!r&&!pw.has(l.name)){let a=e.createElement("title");e.insert(a,n),e.insertElement("title-content",a),t=!0;continue}pw.has(l.name)?bI(l,e,i):e.move(e.createRangeOn(r),n,0),kw(o,e,i),t=!0}return t}_fixBodyElement(e){let t=!1;for(let i of this.editor.model.document.getRootNames()){let n=this.editor.model.document.getRoot(i);if(n.childCount<2){let o=e.createElement("paragraph");e.insert(o,n,1),this._bodyPlaceholder.set(i,o),t=!0}}return t}_fixExtraParagraph(e){let t=!1;for(let i of this.editor.model.document.getRootNames()){let n=this.editor.model.document.getRoot(i),o=this._bodyPlaceholder.get(i);_I(o,n)&&(this._bodyPlaceholder.delete(i),e.remove(o),t=!0)}return t}_attachPlaceholders(){let e=this.editor,t=e.t,i=e.editing.view,n=e.sourceElement,o=e.config.get("title.placeholder")||t("Type your title"),r=e.config.get("placeholder")||n&&n.tagName.toLowerCase()==="textarea"&&n.getAttribute("placeholder")||t("Type or paste your content here.");e.editing.downcastDispatcher.on("insert:title-content",(a,c,u)=>{let d=u.mapper.toViewElement(c.item);d.placeholder=o,Ge({view:i,element:d,keepOnFocus:!0})});let l=new Map;i.document.registerPostFixer(a=>{let c=!1;for(let u of i.document.roots){if(u.isEmpty)continue;let d=u.getChild(1),m=l.get(u.rootName);d!==m&&(m&&(Hr(a,m),a.removeAttribute("data-placeholder",m)),a.setAttribute("data-placeholder",r,d),l.set(u.rootName,d),c=!0),Og(d,!0)&&u.childCount===2&&d.name==="p"?c=Fg(a,d)?!0:c:c=Hr(a,d)?!0:c}return c})}_attachTabPressHandling(){let e=this.editor,t=e.model;e.keystrokes.set("TAB",(i,n)=>{t.change(o=>{let r=t.document.selection,l=Array.from(r.getSelectedBlocks());if(l.length===1&&l[0].is("element","title-content")){let c=r.getFirstPosition().root.getChild(1);o.setSelection(c,0),n()}})}),e.keystrokes.set("SHIFT + TAB",(i,n)=>{t.change(o=>{let r=t.document.selection;if(!r.isCollapsed)return;let l=O(r.getSelectedBlocks()),a=r.getFirstPosition(),c=e.model.document.getRoot(a.root.rootName),u=c.getChild(0),d=c.getChild(1);l===d&&a.isAtStart&&(o.setSelection(u.getChild(0),0),n())})})}}});function kI(s){let e={model:{key:"highlight",values:[]},view:{}};for(let t of s)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}function yI(s){s.buttonView.actionView.iconView.bind("fillColor").to(s.buttonView,"color")}function As(s){return s==="marker"?kf:Pf}var Tc,Ac,Ec,Cw,Iw=M(()=>{U();
vendor: 6,028 bytes, line 28
28ve();re();z();Tc=class extends v{refresh(){let e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){let t=this.editor.model,n=t.document.selection,o=e.value;t.change(r=>{if(n.isCollapsed){let l=n.getFirstPosition();if(n.hasAttribute("highlight")){let a=m=>m.item.hasAttribute("highlight")&&m.item.getAttribute("highlight")===this.value,c=l.getLastMatchingPosition(a,{direction:"backward"}),u=l.getLastMatchingPosition(a),d=r.createRange(c,u);!o||this.value===o?(l.isEqual(u)||r.removeAttribute("highlight",d),r.removeSelectionAttribute("highlight")):(l.isEqual(u)||r.setAttribute("highlight",o,d),r.setSelectionAttribute("highlight",o))}else o&&r.setSelectionAttribute("highlight",o)}else{let l=t.schema.getValidRanges(n.getRanges(),"highlight",{includeEmptyRanges:!0});for(let a of l){let c=a,u="highlight";a.isCollapsed&&(c=a.start.parent,u=pi._getStoreAttributeKey("highlight")),o?r.setAttribute(u,o,c):r.removeAttribute(u,c)}}})}},Ac=class extends f{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-highlight-pen-green)",type:"pen"}]})}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});let t=e.config.get("highlight.options");e.conversion.attributeToElement(kI(t)),e.commands.add("highlight",new Tc(e))}};Ec=class extends f{get localizedOptionTitles(){let e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.config.get("highlight.options");for(let t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){let e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),Qr,null,i=>{i.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){let t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,As(e.type),e.model,i);function i(n){n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",o=>o===e.model),n.iconView.fillColor=e.color,n.isToggleable=!0}}_addButton(e,t,i,n,o){let r=this.editor;r.ui.componentFactory.add(e,l=>{let a=new y(l),c=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:c,icon:i,tooltip:!0}),a.on("execute",()=>{r.execute("highlight",{value:n}),r.editing.view.focus()}),o(a),a})}_addDropdown(e){let t=this.editor,i=t.t,n=t.ui.componentFactory,o=e[0],r=e.reduce((l,a)=>(l[a.model]=a,l),{});n.add("highlight",l=>{let a=t.commands.get("highlight"),c=X(l,ht),u=c.buttonView;u.set({label:i("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),u.bind("icon").to(a,"value",h=>As(m(h,"type"))),u.bind("color").to(a,"value",h=>m(h,"color")),u.bind("commandValue").to(a,"value",h=>m(h,"model")),u.bind("isOn").to(a,"value",h=>!!h),u.delegate("execute").to(c);let d=()=>{let h=e.map(g=>{let p=n.create("highlight:"+g.model);return this.listenTo(p,"execute",()=>{c.buttonView.set({lastExecuted:g.model})}),p});return h.push(new mp),h.push(n.create("removeHighlight")),h};c.bind("isEnabled").to(a,"isEnabled"),ki(c,d,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:i("Text highlight toolbar")}),yI(c),u.on("execute",()=>{t.execute("highlight",{value:u.commandValue})}),this.listenTo(c,"execute",()=>{t.editing.view.focus()});function m(h,g){let p=!h||h===u.lastExecuted?u.lastExecuted:h;return r[p][g]}return c})}_addMenuBarButton(e){let t=this.editor,i=t.t,n=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",o=>{let r=new Ie(o);r.buttonView.set({label:i("Highlight"),icon:As("marker")}),r.bind("isEnabled").to(n),r.buttonView.iconView.fillColor="transparent";let l=new He(o);for(let u of e){let d=new De(o,r),m=new x(o);m.set({label:u.title,icon:As(u.type),role:"menuitemradio",isToggleable:!0}),m.iconView.fillColor=u.color,m.delegate("execute").to(r),m.bind("isOn").to(n,"value",h=>h===u.model),m.on("execute",()=>{t.execute("highlight",{value:u.model}),t.editing.view.focus()}),d.children.add(m),l.items.add(d)}l.items.add(new ts(o));let a=new De(o,r),c=new x(o);return c.set({label:i("Remove highlight"),icon:Qr}),c.delegate("execute").to(r),c.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),a.children.add(c),l.items.add(a),r.panelView.children.add(l),r})}};Cw=class extends f{static get requires(){return[Ac,Ec]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}});function vI(s,e,t){let i=CI(s,t);return e.checkChild(i,"horizontalLine")}function CI(s,e){let i=Wt(s,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function II(s,e,t){return e.setCustomProperty("horizontalLine",!0,s),We(s,e,{label:t})}var xc,Sc,Vc,Tw,Aw=M(()=>{U();zt();re();z();xc=class extends v{refresh(){let e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=vI(i,t,e)}execute(){let e=this.editor.model;e.change(t=>{let i=t.createElement("horizontalLine");
28e.insertObject(i,null,null,{setSelection:"after"})})}};Sc=class extends f{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToElement({model:"horizontalLine",view:(o,{writer:r})=>r.createEmptyElement("hr")}),n.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(o,{writer:r})=>{let l=i("Horizontal line"),a=r.createContainerElement("div",null,r.createEmptyElement("hr"));return r.addClass("ck-horizontal-line",a),r.setCustomProperty("hr",!0,a),II(a,r,l)}}),n.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new xc(e))}};Vc=class extends f{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("horizontalLine",()=>{let t=this._createButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(x))}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get("horizontalLine"),o=new e(t.locale),r=i.t;return o.set({label:r("Horizontal line"),icon:Xf}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("horizontalLine"),t.editing.view.focus()}),o}},Tw=class extends f{static get requires(){return[Sc,Vc,ze]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}});function TI(s,e,t){let i=AI(s,t);return e.checkChild(i,"rawHtml")}function AI(s,e){let i=Wt(s,e).start.parent;return i.isEmpty&&!i.is("rootElement")?i.parent:i}function Ew(s){let e=s.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}function Pc(s,e,t){let{t:i}=s.locale,n=new y(s.locale),o=s.commands.get("htmlEmbed");return n.set({class:`raw-html-embed__${e}-button`,icon:Wi,tooltip:!0,tooltipPosition:s.locale.uiLanguageDirection==="rtl"?"e":"w"}),n.render(),e==="edit"?(n.set({icon:Wi,label:i("Edit source")}),n.bind("isEnabled").to(o)):e==="save"?(n.set({icon:oo,label:i("Save changes")}),n.bind("isEnabled").to(o)):n.set({icon:no,label:i("Cancel")}),n.on("execute",t),n}var Bc,Lc,Rc,xw,Sw=M(()=>{U();zt();z();j();re();Bc=class extends v{refresh(){let e=this.editor.model,t=e.schema,i=e.document.selection,n=Ew(i);this.isEnabled=TI(i,t,e),this.value=n?n.getAttribute("value")||"":null}execute(e){let t=this.editor.model,i=t.document.selection;t.change(n=>{let o;this.value!==null?o=Ew(i):(o=n.createElement("rawHtml"),t.insertObject(o,null,null,{setSelection:"on"})),n.setAttribute("value",e,o)})}};Lc=class extends f{_widgetButtonViewReferences=new Set;static get pluginName(){return"HtmlEmbedEditing"}static get licenseFeatureCode(){return"HE"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:t=>(Q("html-embed-provide-sanitize-function"),{html:t,hasChanged:!1})})}init(){let e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new Bc(e)),this._setupConversion()}_setupConversion(){let e=this.editor,t=e.t,i=e.editing.view,n=this._widgetButtonViewReferences,o=e.config.get("htmlEmbed");this.editor.editing.view.on("render",()=>{for(let u of n){if(u.element&&u.element.isConnected)return;u.destroy(),n.delete(u)}},{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(u,{writer:d})=>d.createElement("rawHtml",{value:u.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(u,{writer:d})=>d.createRawElement("div",{class:"raw-html-embed"},function(m){m.innerHTML=u.getAttribute("value")||""})}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(u,{writer:d})=>{let m,h,g,p=d.createRawElement("div",{class:"raw-html-embed__content-wrapper"},function(k){m=k,r({editor:e,domElement:k,state:h,props:g}),m.addEventListener("mousedown",()=>{if(h.isEditable){let T=e.model;T.document.selection.getSelectedElement()!==u&&T.change(Z=>Z.setSelection(u,"on"))}},!0)}),b={makeEditable(){h=Object.assign({},h,{isEditable:!0}),r({domElement:m,editor:e,state:h,props:g}),i.change(k=>{k.setAttribute("data-cke-ignore-events","true",p)}),m.querySelector("textarea").focus()},save(k){k!==h.getRawHtmlValue()?(e.execute("htmlEmbed",k),e.editing.view.focus()):this.cancel()},cancel(){h=Object.assign({},h,{isEditable:!1}),r({domElement:m,editor:e,state:h,props:g}),e.editing.view.focus(),i.change(k=>{k.removeAttribute("data-cke-ignore-events",p)})}};h={showPreviews:o.showPreviews,isEditable:!1,getRawHtmlValue:()=>u.getAttribute("value")||""},g={sanitizeHtml:o.sanitizeHtml,textareaPlaceholder:t("Paste raw HTML here..."),onEditClick(){b.makeEditable()},onSaveClick(k){b.save(k)},onCancelClick(){b.cancel()}};let w=d.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":t("HTML snippet"),dir:e.locale.uiLanguageDirection},p);return d.setCustomProperty("rawHtmlApi",b,w),d.setCustomProperty("rawHtml",!0,w),We(w,d,{label:t("HTML snippet"),hasSelectionHandle:!0})}});function r({editor:u,domElement:d,state:m,props:h}){d.textContent="";let g=d.ownerDocument,p;if(m.isEditable){let w={isDisabled:!1,placeholder:h.textareaPlaceholder};p=a({domDocument:g,state:m,props:w}),d.append(p)}else if(m.showPreviews){let w={sanitizeHtml:h.sanitizeHtml};d.append(c({domDocument:g,state:m,props:w,editor:u}))}else{let w={isDisabled:!0,placeholder:h.textareaPlaceholder};d.append(a({domDocument:g,state:m,props:w}))}let b={onEditClick:h.onEditClick,onSaveClick:()=>{h.onSaveClick(p.value)},onCancelClick:h.onCancelClick}
28;d.prepend(l({editor:u,domDocument:g,state:m,props:b}))}function l({editor:u,domDocument:d,state:m,props:h}){let g=Te(d,"div",{class:"raw-html-embed__buttons-wrapper"});if(m.isEditable){let p=Pc(u,"save",h.onSaveClick),b=Pc(u,"cancel",h.onCancelClick);g.append(p.element,b.element),n.add(p).add(b)}else{let p=Pc(u,"edit",h.onEditClick);g.append(p.element),n.add(p)}return g}function a({domDocument:u,state:d,props:m}){let h=Te(u,"textarea",{placeholder:m.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return h.disabled=m.isDisabled,h.value=d.getRawHtmlValue(),h}function c({editor:u,domDocument:d,state:m,props:h}){let g=h.sanitizeHtml(m.getRawHtmlValue()),p=m.getRawHtmlValue().length>0?t("No preview available"):t("Empty snippet content"),b=Te(d,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},p),w=Te(d,"div",{class:"raw-html-embed__preview-content",dir:u.locale.contentLanguageDirection}),T=d.createRange().createContextualFragment(g.html);return w.appendChild(T),Te(d,"div",{class:"raw-html-embed__preview"},[b,w])}}};Rc=class extends f{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,i=e.locale.t;e.ui.componentFactory.add("htmlEmbed",()=>{let n=this._createButton(y);return n.set({tooltip:!0,label:i("Insert HTML")}),n}),e.ui.componentFactory.add("menuBar:htmlEmbed",()=>{let n=this._createButton(x);return n.set({label:i("HTML snippet")}),n})}_createButton(e){let t=this.editor,i=t.commands.get("htmlEmbed"),n=new e(t.locale);return n.set({icon:lf}),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",()=>{t.execute("htmlEmbed"),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()}),n}},xw=class extends f{static get requires(){return[Lc,Rc,ze]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}}});function Gt(s,e,t,i){e&&EI(s,e,i),t&&Kt(s,t,i)}function Kt(s,e,t){if(e.attributes)for(let[i,n]of Object.entries(e.attributes))s.setAttribute(i,n,t);e.styles&&s.setStyle(e.styles,t),e.classes&&s.addClass(e.classes,t)}function EI(s,e,t){if(e.attributes)for(let[i]of Object.entries(e.attributes))s.removeAttribute(i,t);if(e.styles)for(let i of Object.keys(e.styles))s.removeStyle(i,t);e.classes&&s.removeClass(e.classes,t)}function xI(s,e){let t=hg(s),i="attributes";for(i in e)i=="classes"?t[i]=Array.from(new Set([...s[i]||[],...e[i]])):t[i]=I(I({},s[i]),e[i]);return t}function Sn(s,e,t,i,n){let o=e.getAttribute(t),r={};for(let l of["attributes","styles","classes"]){if(l!=i){o&&o[l]&&(r[l]=o[l]);continue}if(i=="classes"){let c=new Set(o&&o.classes||[]);n(c),c.size&&(r[l]=Array.from(c));continue}let a=new Map(Object.entries(o&&o[l]||{}));n(a),a.size&&(r[l]=Object.fromEntries(a))}Object.keys(r).length?e.is("documentSelection")?s.setSelectionAttribute(t,r):s.setAttribute(t,r,e):o&&(e.is("documentSelection")?s.removeSelectionAttribute(t):s.removeAttribute(t,e))}function SI(s,e,t){for(let i of e.getItems({shallow:!0})){let n=i.getAttribute(s);n&&n.attributes&&Object.keys(n.attributes).length?Object.keys(n).length>1&&t.setAttribute(s,{attributes:n.attributes},i):t.removeAttribute(s,i)}}function VI(s){return bg(s).replace(/ /g,"")}function pt(s){return`html${VI(s)}Attributes`}function Yc({model:s}){return(e,t)=>t.writer.createElement(s,{htmlContent:e.getCustomProperty("$rawContent")})}function PI(s,{view:e,isInline:t}){let i=s.t;return(n,{writer:o})=>{let r=i("HTML object"),l=Es(e,n,o),a=n.getAttribute(pt(e));o.addClass("html-object-embed__content",l),a&&Kt(o,a,l);let c=o.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":r},l);return We(c,o,{label:r})}}function Es(s,e,t){return t.createRawElement(s,null,(i,n)=>{n.setContentOf(i,e.getAttribute("htmlContent"))})}function BI({view:s,model:e,allowEmpty:t},i){return o=>{o.on(`element:${s}`,(r,l,a)=>{let c=i.processViewAttributes(l.viewItem,a);if(!(!c&&!a.consumable.test(l.viewItem,{name:!0}))){if(c=c||{},a.consumable.consume(l.viewItem,{name:!0}),l.modelRange||(l=Object.assign(l,a.convertChildren(l.viewItem,l.modelCursor))),t&&l.modelRange.isCollapsed&&Object.keys(c).length){let u=a.writer.createElement("htmlEmptyElement");
28if(!a.safeInsert(u,l.modelCursor))return;let d=a.getSplitParts(u);l.modelRange=a.writer.createRange(l.modelRange.start,a.writer.createPositionAfter(d[d.length-1])),a.updateConversionResult(u,l),n(u,c,a);return}for(let u of l.modelRange.getItems())n(u,c,a)}},{priority:"low"})};function n(o,r,l){if(l.schema.checkAttribute(o,e)){let a=o.getAttribute(e),c=xI(r,a||{});l.writer.setAttribute(e,c,o)}}}function Vw({model:s,view:e},t){return(i,{writer:n,consumable:o})=>{if(!i.hasAttribute(s))return null;let r=n.createContainerElement(e),l=i.getAttribute(s);return o.consume(i,`attribute:${s}`),Kt(n,l,r),r.getFillerOffset=()=>null,t?We(r,n):r}}function LI({priority:s,view:e}){return(t,i)=>{if(!t)return;let{writer:n}=i,o=n.createAttributeElement(e,null,{priority:s});return Kt(n,t,o),o}}function Pn({view:s},e){return t=>{t.on(`element:${s}`,(i,n,o)=>{if(!n.modelRange||n.modelRange.isCollapsed)return;let r=e.processViewAttributes(n.viewItem,o);r&&o.writer.setAttribute(pt(n.viewItem.name),r,n.modelRange)},{priority:"low"})}}function _o({view:s,model:e}){return t=>{t.on(`attribute:${pt(s)}:${e}`,(i,n,o)=>{if(!o.consumable.consume(n.item,i.name))return;let{attributeOldValue:r,attributeNewValue:l}=n,a=o.writer,c=o.mapper.toViewElement(n.item);Gt(a,r,l,c)})}}function RI(s,e){return typeof s=="string"?s===e:s instanceof RegExp?s.test(e):!1}function Bw(s,e,t){let i=e.matchAll(s)||[],n=s.document.stylesProcessor;return i.reduce((o,{match:r})=>{for(let[l,a]of r.attributes||[])if(l=="style"){let c=a,u=n.getRelatedStyles(c).filter(d=>d.split("-").length>c.split("-").length).sort((d,m)=>m.split("-").length-d.split("-").length);for(let d of u)t.consume(s,{styles:[d]})&&o.styles.push(d);t.consume(s,{styles:[c]})&&o.styles.push(c)}else if(l=="class"){let c=a;t.consume(s,{classes:[c]})&&o.classes.push(c)}else t.consume(s,{attributes:[l]})&&o.attributes.push(l);return o},{attributes:[],classes:[],styles:[]})}function FI(s,{attributes:e,classes:t,styles:i}){return!e.length&&!t.length&&!i.length?null:I(I(I({},e.length&&{attributes:OI(s,e)}),i.length&&{styles:DI(s,i)}),t.length&&{classes:t})}function OI(s,e){let t={};for(let i of e){let n=s.getAttribute(i);n!==void 0&&Ag(i)&&(t[i]=n)}return t}function DI(s,e){let t=new Dg(s.document.stylesProcessor);for(let i of e){let n=s.getStyle(i);n!==void 0&&t.set(i,n)}return Object.fromEntries(t.getStylesEntries())}function Fc(s,e){let{name:t}=s,i=s[e];return fg(i)?Object.entries(i).map(([n,o])=>({name:t,[e]:{[n]:o}})):Array.isArray(i)?i.map(n=>({name:t,[e]:[n]})):[s]}function Lw(s){let{name:e,attributes:t,classes:i,styles:n}=s,o=[];return t&&o.push(...Fc({name:e,attributes:t},"attributes")),i&&o.push(...Fc({name:e,classes:i},"classes")),n&&o.push(...Fc({name:e,styles:n},"styles")),o}function NI(s){return e=>{e.on("element:code",(t,i,n)=>{let o=i.viewItem,r=o.parent;if(!r||!r.is("element","pre"))return;l(r,"htmlPreAttributes"),l(o,"htmlContentAttributes");function l(a,c){let u=s.processViewAttributes(a,n);u&&n.writer.setAttribute(c,u,i.modelRange)}},{priority:"low"})}}function MI(){return s=>{s.on("attribute:htmlPreAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;let{attributeOldValue:n,attributeNewValue:o}=t,l=i.mapper.toViewElement(t.item).parent;Gt(i.writer,n,o,l)}),s.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;let{attributeOldValue:n,attributeNewValue:o}=t,r=i.mapper.toViewElement(t.item);Gt(i.writer,n,o,r)})}}function ko(s,e,t){let i=s.createRangeOn(e);for(let{item:n}of i.getWalker())if(n.is("element",t))return n}function UI(s){return e=>{e.on("element:img",(t,i,n)=>{if(!i.modelRange)return;let o=i.viewItem,r=s.processViewAttributes(o,n);r&&n.writer.setAttribute("htmlImgAttributes",r,i.modelRange)},{priority:"low"})}}function HI(s,e){let t=e.plugins.get("ImageUtils");return i=>{i.on("element:a",(n,o,r)=>{let l=o.viewItem;if(!t.findViewImgElement(l))return;let c=o.modelCursor.parent;if(!c.is("element","imageBlock"))return;let u=s.processViewAttributes(l,r);u&&r.writer.setAttribute("htmlLinkAttributes",u,c)},{priority:"low"})}}function WI(s){return e=>{e.on("element:figure",(t,i,n)=>{let o=i.viewItem;if(!i.modelRange||!o.hasClass("image"))return;let r=s.processViewAttributes(o,n);r&&n.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function zI(){return s=>{e("htmlImgAttributes"),t("img","htmlImgAttributes"),t("figure","htmlFigureAttributes"),t("a","htmlLinkAttributes");function e(i){s.on(`attribute:${i}:imageInline`,(n,o,r)=>{if(!r.consumable.consume(o.item,n.name))return;let{attributeOldValue:l,attributeNewValue:a}=o,c=r.mapper.toViewElement(o.item);Gt(r.writer,l,a,c)},{priority:"low"})}function t(i,n){s.on(`attribute:${n}:imageBlock`,(o,r,l)=>{if(!l.consumable.test(r.item,o.name))return;let{attributeOldValue:a,attributeNewValue:c}=r,u=l.mapper.toViewElement(r.item),d=ko(l.writer,u,i);d&&(Gt(l.writer,a,c,d),l.consumable.consume(r.item,o.name))},{priority:"low"}),i==="a"&&s.on("attribute:linkHref:imageBlock",(o,r,l)=>{if(!l.consumable.consume(r.item,"attribute:htmlLinkAttributes:imageBlock"))return;let a=l.mapper.toViewElement(r.item),c=ko(l.writer,a,"a");Kt(l.writer,r.item.getAttribute("htmlLinkAttributes"),c)},{priority:"low"})}}}function $I(s,e){let t=(i,n,o)=>{let r=n.viewItem;l(r,pt(e));function l(a,c){let u=s.processViewAttributes(a,o);u&&o.writer.setAttribute(c,u,n.modelRange)}};return i=>{i.on(`element:${e}`,t,{priority:"low"})}}function jI(s){return e=>{e.on("element:figure",(t,i,n)=>{let o=i.viewItem;if(!i.modelRange||!o.hasClass("media"))return;let r=s.processViewAttributes(o,n);r&&n.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function qI(s){return e=>{t(s,pt(s)),t("figure","htmlFigureAttributes");function t(i,n){e.on(`attribute:${n}:media`,(o,r,l)=>{if(!l.consumable.consume(r.item,o.name))return;let{attributeOldValue:a,attributeNewValue:c}=r,u=l.mapper.toViewElement(r.item),d=ko(l.writer,u,i);Gt(l.writer,a,c,d)})}}}function KI(s,e){return t=>{let i=s.document.differ.getChanges(),n=!1;for(let o of i){if(o.type!="attribute"||o.attributeKey!="headingRows")continue;let r=o.range.start.nodeAfter,l=r.getAttribute("htmlTheadAttributes"),a=r.getAttribute("htmlTbodyAttributes");l&&!o.attributeNewValue?(t.removeAttribute("htmlTheadAttributes",r),n=!0):a&&o.attributeNewValue==e.getRows(r)&&(t.removeAttribute("htmlTbodyAttributes",r),n=!0)}return n}}function XI(s){return e=>{e.on("element:table",(t,i,n)=>{if(!i.modelRange)return;let o=i.viewItem;n.consumable.consume(o,{classes:"table"}),r(o,"htmlTableAttributes");for(let l of o.getChildren())l.is("element","thead")&&r(l,"htmlTheadAttributes"),l.is("element","tbody")&&r(l,"htmlTbodyAttributes");function r(l,a){let c=s.processViewAttributes(l,n);c&&n.writer.setAttribute(a,c,i.modelRange)}},{priority:"low"})}}function YI(s){return e=>{e.on("element:figure",(t,i,n)=>{let o=i.viewItem;if(!i.modelRange||!o.hasClass("table"))return;let r=s.processViewAttributes(o,n);r&&n.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function QI(){return s=>{e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes");function e(t,i){s.on(`attribute:${i}:table`,(n,o,r)=>{if(!r.consumable.test(o.item,n.name))return;let l=r.mapper.toViewElement(o.item),a=ko(r.writer,l,t);if(a)if(r.consumable.consume(o.item,n.name),i==="htmlTableAttributes"&&l!==a){let c=Rw(o.attributeOldValue),u=Rw(o.attributeNewValue);Gt(r.writer,c.tableAttributes,u.tableAttributes,a),Gt(r.writer,c.figureAttributes,u.figureAttributes,l)}else Gt(r.writer,o.attributeOldValue,o.attributeNewValue,a)})}}}function Rw(s){let e={},t=I({},s);if(!s||!("styles"in s))return{figureAttributes:e,tableAttributes:t};t.styles={};for(let[i,n]of Object.entries(s.styles))GI.includes(i)?e.styles=N(I({},e.styles),{[i]:n}):t.styles=N(I({},t.styles),{[i]:n});return{figureAttributes:e,tableAttributes:t}}function Oc(s,e){return(t,i,n)=>{let o=i.viewItem;i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));let r=e.processViewAttributes(o,n);for(let l of i.modelRange.getItems({shallow:!0}))l.hasAttribute("listItemId")&&(l.hasAttribute("htmlUlAttributes")||l.hasAttribute("htmlOlAttributes")||n.writer.model.schema.checkAttribute(l,s)&&n.writer.setAttribute(s,r||{},l))}}function Fw(s){return s==="numbered"||s=="customNumbered"?"htmlOlAttributes":"htmlUlAttributes"}function JI(){return s=>{s.on("attribute:htmlHrAttributes:horizontalLine",(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;let{attributeOldValue:n,attributeNewValue:o}=t,r=i.mapper.toViewElement(t.item),l=ko(i.writer,r,"hr");l&&(Gt(i.writer,n,o,l),i.consumable.consume(t.item,e.name))},{priority:"low"})}}function ZI(s){try{document.createElement(s)}catch(e){return!1}return!0}function*Vn(s,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)s.schema.checkAttributeInSelection(e,t)&&(yield e);else for(let i of eT(s,e,t))yield*rn(i.getItems({shallow:!0}))}function eT(s,e,t){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?s.schema.checkAttribute(e,t)?[s.createRangeOn(e)]:[]:s.schema.getValidRanges(s.createSelection(e).getRanges(),t)}function Mw(s){return s.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}function Hw(){return s=>{s.on(`attribute:${qt}`,(e,t,i)=>{let{mapper:n,consumable:o}=i,{item:r}=t;if(!o.consume(r,e.name))return;let l=n.toViewElement(r);l&&t.attributeNewValue&&(l.getFillerOffset=()=>null)})}}function tT(s){return e=>{e.on("element",(t,i,n)=>{let{viewItem:o,modelRange:r}=i;if(!o.is("element")||!o.isEmpty||o.getCustomProperty("$hasBlockFiller"))return;let l=r&&r.start.nodeAfter;if(!l||!s.checkAttribute(l,qt)||(n.writer.setAttribute(qt,!0,l),l.childCount!=1))return;let a=l.getChild(0);a.is("element","paragraph")&&s.checkAttribute(a,qt)&&n.writer.setAttribute(qt,!0,a)},{priority:"lowest"})}}var Pw,Ei,pe,Dc,Nc,Mc,Uc,Hc,Wc,GI,zc,$c,jc,qc,Gc,Kc,Ow,Dw,Xc,Nw,qt,Uw,Ww=M(()=>{U();j();
28ve();zt();Me();kn();Pw={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom
28:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDiv"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlHr",view:"hr",isEmpty:!0,modelSchema:{inheritAllFrom:"$blockObject"}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:!0,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{isFormatting:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom
28:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:!0}}]},Ei=class extends f{_definitions=[];static get pluginName(){return"DataSchema"}static get isOfficialPlugin(){return!0}init(){for(let e of Pw.block)this.registerBlockElement(e);for(let e of Pw.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push(N(I({},e),{isBlock:!0}))}registerInlineElement(e){this._definitions.push(N(I({},e),{isInline:!0}))}extendBlockElement(e){this._extendDefinition(N(I({},e),{isBlock:!0}))}extendInlineElement(e){this._extendDefinition(N(I({},e),{isInline:!0}))}getDefinitionsForView(e,t=!1){let i=new Set;for(let n of this._getMatchingViewDefinitions(e)){if(t)for(let o of this._getReferences(n.model))i.add(o);i.add(n)}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&RI(e,t.view))}*_getReferences(e){let t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(n=>n.model==e);for(let{modelSchema:n}of i)if(n)for(let o of t)for(let r of Ve(n[o]||[])){let l=this._definitions.filter(a=>a.model==r);for(let a of l)r!==e&&(yield*rn(this._getReferences(a.model)),yield a)}}_extendDefinition(e){let t=Array.from(this._definitions.entries()).filter(([,i])=>i.model==e.model);if(t.length==0){this._definitions.push(e);return}for(let[i,n]of t)this._definitions[i]=pg({},n,e,(o,r)=>Array.isArray(o)?o.concat(r):void 0)}};pe=class extends f{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new Ct,this._disallowedAttributes=new Ct,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 isOfficialPlugin(){return!0}static get requires(){return[Ei,ze]}loadAllowedConfig(e){for(let t of e){let i=t.name||/[\s\S]+/,n=Lw(t);this.allowElement(i),n.forEach(o=>
vendor: 25,821 bytes, lines 28-30
28this.allowAttributes(o))}}loadDisallowedConfig(e){for(let t of e){let i=t.name||/[\s\S]+/,n=Lw(t);n.length==0?this.disallowElement(i):n.forEach(o=>this.disallowAttributes(o))}}loadAllowedEmptyElementsConfig(e){for(let t of e)this.allowEmptyElement(t)}allowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement(N(I({},t),{allowEmpty:!0}))}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){let{consumable:i}=t;return Bw(e,this._disallowedAttributes,i),FI(e,Bw(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(let t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:Le.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(let e of this._allowedElements)this._fireRegisterEvent(e)},{priority:Le.highest+1})}_registerElementHandlers(){this.on("register",(e,t)=>{let 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 S("data-filter-invalid-definition",null,t);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){let e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(i=>{let n=e.document.differ.getChanges(),o=!1,r=this._getCoupledAttributesMap();for(let l of n){if(l.type!="attribute"||l.attributeNewValue!==null)continue;let a=r.get(l.attributeKey);if(a)for(let{item:c}of l.range.getWalker())for(let u of a)c.hasAttribute(u)&&(i.removeAttribute(u,c),o=!0)}return o}),this.listenTo(t,"change:attribute",(i,{attributeKeys:n})=>{let o=new Set,r=this._getCoupledAttributesMap();for(let l of n){if(t.hasAttribute(l))continue;let a=r.get(l);if(a)for(let c of a)t.hasAttribute(c)&&o.add(c)}o.size!=0&&e.change(l=>{for(let a of o)l.removeSelectionAttribute(a)})})}_registerAssociatedHtmlAttributesPostFixer(){let e=this.editor.model;e.document.registerPostFixer(t=>{let i=e.document.differ.getChanges(),n=!1;for(let o of i)if(!(o.type!=="insert"||o.name==="$text"))for(let r of o.attributes.keys())!r.startsWith("html")||!r.endsWith("Attributes")||e.schema.checkAttribute(o.name,r)||(t.removeAttribute(r,o.position.nodeAfter),n=!0);return n})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(let e of this._allowedElements)if(e.coupledAttribute&&e.model){let 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){let t=this.editor,i=t.model.schema,n=t.conversion,{view:o,model:r}=e;i.register(r,e.modelSchema);o&&(i.extend(e.model,{allowAttributes:[pt(o),"htmlContent"]}),t.data.registerRawContentMatcher({name:o}),n.for("upcast").elementToElement({view:o,model:Yc(e),converterPriority:Le.low+2}),n.for("upcast").add(Pn(e,this)),n.for("editingDowncast").elementToStructure({model:{name:r,attributes:[pt(o)]},view:PI(t,e)}),n.for("dataDowncast").elementToElement({model:r,view:(l,{writer:a})=>Es(o,l,a)}),n.for("dataDowncast").add(_o(e)))}_registerBlockElement(e){let t=this.editor,i=t.model.schema,n=t.conversion,{view:o,model:r}=e;if(!i.isRegistered(e.model)){if(!e.modelSchema||(i.register(e.model,e.modelSchema),!o))return;n.for("upcast").elementToElement({model:r,view:o,converterPriority:Le.low+2}),n.for("downcast").elementToElement({model:r,view:(l,{writer:a})=>e.isEmpty?a.createEmptyElement(o):a.createContainerElement(o)})}o&&(i.extend(e.model,{allowAttributes:pt(o)}),n.for("upcast").add(Pn(e,this)),n.for("downcast").add(_o(e)))}_registerInlineElement(e){let t=this.editor,i=t.model.schema,n=t.conversion,o=e.model;if(!e.appliesToBlock&&(i.extend("$text",{allowAttributes:o}),e.attributeProperties&&i.setAttributeProperties(o,e.attributeProperties),n.for("upcast").add(BI(e,this)),n.for("downcast").attributeToElement({model:o,view:LI(e)}),!!e.allowEmpty)){if(i.setAttributeProperties(o,{copyFromObject:!1}),!i.isRegistered("htmlEmptyElement")){i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});let r=l=>Array.from(l.getAttributeKeys()).some(a=>a.startsWith("html"));t.model.document.registerPostFixer(l=>{let a=t.model.document.differ.getChanges(),c=new Set;for(let u of a)if(u.type!=="remove"){if(u.type==="attribute"&&u.attributeNewValue===null)for(let{item:d}of u.range)d.is("element","htmlEmptyElement")&&!r(d)&&c.add(d);if(u.type==="insert"&&u.position.nodeAfter){let d=u.position.nodeAfter;for(let{item:m}of l.createRangeOn(d))m.is("element","htmlEmptyElement")&&!r(m)&&c.add(m)}}for(let u of c)l.remove(u);return c.size>0})}t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(r=>r.name==e.view&&r.isEmpty&&Array.from(r.getAttributeKeys()).length?{name:!0}:null),n.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:Vw(e,!0)}),n.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:Vw(e)})}}};Dc=class extends f{static get requires(){return[pe]}static get pluginName(){return"CodeBlockElementSupport"}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;let e=this.editor.plugins.get(pe);e.on("register:pre",(t,i)=>{if(i.model!=="codeBlock")return;let n=this.editor,o=n.model.schema,r=n.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),r.for("upcast").add(NI(e)),r.for("downcast").add(MI()),t.stop()})}};Nc=class extends f{static get requires(){return[pe]}static get pluginName(){return"DualContentModelElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(pe).on("register",(t,i)=>{let n=i,o=this.editor,r=o.model.schema,l=o.conversion;if(!n.paragraphLikeModel||r.isRegistered(n.model)||r.isRegistered(n.paragraphLikeModel))return;let a={model:n.paragraphLikeModel,view:n.view};r.register(n.model,n.modelSchema),r.register(a.model,{inheritAllFrom:"$block"}),l.for("upcast").elementToElement({view:n.view,model:(c,{writer:u})=>this._hasBlockContent(c)?u.createElement(n.model):u.createElement(a.model),converterPriority:Le.low+.5}),l.for("downcast").elementToElement({view:n.view,model:n.model}),this._addAttributeConversion(n),l.for("downcast").elementToElement({view:a.view,model:a.model}),this._addAttributeConversion(a),t.stop()})}_hasBlockContent(e){let t=this.editor.editing.view,i=t.domConverter.blockElements;for(let n of t.createRangeIn(e).getItems())if(n.is("element")&&i.includes(n.name))return!0;return!1}_addAttributeConversion(e){let t=this.editor,i=t.conversion,n=t.plugins.get(pe);t.model.schema.extend(e.model,{allowAttributes:pt(e.view)}),i.for("upcast").add(Pn(e,n)),i.for("downcast").add(_o(e))}},Mc=class extends f{static get requires(){return[Ei,li]}static get pluginName(){return"HeadingElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has("HeadingEditing"))return;let t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){let i=e.plugins.get(Ei),n=[];for(let o of t)"model"in o&&"view"in o&&(i.registerBlockElement({view:o.view,model:o.model}),n.push(o.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:n}}),i.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:n}})}};Uc=class extends f{static get requires(){return[pe]}static get pluginName(){return"ImageElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;let t=e.model.schema,i=e.conversion,n=e.plugins.get(pe);n.on("register:figure",()=>{i.for("upcast").add(WI(n))}),n.on("register:img",(o,r)=>{r.model!=="imageBlock"&&r.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(UI(n)),i.for("downcast").add(zI()),e.plugins.has("LinkImage")&&i.for("upcast").add(HI(n,e)),o.stop())})}};Hc=class extends f{static get requires(){return[pe]}static get pluginName(){return"MediaEmbedElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;let t=e.model.schema,i=e.conversion,n=this.editor.plugins.get(pe),o=this.editor.plugins.get(Ei),r=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:r}),n.on("register:figure",()=>{i.for("upcast").add(jI(n))}),n.on(`register:${r}`,(l,a)=>{a.model==="media"&&(t.extend("media",{allowAttributes:[pt(r),"htmlFigureAttributes"]}),i.for("upcast").add($I(n,r)),i.for("dataDowncast").add(qI(r)),l.stop())})}};Wc=class extends f{static get requires(){return[pe]}static get pluginName(){return"ScriptElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(pe);e.on("register:script",(t,i)=>{let n=this.editor,o=n.model.schema,r=n.conversion;o.register("htmlScript",i.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),n.data.registerRawContentMatcher({name:"script"}),r.for("upcast").elementToElement({view:"script",model:Yc(i)}),r.for("upcast").add(Pn(i,e)),r.for("downcast").elementToElement({model:"htmlScript",view:(l,{writer:a})=>Es("script",l,a)}),r.for("downcast").add(_o(i)),t.stop()})}},GI=["width","max-width","min-width","height","min-height","max-height"],zc=class extends f{static get requires(){return[pe]}static get pluginName(){return"TableElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has("TableEditing"))return;let t=e.model.schema,i=e.conversion,n=e.plugins.get(pe),o=e.plugins.get("TableUtils");n.on("register:figure",()=>{i.for("upcast").add(YI(n))}),n.on("register:table",(r,l)=>{l.model==="table"&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(XI(n)),i.for("downcast").add(QI()),e.model.document.registerPostFixer(KI(e.model,o)),r.stop())})}};$c=class extends f{static get requires(){return[pe]}static get pluginName(){return"StyleElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(pe);e.on("register:style",(t,i)=>{let n=this.editor,o=n.model.schema,r=n.conversion;o.register("htmlStyle",i.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),n.data.registerRawContentMatcher({name:"style"}),r.for("upcast").elementToElement({view:"style",model:Yc(i)}),r.for("upcast").add(Pn(i,e)),r.for("downcast").elementToElement({model:"htmlStyle",view:(l,{writer:a})=>Es("style",l,a)}),r.for("downcast").add(_o(i)),t.stop()})}},jc=class extends f{static get requires(){return[pe]}static get pluginName(){return"ListElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has("ListEditing"))return;let t=e.model.schema,i=e.conversion,n=e.plugins.get(pe),o=e.plugins.get("ListEditing"),r=e.plugins.get("ListUtils"),l=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:Kt}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:Kt}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:Kt}),n.on("register",(a,c)=>{if(!l.includes(c.view)||(a.stop(),t.checkAttribute("$block","htmlLiAttributes")))return;let u=l.map(d=>pt(d));t.extend("$listItem",{allowAttributes:u}),i.for("upcast").add(d=>{d.on("element:ul",Oc("htmlUlAttributes",n),{priority:"low"}),d.on("element:ol",Oc("htmlOlAttributes",n),{priority:"low"}),d.on("element:li",Oc("htmlLiAttributes",n),{priority:"low"})})}),o.on("postFixer",(a,{listNodes:c,writer:u})=>{for(let{node:d,previousNodeInList:m}of c)if(m){if(m.getAttribute("listType")==d.getAttribute("listType")){let h=Fw(m.getAttribute("listType")),g=m.getAttribute(h);!fi(d.getAttribute(h),g)&&u.model.schema.checkAttribute(d,h)&&(u.setAttribute(h,g,d),a.return=!0)}if(m.getAttribute("listItemId")==d.getAttribute("listItemId")){let h=m.getAttribute("htmlLiAttributes");!fi(d.getAttribute("htmlLiAttributes"),h)&&u.model.schema.checkAttribute(d,"htmlLiAttributes")&&(u.setAttribute("htmlLiAttributes",h,d),a.return=!0)}}}),o.on("postFixer",(a,{listNodes:c,writer:u})=>{for(let{node:d}of c){let m=d.getAttribute("listType");!r.isNumberedListType(m)&&d.getAttribute("htmlOlAttributes")&&(u.removeAttribute("htmlOlAttributes",d),a.return=!0),r.isNumberedListType(m)&&d.getAttribute("htmlUlAttributes")&&(u.removeAttribute("htmlUlAttributes",d),a.return=!0)}})}afterInit(){let e=this.editor;if(!e.commands.get("indentList"))return;let t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(i,n)=>{e.model.change(o=>{for(let r of n){let l=Fw(r.getAttribute("listType"));e.model.schema.checkAttribute(r,l)&&o.setAttribute(l,{},r)}})})}};qc=class extends f{static get requires(){return[pe]}static get pluginName(){return"HorizontalLineElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;let t=e.model.schema,i=e.conversion,n=e.plugins.get(pe);n.on("register:hr",(o,r)=>{r.model==="horizontalLine"&&(t.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),i.for("upcast").add(Pn(r,n)),i.for("downcast").add(JI()),o.stop())})}};Gc=class extends f{static get requires(){return[pe]}static get pluginName(){return"IframeElementSupport"}static get isOfficialPlugin(){return!0}init(){this.editor.config.define("htmlSupport.htmlIframeSandbox",!0),this._setupSandboxConversion()}_setupSandboxConversion(){let{plugins:e,config:t,conversion:i}=this.editor,n=e.get(pe),o=t.get("htmlSupport.htmlIframeSandbox");if(o===!1)return;let r=Array.isArray(o)?Array.from(o):[];n.on("register:iframe",(l,a)=>{i.for("editingDowncast").add(c=>{c.on(`insert:${a.model}`,(u,d,m)=>{let{mapper:h,writer:g}=m,p=h.toViewElement(d.item);for(let{item:b}of g.createRangeOn(p))if(b.is("element","iframe"))if(b.hasAttribute("sandbox")){let w=new Set,k=b.getAttribute("sandbox");for(let T of k.trim().split(/\s+/))r.includes(T)&&w.add(T);g.setAttribute("sandbox",Array.from(w).join(" "),b)}else g.setAttribute("sandbox",r.join(" "),b)},{priority:"lowest"})})})}},Kc=class extends f{static get requires(){return[pe,Ei]}static get pluginName(){return"CustomElementSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(pe),t=this.editor.plugins.get(Ei);e.on("register:$customElement",(i,n)=>{i.stop();let o=this.editor,r=o.model.schema,l=o.conversion,a=o.editing.view.domConverter.unsafeElements,c=o.data.htmlProcessor.domConverter.preElements;r.register(n.model,n.modelSchema),r.extend(n.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),l.for("upcast").elementToElement({view:/.*/,model:(u,d)=>{if(u.name=="$comment")return null;if(!ZI(u.name)||t.getDefinitionsForView(u.name).size)return null;a.includes(u.name)||a.push(u.name),c.includes(u.name)||c.push(u.name);let m=d.writer.createElement(n.model,{htmlElementName:u.name}),h=e.processViewAttributes(u,d);h&&d.writer.setAttribute("htmlCustomElementAttributes",h,m);let g;if(u.is("element","template")&&u.getCustomProperty("$rawContent"))g=u.getCustomProperty("$rawContent");else{let b=new Ft(u.document).createDocumentFragment(u),w=o.data.htmlProcessor.domConverter.viewToDom(b),k=w.firstChild;for(;k.firstChild;)w.appendChild(k.firstChild);k.remove(),g=o.data.htmlProcessor.htmlWriter.getHtml(w)}d.writer.setAttribute("htmlContent",g,m);for(let{item:p}of o.editing.view.createRangeIn(u))d.consumable.consume(p,{name:!0});return m},converterPriority:"low"}),l.for("editingDowncast").elementToElement({model:{name:n.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:d})=>{let m=u.getAttribute("htmlElementName"),h=d.createRawElement(m);return u.hasAttribute("htmlCustomElementAttributes")&&Kt(d,u.getAttribute("htmlCustomElementAttributes"),h),h}}),l.for("dataDowncast").elementToElement({model:{name:n.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:d})=>{let m=u.getAttribute("htmlElementName"),h=u.getAttribute("htmlContent"),g=d.createRawElement(m,null,(p,b)=>{b.setContentOf(p,h)});return u.hasAttribute("htmlCustomElementAttributes")&&Kt(d,u.getAttribute("htmlCustomElementAttributes"),g),g}})})}};Ow=class extends f{static get pluginName(){return"GeneralHtmlSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[pe,Dc,Nc,Mc,Uc,Hc,Wc,zc,$c,jc,qc,Gc,Kc]}init(){let e=this.editor,t=e.plugins.get(pe);t.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}afterInit(){this.editor.commands.get("removeFormat")?.registerCustomAttribute(t=>t.startsWith("html")&&t.endsWith("Attributes"),SI)}getGhsAttributeNameForElement(e){let t=this.editor.plugins.get("DataSchema"),i=Array.from(t.getDefinitionsForView(e,!1)),n=i.find(o=>o.isInline&&!i[0].isObject);return n?n.model:pt(e)}addModelHtmlClass(e,t,i){let n=this.editor.model,o=this.getGhsAttributeNameForElement(e);n.change(r=>{for(let l of Vn(n,i,o))Sn(r,l,o,"classes",a=>{for(let c of Ve(t))a.add(c)})})}removeModelHtmlClass(e,t,i){let n=this.editor.model,o=this.getGhsAttributeNameForElement(e);n.change(r=>{for(let l of Vn(n,i,o))Sn(r,l,o,"classes",a=>{for(let c of Ve(t))a.delete(c)})})}setModelHtmlAttributes(e,t,i){let n=this.editor.model,o=this.getGhsAttributeNameForElement(e);n.change(r=>{for(let l of Vn(n,i,o))Sn(r,l,o,"attributes",a=>{for(let[c,u]of Object.entries(t))a.set(c,u)})})}removeModelHtmlAttributes(e,t,i){let n=this.editor.model,o=this.getGhsAttributeNameForElement(e);n.change(r=>{for(let l of Vn(n,i,o))Sn(r,l,o,"attributes",a=>{for(let c of Ve(t))a.delete(c)})})}setModelHtmlStyles(e,t,i){let n=this.editor.model,o=this.getGhsAttributeNameForElement(e);n.change(r=>{for(let l of Vn(n,i,o))Sn(r,l,o,"styles",a=>{for(let[c,u]of Object.entries(t))a.set(c,u)})})}removeModelHtmlStyles(e,t,i){let n=this.editor.model,o=this.getGhsAttributeNameForElement(e);n.change(r=>{for(let l of Vn(n,i,o))Sn(r,l,o,"styles",a=>{for(let c of Ve(t))a.delete(c)})})}};Dw=class extends f{static get pluginName(){return"HtmlComment"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=new Map;e.data.processor.skipComments=!1,e.model.schema.addAttributeCheck((i,n)=>{if(i.endsWith("$root")&&n.startsWith("$comment"))return!0}),e.conversion.for("upcast").elementToMarker({view:"$comment",model:i=>{let o=`$comment:${yt()}`,r=i.getCustomProperty("$rawContent");return t.set(o,r),o}}),e.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(i,{writer:n})=>{let o;for(let c of this.editor.model.document.getRootNames())if(o=this.editor.model.document.getRoot(c),o.hasAttribute(i.markerName))break;let r=i.markerName,l=o.getAttribute(r),a=n.createUIElement("$comment");return n.setCustomProperty("$rawContent",l,a),a}}),e.model.document.registerPostFixer(i=>{let n=!1,o=e.model.document.differ.getChangedMarkers().filter(r=>r.name.startsWith("$comment:"));for(let r of o){let{oldRange:l,newRange:a}=r.data;if(!(l&&a&&l.root==a.root)){if(l){let c=l.root;c.hasAttribute(r.name)&&(i.removeAttribute(r.name,c),n=!0)}if(a){let c=a.root;c.rootName=="$graveyard"?(i.removeMarker(r.name),n=!0):c.hasAttribute(r.name)||(i.setAttribute(r.name,t.get(r.name)||"",c),n=!0)}}}return n}),e.data.on("set",()=>{for(let i of e.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(i.name)},{priority:"high"}),e.model.on("deleteContent",(i,[n])=>{for(let o of n.getRanges()){let r=e.model.schema.getLimitElement(o),l=e.model.createPositionAt(r,0),a=e.model.createPositionAt(r,"end"),c;l.isTouching(o.start)&&a.isTouching(o.end)?c=this.getHtmlCommentsInRange(e.model.createRange(l,a)):c=this.getHtmlCommentsInRange(o,{skipBoundaries:!0});for(let u of c)this.removeHtmlComment(u)}},{priority:"high"})}createHtmlComment(e,t){let i=yt(),o=this.editor.model,r=o.document.getRoot(e.root.rootName),l=`$comment:${i}`;return o.change(a=>{let c=a.createRange(e);return a.addMarker(l,{usingOperation:!0,affectsData:!0,range:c}),a.setAttribute(l,t,r),l})}removeHtmlComment(e){let t=this.editor,i=t.model.markers.get(e);return i?(t.model.change(n=>{n.removeMarker(i)}),!0):!1}getHtmlCommentData(e){let i=this.editor.model.markers.get(e);if(!i)return null;let n="";for(let o of this.editor.model.document.getRoots())if(o.hasAttribute(e)){n=o.getAttribute(e);break}return{content:n,position:i.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:t=!1}={}){let i=!t;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(o=>n(o,e)).map(o=>o.name);function n(o,r){let l=o.getRange().start;return(l.isAfter(r.start)||i&&l.isEqual(r.start))&&(l.isBefore(r.end)||i&&l.isEqual(r.end))}}},Xc=class extends jg{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let t="",i="";e=e.trim().replace(/<\?xml\s[^?]*\?>/i,a=>(i=a,"")),e=e.trim().replace(/^<!DOCTYPE\s[^>]*?>/i,a=>(t=a,""));let n=this._toDom(e),o=this.domConverter.domToView(n,{skipComments:this.skipComments}),r=new Ft(o.document);r.setCustomProperty("$fullPageDocument",n.ownerDocument.documentElement.outerHTML,o);let l=Array.from(n.ownerDocument.querySelectorAll("head style"));return r.setCustomProperty("$fullPageHeadStyles",l,o),t&&r.setCustomProperty("$fullPageDocType",t,o),i&&r.setCustomProperty("$fullPageXmlDeclaration",i,o),o}toData(e){let t=super.toData(e),i=e.getCustomProperty("$fullPageDocument"),n=e.getCustomProperty("$fullPageDocType"),o=e.getCustomProperty("$fullPageXmlDeclaration");return i&&(t=i.replace(/<\/body\s*>/,t+"$&"),n&&(t=n+`
29`+t),o&&(t=o+`
30`+t)),t}},Nw=class extends f{static get pluginName(){return"FullPage"}static get licenseFeatureCode(){return"FPH"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("htmlSupport.fullPage",{allowRenderStylesFromHead:!1,sanitizeCss:t=>(Q("css-full-page-provide-sanitize-function"),{css:t,hasChanged:!1})}),e.data.processor=new Xc(e.data.viewDocument)}init(){let e=this.editor,t=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration","$fullPageHeadStyles"];e.model.schema.extend("$root",{allowAttributes:t}),e.data.on("toModel",(i,[n])=>{let o=e.model.document.getRoot();e.model.change(r=>{for(let l of t){let a=n.getCustomProperty(l);a&&r.setAttribute(l,a,o)}}),Mw(e)&&this._renderStylesFromHead(o)},{priority:"low"}),e.data.on("toView",(i,[n])=>{if(!n.is("rootElement"))return;let o=n,r=i.return;if(!o.hasAttribute("$fullPageDocument"))return;let l=new Ft(r.document);for(let a of t){let c=o.getAttribute(a);c&&l.setCustomProperty(a,c,r)}},{priority:"low"}),e.data.on("set",()=>{let i=e.model.document.getRoot();e.model.change(n=>{for(let o of t)i.hasAttribute(o)&&n.removeAttribute(o,i)})},{priority:"high"}),e.data.on("get",(i,n)=>{n[0]||(n[0]={}),n[0].trim=!1},{priority:"high"})}destroy(){super.destroy(),Mw(this.editor)&&this._removeStyleElementsFromDom()}_removeStyleElementsFromDom(){let e=Array.from(W.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(let t of e)t.remove()}_renderStyleElementsInDom(e){let t=this.editor,i=e.getAttribute("$fullPageHeadStyles");if(!i)return;let n=t.config.get("htmlSupport.fullPage.sanitizeCss");for(let o of i){o.setAttribute("data-full-page-style-id",t.id);let r=n(o.innerText);r.hasChanged&&(o.innerText=r.css),W.document.head.append(o)}}_renderStylesFromHead(e){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(e)}};qt="htmlEmptyBlock",Uw=class extends f{static get pluginName(){return"EmptyBlock"}static get isOfficialPlugin(){return!0}afterInit(){let{model:e,conversion:t,plugins:i,config:n}=this.editor,o=e.schema,r=n.get("htmlSupport.preserveEmptyBlocksInEditingView");o.extend("$block",{allowAttributes:[qt]}),o.extend("$container",{allowAttributes:[qt]}),o.isRegistered("tableCell")&&o.extend("tableCell",{allowAttributes:[qt]}),r?t.for("downcast").add(Hw()):t.for("dataDowncast").add(Hw()),t.for("upcast").add(tT(o)),i.has("ClipboardPipeline")&&this._registerClipboardPastingHandler()}_registerClipboardPastingHandler(){let e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"contentInsertion",(t,i)=>{i.sourceEditorId!==this.editor.id&&this.editor.model.change(n=>{for(let{item:o}of n.createRangeIn(i.content))o.is("element")&&o.hasAttribute(qt)&&n.removeAttribute(qt,o)})})}}});var zw=Lt(Qc=>{"use strict";Object.defineProperty(Qc,Symbol.toStringTag,{value:"Module"});function iT(s){if(!s||typeof s!="object")return!1;let e=Object.getPrototypeOf(s);
30return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(s)==="[object Object]":!1}Qc.isPlainObject=iT});var $w=Lt(Jc=>{"use strict";Object.defineProperty(Jc,Symbol.toStringTag,{value:"Module"});function nT(s){return Object.getOwnPropertySymbols(s).filter(e=>Object.prototype.propertyIsEnumerable.call(s,e))}Jc.getSymbols=nT});var jw=Lt(Zc=>{"use strict";Object.defineProperty(Zc,Symbol.toStringTag,{value:"Module"});function oT(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}Zc.getTag=oT});var qw=Lt(he=>{"use strict";Object.defineProperty(he,Symbol.toStringTag,{value:"Module"});var sT="[object RegExp]",rT="[object String]",lT="[object Number]",aT="[object Boolean]",cT="[object Arguments]",uT="[object Symbol]",dT="[object Date]",mT="[object Map]",hT="[object Set]",gT="[object Array]",fT="[object Function]",pT="[object ArrayBuffer]",bT="[object Object]",wT="[object Error]",_T="[object DataView]",kT="[object Uint8Array]",yT="[object Uint8ClampedArray]",vT="[object Uint16Array]",CT="[object Uint32Array]",IT="[object BigUint64Array]",TT="[object Int8Array]",AT="[object Int16Array]",ET="[object Int32Array]",xT="[object BigInt64Array]",ST="[object Float32Array]",VT="[object Float64Array]";he.argumentsTag=cT;he.arrayBufferTag=pT;he.arrayTag=gT;he.bigInt64ArrayTag=xT;he.bigUint64ArrayTag=IT;he.booleanTag=aT;he.dataViewTag=_T;he.dateTag=dT;he.errorTag=wT;he.float32ArrayTag=ST;he.float64ArrayTag=VT;he.functionTag=fT;he.int16ArrayTag=AT;he.int32ArrayTag=ET;he.int8ArrayTag=TT;he.mapTag=mT;he.numberTag=lT;he.objectTag=bT;he.regexpTag=sT;he.setTag=hT;he.stringTag=rT;he.symbolTag=uT;he.uint16ArrayTag=vT;he.uint32ArrayTag=CT;he.uint8ArrayTag=kT;he.uint8ClampedArrayTag=yT});var Gw=Lt(eu=>{"use strict";Object.defineProperty(eu,Symbol.toStringTag,{value:"Module"});function PT(s,e){return s===e||Number.isNaN(s)&&Number.isNaN(e)}eu.eq=PT});var Qw=Lt(tu=>{"use strict";Object.defineProperty(tu,Symbol.toStringTag,{value:"Module"});var Kw=zw(),Xw=$w(),Yw=jw(),ue=qw(),BT=Gw();function LT(s,e,t){return yo(s,e,void 0,void 0,void 0,void 0,t)}function yo(s,e,t,i,n,o,r){let l=r(s,e,t,i,n,o);if(l!==void 0)return l;if(typeof s==typeof e)switch(typeof s){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return s===e;case"number":return s===e||Object.is(s,e);case"function":return s===e;case"object":return vo(s,e,o,r)}return vo(s,e,o,r)}function vo(s,e,t,i){if(Object.is(s,e))return!0;let n=Yw.getTag(s),o=Yw.getTag(e);if(n===ue.argumentsTag&&(n=ue.objectTag),o===ue.argumentsTag&&(o=ue.objectTag),n!==o)return!1;switch(n){case ue.stringTag:return s.toString()===e.toString();case ue.numberTag:{let a=s.valueOf(),c=e.valueOf();return BT.eq(a,c)}case ue.booleanTag:case ue.dateTag:case ue.symbolTag:return Object.is(s.valueOf(),e.valueOf());case ue.regexpTag:return s.source===e.source&&s.flags===e.flags;case ue.functionTag:return s===e}t=t??new Map;let r=t.get(s),l=t.get(e);if(r!=null&&l!=null)return r===e;t.set(s,e),t.set(e,s);try{switch(n){case ue.mapTag:{if(s.size!==e.size)return!1;for(let[a,c]of s.entries())if(!e.has(a)||!yo(c,e.get(a),a,s,e,t,i))return!1;return!0}case ue.setTag:{if(s.size!==e.size)return!1;let a=Array.from(s.values()),c=Array.from(e.values());for(let u=0;u<a.length;u++){let d=a[u],m=c.findIndex(h=>yo(d,h,void 0,s,e,t,i));if(m===-1)return!1;c.splice(m,1)}return!0}case ue.arrayTag:case ue.uint8ArrayTag:case ue.uint8ClampedArrayTag:case ue.uint16ArrayTag:case ue.uint32ArrayTag:case ue.bigUint64ArrayTag:case ue.int8ArrayTag:case ue.int16ArrayTag:case ue.int32ArrayTag:case ue.bigInt64ArrayTag:case ue.float32ArrayTag:case ue.float64ArrayTag:{if(typeof Buffer<"u"&&Buffer.isBuffer(s)!==Buffer.isBuffer(e)||s.length!==e.length)return!1;for(let a=0;a<s.length;a++)if(!yo(s[a],e[a],a,s,e,t,i))return!1;return!0}case ue.arrayBufferTag:return s.byteLength!==e.byteLength?!1:vo(new Uint8Array(s),new Uint8Array(e),t,i);case ue.dataViewTag:return s.byteLength!==e.byteLength||s.byteOffset!==e.byteOffset?!1:vo(new Uint8Array(s),new Uint8Array(e),t,i);case ue.errorTag:return s.name===e.name&&s.message===e.message;
30case ue.objectTag:{if(!(vo(s.constructor,e.constructor,t,i)||Kw.isPlainObject(s)&&Kw.isPlainObject(e)))return!1;let c=[...Object.keys(s),...Xw.getSymbols(s)],u=[...Object.keys(e),...Xw.getSymbols(e)];if(c.length!==u.length)return!1;for(let d=0;d<c.length;d++){let m=c[d],h=s[m];if(!Object.hasOwn(e,m))return!1;let g=e[m];if(!yo(h,g,m,s,e,t,i))return!1}return!0}default:return!1}}finally{t.delete(s),t.delete(e)}}tu.isEqualWith=LT});var Jw=Lt(iu=>{"use strict";Object.defineProperty(iu,Symbol.toStringTag,{value:"Module"});function RT(){}iu.noop=RT});var Zw=Lt(nu=>{"use strict";Object.defineProperty(nu,Symbol.toStringTag,{value:"Module"});var FT=Qw(),OT=Jw();function DT(s,e){return FT.isEqualWith(s,e,OT.noop)}nu.isEqual=DT});var t_=Lt((_R,e_)=>{e_.exports=Zw().isEqual});function NT(s){return s.createContainerElement("span",{class:"image-inline"},s.createEmptyElement("img"))}function i_(s){return s.createContainerElement("figure",{class:"image"},[s.createEmptyElement("img"),s.createSlot("children")])}function w_(s,e){let t=s.plugins.get("ImageUtils"),i=s.plugins.has("ImageInlineEditing")&&s.plugins.has("ImageBlockEditing");return o=>t.isInlineImageView(o)?i&&(o.getStyle("display")=="block"||o.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:n(o):null;function n(o){let r={name:!0};return o.hasAttribute("src")&&(r.attributes=["src"]),r}}function Ou(s,e){let t=O(e.getSelectedBlocks());return!t||s.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function Ss(s){return s&&s.endsWith("px")?parseInt(s):null}function Vs(s){let e=Ss(s.getStyle("width")),t=Ss(s.getStyle("height"));return!!(e&&t)}function UT(s,e){if(__(s,e,null)=="imageBlock"){let i=WT(e,s.model);if(s.model.schema.checkChild(i,"imageBlock"))return!0}else if(s.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}function HT(s){return[...s.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function WT(s,e){let i=Wt(s,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function __(s,e,t){let i=s.model.schema,n=s.config.get("image.insert.type");return s.plugins.has("ImageBlockEditing")?s.plugins.has("ImageInlineEditing")?t||(n==="inline"?"imageInline":n!=="auto"?"imageBlock":e.is("selection")?Ou(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}function $T(s){let e=s.plugins.get("ContextualBalloon");if(s.plugins.get("ImageUtils").getClosestSelectedImageWidget(s.editing.view.document.selection)){let i=Du(s);e.updatePosition(i)}}function Du(s){let e=s.editing.view,t=tt.defaultPositions,i=s.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]}}function jT(s){let e=(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;let o=s.findViewImgElement(i.viewItem);if(!o||!n.consumable.test(o,{name:!0}))return;n.consumable.consume(i.viewItem,{name:!0,classes:"image"});let r=n.convertItem(o,i.modelCursor),l=O(r.modelRange.getItems());if(!l){n.consumable.revert(i.viewItem,{name:!0,classes:"image"});return}n.convertChildren(i.viewItem,l),n.updateConversionResult(l,i)};return t=>{t.on("element:figure",e)}}function qT(s){let e=["srcset","media","type","sizes"],t=(i,n,o)=>{let r=n.viewItem;if(!o.consumable.test(r,{name:!0}))return;let l=new Map;for(let u of r.getChildren())if(u.is("element","source")){let d={};for(let m of e)u.hasAttribute(m)&&o.consumable.test(u,{attributes:m})&&(d[m]=u.getAttribute(m));Object.keys(d).length&&l.set(u,d)}let a=s.findViewImgElement(r);if(!a)return;let c=n.modelCursor.parent;if(!c.is("element","imageBlock")){let u=o.convertItem(a,n.modelCursor);n.modelRange=u.modelRange,n.modelCursor=u.modelCursor,c=O(u.modelRange.getItems())}o.consumable.consume(r,{name:!0});for(let[u,d]of l)o.consumable.consume(u,{attributes:Object.keys(d)});l.size&&o.writer.setAttribute("sources",Array.from(l.values()),c),o.convertChildren(r,c)};return i=>{i.on("element:picture",t)}}function k_(s,e){let t=(i,n,o)=>
vendor: 4,902 bytes, line 30
30{if(!o.consumable.consume(n.item,i.name))return;let r=o.writer,l=o.mapper.toViewElement(n.item),a=s.findViewImgElement(l);n.attributeNewValue===null?(r.removeAttribute("srcset",a),r.removeAttribute("sizes",a)):n.attributeNewValue&&(r.setAttribute("srcset",n.attributeNewValue,a),r.setAttribute("sizes","100vw",a))};return i=>{i.on(`attribute:srcset:${e}`,t)}}function GT(s){let e=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;let o=n.writer,r=n.mapper.toViewElement(i.item),l=s.findViewImgElement(r),a=i.attributeNewValue;if(a&&a.length){let c=[],u=l.parent;for(;u&&u.is("attributeElement");){let h=u.parent;o.unwrap(o.createRangeOn(l),u),c.unshift(u),u=h}let d=l.parent.is("element","picture"),m=d?l.parent:o.createContainerElement("picture",null);d||o.insert(o.createPositionBefore(l),m),o.remove(o.createRangeIn(m)),o.insert(o.createPositionAt(m,"end"),a.map(h=>o.createEmptyElement("source",h))),o.move(o.createRangeOn(l),o.createPositionAt(m,"end"));for(let h of c)o.wrap(o.createRangeOn(m),h)}else if(l.parent.is("element","picture")){let c=l.parent;o.move(o.createRangeOn(l),o.createPositionBefore(c)),o.remove(c)}};return t=>{t.on("attribute:sources:imageBlock",e),t.on("attribute:sources:imageInline",e)}}function Bs(s,e,t){let i=(n,o,r)=>{if(!r.consumable.consume(o.item,n.name))return;let l=r.writer,a=r.mapper.toViewElement(o.item),c=s.findViewImgElement(a);l.setAttribute(o.attributeKey,o.attributeNewValue||"",c)};return n=>{n.on(`attribute:${t}:${e}`,i)}}function y_(s){let e=s.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function KT(s){return new Promise((e,t)=>{let i=s.getAttribute("src");fetch(i).then(n=>n.blob()).then(n=>{let o=v_(n,i),l=`image.${o.replace("image/","")}`,a=new File([n],l,{type:o});e(a)}).catch(n=>n&&n.name==="TypeError"?YT(i).then(e).catch(t):t(n))})}function XT(s,e){return!s.isInlineImageView(e)||!e.getAttribute("src")?!1:!!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!e.getAttribute("src").match(/^blob:/g)}function v_(s,e){return s.type?s.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function YT(s){return QT(s).then(e=>{let t=v_(e,s),n=`image.${t.replace("image/","")}`;return new File([e],n,{type:t})})}function QT(s){return new Promise((e,t)=>{let i=W.document.createElement("img");i.addEventListener("load",()=>{let n=W.document.createElement("canvas");n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0),n.toBlob(r=>r?e(r):t())}),i.addEventListener("error",()=>t()),i.src=s})}function r_(s,e){s.hasClass("ck-appear")||e.addClass("ck-appear",s)}function JT(s,e){e.removeClass("ck-appear",s)}function l_(s,e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);let n=s.findViewImgElement(t);n.getAttribute("src")!==e&&i.setAttribute("src",e,n),C_(t,"placeholder")||i.insert(i.createPositionAfter(n),nA(i))}function a_(s,e){s.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",s),I_(s,e,"placeholder")}function ZT(s,e,t,i){let n=iA(e);e.insert(e.createPositionAt(s,"end"),n),t.on("change:uploadedPercent",(o,r,l)=>{i.change(a=>{a.setStyle("width",l+"%",n)})})}function eA(s,e){I_(s,e,"progressBar")}function tA(s,e,t){let i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(s,"end"),i),setTimeout(()=>{t.change(n=>n.remove(n.createRangeOn(i)))},3e3)}function iA(s){let e=s.createUIElement("div",{class:"ck-progress-bar"});return s.setCustomProperty("progressBar",!0,e),e}function nA(s){let e=s.createUIElement("div",{class:"ck-upload-placeholder-loader"});return s.setCustomProperty("placeholder",!0,e),e}function C_(s,e){for(let t of s.getChildren())if(t.getCustomProperty(e))return t}function I_(s,e,t){let i=C_(s,t);i&&e.remove(e.createRangeOn(i))}function oA(s,e,t,i){if(i.data){let n=s.findViewImgElement(e);t.setAttribute("src",i.data,n)}}function sA(s){return Array.from(s.types).includes("text/html")&&s.getData("text/html")!==""}function rA(s,e){let t=s.plugins.get("ImageUtils");return Array.from(s.model.createRangeOn(e)).filter(i=>t.isImage(i.item)).map(i=>i.item)}function Co(s){return s.value==="custom"}function Su(s){return(e,t)=>{let i=e;return i===void 0||!t?!1:s===null&&i===s?!0:i!==null&&i.width===s}}function lA(s){return(e,t)=>!s.some(i=>Su(i)(e,t))}function T_(s){if(!s)return null;let[,e,t]=s.trim().match(/([.,\d]+)(%|px)$/)||[],i=Number.parseFloat(e);return Number.isNaN(i)?null:{value:i,unit:t}}function A_(s,e,t){return t==="px"?{value:e.value,unit:"px"}:{value:e.value/s*100,unit:"%"}}function E_(s){let{editing:e}=s,i=s.plugins.get("ImageUtils").getClosestSelectedImageElement(s.model.document.selection);if(!i)return null;let n=e.mapper.toViewElement(i),o=e.view.domConverter.mapViewToDom(n);return{model:i,view:n,dom:o}}function cA(s,e){let t=E_(s);if(!t)return null;
30let i=T_(t.model.getAttribute("resizedWidth")||null);if(!i)return null;if(i.unit===e)return i;let n=dl(t.dom),o={value:new ie(t.dom).width};return A_(n,o,e)}function uA(s,e){let t=E_(s);if(!t)return null;let i=dl(t.dom),n=T_(window.getComputedStyle(t.dom).minWidth)||{value:1},o=Math.max(.1,A_(i,n,e).value);return{unit:e,lower:o,upper:e==="px"?i:100}}function dA(s){let e=s.t;return[t=>{if(t.rawSize.trim()==="")return e("The value must not be empty.");if(t.parsedSize===null)return e("The value should be a plain number.")}]}function gA(s){return(s.configuredStyles.options||[]).map(i=>bA(i)).filter(i=>wA(i,s))}function fA(s,e){return s&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:s?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function pA(s){return s.has("ImageBlockEditing")&&s.has("ImageInlineEditing")?[...hA]:[]}function bA(s){return typeof s=="string"?xs[s]?s=I({},xs[s]):s={name:s}:s=_A(xs[s.name],s),typeof s.icon=="string"&&(s.icon=mA[s.icon]||s.icon),s}function wA(s,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){let{modelElements:i,name:n}=s;if(!i||!i.length||!n)return x_({style:s}),!1;{let o=[e?"imageBlock":null,t?"imageInline":null];if(!i.some(r=>o.includes(r)))return Q("image-style-missing-dependency",{style:s,missingPlugins:i.map(r=>r==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function _A(s,e){let t=I({},e);for(let i in s)Object.prototype.hasOwnProperty.call(e,i)||(t[i]=s[i]);return t}function x_(s){Q("image-style-configuration-definition-invalid",s)}function kA(s){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;let n=Ru(t.attributeNewValue,s),o=Ru(t.attributeOldValue,s),r=i.mapper.toViewElement(t.item),l=i.writer;o&&l.removeClass(o.className,r),n&&l.addClass(n.className,r)}}function yA(s){let e={imageInline:s.filter(t=>!t.isDefault&&t.modelElements.includes("imageInline")),imageBlock:s.filter(t=>!t.isDefault&&t.modelElements.includes("imageBlock"))};return(t,i,n)=>{if(!i.modelRange)return;let o=i.viewItem,r=O(i.modelRange.getItems());if(r&&n.schema.checkAttribute(r,"imageStyle")){for(let l of e[r.name])n.consumable.consume(o,{classes:l.className})&&n.writer.setAttribute("imageStyle",l.name,r);vA(n,o,r,s)}}}function vA(s,e,t,i){if(!s.consumable.test(e,{styles:["float"]}))return;let n=null;switch(e.getStyle("float")){case"left":n="alignLeft";break;case"right":n="alignRight";break}if(!n)return;let o=Ru(n,i);if(!o)return;let r=xs[o.name];(0,b_.default)(o,r)&&(s.writer.setAttribute("imageStyle",n,t),s.consumable.consume(e,{styles:["float"]}))}function Ru(s,e){for(let t of e)if(t.name===s)return t}function d_(s,e){for(let t of s)e[t.title]&&(t.title=e[t.title]);return s}function m_(s){return`imageStyle:${s}`}function h_(s,e){return(s?s+": ":"")+e}function CA(s){return s.map(e=>Ni(e)?e.name:e)}var b_,MT,Pe,zT,n_,ru,lu,au,cu,Ps,Io,uu,du,To,Ls,Rs,Fs,Os,mu,Xi,hu,gu,fu,o_,Ds,pu,bu,wu,s_,_u,ku,yu,vu,Cu,Iu,Tu,Au,c_,Eu,Ns,ou,xu,aA,su,Vu,Pu,Bu,u_,Lu,xs,mA,hA,Ms,Us,Fu,g_,f_,p_,S_=M(()=>{U();Ci();ve();us();at();j();zt();z();re();Jn();b_=mg(t_(),1);Me();MT=/^(image|image-inline)$/,Pe=class extends f{_domEmitter=new(cn());static get pluginName(){return"ImageUtils"}static get isOfficialPlugin(){return!0}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,n={}){let o=this.editor,r=o.model,l=r.document.selection,a=__(o,t||l,i);e=I(I({},Object.fromEntries(l.getAttributes())),e);for(let c in e)r.schema.checkAttribute(a,c)||delete e[c];return r.change(c=>{let{setImageSizes:u=!0}=n,d=c.createElement(a,e);return r.insertObject(d,t,null,{setSelection:"on",findOptimalPosition:!t&&a!="imageInline"?"auto":void 0}),d.parent?(u&&this.setImageNaturalSizeAttributes(d),d):null})}setImageNaturalSizeAttributes(e){let t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(i=>{let n=new W.window.Image;this._domEmitter.listenTo(n,"load",()=>{!e.getAttribute("width")&&!e.getAttribute("height")&&this.editor.model.enqueueChange(i.batch,o=>
vendor: 20,068 bytes, line 30
30{o.setAttribute("width",n.naturalWidth,e),o.setAttribute("height",n.naturalHeight,e)}),this._domEmitter.stopListening(n,"load")}),n.src=t}))}getClosestSelectedImageWidget(e){let t=e.getFirstPosition();if(!t)return null;let i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let n=t.parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(e){let t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:MT})}isImageAllowed(){let t=this.editor.model.document.selection;return UT(this.editor,t)&&HT(t)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),We(e,t,{label:()=>{let r=this.findViewImgElement(e).getAttribute("alt");return r?`${r} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&Ht(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;let t=this.editor.editing.view;for(let{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}};zT=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source)),n_=class extends f{static get requires(){return[yn,Pe,vn,it]}static get pluginName(){return"AutoImage"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){let e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{let n=t.selection.getFirstRange(),o=It.fromPosition(n.start);o.stickiness="toPrevious";let r=It.fromPosition(n.end);r.stickiness="toNext",t.once("change:data",()=>{this._embedImageBetweenPositions(o,r),o.detach(),r.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(W.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedImageBetweenPositions(e,t){let i=this.editor,n=new un(e,t),o=n.getWalker({ignoreElementEnd:!0}),r=Object.fromEntries(i.model.document.selection.getAttributes()),l=this.editor.plugins.get("ImageUtils"),a="";for(let c of o)c.item.is("$textProxy")&&(a+=c.item.data);if(a=a.trim(),!a.match(zT)){n.detach();return}this._positionToInsert=It.fromPosition(e),this._timeoutId=setTimeout(()=>{if(!i.commands.get("insertImage").isEnabled){n.detach();return}i.model.change(d=>{this._timeoutId=null,d.remove(n),n.detach();let m;this._positionToInsert.root.rootName!=="$graveyard"&&(m=this._positionToInsert.toPosition()),l.insertImage(N(I({},r),{src:a}),m),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get("Delete").requestUndoOnBackspace()},100)}},ru=class extends v{refresh(){let 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){let t=this.editor,i=t.plugins.get("ImageUtils"),n=t.model,o=i.getClosestSelectedImageElement(n.document.selection);n.change(r=>{r.setAttribute("alt",e.newValue,o)})}},lu=class extends f{static get requires(){return[Pe]}static get pluginName(){return"ImageTextAlternativeEditing"}static get isOfficialPlugin(){return!0}init(){this.editor.commands.add("imageTextAlternative",new ru(this.editor))}},au=class extends P{focusTracker;keystrokes;labeledInput;backButtonView;saveButtonView;children;_focusables;_focusCycler;constructor(e){super(e),this.focusTracker=new J,this.keystrokes=new K,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new q(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new ye,this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.backButtonView,this.labeledInput,this.saveButtonView].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()}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){let e=this.locale.t,t=new y(this.locale);return t.set({label:e("Save"),withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){let e=this.locale.t,t=new Oe(this.locale,{label:e("Text Alternative")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){let e=this.locale.t,t=new H(this.locale,ce);return t.label=e("Text alternative"),t.class="ck-labeled-field-view_full-width",t}};cu=class extends f{_balloon;_form;static get requires(){return[Ce]}static get pluginName(){return"ImageTextAlternativeUI"}static get isOfficialPlugin(){return!0}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){let e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{let n=e.commands.get("imageTextAlternative"),o=new y(i);return o.set({label:t("Change image text alternative"),icon:np,tooltip:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value",r=>!!r),this.listenTo(o,"execute",()=>{this._showForm()}),o})}_createForm(){let e=this.editor,i=e.editing.view.document,n=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(mt(au))(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.listenTo(e.ui,"update",()=>{n.getClosestSelectedImageWidget(i.selection)?this._isVisible&&$T(e):this._hideForm(!0)}),Xe({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();let e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Du(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)}},Ps=class extends f{static get requires(){return[lu,cu]}static get pluginName(){return"ImageTextAlternative"}static get isOfficialPlugin(){return!0}};Io=class extends Wg{observe(e){this.listenTo(e,"load",(t,i)=>{let n=i.target;this.checkShouldIgnoreEventFromTarget(n)||n.tagName=="IMG"&&this._fireEvents(i)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}},uu=class extends v{constructor(e){super(e);let t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&Q("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&Q("image-inline-plugin-required")}refresh(){let e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){let t=Ve(e.source),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach((r,l)=>{let a=i.getSelectedElement();if(typeof r=="string"&&(r={src:r}),l&&a&&n.isImage(a)){let c=this.editor.model.createPositionAfter(a);n.insertImage(I(I({},r),o),c,e.imageType)}else e.breakBlock?n.insertImage(I(I({},r),o),i.getFirstPosition(),e.imageType):n.insertImage(I(I({},r),o),null,e.imageType)})}},du=class extends v{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){let t=this.editor.plugins.get("ImageUtils"),i=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(i),this.value=this.isEnabled?i.getAttribute("src"):null}execute(e){let t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change(n=>{n.setAttribute("src",e.source,t),this.cleanupImage(n,t),i.setImageNaturalSizeAttributes(t)})}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}},To=class extends f{static get requires(){return[Pe]}static get pluginName(){return"ImageEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.conversion;e.editing.view.addObserver(Io),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});let i=new uu(e),n=new du(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",n),e.commands.add("imageInsert",i)}},Ls=class extends f{static get requires(){return[Pe]}static get pluginName(){return"ImageSizeAttributes"}static get isOfficialPlugin(){return!0}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){let e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){let t=this.editor,i=t.plugins.get("ImageUtils"),n=e==="imageBlock"?"figure":"img";t.conversion.for("upcast").attributeToAttribute({view:{name:n,styles:{width:/.+/}},model:{key:"width",value:r=>Vs(r)?Ss(r.getStyle("width")):null}}).attributeToAttribute({view:{name:n,key:"width"},model:"width"}).attributeToAttribute({view:{name:n,styles:{height:/.+/}},model:{key:"height",value:r=>Vs(r)?Ss(r.getStyle("height")):null}}).attributeToAttribute({view:{name:n,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(r=>{o(r,"width","width",!0,!0),o(r,"height","height",!0,!0)}),t.conversion.for("dataDowncast").add(r=>{o(r,"width","width",!1),o(r,"height","height",!1)}),t.conversion.for("upcast").add(r=>{r.on("element:img",(l,a,c)=>{let u=a.viewItem.getAttribute("width"),d=a.viewItem.getAttribute("height");u&&d&&c.consumable.consume(a.viewItem,{styles:["aspect-ratio"]})})});function o(r,l,a,c,u=!1){r.on(`attribute:${l}:${e}`,(d,m,h)=>{if(!h.consumable.consume(m.item,d.name))return;let g=h.writer,p=h.mapper.toViewElement(m.item),b=i.findViewImgElement(p);m.attributeNewValue!==null?g.setAttribute(a,m.attributeNewValue,b):g.removeAttribute(a,b);let w=m.item.getAttribute("width"),k=m.item.getAttribute("height"),T=w&&k;if(T&&u&&g.setAttribute("loading","lazy",b),m.item.hasAttribute("sources"))return;let B=m.item.hasAttribute("resizedWidth");e==="imageInline"&&!B&&!c||T&&g.setStyle("aspect-ratio",`${w}/${k}`,b)})}}},Rs=class extends v{_modelElementName;constructor(e,t){super(e),this._modelElementName=t}refresh(){let t=this.editor.plugins.get("ImageUtils"),i=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(i):this.isEnabled=t.isBlockImage(i)}execute(e={}){let t=this.editor,i=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(i.document.selection),r=Object.fromEntries(o.getAttributes());return!r.src&&!r.uploadId?null:i.change(l=>{let{setImageSizes:a=!0}=e,c=Array.from(i.markers).filter(m=>m.getRange().containsItem(o)),u=n.insertImage(r,i.createSelection(o,"on"),this._modelElementName,{setImageSizes:a});if(!u)return null;let d=l.createRangeOn(u);for(let m of c){let h=m.getRange(),g=h.root.rootName!="$graveyard"?h.getJoined(d,!0):d;l.updateMarker(m,{range:g})}return{oldElement:o,newElement:u}})}},Fs=class extends f{static get requires(){return[Pe]}static get pluginName(){return"ImagePlaceholder"}static get isOfficialPlugin(){return!0}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){let e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){let e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add(n=>{n.on("attribute:placeholder",(o,r,l)=>{if(!l.consumable.test(r.item,o.name)||!r.item.is("element","imageBlock")&&!r.item.is("element","imageInline"))return;l.consumable.consume(r.item,o.name);let a=l.writer,c=l.mapper.toViewElement(r.item),u=i.findViewImgElement(c);r.attributeNewValue?(a.addClass("image_placeholder",u),a.setStyle("background-image",`url(${r.attributeNewValue})`,u),a.setCustomProperty("editingPipeline:doNotReuseOnce",!0,u)):(a.removeClass("image_placeholder",u),a.removeStyle("background-image",u))})})}_setupLoadListener(){let e=this.editor,t=e.model,i=e.editing,n=i.view,o=e.plugins.get("ImageUtils");n.addObserver(Io),this.listenTo(n.document,"imageLoaded",(r,l)=>{let a=n.domConverter.mapDomToView(l.target);if(!a)return;let c=o.getImageWidgetFromImageView(a);if(!c)return;let u=i.mapper.toModelElement(c);!u||!u.hasAttribute("placeholder")||t.enqueueChange({isUndoable:!1},d=>{d.removeAttribute("placeholder",u)})})}},Os=class extends f{static get requires(){return[To,Ls,Pe,Fs,ct]}static get pluginName(){return"ImageBlockEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new Rs(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){let e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>i_(r)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>n.toImageWidget(i_(r),r,t("image widget"))}),i.for("downcast").add(Bs(n,"imageBlock","src")).add(Bs(n,"imageBlock","alt")).add(k_(n,"imageBlock")),i.for("upcast").elementToElement({view:w_(e,"imageBlock"),model:(o,{writer:r})=>r.createElement("imageBlock",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)}).add(jT(n))}_setupClipboardIntegration(){let e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,l)=>{let a=Array.from(l.content.getChildren()),c;if(!a.every(n.isInlineImageView))return;l.targetRanges?c=e.editing.mapper.toModelRange(l.targetRanges[0]):c=t.document.selection.getFirstRange();let u=t.createSelection(c);if(Ou(t.schema,u)==="imageBlock"){let d=new Ft(i.document),m=a.map(h=>d.createElement("figure",{class:"image"},h));l.content=d.createDocumentFragment(m)}}),this.listenTo(o,"contentInsertion",(r,l)=>{l.method==="paste"&&t.change(a=>{let c=a.createRangeIn(l.content);for(let u of c.getItems())u.is("element","imageBlock")&&n.setImageNaturalSizeAttributes(u)})})}},mu=class extends P{focusTracker;keystrokes;_focusables;_focusCycler;children;constructor(e,t=[]){super(e),this.focusTracker=new J,this.keystrokes=new K,this._focusables=new ye,this.children=this.createCollection(),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(let i of t)this.children.add(i),this._focusables.add(i),i instanceof fn&&this._focusables.addMany(i.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),Fe({view:this});for(let t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);let e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}},Xi=class extends f{static get pluginName(){return"ImageInsertUI"}static get isOfficialPlugin(){return!0}static get requires(){return[Pe]}dropdownView;_integrations=new Map;constructor(e){super(e),e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){let e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=i.isImage(t.getSelectedElement())});let n=r=>this._createToolbarComponent(r),o=r=>this._createMenuBarComponent(r);e.ui.componentFactory.add("insertImage",n),e.ui.componentFactory.add("imageInsert",n),e.ui.componentFactory.add("menuBar:insertImage",o)}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:n,menuBarButtonViewCreator:o,requiresForm:r=!1,override:l=!1}){this._integrations.has(e)&&!l&&Q("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,menuBarButtonViewCreator:o,formViewCreator:n,requiresForm:r})}_createToolbarComponent(e){let t=this.editor,i=e.t,n=this._prepareIntegrations();if(!n.length)return null;let o,r=n[0];if(n.length==1){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{let c=r.buttonViewCreator(!1);o=new ht(e,c),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",u=>i(u?"Replace image":"Insert image"))}let l=this.dropdownView=X(e,o),a=n.map(({observable:c})=>typeof c=="function"?c():c);return l.bind("isEnabled").toMany(a,"isEnabled",(...c)=>c.some(u=>u)),l.once("change:isOpen",()=>{let c=n.flatMap(({formViewCreator:d})=>d(n.length==1)),u=new mu(t.locale,c);l.panelView.children.add(u)}),l}_createMenuBarComponent(e){let t=e.t,i=this._prepareIntegrations();if(!i.length)return null;let n=i.flatMap(({menuBarButtonViewCreator:l})=>l(i.length==1)),o=new Ie(e),r=new He(e);o.panelView.children.add(r),o.buttonView.set({icon:af,label:t("Image")});for(let l of n){let a=new De(e,o);a.children.add(l),r.items.add(a),l.delegate("execute").to(o)}return o}_prepareIntegrations(){let t=this.editor.config.get("image.insert.integrations"),i=[];if(!t.length)return Q("image-insert-integrations-not-specified"),i;for(let n of t){if(!this._integrations.has(n)){["upload","assetManager","url"].includes(n)||Q("image-insert-unknown-integration",{item:n});continue}i.push(this._integrations.get(n))}return i.length||Q("image-insert-integrations-not-registered"),i}},hu=class extends f{static get requires(){return[Os,ze,Ps,Xi]}static get pluginName(){return"ImageBlock"}static get isOfficialPlugin(){return!0}},gu=class extends f{static get requires(){return[To,Ls,Pe,Fs,ct]}static get pluginName(){return"ImageInlineEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;
30e.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new Rs(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){let e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(o,{writer:r})=>r.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(o,{writer:r})=>n.toImageWidget(NT(r),r,t("image widget"))}),i.for("downcast").add(Bs(n,"imageInline","src")).add(Bs(n,"imageInline","alt")).add(k_(n,"imageInline")),i.for("upcast").elementToElement({view:w_(e,"imageInline"),model:(o,{writer:r})=>r.createElement("imageInline",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){let e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,l)=>{let a=Array.from(l.content.getChildren()),c;if(!a.every(n.isBlockImageView))return;l.targetRanges?c=e.editing.mapper.toModelRange(l.targetRanges[0]):c=t.document.selection.getFirstRange();let u=t.createSelection(c);if(Ou(t.schema,u)==="imageInline"){let d=new Ft(i.document),m=a.map(h=>h.childCount===1?(Array.from(h.getAttributes()).forEach(g=>d.setAttribute(...g,n.findViewImgElement(h))),h.getChild(0)):h);l.content=d.createDocumentFragment(m)}}),this.listenTo(o,"contentInsertion",(r,l)=>{l.method==="paste"&&t.change(a=>{let c=a.createRangeIn(l.content);for(let u of c.getItems())u.is("element","imageInline")&&n.setImageNaturalSizeAttributes(u)})})}},fu=class extends f{static get requires(){return[gu,ze,Ps,Xi]}static get pluginName(){return"ImageInline"}static get isOfficialPlugin(){return!0}},o_=class extends f{static get requires(){return[hu,fu]}static get pluginName(){return"Image"}static get isOfficialPlugin(){return!0}},Ds=class extends f{static get pluginName(){return"ImageCaptionUtils"}static get isOfficialPlugin(){return!0}static get requires(){return[Pe]}getCaptionFromImageModelElement(e){for(let t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){let t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){let t=this.editor.plugins.get("ImageUtils");return e.name=="figcaption"&&t.isBlockImageView(e.parent)?{name:!0}:null}},pu=class extends v{refresh(){let e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(Os)){this.isEnabled=!1,this.value=!1;return}let n=e.model.document.selection,o=n.getSelectedElement();if(!o){let r=t.getCaptionFromModelSelection(n);this.isEnabled=!!r,this.value=!!r;return}this.isEnabled=i.isImage(o),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(o):this.value=!1}execute(e={}){let{focusCaptionOnShow:t}=e;this.editor.model.change(i=>{this.value?this._hideImageCaption(i):this._showImageCaption(i,t)})}_showImageCaption(e,t){let n=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing"),r=this.editor.plugins.get("ImageUtils"),l=n.getSelectedElement(),a=o._getSavedCaption(l);r.isInlineImage(l)&&(this.editor.execute("imageTypeBlock"),l=n.getSelectedElement());let c=a||e.createElement("caption");e.append(c,l),t&&e.setSelection(c,"in")}_hideImageCaption(e){let t=this.editor,i=t.model.document.selection,n=t.plugins.get("ImageCaptionEditing"),o=t.plugins.get("ImageCaptionUtils"),r=i.getSelectedElement(),l;r?l=o.getCaptionFromImageModelElement(r):(l=o.getCaptionFromModelSelection(i),r=l.parent),n._saveCaption(r,l),e.setSelection(r,"on"),e.remove(l)}},bu=class extends f{static get requires(){return[Pe,Ds]}static get pluginName(){return"ImageCaptionEditing"}static get isOfficialPlugin(){return!0}_savedCaptionsMap;constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){let 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 pu(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){let e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:r=>n.matchImageCaptionViewElement(r),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(r,{writer
vendor: 77,421 bytes, line 30
30:l})=>i.isBlockImage(r.parent)?l.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(r,{writer:l})=>{if(!i.isBlockImage(r.parent))return null;let a=l.createEditableElement("figcaption");l.setCustomProperty("imageCaption",!0,a),a.placeholder=o("Enter image caption"),Ge({view:t,element:a,keepOnFocus:!0});let c=r.parent.getAttribute("alt"),u=c?o("Caption for image: %0",[c]):o("Caption for the image");return ao(a,l,{label:u})}})}_setupImageTypeCommandsIntegration(){let e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),n=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),r=l=>{if(!l.return)return;let{oldElement:a,newElement:c}=l.return;if(!a)return;if(t.isBlockImage(a)){let d=i.getCaptionFromImageModelElement(a);if(d){this._saveCaption(c,d);return}}let u=this._getSavedCaption(a);u&&this._saveCaption(c,u)};n&&this.listenTo(n,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(e){let t=this._savedCaptionsMap.get(e);return t?Go.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){let e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{let o=t.document.differ.getChanges();for(let r of o){if(r.attributeKey!=="alt")continue;let l=r.range.start.nodeAfter;if(i.isBlockImage(l)){let a=n.getCaptionFromImageModelElement(l);if(!a)return;e.editing.reconvertItem(a)}}})}},wu=class extends f{static get requires(){return[Ds]}static get pluginName(){return"ImageCaptionUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),n=e.t;e.ui.componentFactory.add("toggleImageCaption",o=>{let r=e.commands.get("toggleImageCaption"),l=new y(o);return l.set({icon:Qo,tooltip:!0,isToggleable:!0}),l.bind("isOn","isEnabled").to(r,"value","isEnabled"),l.bind("label").to(r,"value",a=>n(a?"Toggle caption off":"Toggle caption on")),this.listenTo(l,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});let a=i.getCaptionFromModelSelection(e.model.document.selection);if(a){let c=e.editing.mapper.toViewElement(a);t.scrollToTheSelection(),t.change(u=>{u.addClass("image__caption_highlighted",c)})}e.editing.view.focus()}),l})}},s_=class extends f{static get requires(){return[bu,wu]}static get pluginName(){return"ImageCaption"}static get isOfficialPlugin(){return!0}};_u=class extends f{static get pluginName(){return"ImageUploadUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("uploadImage",()=>this._createToolbarButton()),e.ui.componentFactory.add("imageUpload",()=>this._createToolbarButton()),e.ui.componentFactory.add("menuBar:uploadImage",()=>this._createMenuBarButton("standalone")),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:t=>this._createMenuBarButton(t?"insertOnly":"insertNested")})}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get("uploadImage"),o=t.config.get("image.upload.types"),r=y_(o),l=new e(t.locale),a=i.t;return l.set({acceptedType:o.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:a("Upload from computer"),icon:Yf}),l.bind("isEnabled").to(n),l.on("done",(c,u)=>{let d=Array.from(u).filter(m=>r.test(m.type));d.length&&(t.execute("uploadImage",{file:d}),t.editing.view.focus())}),l}_createToolbarButton(){let e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this.editor.commands.get("uploadImage"),n=this._createButton(ul);return n.tooltip=!0,n.bind("label").to(t,"isImageSelected",i,"isAccessAllowed",(o,r)=>e(r?o?"Replace image from computer":"Upload image from computer":"You have no image upload permissions.")),n}_createDropdownButton(){let e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(ul);return i.withText=!0,i.bind("label").to(t,"isImageSelected",n=>e(n?"Replace from computer":"Upload from computer")),i.on("execute",()=>{t.dropdownView.isOpen=!1}),i}_createMenuBarButton(e){let t=this.editor.locale.t,i=this._createButton(_p);switch(i.withText=!0,e){case"standalone":i.label=t("Image from computer");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("From computer");break}return i}},ku=class extends f{static get pluginName(){return"ImageUploadProgress"}static get isOfficialPlugin(){return!0}placeholder;constructor(e){super(e),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){let 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)}uploadStatusChange=(e,t,i)=>{let n=this.editor,o=t.item,r=o.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;let l=n.plugins.get("ImageUtils"),a=n.plugins.get(Ke),c=r?t.attributeNewValue:null,u=this.placeholder,d=n.editing.mapper.toViewElement(o),m=i.writer;if(c=="reading"){r_(d,m),l_(l,u,d,m);return}if(c=="uploading"){let h=a.loaders.get(r);r_(d,m),h?(a_(d,m),ZT(d,m,h,n.editing.view),oA(l,d,m,h)):l_(l,u,d,m);return}c=="complete"&&a.loaders.get(r)&&tA(d,m,n.editing.view),eA(d,m),a_(d,m),JT(d,m)}};yu=class extends v{constructor(e){super(e),this.set("isAccessAllowed",!0)}refresh(){let e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){let t=Ve(e.file),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach((r,l)=>{let a=i.getSelectedElement();if(l&&a&&n.isImage(a)){let c=this.editor.model.createPositionAfter(a);this._uploadImage(r,o,c)}else this._uploadImage(r,o)})}_uploadImage(e,t,i){let n=this.editor,r=n.plugins.get(Ke).createLoader(e),l=n.plugins.get("ImageUtils");r&&l.insertImage(N(I({},t),{uploadId:r.id}),i)}},vu=class extends f{static get requires(){return[Ke,ri,ct,Pe]}static get pluginName(){return"ImageUploadEditing"}static get isOfficialPlugin(){return!0}_uploadImageElements;_uploadedImages=new Map;constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){let e=this.editor,t=e.model.document,i=e.conversion,n=e.plugins.get(Ke),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),l=y_(e.config.get("image.upload.types")),a=new yu(e);e.commands.add("uploadImage",a),e.commands.add("imageUpload",a),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add(c=>c.on("element:img",(u,d,m)=>{if(!m.consumable.test(d.viewItem,{attributes:["data-ck-upload-id"]}))return;let h=d.viewItem.getAttribute("data-ck-upload-id");if(!h)return;let[g]=Array.from(d.modelRange.getItems({shallow:!0})),p=n.loaders.get(h);g&&(m.writer.setAttribute("uploadId",h,g),m.consumable.consume(d.viewItem,{attributes:["data-ck-upload-id"]}),p&&p.data&&m.writer.setAttribute("uploadStatus",p.status,g))},{priority:"low"})),this.listenTo(e.editing.view.document,"clipboardInput",(c,u)=>{if(sA(u.dataTransfer))return;let d=Array.from(u.dataTransfer.files).filter(h=>h?l.test(h.type):!1);if(!d.length)return;if(c.stop(),e.model.change(h=>{u.targetRanges&&h.setSelection(u.targetRanges.map(g=>e.editing.mapper.toModelRange(g))),e.execute("uploadImage",{file:d})}),!e.commands.get("uploadImage").isAccessAllowed){let h=e.plugins.get("Notification"),g=e.locale.t;h.showWarning(g("You have no image upload permissions."),{namespace:"image"})}}),this.listenTo(r,"inputTransformation",(c,u)=>{let d=Array.from(e.editing.view.createRangeIn(u.content)).map(h=>h.item).filter(h=>XT(o,h)&&!h.getAttribute("uploadProcessed")).map(h=>({promise:KT(h),imageElement:h}));if(!d.length)return;let m=new Ft(e.editing.view.document);for(let h of d){m.setAttribute("uploadProcessed",!0,h.imageElement);let g=n.createLoader(h.promise);g&&(m.setAttribute("src","",h.imageElement),m.setAttribute("uploadId",g.id,h.imageElement))}}),e.editing.view.document.on("dragover",(c,u)=>{u.preventDefault()}),t.on("change",()=>{let c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),u=new Set;for(let d of c)if(d.type=="insert"&&d.name!="$text"){let m=d.position.nodeAfter,h=d.position.root.rootName=="$graveyard";for(let g of rA(e,m)){let p=g.getAttribute("uploadId"),b=g.getAttribute("uploadStatus");if(!p||b=="complete")continue;let w=n.loaders.get(p);if(!w){!h&&this._uploadedImages.has(p)&&e.model.enqueueChange({isUndoable:!1},k=>{k.setAttribute("uploadStatus","complete",g),this.fire("uploadComplete",{data:this._uploadedImages.get(p),imageElement:g})});continue}h?u.has(p)||Array.from(this._uploadImageElements.get(p)).every(T=>T.root.rootName=="$graveyard")&&w.abort():(u.add(p),this._uploadImageElements.has(p)?this._uploadImageElements.get(p).add(g):this._uploadImageElements.set(p,new Set([g])),w.status=="idle"&&this._readAndUpload(w))}}}),this.on("uploadComplete",(c,{imageElement:u,data:d})=>{let m=d.urls?d.urls:d;this.editor.model.change(h=>{h.setAttribute("src",m.default,u),this._parseAndSetSrcsetAttributeOnImage(m,u,h),o.setImageNaturalSizeAttributes(u)})},{priority:"low"})}afterInit(){let e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"))}_readAndUpload(e){let t=this.editor,i=t.model,n=t.locale.t,o=t.plugins.get(Ke),r=t.plugins.get(ri),l=t.plugins.get("ImageUtils"),a=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},u=>{let d=a.get(e.id);for(let m of d)u.setAttribute("uploadStatus","reading",m)}),e.read().then(()=>{let u=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Uploading image"));for(let d of a.get(e.id)){if(Je.isSafari){let m=t.editing.mapper.toViewElement(d),h=l.findViewImgElement(m);t.editing.view.once("render",()=>{if(!h.parent)return;let g=t.editing.view.domConverter.mapViewToDom(h.parent);if(!g)return;let p=g.style.display;g.style.display="none",g._ckHack=g.offsetHeight,g.style.display=p})}i.enqueueChange({isUndoable:!1},m=>{m.setAttribute("uploadStatus","uploading",d)})}return u}).then(u=>{i.enqueueChange({isUndoable:!1},d=>{for(let m of a.get(e.id))d.setAttribute("uploadStatus","complete",m),this.fire("uploadComplete",{data:u,imageElement:m});t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Image upload complete")),this._uploadedImages.set(e.id,u)}),c()}).catch(u=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Error during image upload")),e.status!=="error"&&e.status!=="aborted")throw u;e.status=="error"&&u&&r.showWarning(u,{title:n("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},d=>{for(let m of a.get(e.id))m.root.rootName!=="$graveyard"&&d.remove(m)}),c()});function c(){i.enqueueChange({isUndoable:!1},u=>{for(let d of a.get(e.id))u.removeAttribute("uploadId",d),u.removeAttribute("uploadStatus",d);a.delete(e.id)}),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0,o=Object.keys(e).filter(r=>{let l=parseInt(r,10);if(!isNaN(l))return n=Math.max(n,l),!0}).map(r=>`${e[r]} ${r}w`).join(", ");if(o!=""){let r={srcset:o};!t.hasAttribute("width")&&!t.hasAttribute("height")&&(r.width=n),i.setAttributes(r,t)}}_registerConverters(e){let{conversion:t,plugins:i}=this.editor,n=i.get(Ke),o=i.get(Pe);t.for("dataDowncast").add(r=>{r.on(`attribute:uploadId:${e}`,(l,a,c)=>{if(!c.consumable.test(a.item,l.name))return;let u=n.loaders.get(a.attributeNewValue);if(!u||!u.data)return null;let d=c.mapper.toViewElement(a.item),m=o.findViewImgElement(d);m&&(c.consumable.consume(a.item,l.name),c.writer.setAttribute("data-ck-upload-id",u.id,m))})})}};Cu=class extends f{static get pluginName(){return"ImageUpload"}static get isOfficialPlugin(){return!0}static get requires(){return[vu,_u,ku]}},Iu=class extends P{urlInputView;keystrokes;constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new K,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-url"],tabindex:"-1"},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),Fe({view:this}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){let e=this.locale,t=e.t,i=new H(e,ce);return i.bind("label").to(this,"isImageSelected",n=>t(n?"Update image URL":"Insert image via URL")),i.bind("isEnabled").to(this),i.fieldView.inputMode="url",i.fieldView.placeholder="https://example.com/image.png",i.fieldView.bind("value").to(this,"imageURLInputValue",n=>n||""),i.fieldView.on("input",()=>{this.imageURLInputValue=i.fieldView.element.value.trim()}),i}focus(){this.urlInputView.focus()}},Tu=class extends f{_imageInsertUI;_formView;static get pluginName(){return"ImageInsertViaUrlUI"}static get isOfficialPlugin(){return!0}static get requires(){return[Xi,Nt]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",()=>this._createToolbarButton()),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",()=>this._createMenuBarButton("standalone"))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){let t=new e(this.editor.locale);return t.icon=cf,t.on("execute",()=>{this._showModal()}),t}_createToolbarButton(){let e=this.editor.locale.t,t=this._createInsertUrlButton(y);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",i=>e(i?"Update image URL":"Insert image via URL")),t}_createDropdownButton(){let e=this.editor.locale.t,t=this._createInsertUrlButton(y);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",i=>e(i?"Update image URL":"Insert via URL")),t}_createMenuBarButton(e){let t=this.editor.locale.t,i=this._createInsertUrlButton(x);switch(i.withText=!0,e){case"standalone":i.label=t("Image via URL");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("Via URL");break}return i}_createInsertUrlView(){let e=this.editor,t=e.locale,i=e.commands.get("replaceImageSource"),n=e.commands.get("insertImage"),o=new Iu(t);return o.bind("isImageSelected").to(this._imageInsertUI),o.bind("isEnabled").toMany([n,i],"isEnabled",(...r)=>r.some(l=>l)),o}_showModal(){let e=this.editor,i=e.locale.t,n=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",()=>this._handleSave()));let o=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=o.value||"",n.show({id:"insertImageViaUrl",title:i("Image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:i("Cancel"),withText:!0,onExecute:()=>n.hide()},{label:this._imageInsertUI.isImageSelected?i("Save"):i("Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}},Au=class extends f{static get pluginName(){return"ImageInsertViaUrl"}static get isOfficialPlugin(){return!0}static get requires(){return[Tu,Xi]}},c_=class extends f{static get pluginName(){return"ImageInsert"}static get isOfficialPlugin(){return!0}static get requires(){return[Cu,Au,Xi]}},Eu=class extends v{refresh(){let e=this.editor,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!i,!i||!i.hasAttribute("resizedWidth")?this.value=null:this.value={width:i.getAttribute("resizedWidth"),height:null}}execute(e){let t=this.editor,i=t.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change(r=>{r.setAttribute("resizedWidth",e.width,o),r.removeAttribute("resizedHeight",o),n.setImageNaturalSizeAttributes(o)})}},Ns=class extends f{static get requires(){return[Pe]}static get pluginName(){return"ImageResizeEditing"}static get licenseFeatureCode(){return"IR"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){let e=this.editor,t=new Eu(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){let e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),e.setAttributeProperties("resizedWidth",{isFormatting:!0}),e.setAttributeProperties("resizedHeight",{isFormatting:!0})),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]}),e.setAttributeProperties("resizedWidth",{isFormatting:!0}),e.setAttributeProperties("resizedHeight",{isFormatting:!0}))}_registerConverters(e){let t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add(n=>n.on(`attribute:resizedWidth:${e}`,(o,r,l)=>{if(!l.consumable.consume(r.item,o.name))return;let a=l.writer,c=l.mapper.toViewElement(r.item);r.attributeNewValue!==null?(a.setStyle("width",r.attributeNewValue,c),a.addClass("image_resized",c)):(a.removeStyle("width",c),a.removeClass("image_resized",c))})),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:n=>({key:"style",value:{height:n}})}),t.conversion.for("editingDowncast").add(n=>n.on(`attribute:resizedHeight:${e}`,(o,r,l)=>{if(!l.consumable.consume(r.item,o.name))return;let a=l.writer,c=l.mapper.toViewElement(r.item),u=e==="imageInline"?i.findViewImgElement(c):c;r.attributeNewValue!==null?a.setStyle("height",r.attributeNewValue,u):a.removeStyle("height",u)})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:n=>Vs(n)?null:n.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:n=>Vs(n)?null:n.getStyle("height")}}),t.conversion.for("upcast").add(n=>{n.on(`element:${e==="imageBlock"?"figure":"img"}`,(o,r,l)=>{l.consumable.consume(r.viewItem,{classes:["image_resized"]})})})}},ou={small:Sf,medium:xf,large:Ef,custom:Tf,original:Af},xu=class extends f{static get requires(){return[Ns]}static get pluginName(){return"ImageResizeButtons"}static get isOfficialPlugin(){return!0}_resizeUnit;constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){let e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(let n of t)this._registerImageResizeButton(n);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){let t=this.editor,{name:i,value:n,icon:o}=e;t.ui.componentFactory.add(i,r=>{let l=new y(r),a=t.commands.get("resizeImage"),c=this._getOptionLabelValue(e,!0);if(!ou[o])throw new S("imageresizebuttons-missing-icon",t,e);if(l.set({label:c,icon:ou[o],tooltip:c,isToggleable:!0}),l.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&Co(e)){let u=t.plugins.get("ImageCustomResizeUI");this.listenTo(l,"execute",()=>{u._showForm(this._resizeUnit)})}else{let u=n?n+this._resizeUnit:null;l.bind("isOn").to(a,"value",a,"isEnabled",Su(u)),this.listenTo(l,"execute",()=>{t.execute("resizeImage",{width:u})})}return l})}_registerImageResizeDropdown(e){let t=this.editor,i=t.t,n=e.find(r=>!r.value),o=r=>{let l=t.commands.get("resizeImage"),a=X(r,es),c=a.buttonView,u=i("Resize image");return c.set({tooltip:u,commandValue:n.value,icon:ou.medium,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button",ariaLabel:u,ariaLabelledBy:void 0}),c.bind("label").to(l,"value",d=>d&&d.width?d.width:this._getOptionLabelValue(n)),a.bind("isEnabled").to(this),be(a,()=>this._getResizeDropdownListItemDefinitions(e,l),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(a,"execute",d=>{"onClick"in d.source?d.source.onClick():(t.execute(d.source.commandName,{width:d.source.commandValue}),t.editing.view.focus())}),a};t.ui.componentFactory.add("resizeImage",o),t.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(e,t=!1){let i=this.editor.t;return e.label?e.label:t?Co(e)?i("Custom image size"):e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):Co(e)?i("Custom"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){let{editor:i}=this,n=new ne,o=e.map(r=>Co(r)?N(I({},r),{valueWithUnits:"custom"}):r.value?N(I({},r),{valueWithUnits:`${r.value}${this._resizeUnit}`}):N(I({},r),{valueWithUnits:null}));for(let r of o){let l=null;if(i.plugins.has("ImageCustomResizeUI")&&Co(r)){let a=i.plugins.get("ImageCustomResizeUI");l={type:"button",model:new we({label:this._getOptionLabelValue(r),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{a._showForm(this._resizeUnit)}})};let c=Object.values(o).map(u=>u.valueWithUnits);l.model.bind("isOn").to(t,"value",t,"isEnabled",lA(c))}else l={type:"button",model:new we({commandName:"resizeImage",commandValue:r.valueWithUnits,label:this._getOptionLabelValue(r),role:"menuitemradio",withText:!0,icon:null})},l.model.bind("isOn").to(t,"value",t,"isEnabled",Su(r.valueWithUnits));l.model.bind("isEnabled").to(t,"isEnabled"),n.add(l)}return n}};aA="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",su="image_resized",Vu=class extends f{static get requires(){return[as,Pe]}static get pluginName(){return"ImageResizeHandles"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){let e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(Io),this.listenTo(t.document,"imageLoaded",(n,o)=>{if(!o.target.matches(aA))return;let r=e.editing.view.domConverter,l=r.domToView(o.target),a=i.getImageWidgetFromImageView(l),c=this.editor.plugins.get(as).getResizerByViewElement(a);if(c){c.redraw();return}let u=e.editing.mapper,d=u.toModelElement(a);c=e.plugins.get(as).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:d,viewElement:a,editor:e,getHandleHost(m){return m.querySelector("img")},getResizeHost(){return r.mapViewToDom(u.toViewElement(d))},isCentered(){return d.getAttribute("imageStyle")=="alignCenter"},onCommit(m){t.change(h=>{h.removeClass(su,a)}),e.execute("resizeImage",{width:m})}}),c.on("updateSize",()=>{a.hasClass(su)||t.change(h=>{h.addClass(su,a)});let m=d.name==="imageInline"?l:a;m.getStyle("height")&&t.change(h=>{h.removeStyle("height",m)})}),c.bind("isEnabled").to(this)})}};Pu=class extends P{focusTracker;keystrokes;unit;backButtonView;saveButtonView;labeledInput;children;_focusables;_focusCycler;_validators;constructor(e,t,i){super(e),this.focusTracker=new J,this.keystrokes=new K,this.unit=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new q(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new ye,this._validators=i,this.keystrokes.set("Esc",(n,o)=>{this.fire("cancel"),o()}),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.backButtonView,this.labeledInput,this.saveButtonView].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()}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){let e=this.locale.t,t=new y(this.locale);return t.set({label:e("Save"),withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){let e=this.locale.t,t=new Oe(this.locale,{label:e("Image Resize")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){let e=this.locale.t,t=new H(this.locale,os);return t.label=e("Resize image (in %0)",this.unit),t.class="ck-labeled-field-view_full-width",t.fieldView.set({step:.1}),t}isValid(){this.resetFormStatus();for(let e of this._validators){let t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){let{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){let{rawSize:e}=this;if(e===null)return null;let t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){let{parsedSize:e,unit:t}=this;return e===null?null:`${e}${t}`}};Bu=class extends f{_balloon;_form;static get requires(){return[Ce]}static get pluginName(){return"ImageCustomResizeUI"}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){let t=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(mt(Pu))(t.locale,e,dA(t)),this._form.render(),this.listenTo(this._form,"submit",()=>{this._form.isValid()&&(t.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))}),this.listenTo(this._form.labeledInput,"change:errorText",()=>{t.ui.update()}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),Xe({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(e){if(this._isVisible)return;this._form||this._createForm(e);let t=this.editor,i=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:Du(t)});let n=cA(t,e),o=n?n.value.toFixed(1):"",r=uA(t,e);i.fieldView.value=i.fieldView.element.value=o,r&&Object.assign(i.fieldView,{min:r.lower.toFixed(1),max:Math.ceil(r.upper).toFixed(1)}),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)}};u_=class extends f{static get requires(){return[Ns,Vu,Bu,xu]}static get pluginName(){return"ImageResize"}static get isOfficialPlugin(){return!0}},Lu=class extends v{_defaultStyles;_styles;constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(let n of i.modelElements)this._defaultStyles[n]=i.name;return[i.name,i]}))}refresh(){let 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={}){let t=this.editor,i=t.model,n=t.plugins.get("ImageUtils");i.change(o=>{let r=e.value,{setImageSizes:l=!0}=e,a=n.getClosestSelectedImageElement(i.document.selection);r&&this.shouldConvertImageType(r,a)&&(this.editor.execute(n.isBlockImage(a)?"imageTypeInline":"imageTypeBlock",{setImageSizes:l}),a=n.getClosestSelectedImageElement(i.document.selection)),!r||this._styles.get(r).isDefault?o.removeAttribute("imageStyle",a):o.setAttribute("imageStyle",r,a),l&&n.setImageNaturalSizeAttributes(a)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}},xs={get inline(){return{name:"inline",title:"In line",icon:el,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:hn,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:so,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Hi,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Ui,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:ro,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Hi,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Ui,modelElements:["imageBlock"],className:"image-style-side"}}},mA={full:If,left:so,right:ro,center:Hi,inlineLeft:hn,inlineRight:Ui,inline:el},hA=[{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"]}];Ms={normalizeStyles:gA,getDefaultStylesConfiguration:fA,getDefaultDropdownDefinitions:pA,warnInvalidStyle:x_};Us=class extends f{static get pluginName(){return"ImageStyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Pe]}normalizedStyles;init(){let e=this.editor,t=e.plugins.has("ImageBlockEditing"),i=e.plugins.has("ImageInlineEditing");e.config.define("image.styles",Ms.getDefaultStylesConfiguration(t,i)),this.normalizedStyles=Ms.normalizeStyles({configuredStyles:e.config.get("image.styles"),isBlockPluginLoaded:t,isInlinePluginLoaded:i}),this._setupConversion(t,i),this._setupPostFixer(),e.commands.add("imageStyle",new Lu(e,this.normalizedStyles))}_setupConversion(e,t){let i=this.editor,n=i.model.schema,o=kA(this.normalizedStyles),r=yA(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",o),i.data.downcastDispatcher.on("attribute:imageStyle",o),e&&(n.extend("imageBlock",{allowAttributes:"imageStyle"}),n.setAttributeProperties("imageStyle",{isFormatting:!0}),i.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),t&&(n.extend("imageInline",{allowAttributes:"imageStyle"}),n.setAttributeProperties("imageStyle",{isFormatting:!0}),i.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){let e=this.editor,t=e.model.document,i=e.plugins.get(Pe),n=new Map(this.normalizedStyles.map(o=>[o.name,o]));t.registerPostFixer(o=>{let r=!1;for(let l of t.differ.getChanges())if(l.type=="insert"||l.type=="attribute"&&l.attributeKey=="imageStyle"){let a=l.type=="insert"?l.position.nodeAfter:l.range.start.nodeAfter;if(a&&a.is("element","paragraph")&&a.childCount>0&&(a=a.getChild(0)),!i.isImage(a))continue;let c=a.getAttribute("imageStyle");if(!c)continue;let u=n.get(c);(!u||!u.modelElements.includes(a.name))&&(o.removeAttribute("imageStyle",a),r=!0)}return r})}},Fu=class extends f{static get requires(){return[Us]}static get pluginName(){return"ImageStyleUI"}static get isOfficialPlugin(){return!0}get localizedDefaultStylesTitles(){let 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(){let e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=e.get("ImageStyleEditing"),n=d_(i.normalizedStyles,this.localizedDefaultStylesTitles);for(let r of n)this._createButton(r);let o=d_([...t.filter(Ni),...Ms.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(let r of o)this._createDropdown(r,n)}_createDropdown(e,t){let i=this.editor.ui.componentFactory;i.add(e.name,n=>{let o,{defaultItem:r,items:l,title:a}=e,c=l.filter(h=>t.find(({name:g})=>m_(g)===h)).map(h=>{let g=i.create(h);return h===r&&(o=g),g});l.length!==c.length&&Ms.warnInvalidStyle({dropdown:e});let u=X(n,ht),d=u.buttonView,m=d.arrowView;return ki(u,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:h_(a,o.label),class:null,tooltip:!0}),m.unbind("label"),m.set({label:a}),d.bind("icon").toMany(c,"isOn",(...h)=>{let g=h.findIndex(ln);return g<0?o.icon:c[g].icon}),d.bind("label").toMany(c,"isOn",(...h)=>{let g=h.findIndex(ln);return h_(a,g<0?o.label:c[g].label)}),d.bind("isOn").toMany(c,"isOn",(...h)=>h.some(ln)),d.bind("class").toMany(c,"isOn",(...h)=>h.some(ln)?"ck-splitbutton_flatten":void 0),d.on("execute",()=>{c.some(({isOn:h})=>h)?u.isOpen=!u.isOpen:o.fire("execute")}),u.bind("isEnabled").toMany(c,"isEnabled",(...h)=>h.some(ln)),this.listenTo(u,"execute",()=>{this.editor.editing.view.focus()}),u})}_createButton(e){let t=e.name;this.editor.ui.componentFactory.add(m_(t),i=>{let n=this.editor.commands.get("imageStyle"),o=new y(i);return o.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"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()}};g_=class extends f{static get requires(){return[Us,Fu]}static get pluginName(){return"ImageStyle"}static get isOfficialPlugin(){return!0}},f_=class extends f{static get requires(){return[ft,Pe]}static get pluginName(){return"ImageToolbar"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t,i=e.plugins.get(ft),n=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:CA(e.config.get("image.toolbar")||[]),getRelatedElement:o=>n.getClosestSelectedImageWidget(o)})}};p_=class extends f{static get requires(){return[To,Pe]}static get pluginName(){return"PictureEditing"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){let e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("upcast").add(qT(i)),t.for("downcast").add(GT(i))}_setupImageUploadEditingIntegration(){let e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;let t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",(i,{imageElement:n,data:o})=>{let r=o.sources;r&&e.model.change(l=>{l.setAttributes({sources:r},n)})})}}});function G(s){return!!s&&s.is("element")&&s.hasAttribute("listItemId")}function ui(s,e={}){return[...Si(s,N(I({},e),{direction:"backward"})),...Si(s,N(I({},e),{direction:"forward"}))]}function Si(s,e={}){let t=e.direction=="forward",i=Array.from(new Ze(s,N(I({},e),{includeSelf:t,sameIndent:!0,sameAttributes:"listItemId"})));return t?i:i.reverse()}function IA(s){return Array.from(new Ze(s,{direction:"forward",higherIndent:!0}))}function sk(s,e){let t=new Ze(s,I({sameIndent:!0,sameAttributes:"listType"},e)),i=new Ze(s,I({sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward"},e));return[...Array.from(t).reverse(),...i]}function Xt(s){return!Ze.first(s,{sameIndent:!0,sameAttributes:"listItemId"})}function V_(s){return!Ze.first(s,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function Bo(s,e={}){s=Ve(s);let t=e.withNested!==!1,i=new Set;for(let n of s)for(let o of ui(n,{higherIndent:t}))i.add(o);return Ji(i)}function er(s){s=Ve(s);let e=new Set;for(let t of s)for(let i of sk(t))e.add(i);return Ji(e)}function fd(s,e){let t=Si(s,{direction:"forward"}),i=xi.next();for(let n of t)e.setAttribute("listItemId",i,n);return t}function Hu(s,e,t){let i={};for(let[o,r]of e.getAttributes())o.startsWith("list")&&(i[o]=r);let n=Si(s,{direction:"forward"});for(let o of n)t.setAttributes(i,o);return n}function Wu(s,e,{expand:t,indentBy:i=1,attributeNames:n}){s=Ve(s);let o=t?Bo(s):s;for(let r of o){let l=r.getAttribute("listIndent")+i;l<0?tr(r,e,n):e.setAttribute("listIndent",l,r)}return o}function TA(s,e,{attributeNames:t}){s=Ve(s);let i=Bo(s),n=new Set,o=Math.min(...i.map(l=>l.getAttribute("listIndent"))),r=new Map;for(let l of i)r.set(l,Ze.first(l,{lowerIndent:!0}));for(let l of i){if(n.has(l))continue;n.add(l);let a=l.getAttribute("listIndent")-1;if(a<0){tr(l,e,t);continue}if(l.getAttribute("listIndent")==o){let c=xA(l,r.get(l),e);for(let u of c)n.add(u);if(c.length)continue}e.setAttribute("listIndent",a,l)}return Ji(n)}function tr(s,e,t){s=Ve(s);for(let i of s)i.is("element","listItem")&&e.rename(i,"paragraph");for(let i of s)for(let n of i.getAttributeKeys())t.includes(n)&&e.removeAttribute(n,i);return s}function xo(s){if(!s.length)return!1;let e=s[0].getAttribute("listItemId");return e?!s.some(t=>t.getAttribute("listItemId")!=e):!1}function AA(s,e){let t=[],i=Number.POSITIVE_INFINITY;for(let{node:n}of new Qi(s.nextSibling)){let o=n.getAttribute("listIndent");if(o==0)break;o<i&&(i=o);let r=o-i;e.setAttribute("listIndent",r,n),t.push(n)}return t}function Ji(s){return Array.from(s).filter(e=>e.root.rootName!=="$graveyard").sort((e,t)=>e.index-t.index)}function So(s){let e=s.document.selection.getSelectedElement();return e&&s.schema.isObject(e)&&s.schema.isBlock(e)?e:null}function Nu(s,e){return e.checkChild(s.parent,"listItem")&&e.checkChild(s,"$text")&&!e.isObject(s)}function $s(s){return s=="numbered"||s=="customNumbered"}function EA(s){return!Ze.first(s,{sameIndent:!0,sameAttributes:"listType"})}function xA(s,e,t){return Si(e,{direction:"forward"}).pop().index>s.index?Hu(s,e,t):[]}function P_(s){let e=Array.from(s.getSelectedBlocks()),t=e.findIndex(i=>!G(i));return t!=-1&&(e.length=t),e}function SA(s,e,t){if(Xt(e))return B_(s,e,t);let i=ui(e);return B_(s,i[0],t)}function B_(s,e,t){if(!BA(e)||s.schema.isLimit(e))return Object.fromEntries(t.map(l=>[l]));if(e.isEmpty)return Object.fromEntries(t.map(l=>[l,e.getAttribute(`selection:${l}`)]));let i=new Set(t),n={},r=s.createRangeIn(e).getWalker({ignoreElementEnd:!0});for(let{item:l}of r){for(let a of i)if(s.schema.checkAttribute(l,a)){let c=l.getAttribute(a);c===void 0?(i.delete(a),n[a]=void 0):n[a]===void 0?n[a]=c:n[a]!==c&&(i.delete(a),n[a]=void 0)}else a in n||(n[a]=void 0);if(!i.size)break;s.schema.isLimit(l)&&r.jumpTo(s.createPositionAfter(l))}return n}function VA(s,e,t,i){let n=ui(e),o=!1;for(let r of n)(!r.hasAttribute(t)||r.getAttribute(t)!==i)&&(s.setAttribute(t,i,r),o=!0);return o}function PA(s,e,t){let i=ui(e),n=!1;for(let o of i)o.hasAttribute(t)&&(s.removeAttribute(t,o),n=!0);return n}function BA(s){return["numbered","bulleted","customNumbered","customBulleted"].includes(s.getAttribute("listType"))}function LA(s){return s.is("element","ol")||s.is("element","ul")}function Yu(s){return s.is("element","li")}function RA(s){let e=0,t=s.parent;for(;t;){if(Yu(t))e++;else{let i=t.previousSibling;i&&Yu(i)&&e++}t=t.parent}return e}function FA(s,e,t,i=lk(t,e)){return s.createAttributeElement(rk(t),null,{priority:2*e/100-100,id:i})}function OA(s,e,t){return s.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:t})}function rk(s){return s=="numbered"||s=="customNumbered"?"ol":"ul"}function lk(s,e){return`list-${s}-${e}`}function Et(s,e,t){let i=s.nodeBefore;if(G(i)){let n=i;for(let{node:o}of new Qi(n,"backward"))if(n=o,t.has(n)||(t.add(n),e.has(i)))return;e.add(n)}else{let n=s.nodeAfter;G(n)&&e.add(n)}}function DA(s,e){let t=0,i=-1,n=null,o=!1;for(let{node:r}of s){let l=r.getAttribute("listIndent");if(l>t){let a;n===null?(n=l-t,a=t):(n>l&&(n=l),a=l-n),a>i+1&&(a=i+1),e.setAttribute("listIndent",a,r),o=!0,i=a}else n=null,t=l+1,i=l}return o}function NA(s,e,t){let i=new Set,n=!1;for(let{node:o}of s){if(i.has(o))continue;let r=o.getAttribute("listType"),l=o.getAttribute("listItemId");if(e.has(l)&&(l=xi.next()),e.add(l),o.is("element","listItem")){o.getAttribute("listItemId")!=l&&(t.setAttribute("listItemId",l,o),n=!0);continue}for(let a of Si(o,{direction:"forward"}))i.add(a),a.getAttribute("listType")!=r&&(l=xi.next(),r=a.getAttribute("listType")),a.getAttribute("listItemId")!=l&&(t.setAttribute("listItemId",l,a),n=!0)}return n}function MA(){return(s,e,t)=>{let{writer:i,schema:n}=t;if(!e.modelRange)return;let o=Array.from(e.modelRange.getItems({shallow:!0})).filter(d=>n.checkAttribute(d,"listItemId"));if(!o.length)return;let r=e.viewItem.getAttribute("data-list-item-id")||xi.next();t.consumable.consume(e.viewItem,{attributes:"data-list-item-id"});let l=RA(e.viewItem),a=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted",c=o[0].getAttribute("listType");c&&(a=c);let u={listItemId:r,listIndent:l,listType:a};for(let d of o)d.hasAttribute("listItemId")||i.setAttributes(u,d);o.length>1&&o[1].getAttribute("listItemId")!=u.listItemId&&t.keepEmptyElement(o[0])}}function UA(s,e,t,i){return()=>{let a=s.document.differ.getChanges(),c=[],u=new Set,d=new Set,m=new Set;for(let h of a)if(h.type=="insert"&&h.name!="$text")Et(h.position,u,m),h.attributes.has("listItemId")?d.add(h.position.nodeAfter):Et(h.position.getShiftedBy(h.length),u,m);else if(h.type=="remove"&&h.attributes.has("listItemId"))Et(h.position,u,m);else if(h.type=="attribute"){let g=h.range.start.nodeAfter;t.includes(h.attributeKey)?(Et(h.range.start,u,m),h.attributeNewValue===null?(Et(h.range.start.getShiftedBy(1),u,m),o(g)&&c.push(g)):d.add(g)):G(g)&&o(g)&&c.push(g)}for(let h of u.values())c.push(...n(h,d));for(let h of new Set(c))e.reconvertItem(h)};function n(a,c){let u=[],d=new Set,m=[];for(let{node:h,previous:g}of new Qi(a)){if(d.has(h))continue;let p=h.getAttribute("listIndent");g&&p<g.getAttribute("listIndent")&&(m.length=p+1),m[p]={modelAttributes:Object.fromEntries(Array.from(h.getAttributes()).filter(([w])=>t.includes(w))),modelElement:h};let b=Si(h,{direction:"forward"});for(let w of b)d.add(w),(o(w,b)||l(w,m,c))&&u.push(w)}return u}function o(a,c){let u=e.mapper.toViewElement(a);if(!u)return!1;if(r(u)||i.fire("checkElement",{modelElement:a,viewElement:u}))return!0;if(!a.is("element","paragraph")&&!a.is("element","listItem"))return!1;let m=ck(a,t,c);return m&&u.is("element","p")?!0:!!(!m&&u.is("element","span"))}function r(a){for(a=a.parent;a.is("attributeElement")&&["ol","ul","li"].includes(a.name);)a=a.parent;return!!(a.getCustomProperty("$structureSlotParent")&&!e.mapper.toModelElement(a))}function l(a,c,u){if(u.has(a))return!1;let d=e.mapper.toViewElement(a),m=c.length-1;for(let h=d.parent;!h.is("editableElement");h=h.parent){let g=Yu(h),p=LA(h);if(!p&&!g)continue;let b=`checkAttributes:${g?"item":"list"}`;if(i.fire(b,{viewElement:h,modelAttributes:c[m].modelAttributes,modelReferenceElement:c[m].modelElement}))break;if(p&&(m--,m<0))return!1}return!0}}function L_(s,e,t,{dataPipeline:i}={}){let n=GA(s,e);return(o,r,l)=>{let{writer:a,mapper:c,consumable:u}=l,d=r.item;if(!s.includes(r.attributeKey)||!n(d,u))return;let m=N(I({},l.options),{dataPipeline:i}),h=WA(d,c,t,a);ak(h,a,c),jA(h,a);let g=$A(d,h,e,a,m);qA(d,g,e,a,m)}}function HA(s){return(e,t,i)=>{let{writer:n,mapper:o}=i,r=e.name.split(":")[1];if(!s.checkAttribute(r,"listItemId"))return;let l=o.toViewPosition(t.position),a=t.position.getShiftedBy(t.length),c=o.toViewPosition(a,{isPhantom:!0}),d=n.createRange(l,c).getTrimmed().end.nodeBefore;d&&ak(d,n,o)}}function R_(s,{dataPipeline:e}={}){return(t,{writer:i})=>{if(!ck(t,s))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});let n=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,n),n}}function WA(s,e,t,i){let n=t.createRangeOn(s),r=e.toViewRange(n).getTrimmed().getWalker();for(let{item:l}of r)if(l.is("element")&&l.getCustomProperty("listItemMarker"))r.jumpTo(i.createPositionAfter(l));else if(l.is("element")&&!l.getCustomProperty("listItemWrapper"))return l}function zA(s,e){return(t,i)=>{if(i.modelPosition.offset>0)return;let n=i.modelPosition.parent;if(!G(n)||!s.some(c=>c.scope=="itemMarker"&&c.canInjectMarkerIntoElement&&c.canInjectMarkerIntoElement(n)))return;let o=i.mapper.toViewElement(n),r=e.createRangeIn(o),l=r.getWalker(),a=r.start;for(let{item:c}of l){if(c.is("element")&&i.mapper.toModelElement(c)||c.is("$textProxy"))break;c.is("element")&&c.getCustomProperty("listItemMarker")&&(a=e.createPositionAfter(c),l.skip(({previousPosition:u})=>!u.isEqual(a)))}i.viewPosition=a}}function ak(s,e,t){for(;s.parent.is("attributeElement")&&s.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeOn(s),s.parent);let i=[];n(e.createPositionBefore(s).getWalker({direction:"backward"})),n(e.createRangeIn(s).getWalker());for(let o of i)e.remove(o);function n(o){for(let{item:r}of o){if(r.is("element")&&t.toModelElement(r))break;r.is("element")&&r.getCustomProperty("listItemMarker")&&i.push(r)}}}function $A(s,e,t,i,{dataPipeline:n}){let o=i.createRangeOn(e);if(!Xt(s))return o;for(let r of t){if(r.scope!="itemMarker")continue;let l=r.createElement(i,s,{dataPipeline:n});if(!l||(i.setCustomProperty("listItemMarker",!0,l),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(s)?i.insert(i.createPositionAt(e,0),l):(i.insert(o.start,l),o=i.createRange(i.createPositionBefore(l),i.createPositionAfter(e))),!r.createWrapperElement||!r.canWrapElement))continue;let a=r.createWrapperElement(i,s,{dataPipeline:n});i.setCustomProperty("listItemWrapper",!0,a),r.canWrapElement(s)?o=i.wrap(o,a):(o=i.wrap(i.createRangeOn(l),a),o=i.createRange(o.start,i.createPositionAfter(e)))}return o}function jA(s,e){let t=s.parent;for(;t.is("attributeElement")&&["ul","ol","li"].includes(t.name);){let i=t.parent;e.unwrap(e.createRangeOn(s),t),t=i}}function qA(s,e,t,i,n){if(!s.hasAttribute("listIndent"))return;let o=s.getAttribute("listIndent"),r=s;for(let l=o;l>=0;l--){let a=OA(i,l,r.getAttribute("listItemId")),c=FA(i,l,r.getAttribute("listType"));for(let u of t)(u.scope=="list"||u.scope=="item")&&r.hasAttribute(u.attributeName)&&u.setAttributeOnDowncast(i,r.getAttribute(u.attributeName),u.scope=="list"?c:a,n,r);if(e=i.wrap(e,a),e=i.wrap(e,c),l==0||(r=Ze.first(r,{lowerIndent:!0}),!r))break}}function GA(s,e){let t=e.filter(i=>i.consume===!1).map(i=>i.attributeName);return(i,n)=>{let o=[];for(let r of s)i.hasAttribute(r)&&!t.includes(r)&&o.push(`attribute:${r}`);return o.every(r=>n.test(i,r)!==!1)?(o.forEach(r=>n.consume(i,r)),!0):!1}}function ck(s,e,t=ui(s)){if(!G(s))return!1;for(let i of s.getAttributeKeys())if(!(i.startsWith("selection:")||i=="htmlEmptyBlock")&&!e.includes(i))return!1;return t.length<2}function KA(s,e,t,i){let n=s.document.differ.getChanges(),o=new Set,r=new Set,l=i.editor.config.get("list.multiBlock"),a=!1;for(let u of n){if(u.type=="insert"&&u.name!="$text"){let d=u.position.nodeAfter;if(!s.schema.checkAttribute(d,"listItemId"))for(let m of Array.from(d.getAttributeKeys()))t.includes(m)&&(e.removeAttribute(m,d),a=!0);Et(u.position,r,o),u.attributes.has("listItemId")||Et(u.position.getShiftedBy(u.length),r,o);for(let{item:m,previousPosition:h}of s.createRangeIn(d))G(m)&&Et(h,r,o)}else u.type=="remove"?Et(u.position,r,o):u.type=="attribute"&&t.includes(u.attributeKey)&&(Et(u.range.start,r,o),u.attributeNewValue===null&&Et(u.range.start.getShiftedBy(1),r,o));if(!l&&u.type=="attribute"&&zs.includes(u.attributeKey)){let d=u.range.start.nodeAfter;u.attributeNewValue===null&&d&&d.is("element","listItem")?(e.rename(d,"paragraph"),a=!0):u.attributeOldValue===null&&d&&d.is("element")&&d.name!="listItem"&&(e.rename(d,"listItem"),a=!0)}}let c=new Set;for(let u of r.values())a=i.fire("postFixer",{listNodes:new Uu(u),listHead:u,writer:e,seenIds:c})||a;return a}function XA(s){return(e,[t,i])=>{let n=t.is("documentFragment")?Array.from(t.getChildren()):[t];if(!n.length)return;let r=(i?s.createSelection(i):s.document.selection).getFirstPosition(),l;if(G(r.parent))l=r.parent;else if(G(r.nodeBefore)&&G(r.nodeAfter))l=r.nodeBefore;else return;s.change(a=>{let c=l.getAttribute("listType"),u=l.getAttribute("listIndent"),d=n[0].getAttribute("listIndent")||0,m=Math.max(u-d,0);for(let h of n){let g=G(h);l.is("element","listItem")&&h.is("element","paragraph")&&a.rename(h,"listItem"),a.setAttributes({listIndent:(g?h.getAttribute("listIndent"):0)+m,listItemId:g?h.getAttribute("listItemId"):xi.next(),listType:c},h)}})}}function F_(s,e){let t=s.document.selection;if(!t.isCollapsed)return!So(s);if(e==="forward")return!0;let n=t.getFirstPosition().parent,o=n.previousSibling;return s.schema.isObject(o)?!1:o.isEmpty?!0:xo([n,o])}function Qu(s,e,t,i){s.ui.componentFactory.add(e,()=>{let n=O_(y,s,e,t,i);return n.set({tooltip:!0,isToggleable:!0}),n}),s.ui.componentFactory.add(`menuBar:${e}`,()=>{let n=O_(x,s,e,t,i);return n.set({role:"menuitemcheckbox",isToggleable:!0}),n})}function O_(s,e,t,i,n){let o=e.commands.get(t),r=new s(e.locale);return r.set({label:i,icon:n}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{e.execute(t),e.editing.view.focus()}),r}function gk(){return hk.map(s=>s.listStyle)}function pd(s){return uk[s]||null}function fk(s){return mk[s]||null}function Zu(s){return dk[s]||null}function pk(s){switch(s){case"lower-alpha":return"lower-latin";case"upper-alpha":return"upper-latin";default:return s}}function N_(s){return(e,t,i)=>{let{writer:n,schema:o,consumable:r}=i;if(r.test(t.viewItem,s.viewConsumables)===!1)return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));let l=!1;for(let a of t.modelRange.getItems({shallow:!0}))o.checkAttribute(a,s.attributeName)&&s.appliesToListItem(a)&&(a.hasAttribute(s.attributeName)||(n.setAttribute(s.attributeName,s.getAttributeOnUpcast(t.viewItem),a),l=!0));l&&r.consume(t.viewItem,s.viewConsumables)}}function bk(s){let{startIndex:e,reversed:t,styles:i}=s;return{styles:YA(i),startIndex:e||!1,reversed:t||!1}}function YA(s){let e={listTypes:["bulleted","numbered"],useAttribute:!1,listStyleTypes:{numbered:["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"],bulleted:["disc","circle","square"]}};return s===!0||(s?Array.isArray(s)||typeof s=="string"?(e.listTypes=Ve(s),e.listStyleTypes=Ur(e.listStyleTypes,e.listTypes)):(e.listTypes=s.listTypes?Ve(s.listTypes):e.listTypes,e.useAttribute=!!s.useAttribute,s.listStyleTypes?e.listStyleTypes=s.listStyleTypes:e.listStyleTypes=Ur(e.listStyleTypes,e.listTypes)):(e.listTypes=[],e.listStyleTypes={})),e}function QA(s){let e=[],t=bk(s);if(s.styles){let i=t.styles.useAttribute;e.push({attributeName:"listStyle",defaultValue:Ao,viewConsumables:{styles:"list-style-type"},addCommand(n){let o=gk();i&&(o=o.filter(r=>!!Zu(r))),n.commands.add("listStyle",new ed(n,Ao,o))},appliesToListItem(n){return n.getAttribute("listType")=="numbered"||n.getAttribute("listType")=="bulleted"},hasValidAttribute(n){if(!this.appliesToListItem(n))return!n.hasAttribute("listStyle");if(!n.hasAttribute("listStyle"))return!1;let o=n.getAttribute("listStyle");return o==Ao?!0:pd(o)==n.getAttribute("listType")},setAttributeOnDowncast(n,o,r){if(o&&o!==Ao)if(i){let l=Zu(o);if(l){n.setAttribute("type",l,r);return}}else{n.setStyle("list-style-type",o,r);return}n.removeStyle("list-style-type",r),n.removeAttribute("type",r)},getAttributeOnUpcast(n){let o=n.getStyle("list-style-type");if(o)return pk(o);let r=n.getAttribute("type");return r?fk(r):Ao}})}return s.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(i){i.commands.add("listReversed",new td(i))},appliesToListItem(i){return i.getAttribute("listType")=="numbered"},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listReversed")},setAttributeOnDowncast(i,n,o){n?i.setAttribute("reversed","reversed",o):i.removeAttribute("reversed",o)},getAttributeOnUpcast(i){return i.hasAttribute("reversed")}}),s.startIndex&&e.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(i){i.commands.add("listStart",new Ju(i))},appliesToListItem(i){return $s(i.getAttribute("listType"))},hasValidAttribute(i){return this.appliesToListItem(i)==i.hasAttribute("listStart")},setAttributeOnDowncast(i,n,o){n==0||n>1?i.setAttribute("start",n,o):i.removeAttribute("start",o)},getAttributeOnUpcast(i){let n=i.getAttribute("start");return n>=0?n:1}}),e}function M_({editor:s,normalizedConfig:e,parentCommandName:t,buttonLabel:i,buttonIcon:n,styleGridAriaLabel:o,styleDefinitions:r}){let l=s.commands.get(t);return a=>{let c=X(a,ht),u=c.buttonView;return c.bind("isEnabled").to(l),c.class="ck-list-styles-dropdown",u.on("execute",()=>{s.execute(t),s.editing.view.focus()}),u.set({label:i,icon:n,tooltip:!0,isToggleable:!0}),u.bind("isOn").to(l,"value",d=>!!d),c.once("change:isOpen",()=>{let d=JA({editor:s,normalizedConfig:e,dropdownView:c,parentCommandName:t,styleGridAriaLabel:o,styleDefinitions:r});c.panelView.children.add(d)}),c.on("execute",()=>{s.editing.view.focus()}),c}}function wk({editor:s,listStyleCommand:e,parentCommandName:t}){let i=s.locale,n=s.commands.get(t);return({label:o,type:r,icon:l,tooltip:a})=>{let c=new y(i);return c.set({label:o,icon:l,tooltip:a}),c.bind("isOn").to(e,"value",u=>u===r),c.on("execute",()=>{n.value?e.value===r?s.execute(t):e.value!==r&&s.execute("listStyle",{type:r}):s.model.change(()=>{s.execute("listStyle",{type:r})})}),c}}function JA({editor:s,normalizedConfig:e,dropdownView:t,parentCommandName:i,styleDefinitions:n,styleGridAriaLabel:o}){let r=s.locale,l=I(I({},e),i!="numberedList"?{startIndex:!1,reversed:!1}:null),a=i.replace("List",""),c=null;if(e.styles.listTypes.includes(a)){let d=s.commands.get("listStyle"),m=wk({editor:s,parentCommandName:i,listStyleCommand:d}),h=e.styles.listStyleTypes,g=n;if(h){let b=h[a];b&&(g=n.filter(w=>b.includes(w.type)))}let p=_k(d);c=g.filter(p).map(m)}let u=new Xs(r,{styleGridAriaLabel:o,enabledProperties:l,styleButtonViews:c});if(e.styles.listTypes.includes(a)&&ns(t,()=>u.stylesView.children.find(d=>d.isOn)),l.startIndex){let d=s.commands.get("listStart");u.startIndexFieldView.bind("isEnabled").to(d),u.startIndexFieldView.fieldView.bind("value").to(d),u.on("listStart",(m,h)=>s.execute("listStart",h))}if(l.reversed){let d=s.commands.get("listReversed");u.reversedSwitchButtonView.bind("isEnabled").to(d),u.reversedSwitchButtonView.bind("isOn").to(d,"value",m=>!!m),u.on("listReversed",()=>{let m=d.value;s.execute("listReversed",{reversed:!m})})}return u.delegate("execute").to(t),u}function U_({editor:s,normalizedConfig:e,parentCommandName:t,buttonLabel:i,styleGridAriaLabel:n,styleDefinitions:o}){return r=>{let l=new Ie(r),a=s.commands.get(t),c=s.commands.get("listStyle"),u=_k(c),d=wk({editor:s,parentCommandName:t,listStyleCommand:c}),m=e.styles.listStyleTypes,h=o;if(m){let b=a.type,w=m[b];w&&(h=o.filter(k=>w.includes(k.type)))}let g=h.filter(u).map(d),p=new Xs(r,{styleGridAriaLabel:n,enabledProperties:N(I({},e),{startIndex:!1,reversed:!1}),styleButtonViews:g});return p.delegate("execute").to(l),l.buttonView.set({label:i,icon:t==="bulletedList"?Yo:Jo}),l.panelView.children.add(p),l.bind("isEnabled").to(a,"isEnabled"),l.on("execute",()=>{s.editing.view.focus()}),l}}function _k(s){return typeof s.isStyleTypeSupported=="function"?e=>s.isStyleTypeSupported(e.type):()=>!0}function eE(){return(s,e,t)=>{let{writer:i,schema:n}=t;if(!e.modelRange)return;let o=Array.from(e.modelRange.getItems({shallow:!0})).filter(r=>r.getAttribute("listType")==="todo"&&n.checkAttribute(r,"listItemId")).reduce((r,l)=>{let a=l.getAttribute("listItemId");return r.has(a)||r.set(a,ui(l)),r},new Map);for(let[,r]of o.entries())if(r.some(l=>l.getAttribute("todoListChecked")))for(let l of r)i.setAttribute("todoListChecked",!0,l)}}function tE(){return(s,e,t)=>{let i=e.modelCursor,n=i.parent,o=e.viewItem;if(!t.consumable.test(o,{name:!0})||o.getAttribute("type")!="checkbox"||!i.isAtStart||!n.hasAttribute("listType"))return;t.consumable.consume(o,{name:!0});let r=t.writer;r.setAttribute("listType","todo",n),e.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,n),e.modelRange=r.createRange(i)}}function Mu(s){let e=new Ct(s);return(t,i,n)=>{let o=e.match(i.viewItem);o&&n.consumable.consume(i.viewItem,o.match)&&Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor))}}function iE(s){let e=new Ct(s);return(t,i,n)=>{let o=e.match(i.viewItem);if(!o)return;let r=o.match;r.name=!1,n.consumable.consume(i.viewItem,r)}}function Hs(s,e){return(s.is("element","paragraph")||s.is("element","listItem"))&&s.getAttribute("listType")=="todo"&&Xt(s)&&nE(s,e)}function nE(s,e){for(let t of s.getAttributeKeys())if(!t.startsWith("selection:")&&!e.includes(t))return!1;return!0}function oE(s,e){return(t,i)=>{let n=Kn(i.keyCode,e.contentLanguageDirection),o=s.schema,r=s.document.selection;if(!r.isCollapsed)return;let l=r.getFirstPosition(),a=l.parent;if(n=="right"&&l.isAtEnd){let c=o.getNearestSelectionRange(s.createPositionAfter(a),"forward");if(!c)return;let u=c.start.parent;u&&G(u)&&u.getAttribute("listType")=="todo"&&(s.change(d=>d.setSelection(c)),i.preventDefault(),i.stopPropagation(),t.stop())}else if(n=="left"&&l.isAtStart&&G(a)&&a.getAttribute("listType")=="todo"){let c=o.getNearestSelectionRange(s.createPositionBefore(a),"backward");if(!c)return;s.change(u=>u.setSelection(c)),i.preventDefault(),i.stopPropagation(),t.stop()}}}function W_(s){return!!s&&s.is("attributeElement")&&s.hasClass("todo-list__label")}function z_(s){return!s||!s.is("element","paragraph")&&!s.is("element","listItem")?!1:s.getAttribute("listType")=="todo"}function j_(s,e,t){let i=e?s[0]:s[s.length-1];if(i.is("element","listItem")){let n=i[e?"previousSibling":"nextSibling"],o=i.getAttribute("listIndent");for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=t;)o>n.getAttribute("listIndent")&&(o=n.getAttribute("listIndent")),n.getAttribute("listIndent")==o&&s[e?"unshift":"push"](n),n=n[e?"previousSibling":"nextSibling"]}}function q_(s,e){return e.checkChild(s.parent,"listItem")&&!e.isObject(s)}function sE(s){let e=s.createContainerElement("li");return e.getFillerOffset=aE,e}function bd(s,e){let t=e.mapper,i=e.writer,n=s.getAttribute("listType")=="numbered"?"ol":"ul",o=sE(i),r=i.createContainerElement(n,null);return i.insert(i.createPositionAt(r,0),o),t.bindElements(s,o),o}function ir(s,e,t,i){let n=e.parent,o=t.mapper,r=t.writer,l=o.toViewPosition(i.createPositionBefore(s)),a=Bn(s.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:s.getAttribute("listIndent")}),c=s.previousSibling;if(a&&a.getAttribute("listIndent")==s.getAttribute("listIndent")){let u=o.toViewElement(a);l=r.breakContainer(r.createPositionAfter(u))}else if(c&&c.name=="listItem"){l=o.toViewPosition(i.createPositionAt(c,"end"));let u=o.findMappedViewAncestor(l),d=kk(u);d?l=r.createPositionBefore(d):l=r.createPositionAt(u,"end")}else l=o.toViewPosition(i.createPositionBefore(s));if(l=wd(l),r.insert(l,n),c&&c.name=="listItem"){let u=o.toViewElement(c),m=r.createRange(r.createPositionAt(u,0),l).getWalker({ignoreElementEnd:!0});for(let h of m)if(h.item.is("element","li")){let g=r.breakContainer(r.createPositionBefore(h.item)),p=h.item.parent,b=r.createPositionAt(e,"end");bt(r,b.nodeBefore,b.nodeAfter),r.move(r.createRangeOn(p),b),m._position=g}}else{let u=n.nextSibling;if(u&&(u.is("element","ul")||u.is("element","ol"))){let d=null;for(let m of u.getChildren()){let h=o.toModelElement(m);if(h&&h.getAttribute("listIndent")>s.getAttribute("listIndent"))d=m;else break}d&&(r.breakContainer(r.createPositionAfter(d)),r.move(r.createRangeOn(d.parent),r.createPositionAt(e,"end")))}}bt(r,n,n.nextSibling),bt(r,n.previousSibling,n)}function bt(s,e,t){return!e||!t||e.name!="ul"&&e.name!="ol"||e.name!=t.name||e.getAttribute("class")!==t.getAttribute("class")?null:s.mergeContainers(s.createPositionAfter(e))}function wd(s){return s.getLastMatchingPosition(e=>e.item.is("uiElement"))}function Bn(s,e){let t=!!e.sameIndent,i=!!e.smallerIndent,n=e.listIndent,o=s;for(;o&&o.name=="listItem";){let r=o.getAttribute("listIndent");if(t&&n==r||i&&n>r)return o;e.direction==="forward"?o=o.nextSibling:o=o.previousSibling}return null}function kk(s){for(let e of s.getChildren())if(e.name=="ul"||e.name=="ol")return e;return null}function Zs(s,e){let t=[],i=s.parent,n={ignoreElementEnd:!1,startPosition:s,shallow:!0,direction:e},o=i.getAttribute("listIndent"),r=[...new Wr(n)].filter(l=>l.item.is("element")).map(l=>l.item);for(let l of r){if(!l.is("element","listItem")||l.getAttribute("listIndent")<o)break;if(!(l.getAttribute("listIndent")>o)){if(l.getAttribute("listType")!==i.getAttribute("listType")||l.getAttribute("listStyle")!==i.getAttribute("listStyle")||l.getAttribute("listReversed")!==i.getAttribute("listReversed")||l.getAttribute("listStart")!==i.getAttribute("listStart"))break;e==="backward"?t.unshift(l):t.push(l)}}return t}function nr(s){let t=[...s.document.selection.getSelectedBlocks()].filter(i=>i.is("element","listItem")).map(i=>{let n=s.change(o=>o.createPositionAt(i,0));return[...Zs(n,"backward"),...Zs(n,"forward")]}).flat();return t=[...new Set(t)],t}function yk(s){return rE.includes(s)?"bulleted":lE.includes(s)?"numbered":null}function aE(){let s=!this.isEmpty&&(this.getChild(0).name=="ul"||this.getChild(0).name=="ol");return this.isEmpty||s?0:Ng.call(this)}function G_(s){return(e,t,i)=>{let n=i.consumable;if(!n.test(t.item,"insert")||!n.test(t.item,"attribute:listType")||!n.test(t.item,"attribute:listIndent"))return;n.consume(t.item,"insert"),n.consume(t.item,"attribute:listType"),n.consume(t.item,"attribute:listIndent");let o=t.item,r=bd(o,i);ir(o,r,i,s)}}function cE(s){return(e,t,i)=>{let r=i.mapper.toViewPosition(t.position).getLastMatchingPosition(h=>!h.item.is("element","li")).nodeAfter,l=i.writer;l.breakContainer(l.createPositionBefore(r)),l.breakContainer(l.createPositionAfter(r));let a=r.parent,c=a.previousSibling,u=l.createRangeOn(a),d=l.remove(u);c&&c.nextSibling&&bt(l,c,c.nextSibling);let m=i.mapper.toModelElement(r);vk(m.getAttribute("listIndent")+1,t.position,u.start,r,i,s);for(let h of l.createRangeIn(d).getItems())i.mapper.unbindViewElement(h);e.stop()}}function mE(s){return(e,t,i)=>{if(!i.consumable.consume(t.item,"attribute:listIndent"))return;let n=i.mapper.toViewElement(t.item),o=i.writer;o.breakContainer(o.createPositionBefore(n)),o.breakContainer(o.createPositionAfter(n));let r=n.parent,l=r.previousSibling,a=o.createRangeOn(r);o.remove(a),l&&l.nextSibling&&bt(o,l,l.nextSibling),vk(t.attributeOldValue+1,t.range.start,a.start,n,i,s),ir(t.item,n,i,s);for(let c of t.item.getChildren())i.consumable.consume(c,"insert")}}function Y_(s){return(e,t)=>{if(t.isPhantom)return;let i=t.modelPosition.nodeBefore;if(i&&i.is("element","listItem")){let n=t.mapper.toViewElement(i),o=n.getAncestors().find(Ln),r=s.createPositionAt(n,0).getWalker();for(let l of r)if(l.type=="elementStart"&&l.item.is("element","li")){t.viewPosition=l.previousPosition;break}else if(l.type=="elementEnd"&&l.item==o){t.viewPosition=l.nextPosition;break}}}}function pE(s){return(e,t)=>{let i=t.viewPosition,n=i.parent,o=t.mapper;if(n.name=="ul"||n.name=="ol"){if(i.isAtEnd){let r=o.toModelElement(i.nodeBefore),l=o.getModelLength(i.nodeBefore);t.modelPosition=s.createPositionBefore(r).getShiftedBy(l)}else{let r=o.toModelElement(i.nodeAfter);t.modelPosition=s.createPositionBefore(r)}e.stop()}else if(n.name=="li"&&i.nodeBefore&&(i.nodeBefore.name=="ul"||i.nodeBefore.name=="ol")){let r=o.toModelElement(n),l=1,a=i.nodeBefore;for(;a&&Ln(a);)l+=o.getModelLength(a),a=a.previousSibling;t.modelPosition=s.createPositionBefore(r).getShiftedBy(l),e.stop()}}}function bE(s,e){let t=s.document.differ.getChanges(),i=new Map,n=!1;for(let a of t)if(a.type=="insert"&&a.name=="listItem")o(a.position);else if(a.type=="insert"&&a.name!="listItem"){if(a.name!="$text"){let u=a.position.nodeAfter;u.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",u),n=!0),u.hasAttribute("listType")&&(e.removeAttribute("listType",u),n=!0),u.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",u),n=!0),u.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",u),n=!0),u.hasAttribute("listStart")&&(e.removeAttribute("listStart",u),n=!0);for(let d of Array.from(s.createRangeIn(u)).filter(m=>m.item.is("element","listItem")))o(d.previousPosition)}let c=a.position.getShiftedBy(a.length);o(c)}else a.type=="remove"&&a.name=="listItem"?o(a.position):(a.type=="attribute"&&a.attributeKey=="listIndent"||a.type=="attribute"&&a.attributeKey=="listType")&&o(a.range.start);for(let a of i.values())r(a),l(a);return n;function o(a){let c=a.nodeBefore;if(!c||!c.is("element","listItem")){let u=a.nodeAfter;u&&u.is("element","listItem")&&i.set(u,u)}else{let u=c;if(i.has(u))return;for(let d=u.previousSibling;d&&d.is("element","listItem");d=u.previousSibling)if(u=d,i.has(u))return;i.set(c,u)}}function r(a){let c=0,u=null;for(;a&&a.is("element","listItem");){let d=a.getAttribute("listIndent");if(d>c){let m;u===null?(u=d-c,m=c):(u>d&&(u=d),m=d-u),e.setAttribute("listIndent",m,a),n=!0}else u=null,c=a.getAttribute("listIndent")+1;a=a.nextSibling}}function l(a){let c=[],u=null;for(;a&&a.is("element","listItem");){let d=a.getAttribute("listIndent");if(u&&u.getAttribute("listIndent")>d&&(c=c.slice(0,d+1)),d!=0)if(c[d]){let m=c[d];a.getAttribute("listType")!=m&&(e.setAttribute("listType",m,a),n=!0)}else c[d]=a.getAttribute("listType");u=a,a=a.nextSibling}}}function _E(s,e,t){let{writer:i,schema:n}=t,o=i.createPositionAfter(s);for(let r of e)if(r.name=="ul"||r.name=="ol")o=t.convertItem(r,o).modelCursor;else{let l=t.convertItem(r,i.createPositionAt(s,"end")),a=l.modelRange.start.nodeAfter;a&&a.is("element")&&!n.checkChild(s,a.name)&&(l.modelCursor.parent.is("element","listItem")?s=l.modelCursor.parent:s=kE(l.modelCursor),o=i.createPositionAfter(s))}return o}function kE(s){let e=new Wr({startPosition:s}),t;do t=e.next();while(!t.value.item.is("element","listItem"));return t.value.item}function vk(s,e,t,i,n,o){let r=Bn(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:s}),l=n.mapper,a=n.writer,c=r?r.getAttribute("listIndent"):null,u;if(!r)u=t;else if(c==s){let d=l.toViewElement(r).parent;u=a.createPositionAfter(d)}else{let d=o.createPositionAt(r,"end");u=l.toViewPosition(d)}u=wd(u);for(let d of[...i.getChildren()])Ln(d)&&(u=a.move(a.createRangeOn(d),u).end,bt(a,d,d.nextSibling),bt(a,d.previousSibling,d))}function Ln(s){return s.is("element","ol")||s.is("element","ul")}function yE(s){let e=0,t=s.parent;for(;t;){if(t.is("element","li"))e++;else{let i=t.previousSibling;i&&i.is("element","li")&&e++}t=t.parent}return e}function ad(s){let e=1;for(let t of s.getChildren())if(t.name=="ul"||t.name=="ol")for(let i of t.getChildren())e+=ad(i);return e}function vE(s){let e=[];return s.styles&&e.push({attributeName:"listStyle",defaultValue:Ws,addCommand(t){t.commands.add("listStyle",new cd(t,Ws))},appliesToListItem(){return!0},setAttributeOnDowncast(t,i,n){i&&i!==Ws?t.setStyle("list-style-type",i,n):t.removeStyle("list-style-type",n)},getAttributeOnUpcast(t){return pk(t.getStyle("list-style-type"))||Ws}}),s.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,addCommand(t){t.commands.add("listReversed",new ud(t))},appliesToListItem(t){return t.getAttribute("listType")=="numbered"},setAttributeOnDowncast(t,i,n){i?t.setAttribute("reversed","reversed",n):t.removeAttribute("reversed",n)},getAttributeOnUpcast(t){return t.hasAttribute("reversed")}}),s.startIndex&&e.push({attributeName:"listStart",defaultValue:1,addCommand(t){t.commands.add("listStart",new dd(t))},appliesToListItem(t){return t.getAttribute("listType")=="numbered"},setAttributeOnDowncast(t,i,n){i==0||i>1?t.setAttribute("start",i,n):t.removeAttribute("start",n)},getAttributeOnUpcast(t){let i=t.getAttribute("start");return i>=0?i:1}}),e}function CE(s){return e=>{e.on("element:li",(t,i,n)=>{if(!i.modelRange)return;let o=i.viewItem.parent,r=i.modelRange.start.nodeAfter||i.modelRange.end.nodeBefore;for(let l of s)if(l.appliesToListItem(r)){let a=l.getAttributeOnUpcast(o);n.writer.setAttribute(l.attributeName,a,r)}},{priority:"low"})}}function IE(s){return t=>{for(let i of s)t.on(`attribute:${i.attributeName}:listItem`,(n,o,r)=>{let l=r.writer,a=o.item,c=Bn(a.previousSibling,{sameIndent:!0,listIndent:a.getAttribute("listIndent"),direction:"backward"}),u=r.mapper.toViewElement(a);e(a,c)||l.breakContainer(l.createPositionBefore(u)),i.setAttributeOnDowncast(l,o.attributeNewValue,u.parent)},{priority:"low"})};function e(t,i){return i&&t.getAttribute("listType")===i.getAttribute("listType")&&t.getAttribute("listIndent")===i.getAttribute("listIndent")&&t.getAttribute("listStyle")===i.getAttribute("listStyle")&&t.getAttribute("listReversed")===i.getAttribute("listReversed")&&t.getAttribute("listStart")===i.getAttribute("listStart")}}function TE(s,e){return(t,i)=>{let n=i[0],o=n.getAttribute("listIndent"),r=i.filter(a=>a.getAttribute("listIndent")===o),l=null;n.previousSibling.getAttribute("listIndent")+1!==o&&(l=Bn(n.previousSibling,{sameIndent:!0,direction:"backward",listIndent:o})),s.model.change(a=>{for(let c of r)for(let u of e)if(u.appliesToListItem(c)){let d=l==null?u.defaultValue:l.getAttribute(u.attributeName);a.setAttribute(u.attributeName,d,c)}})}}function AE(s,e){return(t,i)=>{if(i=i.reverse().filter(l=>l.is("element","listItem")),!i.length)return;let n=i[0].getAttribute("listIndent"),o=i[0].getAttribute("listType"),r=i[0].previousSibling;if(r.is("element","listItem"))for(;r.getAttribute("listIndent")!==n;)r=r.previousSibling;else r=null;r||(r=i[i.length-1].nextSibling),!(!r||!r.is("element","listItem"))&&r.getAttribute("listType")===o&&s.model.change(l=>{let a=i.filter(c=>c.getAttribute("listIndent")===n);for(let c of a)for(let u of e)if(u.appliesToListItem(c)){let d=u.attributeName,m=r.getAttribute(d);l.setAttribute(d,m,c)}})}}function EE(s,e){return t=>{let i=!1,n=Ck(s.model.document.differ.getChanges()).filter(r=>r.getAttribute("listType")!=="todo");if(!n.length)return i;let o=n[n.length-1].nextSibling;if((!o||!o.is("element","listItem"))&&(o=n[0].previousSibling,o)){let r=n[0].getAttribute("listIndent");for(;o.is("element","listItem")&&o.getAttribute("listIndent")!==r&&(o=o.previousSibling,!!o););}for(let r of e){let l=r.attributeName;for(let a of n){if(!r.appliesToListItem(a)){t.removeAttribute(l,a);continue}if(!a.hasAttribute(l))xE(o,a,r)?t.setAttribute(l,o.getAttribute(l),a):t.setAttribute(l,r.defaultValue,a),i=!0;else{let c=a.previousSibling;SE(c,a,r.attributeName)&&(t.setAttribute(l,c.getAttribute(l),a),i=!0)}}}return i}}function xE(s,e,t){if(!s)return!1;let i=s.getAttribute(t.attributeName);return!(!i||i==t.defaultValue||s.getAttribute("listType")!==e.getAttribute("listType"))}function SE(s,e,t){if(!s||!s.is("element","listItem")||e.getAttribute("listType")!==s.getAttribute("listType"))return!1;let i=s.getAttribute("listIndent");if(i<1||i!==e.getAttribute("listIndent"))return!1;let n=s.getAttribute(t);return!(!n||n===e.getAttribute(t))}function VE(s){return e=>{let t=Ck(s.model.document.differ.getChanges()).filter(i=>i.getAttribute("listType")==="todo"&&(i.hasAttribute("listStyle")||i.hasAttribute("listReversed")||i.hasAttribute("listStart")));if(!t.length)return!1;for(let i of t)e.removeAttribute("listStyle",i),e.removeAttribute("listReversed",i),e.removeAttribute("listStart",i);return!0}}function J_(s){return(e,t)=>{t=t.filter(i=>i.is("element","listItem")),s.model.change(i=>{for(let n of t)i.removeAttribute("listStyle",n)})}}function Ck(s){let e=[];for(let t of s){let i=PE(t);i&&i.is("element","listItem")&&e.push(i)}return e}function PE(s){return s.type==="attribute"?s.range.start.nodeAfter:s.type==="insert"?s.position.nodeAfter:null}function BE(s,e){return(t,i,n)=>{let o=n.consumable;if(!o.test(i.item,"insert")||!o.test(i.item,"attribute:listType")||!o.test(i.item,"attribute:listIndent")||i.item.getAttribute("listType")!="todo")return;let r=i.item;o.consume(r,"insert"),o.consume(r,"attribute:listType"),o.consume(r,"attribute:listIndent"),o.consume(r,"attribute:todoListChecked");let l=n.writer,a=bd(r,n),c=!!r.getAttribute("todoListChecked"),u=_d(r,l,c,e),d=l.createContainerElement("span",{class:"todo-list__label__description"});l.addClass("todo-list",a.parent),l.insert(l.createPositionAt(a,0),u),l.insert(l.createPositionAfter(u),d),ir(r,a,n,s)}}function LE(s){return(e,t,i)=>{let n=i.consumable;if(!n.test(t.item,"insert")||!n.test(t.item,"attribute:listType")||!n.test(t.item,"attribute:listIndent")||t.item.getAttribute("listType")!="todo")return;let o=t.item;n.consume(o,"insert"),n.consume(o,"attribute:listType"),n.consume(o,"attribute:listIndent"),n.consume(o,"attribute:todoListChecked");let r=i.writer,l=bd(o,i);r.addClass("todo-list",l.parent);let a=r.createContainerElement("label",{class:"todo-list__label"}),c=r.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),u=r.createContainerElement("span",{class:"todo-list__label__description"});o.getAttribute("todoListChecked")&&r.setAttribute("checked","checked",c),r.insert(r.createPositionAt(l,0),a),r.insert(r.createPositionAt(a,0),c),r.insert(r.createPositionAfter(c),u),ir(o,l,i,s)}}function FE(s,e){return(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;let o=n.mapper.toViewElement(i.item),r=n.writer,l=DE(o,e);if(i.attributeNewValue=="todo"){let a=!!i.item.getAttribute("todoListChecked"),c=_d(i.item,r,a,s),u=r.createContainerElement("span",{class:"todo-list__label__description"}),d=r.createRangeIn(o),m=kk(o),h=wd(d.start),g=m?r.createPositionBefore(m):d.end,p=r.createRange(h,g);r.addClass("todo-list",o.parent),r.move(p,r.createPositionAt(u,0)),r.insert(r.createPositionAt(o,0),c),r.insert(r.createPositionAfter(c),u)}else if(i.attributeOldValue=="todo"){let a=Ik(o,e);r.removeClass("todo-list",o.parent),r.remove(l),r.move(r.createRangeIn(a),r.createPositionBefore(a)),r.remove(a)}}}function OE(s){return(e,t,i)=>{if(t.item.getAttribute("listType")!="todo"||!i.consumable.consume(t.item,"attribute:todoListChecked"))return;let{mapper:n,writer:o}=i,r=!!t.item.getAttribute("todoListChecked"),a=n.toViewElement(t.item).getChild(0),c=_d(t.item,o,r,s);o.insert(o.createPositionAfter(a),c),o.remove(a)}}function ek(s){return(e,t)=>{let i=t.modelPosition,n=i.parent;if(!n.is("element","listItem")||n.getAttribute("listType")!="todo")return;let o=t.mapper.toViewElement(n),r=Ik(o,s);r&&(t.viewPosition=t.mapper.findPositionIn(r,i.offset))}}function _d(s,e,t,i){return e.createUIElement("label",{class:"todo-list__label",contenteditable:!1},function(o){let r=Te(document,"input",{type:"checkbox",tabindex:"-1"});t&&r.setAttribute("checked","checked"),r.addEventListener("change",()=>i(s));let l=this.toDomElement(o);return l.appendChild(r),l})}function DE(s,e){let t=e.createRangeIn(s);for(let i of t)if(i.item.is("uiElement","label"))return i.item}function Ik(s,e){let t=e.createRangeIn(s);for(let i of t)if(i.item.is("containerElement","span")&&i.item.hasClass("todo-list__label__description"))return i.item}function ME(s,e){return(t,i)=>{if(Kn(i.keyCode,e.contentLanguageDirection)!="left")return;let o=s.schema,r=s.document.selection;if(!r.isCollapsed)return;let l=r.getFirstPosition(),a=l.parent;if(a.name==="listItem"&&a.getAttribute("listType")=="todo"&&l.isAtStart){let c=o.getNearestSelectionRange(s.createPositionBefore(a),"backward");c&&s.change(u=>u.setSelection(c)),i.preventDefault(),i.stopPropagation(),t.stop()}}}function tk(s){return!!s&&s.is("element","listItem")&&s.getAttribute("listType")==="todo"}function ok(){return(s,e,t)=>{let i=e.viewItem,n=i.nextSibling;if(!n||i.name!==n.name)return;e.modelRange||Object.assign(e,t.convertChildren(e.viewItem,e.modelCursor));
30let o=t.writer,r=o.createElement("listSeparator");if(!t.safeInsert(r,e.modelCursor))return;let l=t.getSplitParts(r);e.modelRange=o.createRange(e.modelRange.start,o.createPositionAfter(l[l.length-1])),t.updateConversionResult(r,e)}}var Ze,Qi,Uu,xi,js,Yi,qs,Gs,zu,$u,ju,qu,Gu,Ku,Xu,zs,$e,Ks,D_,Ju,uk,dk,mk,hk,ed,td,id,Ao,nd,Xs,Ys,H_,od,sd,ZA,rd,Qs,$_,Vo,Js,rE,lE,ld,uE,dE,K_,hE,gE,X_,fE,wE,Po,Q_,cd,ud,dd,Ws,md,Z_,Eo,hd,RE,NE,gd,ik,nk,kd=M(()=>{U();at();kn();j();pc();Ci();z();re();Me();ve();Ze=class{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward=t.direction=="forward",this._includeSelf=!!t.includeSelf,this._sameAttributes=Ve(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){let n=new this(e,t)[Symbol.iterator]();return O(n)}*[Symbol.iterator](){let e=[];for(let{node:t}of new Qi(this._getStartNode(),this._isForward?"forward":"backward")){let i=t.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*rn(e),e.length=0);break}continue}if(this._sameAttributes.some(n=>t.getAttribute(n)!==this._startElement.getAttribute(n)))break}e.length&&(yield*rn(e),e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}},Qi=class{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(e,t="forward"){this._node=e,this._isForward=t==="forward"}[Symbol.iterator](){return this}next(){if(!G(this._node))return{done:!0,value:void 0};let e=this._node.getAttribute("listIndent"),t=null;if(this._previous){let n=this._previousNodeIndent;e>n?this._previousNodesByIndent[n]=this._previous:e<n?(t=this._previousNodesByIndent[e]||null,this._previousNodesByIndent.length=e):t=this._previous}let i={node:this._node,previous:this._previous,previousNodeInList:t};return this._previous=this._node,this._previousNodeIndent=e,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:i,done:!1}}},Uu=class{_listHead;constructor(e){this._listHead=e}[Symbol.iterator](){return new Qi(this._listHead)}},xi=class{static next(){return yt()}};js=class extends v{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor,t=e.model,i=P_(t.document.selection),o=e.plugins.get("ListEditing").getListAttributeNames();t.change(r=>{let l=[];xo(i)&&!Xt(i[0])?(this._direction=="forward"&&l.push(...Wu(i,r,{attributeNames:o})),l.push(...fd(i[0],r))):this._direction=="forward"?l.push(...Wu(i,r,{expand:!0,attributeNames:o})):l.push(...TA(i,r,{attributeNames:o}));for(let a of l){if(!a.hasAttribute("listType"))continue;let c=Ze.first(a,{sameIndent:!0});c&&r.setAttribute("listType",c.getAttribute("listType"),a)}this._fireAfterExecute(l)})}_fireAfterExecute(e){this.fire("afterExecute",Ji(new Set(e)))}_checkEnabled(){let e=P_(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction=="backward"||xo(e)&&!Xt(e[0]))return!0;e=Bo(e),t=e[0];let i=Ze.first(t,{sameIndent:!0});return i?i.getAttribute("listType")==t.getAttribute("listType"):!1}
vendor: 52,599 bytes, line 30
30};Yi=class extends v{type;_listWalkerOptions;constructor(e,t,i={}){super(e),this.type=t,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,i=t.document,n=So(t),o=Array.from(i.selection.getSelectedBlocks()).filter(l=>t.schema.checkAttribute(l,"listType")||Nu(l,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(l=>{if(r){let a=o[o.length-1],u=this.editor.plugins.get("ListEditing").getListAttributeNames(),d=Si(a,{direction:"forward"}),m=[];d.length>1&&m.push(...fd(d[1],l)),m.push(...tr(o,l,u)),m.push(...AA(a,l)),this._fireAfterExecute(m)}else if((n||i.selection.isCollapsed)&&G(o[0])){let a=sk(n||o[0],this._listWalkerOptions);for(let c of a)l.setAttributes(N(I({},e.additionalAttributes),{listType:this.type}),c);this._fireAfterExecute(a)}else{let a=[];for(let c of o)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&Nu(c,t.schema)&&l.rename(c,"listItem"),l.setAttributes(N(I({},e.additionalAttributes),{listIndent:0,listItemId:xi.next(),listType:this.type}),c),a.push(c);else for(let u of Bo(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(l.setAttributes(N(I({},e.additionalAttributes),{listType:this.type}),u),a.push(u));this._fireAfterExecute(a)}})}_fireAfterExecute(e){this.fire("afterExecute",Ji(new Set(e)))}_getValue(){let e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(let i of t)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){let e=this.editor.model,t=e.schema,i=e.document.selection,n=Array.from(i.getSelectedBlocks());if(!n.length)return!1;if(this.value)return!0;for(let o of n)if(t.checkAttribute(o,"listType")||Nu(o,t))return!0;return!1}},qs=class extends v{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){let t=this.editor,i=t.model,n=i.document.selection,o=[],l=t.plugins.get("ListEditing").getListAttributeNames();i.change(a=>{let{firstElement:c,lastElement:u}=this._getMergeSubjectElements(n,e),d=c.getAttribute("listIndent")||0,m=u.getAttribute("listIndent"),h=u.getAttribute("listItemId");if(d!=m){let g=IA(u);o.push(...Wu([u,...g],a,{indentBy:d-m,expand:d<m,attributeNames:l}))}if(e){let g=n;n.isCollapsed&&(g=a.createSelection(a.createRange(a.createPositionAt(c,"end"),a.createPositionAt(u,0)))),i.deleteContent(g,{doNotResetEntireContent:n.isCollapsed});let p=g.getLastPosition().parent,b=p.nextSibling;o.push(p),b&&b!==u&&b.getAttribute("listItemId")==h&&o.push(...Hu(b,p,a))}else o.push(...Hu(u,c,a));this._fireAfterExecute(o)})}_fireAfterExecute(e){this.fire("afterExecute",Ji(new Set(e)))}_checkEnabled(){let e=this.editor.model,t=e.document.selection,i=So(e);if(t.isCollapsed||i){let n=i||t.getFirstPosition().parent;if(!G(n))return!1;let o=this._direction=="backward"?n.previousSibling:n.nextSibling;if(!o||xo([n,o]))return!1}else{let n=t.getLastPosition(),o=t.getFirstPosition();if(n.parent===o.parent||!G(n.parent))return!1}return!0}_getMergeSubjectElements(e,t){let i=this.editor.model,n=So(i),o,r;if(e.isCollapsed||n){let l=n||e.getFirstPosition().parent,a=Xt(l);this._direction=="backward"?(r=l,a&&!t?o=Ze.first(l,{sameIndent:!0,lowerIndent:!0}):o=l.previousSibling):(o=l,r=l.nextSibling)}else o=e.getFirstPosition().parent,r=e.getLastPosition().parent;return{firstElement:o,lastElement:r}}},Gs=class extends v{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(t=>{let i=fd(this._getStartBlock(),t);this._fireAfterExecute(i)})}_fireAfterExecute(e){this.fire("afterExecute",Ji(new Set(e)))}_checkEnabled(){let e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&G(t)&&!Xt(t)}_getStartBlock(){let t=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?t:t.nextSibling}},zu=class extends f{static get pluginName(){return"ListItemBoldIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[$e]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get($e);!e.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("bold","listItemBold"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(n,o,r,l){o&&(n.addClass("ck-list-marker-bold",r),Je.isSafari&&!(l&&l.dataPipeline)&&n.setStyle("--ck-content-list-marker-dummy-bold","0",r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("BoldEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemBold"}),t.schema.setAttributeProperties("listItemBold",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemBold"),e.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}))}},$u=class extends f{static get pluginName(){return"ListItemItalicIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[$e]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get($e);!e.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("italic","listItemItalic"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(n,o,r,l){o&&(n.addClass("ck-list-marker-italic",r),Je.isSafari&&!(l&&l.dataPipeline)&&n.setStyle("--ck-content-list-marker-dummy-italic","0",r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("ItalicEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),t.schema.setAttributeProperties("listItemItalic",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemItalic"),e.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}))}},ju=class extends f{static get pluginName(){return"ListItemFontSizeIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[$e]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get($e);if(!e.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;let n=xn(e.config.get("fontSize.options"));t.registerFormatAttribute("fontSize","listItemFontSize"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(o,r,l,a){if(r){let c=n.find(u=>u.model==r);c&&c.view&&typeof c.view!="string"?c.view.styles?(o.addClass("ck-list-marker-font-size",l),o.setStyle("--ck-content-list-marker-font-size",c.view.styles["font-size"],l)):c.view.classes&&(o.addClass(`ck-list-marker-font-size-${r}`,l),Je.isSafari&&!(a&&a.dataPipeline)&&o.setStyle("--ck-content-list-marker-dummy-font-size","0",l)):(o.addClass("ck-list-marker-font-size",l),o.setStyle("--ck-content-list-marker-font-size",r,l))}}})}afterInit(){let e=this.editor,t=e.model;if(!e.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;t.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),t.schema.setAttributeProperties("listItemFontSize",{isFormatting:!0}),t.schema.addAttributeCheck(n=>{if(!n.last.getAttribute("listItemId"))return!1},"listItemFontSize"),e.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:n=>n.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});let i=xn(e.config.get("fontSize.options"));for(let n of i)n.model&&n.view&&e.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:n.model},view:{name:"li",classes:`ck-list-marker-font-size-${n.model}`}})}},qu=class extends f{static get pluginName(){return"ListItemFontColorIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[$e]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get($e);!e.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("fontColor","listItemFontColor"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(n,o,r){o&&(n.addClass("ck-list-marker-color",r),n.setStyle("--ck-content-list-marker-color",o,r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("FontColorEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),t.schema.setAttributeProperties("listItemFontColor",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontColor"),e.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:i=>i.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}))}},Gu=class extends f{static get pluginName(){return"ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return!0}static get requires(){return[$e]}init(){let e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get($e);!e.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.registerFormatAttribute("fontFamily","listItemFontFamily"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(n,o,r){o&&(n.addClass("ck-list-marker-font-family",r),n.setStyle("--ck-content-list-marker-font-family",o,r))}}))}afterInit(){let e=this.editor,t=e.model;!e.plugins.has("FontFamilyEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting")||(t.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),t.schema.setAttributeProperties("listItemFontFamily",{isFormatting:!0}),t.schema.addAttributeCheck(i=>{if(!i.last.getAttribute("listItemId"))return!1},"listItemFontFamily"),e.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:i=>i.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}))}},Ku=class extends f{_loadedFormatting={};static get pluginName(){return"ListFormatting"}static get isOfficialPlugin(){return!0}static get requires(){return[zu,$u,ju,qu,Gu]}constructor(e){super(e),e.config.define("list.enableListItemMarkerFormatting",!0)}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){let e=this.editor.model;e.document.registerPostFixer(t=>{let i=e.document.differ.getChanges(),n=new Set,o=!1;for(let r of i)if(r.type==="attribute")(r.attributeKey=="listItemId"||r.attributeKey=="listType"||this._isInlineOrSelectionFormatting(r.attributeKey)||Object.values(this._loadedFormatting).includes(r.attributeKey))&&(G(r.range.start.nodeAfter)?n.add(r.range.start.nodeAfter):G(r.range.start.parent)&&n.add(r.range.start.parent));else if(G(r.position.nodeAfter)&&n.add(r.position.nodeAfter),G(r.position.nodeBefore)&&n.add(r.position.nodeBefore),G(r.position.parent)&&n.add(r.position.parent),r.type=="insert"&&r.name!="$text"){let l=t.createRangeIn(r.position.nodeAfter);for(let a of l.getItems())G(a)&&n.add(a)}for(let r of n){let l=SA(e,r,Object.keys(this._loadedFormatting));for(let[a,c]of Object.entries(l)){let u=this._loadedFormatting[a];(c&&VA(t,r,u,c)||!c&&PA(t,r,u))&&(o=!0)}}return o})}registerFormatAttribute(e,t){this._loadedFormatting[e]=t}_isInlineOrSelectionFormatting(e){return e.replace(/^selection:/,"")in this._loadedFormatting}};Xu=class extends f{static get pluginName(){return"ListUtils"}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(e){return er(e)}isFirstBlockOfListItem(e){return Xt(e)}isListItemBlock(e){return G(e)}expandListBlocksToCompleteItems(e,t={}){return Bo(e,t)}isNumberedListType(e){return $s(e)}isFirstListItemInList(e){return EA(e)}};zs=["listType","listIndent","listItemId"],$e=class extends f{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[li,it,Xu,ct,Ku]}constructor(e){super(e),e.config.define("list.multiBlock",!0)}init(){let e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new S("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:zs}),i?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(let n of zs)t.schema.setAttributeProperties(n,{copyOnReplace:!0});e.commands.add("numberedList",new Yi(e,"numbered")),e.commands.add("bulletedList",new Yi(e,"bulleted")),e.commands.add("customNumberedList",new Yi(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new Yi(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new js(e,"forward")),e.commands.add("outdentList",new js(e,"backward")),e.commands.add("splitListItemBefore",new Gs(e,"before")),e.commands.add("splitListItemAfter",new Gs(e,"after")),i&&(e.commands.add("mergeListItemBackward",new qs(e,"backward")),e.commands.add("mergeListItemForward",new qs(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){let t=this.editor.commands,i=t.get("indent"),n=t.get("outdent");i&&i.registerChildCommand(t.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...zs,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){let e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(n,o)=>{let r=e.model.document.selection;So(e.model)||e.model.change(()=>{let l=r.getFirstPosition();if(r.isCollapsed&&o.direction=="backward"){if(!l.isAtStart)return;let a=l.parent;if(!G(a))return;if(!Ze.first(a,{sameAttributes:"listType",sameIndent:!0})&&a.getAttribute("listIndent")===0)V_(a)||e.execute("splitListItemAfter"),e.execute("outdentList");else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:F_(e.model,"backward")})}o.preventDefault(),n.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:F_(e.model,"forward")}),o.preventDefault(),n.stop()}})},{context:"li"})}_setupEnterIntegration(){let e=this.editor,t=e.model,i=e.commands,n=i.get("enter");this.listenTo(e.editing.view.document,"enter",(o,r)=>{let l=t.document,a=l.selection.getFirstPosition().parent;if(l.selection.isCollapsed&&G(a)&&a.isEmpty&&!r.isSoft){let c=Xt(a),u=V_(a);c&&u?(e.execute("outdentList"),r.preventDefault(),o.stop()):c&&!u?(e.execute("splitListItemAfter"),r.preventDefault(),o.stop()):u&&(e.execute("splitListItemBefore"),r.preventDefault(),o.stop())}},{context:"li"}),this.listenTo(n,"afterExecute",()=>{let o=i.get("splitListItemBefore");if(o.refresh(),!o.isEnabled)return;let l=e.model.document.selection.getLastPosition().parent;ui(l).length===2&&o.execute()})}_setupTabIntegration(){let e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,i)=>{let n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){let e=this.editor,t=e.model,i=this.getListAttributeNames(),n=e.config.get("list.multiBlock"),o=n?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(l,{writer:a})=>a.createElement(o,{listType:""})}).elementToElement({view:"p",model:(l,{writer:a})=>l.parent&&l.parent.is("element","li")?a.createElement(o,{listType:""}):null,converterPriority:"high"}).add(l=>{l.on("element:li",MA())}),n||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:R_(i),converterPriority:"high"}).add(l=>{l.on("attribute",L_(i,this._downcastStrategies,t)),l.on("remove",HA(t.schema))}),e.conversion.for("dataDowncast").elementToElement({model:o,view:R_(i,{dataPipeline:!0}),converterPriority:"high"}).add(l=>{l.on("attribute",L_(i,this._downcastStrategies,t,{dataPipeline:!0}))});let r=zA(this._downcastStrategies,e.editing.view);e.editing.mapper.on("modelToViewPosition",r),e.data.mapper.on("modelToViewPosition",r),this.listenTo(t.document,"change:data",UA(t,e.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(l,{viewElement:a,modelAttributes:c})=>{a.id!=c.listItemId&&(l.return=!0,l.stop())}),this.on("checkAttributes:list",(l,{viewElement:a,modelAttributes:c})=>{(a.name!=rk(c.listType)||a.id!=lk(c.listType,c.listIndent))&&(l.return=!0,l.stop())})}_setupModelPostFixing(){let e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(i=>KA(e,i,t,this)),this.on("postFixer",(i,{listNodes:n,writer:o})=>{i.return=DA(n,o)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:n,writer:o,seenIds:r})=>{i.return=NA(n,r,o)||i.return},{priority:"high"})}_setupClipboardIntegration(){let e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",XA(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(i,n)=>{e.change(o=>{let r=Array.from(n.content.getChildren()),l=r[r.length-1];if(r.length>1&&l.is("element")&&l.isEmpty&&r.slice(0,-1).every(G)&&o.remove(l),n.method=="copy"||n.method=="cut"){let a=Array.from(n.content.getChildren());xo(a)&&tr(a,o,this.getListAttributeNames())}})})}_setupAccessibilityIntegration(){let e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(e,t,i,n){n&&(n.skipListItemIds||n.isClipboardPipeline)||e.setAttribute("data-list-item-id",t,i)}})}};Ks=class extends f{static get pluginName(){return"ListUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||Qu(this.editor,"numberedList",e("Numbered List"),Jo),this.editor.ui.componentFactory.has("bulletedList")||Qu(this.editor,"bulletedList",e("Bulleted List"),Yo)}},D_=class extends f{static get requires(){return[$e,Ks]}static get pluginName(){return"List"}static get isOfficialPlugin(){return!0}},Ju=class extends v{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute({startIndex:e=1}={}){let t=this.editor.model,i=t.document,n=Array.from(i.selection.getSelectedBlocks()).filter(o=>G(o)&&$s(o.getAttribute("listType")));n=er(n),t.change(o=>{for(let r of n)o.setAttribute("listStart",e>=0?e:1,r)})}_getValue(){let t=this.editor.model.document,i=O(t.selection.getSelectedBlocks());return i&&G(i)&&$s(i.getAttribute("listType"))?i.getAttribute("listStart"):null}};uk={},dk={},mk={},hk=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"},{listStyle:"arabic-indic",typeAttribute:null,listType:"numbered"}];for(let{listStyle:s,typeAttribute:e,listType:t}of hk)uk[s]=t,dk[s]=e,e&&(mk[e]=s);ed=class extends v{defaultType;_supportedTypes;constructor(e,t,i){super(e),this.defaultType=t,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,i=t.document;t.change(n=>{this._tryToConvertItemsToList(e);let o=Array.from(i.selection.getSelectedBlocks()).filter(r=>r.hasAttribute("listType"));if(o.length){o=er(o);for(let r of o)n.setAttribute("listStyle",e.type||this.defaultType,r)}})}isStyleTypeSupported(e){return this._supportedTypes?this._supportedTypes.includes(e):!0}_getValue(){let e=O(this.editor.model.document.selection.getSelectedBlocks());return G(e)?e.getAttribute("listStyle"):null}_checkEnabled(){let e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;let t=pd(e.type);if(!t)return;let i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n)}},td=class extends v{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute(e={}){let t=this.editor.model,i=t.document,n=Array.from(i.selection.getSelectedBlocks()).filter(o=>G(o)&&o.getAttribute("listType")=="numbered");n=er(n),t.change(o=>{for(let r of n)o.setAttribute("listReversed",!!e.reversed,r)})}_getValue(){let t=this.editor.model.document,i=O(t.selection.getSelectedBlocks());return G(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listReversed"):null}};id=class extends f{static get pluginName(){return"ListPropertiesUtils"}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return gk()}getListTypeFromListStyleType(e){return pd(e)}getListStyleTypeFromTypeAttribute(e){return fk(e)}getTypeAttributeFromListStyleType(e){return Zu(e)}};Ao="default",nd=class extends f{static get requires(){return[$e,id]}static get pluginName(){return"ListPropertiesEditing"}static get licenseFeatureCode(){return"LP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){let e=this.editor,t=e.model,i=e.plugins.get($e),n=e.config.get("list.properties"),o=QA(n);for(let r of o)r.addCommand(e),t.schema.extend("$listItem",{allowAttributes:r.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:r.attributeName,setAttributeOnDowncast(l,a,c){r.setAttributeOnDowncast(l,a,c)}});e.conversion.for("upcast").add(r=>{for(let l of o)r.on("element:ol",N_(l)),r.on("element:ul",N_(l))}),i.on("checkAttributes:list",(r,{viewElement:l,modelAttributes:a,modelReferenceElement:c})=>{for(let u of o)u.appliesToListItem(c)&&u.getAttributeOnUpcast(l)!=a[u.attributeName]&&(r.return=!0,r.stop())}),this.listenTo(e.commands.get("indentList"),"afterExecute",(r,l)=>{t.change(a=>{for(let c of l)for(let u of o)u.appliesToListItem(c)&&a.setAttribute(u.attributeName,u.defaultValue,c)})}),i.on("postFixer",(r,{listNodes:l,writer:a})=>{for(let{node:c}of l)for(let u of o)u.hasValidAttribute(c)||(u.appliesToListItem(c)?a.setAttribute(u.attributeName,u.defaultValue,c):a.removeAttribute(u.attributeName,c),r.return=!0)}),i.on("postFixer",(r,{listNodes:l,writer:a})=>{for(let{node:c,previousNodeInList:u}of l)if(u&&u.getAttribute("listType")==c.getAttribute("listType"))for(let d of o){let{attributeName:m}=d;if(!d.appliesToListItem(c))continue;let h=u.getAttribute(m);c.getAttribute(m)!=h&&(a.setAttribute(m,h,c),r.return=!0)}})}};Xs=class extends P{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new J;keystrokes=new K;focusables=new ye;focusCycler;constructor(e,{enabledProperties:t,styleButtonViews:i,styleGridAriaLabel:n}){super(e);let o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new me({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,n),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(let e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);Dt({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>W.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);let 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){let i=new P(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(){for(let n of this.children)if(n instanceof y&&n.isOn){n.focus();return}this.children.first.focus()},i.focusTracker=new J,i.keystrokes=new K,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(e){let 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)),this.stylesView?(this.additionalPropertiesCollapsibleView=new fn(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...n)=>n.some(o=>o)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(n,o,r)=>{r||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){let e=this.locale.t,t=new H(this.locale,os);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",()=>{let i=t.fieldView.element,n=i.valueAsNumber;if(Number.isNaN(n)){t.errorText=e("Invalid start index value.");return}i.checkValidity()?this.fire("listStart",{startIndex:n}):t.errorText=e("Start index must be greater than 0.")}),t}_createReversedSwitchButton(){let e=this.locale.t,t=new si(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}},Ys=class extends f{static get pluginName(){return"ListPropertiesUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,i=e.config.get("list.properties"),n=bk(i),o=n.styles.listTypes;if(o.includes("bulleted")){let r=[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:hf},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:uf},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:pf}],l=t("Bulleted List"),a=t("Bulleted list styles toolbar"),c="bulletedList";e.ui.componentFactory.add(c,M_({editor:e,normalizedConfig:n,parentCommandName:c,buttonLabel:l,buttonIcon:Yo,styleGridAriaLabel:a,styleDefinitions:r})),e.ui.componentFactory.add(`menuBar:${c}`,U_({editor:e,normalizedConfig:n,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:r}))}if(o.includes("numbered")||i.startIndex||i.reversed){let r=[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:mf},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:df},{label:t("Toggle the lower\u2013roman list style"),tooltip:t("Lower\u2013roman"),type:"lower-roman",icon:ff},{label:t("Toggle the upper\u2013roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:wf},{label:t("Toggle the lower\u2013latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:gf},{label:t("Toggle the upper\u2013latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:bf},{label:t("Toggle the arabic-indic list style"),tooltip:t("Arabic-indic"),type:"arabic-indic",icon:_f}],l=t("Numbered List"),a=t("Numbered list styles toolbar"),c="numberedList";e.ui.componentFactory.add(c,M_({editor:e,normalizedConfig:n,parentCommandName:c,buttonLabel:l,buttonIcon:Jo,styleGridAriaLabel:a,styleDefinitions:r})),o.includes("numbered")&&e.ui.componentFactory.add(`menuBar:${c}`,U_({editor:e,normalizedConfig:n,parentCommandName:c,buttonLabel:l,styleGridAriaLabel:a,styleDefinitions:r}))}}};H_=class extends f{static get requires(){return[nd,Ys]}static get pluginName(){return"ListProperties"}static get isOfficialPlugin(){return!0}},od=class extends v{constructor(e){super(e),this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){let e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length}execute(e={}){this.editor.model.change(t=>{let i=this._getSelectedItems(),n=e.forceValue===void 0?!this._getValue(i):e.forceValue;for(let o of i)n?t.setAttribute("todoListChecked",!0,o):t.removeAttribute("todoListChecked",o)})}_getValue(e){return e.every(t=>t.getAttribute("todoListChecked"))}_getSelectedItems(){let e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,o=[];t.checkAttribute(n,"todoListChecked")&&o.push(...ui(n));for(let r of i.getItems({shallow:!0}))t.checkAttribute(r,"todoListChecked")&&!o.includes(r)&&o.push(...ui(r));return o}},sd=class extends qo{domEventType=["change"];onDomEvent(e){if(e.target){let t=this.view.domConverter.mapDomToView(e.target);t&&t.is("element","input")&&t.getAttribute("type")=="checkbox"&&t.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e)}}},ZA=Gn("Ctrl+Enter"),rd=class extends f{static get pluginName(){return"TodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[$e]}init(){let e=this.editor,t=e.model,i=e.editing,n=e.plugins.get($e),r=e.config.get("list.multiBlock")?"paragraph":"listItem";e.commands.add("todoList",new Yi(e,"todo")),e.commands.add("checkTodoList",new od(e)),i.view.addObserver(sd),t.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),t.schema.addAttributeCheck(l=>{let a=l.last;if(!a.getAttribute("listItemId")||a.getAttribute("listType")!="todo")return!1},"todoListChecked"),e.conversion.for("upcast").add(l=>{l.on("element:input",tE()),l.on("element:li",eE(),{priority:"low"}),l.on("element:label",Mu({name:"label",classes:"todo-list__label"})),l.on("element:label",Mu({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),l.on("element:span",Mu({name:"span",classes:"todo-list__label__description"})),l.on("element:ul",iE({name:"ul",classes:"todo-list"}))}),e.conversion.for("downcast").elementToElement({model:r,view:(l,{writer:a})=>{if(Hs(l,n.getListAttributeNames()))return a.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),n.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(l,a,c){a=="todo"?l.addClass("todo-list",c):l.removeClass("todo-list",c)}}),n.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(l,a,{dataPipeline:c}){if(a.getAttribute("listType")!="todo")return null;let u=l.createUIElement("input",I(I({type:"checkbox"},a.getAttribute("todoListChecked")?{checked:"checked"}:null),c?{disabled:"disabled"}:{tabindex:"-1"}));if(c)return u;let d=l.createContainerElement("span",{contenteditable:"false"},u);return d.getFillerOffset=()=>null,d},canWrapElement(l){return Hs(l,n.getListAttributeNames())},createWrapperElement(l,a,{dataPipeline:c}){let u=["todo-list__label"];return Hs(a,n.getListAttributeNames())||u.push("todo-list__label_without-description"),l.createAttributeElement(c?"label":"span",{class:u.join(" ")})}}),n.on("checkElement",(l,{modelElement:a,viewElement:c})=>{let u=Hs(a,n.getListAttributeNames());c.hasClass("todo-list__label__description")!=u&&(l.return=!0,l.stop())}),n.on("checkElement",(l,{modelElement:a,viewElement:c})=>{let u=a.getAttribute("listType")=="todo"&&Xt(a),d=!1,m=e.editing.view.createPositionBefore(c).getWalker({direction:"backward"});for(let{item:h}of m){if(h.is("element")&&e.editing.mapper.toModelElement(h))break;h.is("element","input")&&h.getAttribute("type")=="checkbox"&&(d=!0)}d!=u&&(l.return=!0,l.stop())}),n.on("postFixer",(l,{listNodes:a,writer:c})=>{for(let{node:u,previousNodeInList:d}of a){if(!d||d.getAttribute("listItemId")!=u.getAttribute("listItemId"))continue;let m=d.hasAttribute("todoListChecked"),h=u.hasAttribute("todoListChecked");h&&!m?(c.removeAttribute("todoListChecked",u),l.return=!0):!h&&m&&(c.setAttribute("todoListChecked",!0,u),l.return=!0)}}),t.document.registerPostFixer(l=>{let a=t.document.differ.getChanges(),c=!1;for(let u of a)if(u.type=="attribute"&&u.attributeKey=="listType"){let d=u.range.start.nodeAfter;u.attributeOldValue=="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0)}else if(u.type=="insert"&&u.name!="$text")for(let{item:d}of l.createRangeOn(u.position.nodeAfter))d.is("element")&&d.getAttribute("listType")!="todo"&&d.hasAttribute("todoListChecked")&&(l.removeAttribute("todoListChecked",d),c=!0);return c}),this.listenTo(i.view.document,"keydown",(l,a)=>{qn(a)===ZA&&(e.execute("checkTodoList"),l.stop())},{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",(l,a)=>{let c=a.target;if(!c||!c.is("element","input"))return;let u=i.view.createPositionAfter(c),m=i.mapper.toModelPosition(u).parent;m&&G(m)&&m.getAttribute("listType")=="todo"&&this._handleCheckmarkChange(m)}),this.listenTo(i.view.document,"arrowKey",oE(t,e.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",(l,a)=>{let c=a.viewPosition.parent,u=c.is("attributeElement","li")&&a.viewPosition.offset==0,d=W_(c)&&a.viewPosition.offset<=1,m=c.is("element","span")&&c.getAttribute("contenteditable")=="false"&&W_(c.parent);if(!u&&!d&&!m)return;let h=a.modelPosition.nodeAfter;h&&h.getAttribute("listType")=="todo"&&(a.modelPosition=t.createPositionAt(h,0))},{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){let t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change(o=>{o.setSelection(e,"end"),t.execute("checkTodoList"),o.setSelection(n)})}_initAriaAnnouncements(){let{model:e,ui:t,t:i}=this.editor,n=null;t&&e.document.selection.on("change:range",()=>{let o=e.document.selection.focus.parent,r=z_(n),l=z_(o);r&&!l?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!r&&l&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=o})}};Qs=class extends f{static get pluginName(){return"TodoListUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor.t;Qu(this.editor,"todoList",e("To-do List"),Uf)}},$_=class extends f{static get requires(){return[rd,Qs]}static get pluginName(){return"TodoList"}static get isOfficialPlugin(){return!0}},Vo=class extends v{type;constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,i=t.document,n=Array.from(i.selection.getSelectedBlocks()).filter(r=>q_(r,t.schema)),o=e.forceValue!==void 0?!e.forceValue:this.value;t.change(r=>{if(o){let l=n[n.length-1].nextSibling,a=Number.POSITIVE_INFINITY,c=[];for(;l&&l.name=="listItem"&&l.getAttribute("listIndent")!==0;){let u=l.getAttribute("listIndent");u<a&&(a=u);let d=u-a;c.push({element:l,listIndent:d}),l=l.nextSibling}c=c.reverse();for(let u of c)r.setAttribute("listIndent",u.listIndent,u.element)}if(!o){let l=Number.POSITIVE_INFINITY;for(let a of n)a.is("element","listItem")&&a.getAttribute("listIndent")<l&&(l=a.getAttribute("listIndent"));l=l===0?1:l,j_(n,!0,l),j_(n,!1,l)}for(let l of n.reverse())o&&l.name=="listItem"?r.rename(l,"paragraph"):!o&&l.name!="listItem"?(r.setAttributes({listType:this.type,listIndent:0},l),r.rename(l,"listItem")):!o&&l.name=="listItem"&&l.getAttribute("listType")!=this.type&&r.setAttribute("listType",this.type,l);this.fire("_executeCleanup",n)})}_getValue(){let e=O(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is("element","listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,i=O(e.getSelectedBlocks());return i?q_(i,t):!1}};Js=class extends v{_indentBy;constructor(e,t){super(e),this._indentBy=t=="forward"?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model,t=e.document,i=Array.from(t.selection.getSelectedBlocks());e.change(n=>{let o=i[i.length-1],r=o.nextSibling;for(;r&&r.name=="listItem"&&r.getAttribute("listIndent")>o.getAttribute("listIndent");)i.push(r),r=r.nextSibling;this._indentBy<0&&(i=i.reverse());for(let l of i){let a=l.getAttribute("listIndent")+this._indentBy;a<0?n.rename(l,"paragraph"):n.setAttribute("listIndent",a,l)}this.fire("_executeCleanup",i)})}_checkEnabled(){let e=O(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){let t=e.getAttribute("listIndent"),i=e.getAttribute("listType"),n=e.previousSibling;for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=t;){if(n.getAttribute("listIndent")==t)return n.getAttribute("listType")==i;n=n.previousSibling}return!1}return!0}};rE=["disc","circle","square"],lE=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];ld=class extends f{static get pluginName(){return"LegacyListUtils"}static get isOfficialPlugin(){return!0}getListTypeFromListStyleType(e){return yk(e)}getSelectedListItems(e){return nr(e)}getSiblingNodes(e,t){return Zs(e,t)}};uE=(s,e,t)=>{if(!t.consumable.test(e.item,s.name))return;let i=t.mapper.toViewElement(e.item),n=t.writer;n.breakContainer(n.createPositionBefore(i)),n.breakContainer(n.createPositionAfter(i));let o=i.parent,r=e.attributeNewValue=="numbered"?"ol":"ul";n.rename(r,o)},dE=(s,e,t)=>{t.consumable.consume(e.item,s.name);let n=t.mapper.toViewElement(e.item).parent,o=t.writer;bt(o,n,n.nextSibling),bt(o,n.previousSibling,n)};K_=(s,e,t)=>{if(t.consumable.test(e.item,s.name)&&e.item.name!="listItem"){let i=t.mapper.toViewPosition(e.range.start),n=t.writer,o=[];for(;(i.parent.name=="ul"||i.parent.name=="ol")&&(i=n.breakContainer(i),i.parent.name=="li");){let r=i,l=n.createPositionAt(i.parent,"end");if(!r.isEqual(l)){let a=n.remove(n.createRange(r,l));o.push(a)}i=n.createPositionAfter(i.parent)}if(o.length>0){for(let r=0;r<o.length;r++){let l=i.nodeBefore;if(i=n.insert(i,o[r]).end,r>0){let c=bt(n,l,l.nextSibling);c&&c.parent==l&&i.offset--}}bt(n,i.nodeBefore,i.nodeAfter)}}},hE=(s,e,t)=>{let i=t.mapper.toViewPosition(e.position),n=i.nodeBefore,o=i.nodeAfter;bt(t.writer,n,o)},gE=(s,e,t)=>{if(t.consumable.consume(e.viewItem,{name:!0})){let i=t.writer,n=i.createElement("listItem"),o=yE(e.viewItem);i.setAttribute("listIndent",o,n);let r=e.viewItem.parent&&e.viewItem.parent.name=="ol"?"numbered":"bulleted";if(i.setAttribute("listType",r,n),!t.safeInsert(n,e.modelCursor))return;let l=_E(n,e.viewItem.getChildren(),t);e.modelRange=i.createRange(e.modelCursor,l),t.updateConversionResult(n,e)}},X_=(s,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){let i=Array.from(e.viewItem.getChildren());for(let n of i)!(n.is("element","li")||Ln(n))&&n._remove()}},fE=(s,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){if(e.viewItem.childCount===0)return;let i=[...e.viewItem.getChildren()],n=!1;for(let o of i)n&&!Ln(o)&&o._remove(),Ln(o)&&(n=!0)}};wE=function(s,[e,t]){let i=this,n=e.is("documentFragment")?e.getChild(0):e,o;if(t?o=i.createSelection(t):o=i.document.selection,n&&n.is("element","listItem")){let r=o.getFirstPosition(),l=null;if(r.parent.is("element","listItem")?l=r.parent:r.nodeBefore&&r.nodeBefore.is("element","listItem")&&(l=r.nodeBefore),l){let a=l.getAttribute("listIndent");if(a>0)for(;n&&n.is("element","listItem");)n._setAttribute("listIndent",n.getAttribute("listIndent")+a),n=n.nextSibling}}};Po=class extends f{static get pluginName(){return"LegacyListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[li,it,ld]}init(){let e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});let t=e.data,i=e.editing;e.model.document.registerPostFixer(o=>bE(e.model,o)),i.mapper.registerViewToModelLength("li",ad),t.mapper.registerViewToModelLength("li",ad),i.mapper.on("modelToViewPosition",Y_(i.view)),i.mapper.on("viewToModelPosition",pE(e.model)),t.mapper.on("modelToViewPosition",Y_(i.view)),e.conversion.for("editingDowncast").add(o=>{o.on("insert",K_,{priority:"high"}),o.on("insert:listItem",G_(e.model)),o.on("attribute:listType:listItem",uE,{priority:"high"}),o.on("attribute:listType:listItem",dE,{priority:"low"}),o.on("attribute:listIndent:listItem",mE(e.model)),o.on("remove:listItem",cE(e.model)),o.on("remove",hE,{priority:"low"})}),e.conversion.for("dataDowncast").add(o=>{o.on("insert",K_,{priority:"high"}),o.on("insert:listItem",G_(e.model))}),e.conversion.for("upcast").add(o=>{o.on("element:ul",X_,{priority:"high"}),o.on("element:ol",X_,{priority:"high"}),o.on("element:li",fE,{priority:"high"}),o.on("element:li",gE)}),e.model.on("insertContent",wE,{priority:"high"}),e.commands.add("numberedList",new Vo(e,"numbered")),e.commands.add("bulletedList",new Vo(e,"bulleted")),e.commands.add("indentList",new Js(e,"forward")),e.commands.add("outdentList",new Js(e,"backward"));let n=i.view.document;this.listenTo(n,"enter",(o,r)=>{let l=this.editor.model.document,a=l.selection.getLastPosition().parent;l.selection.isCollapsed&&a.name=="listItem"&&a.isEmpty&&(this.editor.execute("outdentList"),r.preventDefault(),o.stop())},{context:"li"}),this.listenTo(n,"delete",(o,r)=>{if(r.direction!=="backward")return;let l=this.editor.model.document.selection;if(!l.isCollapsed)return;let a=l.getFirstPosition();if(!a.isAtStart)return;let c=a.parent;c.name!=="listItem"||c.previousSibling&&c.previousSibling.name==="listItem"||(this.editor.execute("outdentList"),r.preventDefault(),o.stop())},{context:"li"}),this.listenTo(e.editing.view.document,"tab",(o,r)=>{let l=r.shiftKey?"outdentList":"indentList";this.editor.commands.get(l).isEnabled&&(e.execute(l),r.stopPropagation(),r.preventDefault(),o.stop())},{context:"li"})}afterInit(){let e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}};Q_=class extends f{static get requires(){return[Po,Ks]}static get pluginName(){return"LegacyList"}static get isOfficialPlugin(){return!0}},cd=class extends v{defaultType;constructor(e,t){super(e),this.defaultType=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){this._tryToConvertItemsToList(e);let t=this.editor.model,i=nr(t);i.length&&t.change(n=>{for(let o of i)n.setAttribute("listStyle",e.type||this.defaultType,o)})}_getValue(){let e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")?e.getAttribute("listStyle"):null}_checkEnabled(){let e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;let t=yk(e.type);if(!t)return;let i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n)}},ud=class extends v{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute(e={}){let t=this.editor.model,i=nr(t).filter(n=>n.getAttribute("listType")=="numbered");t.change(n=>{for(let o of i)n.setAttribute("listReversed",!!e.reversed,o)})}_getValue(){let e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&e.getAttribute("listType")=="numbered"?e.getAttribute("listReversed"):null}},dd=class extends v{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute({startIndex:e=1}={}){let t=this.editor.model,i=nr(t).filter(n=>n.getAttribute("listType")=="numbered");t.change(n=>{for(let o of i)n.setAttribute("listStart",e>=0?e:1,o)})}_getValue(){let e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&e.getAttribute("listType")=="numbered"?e.getAttribute("listStart"):null}},Ws="default",md=class extends f{static get requires(){return[Po]}static get pluginName(){return"LegacyListPropertiesEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("list",{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){let e=this.editor,t=e.model,i=e.config.get("list.properties"),n=vE(i);t.schema.extend("listItem",{allowAttributes:n.map(o=>o.attributeName)});for(let o of n)o.addCommand(e);this.listenTo(e.commands.get("indentList"),"_executeCleanup",TE(e,n)),this.listenTo(e.commands.get("outdentList"),"_executeCleanup",AE(e,n)),this.listenTo(e.commands.get("bulletedList"),"_executeCleanup",J_(e)),this.listenTo(e.commands.get("numberedList"),"_executeCleanup",J_(e)),t.document.registerPostFixer(EE(e,n)),e.conversion.for("upcast").add(CE(n)),e.conversion.for("downcast").add(IE(n)),this._mergeListAttributesWhileMergingLists(n)}afterInit(){let e=this.editor;e.commands.get("todoList")&&e.model.document.registerPostFixer(VE(e))}_mergeListAttributesWhileMergingLists(e){let i=this.editor.model,n;this.listenTo(i,"deleteContent",(o,[r])=>{let l=r.getFirstPosition(),a=r.getLastPosition();if(l.parent===a.parent||!l.parent.is("element","listItem"))return;let c=a.parent.nextSibling;if(!c||!c.is("element","listItem"))return;let u=Bn(l.parent,{sameIndent:!0,listIndent:c.getAttribute("listIndent")});u&&u.getAttribute("listType")===c.getAttribute("listType")&&(n=u)},{priority:"high"}),this.listenTo(i,"deleteContent",()=>{n&&(i.change(o=>{let r=Bn(n.nextSibling,{sameIndent:!0,listIndent:n.getAttribute("listIndent"),direction:"forward"});if(!r){n=null;return}let l=[r,...Zs(o.createPositionAt(r,0),"forward")];for(let a of l)for(let c of e)if(c.appliesToListItem(a)){let u=c.attributeName,d=n.getAttribute(u);o.setAttribute(u,d,a)}}),n=null)},{priority:"low"})}};Z_=class extends f{static get requires(){return[md,Ys]}static get pluginName(){return"LegacyListProperties"}static get isOfficialPlugin(){return!0}},Eo="todoListChecked",hd=class extends v{_selectedElements;constructor(e){super(e),this._selectedElements=[],this.on("execute",()=>{this.refresh()},{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every(e=>!!e.getAttribute(Eo)),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){let e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,o=[];t.checkAttribute(n,Eo)&&o.push(n);for(let r of i.getItems())t.checkAttribute(r,Eo)&&!o.includes(r)&&o.push(r);return o}execute(e={}){this.editor.model.change(t=>{for(let i of this._selectedElements)(e.forceValue===void 0?!this.value:e.forceValue)?t.setAttribute(Eo,!0,i):t.removeAttribute(Eo,i)})}};RE=(s,e,t)=>{let i=e.modelCursor,n=i.parent,o=e.viewItem;if(o.getAttribute("type")!="checkbox"||n.name!="listItem"||!i.isAtStart||!t.consumable.consume(o,{name:!0}))return;let r=t.writer;r.setAttribute("listType","todo",n),e.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,n),e.modelRange=r.createRange(i)};NE=Gn("Ctrl+Enter"),gd=class extends f{static get pluginName(){return"LegacyTodoListEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Po]}init(){let e=this.editor,{editing:t,data:i,model:n}=e;n.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),n.schema.addAttributeCheck((l,a)=>{let c=l.last;if(a=="todoListChecked"&&c.name=="listItem"&&c.getAttribute("listType")!="todo")return!1}),e.commands.add("todoList",new Vo(e,"todo"));let o=new hd(e);e.commands.add("checkTodoList",o),e.commands.add("todoListCheck",o),i.downcastDispatcher.on("insert:listItem",LE(n),{priority:"high"}),i.upcastDispatcher.on("element:input",RE,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",BE(n,l=>this._handleCheckmarkChange(l)),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",FE(l=>this._handleCheckmarkChange(l),t.view)),t.downcastDispatcher.on("attribute:todoListChecked:listItem",OE(l=>this._handleCheckmarkChange(l))),t.mapper.on("modelToViewPosition",ek(t.view)),i.mapper.on("modelToViewPosition",ek(t.view)),this.listenTo(t.view.document,"arrowKey",ME(n,e.locale),{context:"li"}),this.listenTo(t.view.document,"keydown",(l,a)=>{qn(a)===NE&&(e.execute("checkTodoList"),l.stop())},{priority:"high"});let r=new Set;this.listenTo(n,"applyOperation",(l,a)=>{let c=a[0];if(c.type=="rename"&&c.oldName=="listItem"){let u=c.position.nodeAfter;u.hasAttribute("todoListChecked")&&r.add(u)}else if(c.type=="changeAttribute"&&c.key=="listType"&&c.oldValue==="todo")for(let u of c.range.getItems())u.hasAttribute("todoListChecked")&&u.getAttribute("listType")!=="todo"&&r.add(u)}),n.document.registerPostFixer(l=>{let a=!1;for(let c of r)l.removeAttribute("todoListChecked",c),a=!0;return r.clear(),a}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){let t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change(o=>{o.setSelection(e,"end"),t.execute("checkTodoList"),o.setSelection(n)})}_initAriaAnnouncements(){let{model:e,ui:t,t:i}=this.editor,n=null;t&&e.document.selection.on("change:range",()=>{let o=e.document.selection.focus.parent,r=tk(n),l=tk(o);r&&!l?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!r&&l&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=o})}};ik=class extends f{static get requires(){return[gd,Qs]}static get pluginName(){return"LegacyTodoList"}static get isOfficialPlugin(){return!0}},nk=class extends f{static get pluginName(){return"AdjacentListsSupport"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.register("listSeparator",{allowWhere:"$block",isBlock:!0}),e.conversion.for("upcast").add(i=>{i.on("element:ol",ok()),i.on("element:ul",ok())}).elementToElement({model:"listSeparator",view:"ck-list-separator"}),e.conversion.for("editingDowncast").elementToElement({model:"listSeparator",view:{name:"div",classes:["ck-list-separator","ck-hidden"]}}),e.conversion.for("dataDowncast").elementToElement({model:"listSeparator",view:(i,n)=>{let o=n.writer.createContainerElement("ck-list-separator");return n.writer.setCustomProperty("dataPipeline:transparentRendering",!0,o),o.getFillerOffset=()=>null,o}})}}});function yd(s,e){return(t,i,n)=>
30{let{writer:o,consumable:r}=n;i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));let l=Array.from(i.viewItem.getClassNames()),a=e.find(d=>l.includes(d));if(a===void 0)return;let c=!1,u;for(let d of i.modelRange.getItems({shallow:!0}))u===void 0&&(u=d.getAttribute("listIndent")),!d.hasAttribute(s)&&d.getAttribute("listIndent")===u&&(o.setAttribute(s,a,d),c=!0);c&&r.consume(i.viewItem,{classes:a})}}function vd(s,e){return(t,i,n)=>{let{writer:o,consumable:r}=n;i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));let l=i.viewItem.getStyle(e),a=!1,c;for(let u of i.modelRange.getItems({shallow:!0}))c===void 0&&(c=u.getAttribute("listIndent")),!u.hasAttribute(s)&&u.getAttribute("listIndent")===c&&(o.setAttribute(s,l,u),a=!0);a&&r.consume(i.viewItem,{styles:e})}}function Ak(s,e,t,i){let n=t.getAttribute(s);return e.getAttribute(s)===n?!1:(n?i.setAttribute(s,n,e):i.removeAttribute(s,e),!0)}var Cd,Id,Tk,Rn,Vi,Pi,Fn,On,Td,UE,Ek,xk=M(()=>{U();z();re();ve();j();kd();Cd=class extends f{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.commands.add("indent",new $r(e)),e.commands.add("outdent",new $r(e))}},Id=class extends f{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale,i=e.t,n=t.uiLanguageDirection=="ltr"?sl:ll,o=t.uiLanguageDirection=="ltr"?ll:sl;this._defineButton("indent",i("Increase indent"),n),this._defineButton("outdent",i("Decrease indent"),o)}_defineButton(e,t,i){let n=this.editor;n.ui.componentFactory.add(e,()=>{let o=this._createButton(y,e,t,i);return o.set({tooltip:!0}),o}),n.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(x,e,t,i))}_createButton(e,t,i,n){let o=this.editor,r=o.commands.get(t),l=new e(o.locale);return l.set({label:i,icon:n}),l.bind("isEnabled").to(r,"isEnabled"),this.listenTo(l,"execute",()=>{o.execute(t),o.editing.view.focus()}),l}},Tk=class extends f{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[Cd,Id]}},Rn=class extends v{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){let t=this.editor.model,i=O(t.document.selection.getSelectedBlocks());if(!i||!this._isIndentationChangeAllowed(i)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(i.getAttribute("blockIndent"))}execute(){let e=this.editor.model,t=this._getBlocksToChange();e.change(i=>{for(let n of t){let o=n.getAttribute("blockIndent"),r=this._indentBehavior.getNextIndent(o);r?i.setAttribute("blockIndent",r,n):i.removeAttribute("blockIndent",n)}})}_getBlocksToChange(){let t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(n=>this._isIndentationChangeAllowed(n))}_isIndentationChangeAllowed(e){let t=this.editor;return t.model.schema.checkAttribute(e,"blockIndent")?!t.plugins.has("ListUtils")||!this._indentBehavior.isForward?!0:!t.plugins.get("ListUtils").isListItemBlock(e):!1}};Vi=class{isForward;offset;unit;constructor(e){this.isForward=e.direction==="forward",this.offset=e.offset,this.unit=e.unit}checkEnabled(e){let t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){let t=parseFloat(e||"0"),i=!e||e.endsWith(this.unit);if(t<0)return;if(!i)return this.isForward?this.offset+this.unit:void 0;let n=this.isForward?this.offset:-this.offset,o=t+n;return o>0?o+this.unit:void 0}};Pi=class{isForward;classes;constructor(e){this.isForward=e.direction==="forward",this.classes=e.classes}checkEnabled(e){let t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){let t=this.classes.indexOf(e),i=this.isForward?1:-1,n=t+i,o=Math.min(n,this.classes.length-1);return this.classes[o]}},Fn=class extends v{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){let e=this._getFirstListItemIfSelectionIsAtListStart(this.editor.model.document.selection);this.isEnabled=!!e&&this._indentBehavior.checkEnabled(e.getAttribute("blockIndentList"))}execute(e={}){let i=this.editor.model,n=i.document.selection;i.change(o=>{let r=this._getFirstListItemIfSelectionIsAtListStart(n),l=[];
vendor: 5,092 bytes, line 30
30if(e.firstListOnly)l.push(r);else{let a=Array.from(n.getSelectedBlocks());for(let c of a)G(c)&&c.getAttribute("listIndent")===0&&i.schema.checkAttribute(c,"blockIndentList")&&l.push(c)}for(let a of l){let c=a.getAttribute("blockIndentList"),u=this._indentBehavior.getNextIndent(c);u?o.setAttribute("blockIndentList",u,a):o.removeAttribute("blockIndentList",a)}})}_getFirstListItemIfSelectionIsAtListStart(e){let t=e.getFirstPosition(),i=this.editor.plugins.get("ListUtils"),n=t.parent,o=this.editor.model.schema;return t.isAtStart&&G(n)&&n.getAttribute("listIndent")==0&&o.checkAttribute(n,"blockIndentList")&&i.isFirstListItemInList(n)?n:null}},On=class extends v{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){this.isEnabled=this._getAffectedListItems().length>0}execute(){this.editor.model.change(i=>{for(let n of this._getAffectedListItems())i.removeAttribute("blockIndentListItem",n)})}_getAffectedListItems(){let t=this.editor.model.document.selection,i=this.editor.plugins.get("ListUtils"),n=Array.from(t.getSelectedBlocks());return i.expandListBlocksToCompleteItems(n).filter(r=>this._isIndentationChangeAllowed(r))}_isIndentationChangeAllowed(e){if(!e.hasAttribute("blockIndentListItem"))return!1;let t=parseFloat(e.getAttribute("blockIndentListItem"));return isNaN(t)?!this._indentBehavior.isForward:this._indentBehavior.isForward&&t<0||!this._indentBehavior.isForward&&t>0}},Td=class extends f{static get pluginName(){return"IndentBlockListIntegration"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!this.editor.plugins.has("ListEditing"))return;let t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClassesForListBlock(t.classes),this._setupConversionUsingClassesForListItemBlock(t.classes),e.commands.add("indentBlockList",new Fn(e,new Pi({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlockList",new Fn(e,new Pi({direction:"backward",classes:t.classes}))),e.commands.add("indentBlockListItem",new On(e,new Pi({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlockListItem",new On(e,new Pi({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(Qn),this._setupConversionUsingOffsetForListBlock(),this._setupConversionUsingOffsetForListItemBlock(),e.commands.add("indentBlockList",new Fn(e,new Vi({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlockList",new Fn(e,new Vi({direction:"backward",offset:t.offset,unit:t.unit}))),e.commands.add("indentBlockListItem",new On(e,new Vi({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlockListItem",new On(e,new Vi({direction:"backward",offset:t.offset,unit:t.unit})))),e.plugins.get("ListEditing").on("postFixer",(n,{listNodes:o,writer:r})=>{for(let{node:l,previousNodeInList:a}of o)a&&a.getAttribute("listType")==l.getAttribute("listType")&&(Ak("blockIndentList",l,a,r)&&(n.return=!0),a.getAttribute("listItemId")==l.getAttribute("listItemId")&&Ak("blockIndentListItem",l,a,r)&&(n.return=!0))}),this.listenTo(e.editing.view.document,"tab",(n,o)=>{let r=o.shiftKey?"outdentBlockList":"indentBlockList";this.editor.commands.get(r).isEnabled&&(e.execute(r,{firstListOnly:!0}),o.stopPropagation(),o.preventDefault(),n.stop())},{context:"li",priority:"high"})}afterInit(){let e=this.editor,t=e.model,i=t.schema;if(!e.plugins.has("ListEditing"))return;i.extend("$listItem",{allowAttributes:["blockIndentList","blockIndentListItem"]}),i.setAttributeProperties("blockIndentList",{isFormatting:!0}),i.setAttributeProperties("blockIndentListItem",{isFormatting:!0}),t.schema.addAttributeCheck(c=>{if(!c.last.getAttribute("listItemId"))return!1},"blockIndentList"),t.schema.addAttributeCheck(c=>{if(!c.last.getAttribute("listItemId"))return!1},"blockIndentListItem");let n=(c,u)=>{e.model.change(d=>{for(let m of u)m.hasAttribute("listItemId")&&(m.hasAttribute("blockIndentList")&&d.removeAttribute("blockIndentList",m),m.hasAttribute("blockIndentListItem")&&d.removeAttribute("blockIndentListItem",m))})},o=e.commands.get("indentList"),r=e.commands.get("outdentList");o&&this.listenTo(o,"afterExecute",n),r&&this.listenTo(r,"afterExecute",n);let l=e.commands.get("indent"),a=e.commands.get("outdent");l.registerChildCommand(e.commands.get("indentBlockList")),a.registerChildCommand(e.commands.get("outdentBlockList")),l.registerChildCommand(e.commands.get("indentBlockListItem")),a.registerChildCommand(e.commands.get("outdentBlockListItem"))}_setupConversionUsingOffsetForListBlock(){let e=this.editor,t=e.conversion,n=e.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left",o=e.plugins.get("ListEditing");t.for("upcast").add(r=>{r.on("element:ol",vd("blockIndentList",n)),r.on("element:ul",vd("blockIndentList",n))}),o.registerDowncastStrategy({scope:"list",attributeName:"blockIndentList",setAttributeOnDowncast(r,l,a){l&&r.setStyle(n,l,a)}})}_setupConversionUsingOffsetForListItemBlock(){let e=this.editor,t=e.locale,i=e.conversion,n=t.contentLanguageDirection==="rtl"?"margin-right":"margin-left",o=e.plugins.get("ListEditing");
30i.for("upcast").add(r=>{r.on("element:li",vd("blockIndentListItem",n),{priority:"low"})}),o.registerDowncastStrategy({scope:"item",attributeName:"blockIndentListItem",setAttributeOnDowncast(r,l,a){l&&r.setStyle(n,l,a)}})}_setupConversionUsingClassesForListBlock(e){let t=this.editor,i=t.conversion,n=t.plugins.get("ListEditing");i.for("upcast").add(o=>{o.on("element:ol",yd("blockIndentList",e)),o.on("element:ul",yd("blockIndentList",e))}),n.registerDowncastStrategy({scope:"list",attributeName:"blockIndentList",setAttributeOnDowncast(o,r,l){r&&o.addClass(r,l)}})}_setupConversionUsingClassesForListItemBlock(e){let t=this.editor,i=t.conversion,n=t.plugins.get("ListEditing");i.for("upcast").add(o=>{o.on("element:li",yd("blockIndentListItem",e),{priority:"low"})}),n.registerDowncastStrategy({scope:"item",attributeName:"blockIndentListItem",setAttributeOnDowncast(o,r,l){r&&o.addClass(r,l)}})}};UE=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"],Ek=class extends f{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}static get isOfficialPlugin(){return!0}static get requires(){return[Td]}init(){let e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new Rn(e,new Pi({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new Rn(e,new Pi({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(Qn),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new Rn(e,new Vi({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new Rn(e,new Vi({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){let e=this.editor,t=e.model.schema,i=e.commands.get("indent"),n=e.commands.get("outdent"),o=e.config.get("heading.options");(o&&o.map(a=>a.model)||UE).forEach(a=>{t.isRegistered(a)&&t.extend(a,{allowAttributes:"blockIndent"})}),t.setAttributeProperties("blockIndent",{isFormatting:!0}),i.registerChildCommand(e.commands.get("indentBlock")),n.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){let e=this.editor.conversion,i=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[i]:/[\s\S]+/}},model:{key:"blockIndent",value:n=>{if(!n.is("element","li"))return n.getStyle(i)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:n=>({key:"style",value:{[i]:n}})})}_setupConversionUsingClasses(e){let t={model:{key:"blockIndent",values:[]},view:{}};for(let i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t)}}});function Sd(s,e){return e=e||Sg(s),`${s}:${e}`}function HE(s){let[e,t]=s.split(":");return{languageCode:e,textDirection:t}}var Ad,Ed,xd,Sk,Vk=M(()=>{U();ve();j();z();Ad=class extends v{refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){let i=this.editor.model,o=i.document.selection,r=e?Sd(e,t):!1;i.change(l=>{if(o.isCollapsed)r?l.setSelectionAttribute("language",r):l.removeSelectionAttribute("language");else{let a=i.schema.getValidRanges(o.getRanges(),"language",{includeEmptyRanges:!0});for(let c of a){let u=c,d="language";c.isCollapsed&&(u=c.start.parent,d=pi._getStoreAttributeKey("language")),r?l.setAttribute(d,r,u):l.removeAttribute(d,u)}}})}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.getAttribute("language")||!1;for(let n of i.getRanges())for(let o of n.getItems())if(t.checkAttribute(o,"language"))return o.getAttribute("language")||!1;return!1}},Ed=class extends f{static get pluginName(){return"TextPartLanguageEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){let e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new Ad(e))}_defineConverters(){let e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:t=>{let i=t.getAttribute("lang"),n=t.getAttribute("dir");return Sd(i,n)}},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(t,{writer
vendor: 50,238 bytes, line 30
30:i},n)=>{if(!t||!n.item.is("$textProxy")&&!n.item.is("documentSelection"))return;let{languageCode:o,textDirection:r}=HE(t);return i.createAttributeElement("span",{lang:o,dir:r})}})}},xd=class extends f{static get pluginName(){return"TextPartLanguageUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,i=t("Choose language"),n=t("Language");e.ui.componentFactory.add("textPartLanguage",o=>{let{definitions:r,titles:l}=this._getItemMetadata(),a=e.commands.get("textPartLanguage"),c=X(o);return be(c,r,{ariaLabel:n,role:"menu"}),c.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),c.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),c.bind("isEnabled").to(a,"isEnabled"),c.buttonView.bind("label").to(a,"value",u=>u&&l[u]||i),c.buttonView.bind("ariaLabel").to(a,"value",u=>{let d=u&&l[u];return d?`${d}, ${n}`:n}),this.listenTo(c,"execute",u=>{a.execute({languageCode:u.source.languageCode,textDirection:u.source.textDirection}),e.editing.view.focus()}),c}),e.ui.componentFactory.add("menuBar:textPartLanguage",o=>{let{definitions:r}=this._getItemMetadata(),l=e.commands.get("textPartLanguage"),a=new Ie(o);a.buttonView.set({label:n});let c=new He(o);c.set({ariaLabel:t("Language"),role:"menu"});for(let u of r){if(u.type!="button"){c.items.add(new ts(o));continue}let d=new De(o,a),m=new x(o);m.set({role:"menuitemradio",isToggleable:!0}),m.bind(...Object.keys(u.model)).to(u.model),m.delegate("execute").to(a),d.children.add(m),c.items.add(d)}return a.bind("isEnabled").to(l,"isEnabled"),a.panelView.children.add(c),a.on("execute",u=>{l.execute({languageCode:u.source.languageCode,textDirection:u.source.textDirection}),e.editing.view.focus()}),a})}_getItemMetadata(){let e=this.editor,t=new ne,i={},n=e.commands.get("textPartLanguage"),o=e.config.get("language.textPartLanguage"),r=e.locale.t,l=r("Remove language");t.add({type:"button",model:new we({label:l,languageCode:!1,withText:!0})}),t.add({type:"separator"});for(let a of o){let c={type:"button",model:new we({label:a.title,languageCode:a.languageCode,role:"menuitemradio",textDirection:a.textDirection,withText:!0})},u=Sd(a.languageCode,a.textDirection);c.model.bind("isOn").to(n,"value",d=>d===u),t.add(c),i[u]=a.title}return{definitions:t,titles:i}}},Sk=class extends f{static get requires(){return[Ed,xd]}static get pluginName(){return"TextPartLanguage"}static get isOfficialPlugin(){return!0}}});function GE(s){return s.is("attributeElement")&&!!s.getCustomProperty("link")}function Pk(s,{writer:e}){let t=e.createAttributeElement("a",{href:s},{priority:5});return e.setCustomProperty("link",!0,t),t}function Ok(s,e=qE){let t=String(s),i=e.join("|"),n=new RegExp(`${zE.replace("<protocols>",i)}`,"i");return KE(t,n)?t:"#"}function KE(s,e){return!!s.replace(WE,"").match(e)}function XE(s,e){let t={"Open in a new tab":s("Open in a new tab"),Downloadable:s("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function YE(s){let e=[];if(s)for(let[t,i]of Object.entries(s)){let n=Object.assign({},i,{id:`link${wg(t)}`});e.push(n)}return e}function Bd(s,e){return s?e.checkAttribute(s.name,"linkHref"):!1}function QE(s){return $E.test(s)}function qd(s,e){let t=QE(s)?"mailto:":e,i=!!t&&!Dk(s);return s&&i?t+s:s}function Dk(s){return jE.test(s)}function JE(s){window.open(s,"_blank","noopener")}function Ld(s){let e="";for(let t of s.getItems()){if(!t.is("$text")&&!t.is("$textProxy"))return;e+=t.data}return e}function Rd(s,e){if(s.attributes&&e.attributes&&Object.keys(s.attributes).some(n=>!t(n)&&n in e.attributes)||s.styles&&e.styles&&Object.keys(s.styles).some(n=>n in e.styles))return!0;return!1;function t(i){return i==="class"||i==="style"||i==="rel"}}function ZE({decoratorStates:s,allDecorators:e}){let t=I({},s);for(let n in s)if(s[n]&&i(n)){let o=ex(n,e);for(let r of o)t[r]=!1}function i(n){return e.some(o=>o.id===n&&!o.value)}return t}function ex(s,e){let t=e.find(i=>i.id===s);return t?e.filter(i=>i.id!==s&&Rd(t,i)).map(i=>i.id):[]}function tx(s,e){let t=_g(s,e),i={equal:0,insert:0,delete:0},n=[],o="",r="";for(let l of[...t,null])l=="insert"?r+=e[i.equal+i.insert]:l=="delete"?o+=s[i.equal+i.delete]:(o.length||r.length)&&(n.push({offset:i.equal,actual:o,expected:r}),o="",r=""),l&&i[l]++;return n}function ix(s,e){if(!s.isCollapsed)return O(s.getItems());let t=s.start;return t.textNode?t.textNode:!t.nodeBefore||t.isEqual(e.start)?t.nodeAfter:t.nodeBefore}function rx(s,e){s.removeSelectionAttribute("linkHref");for(let t of e)s.removeSelectionAttribute(t)}function lx(s){return s.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}function Vd(s){return s.getAncestors().find(e=>GE(e))||null}function ax(s){let e=s.t,t=s.config.get("link.allowCreatingEmptyLinks");return[i=>{if(!t&&!i.url.length)return e("Link URL must not be empty.")}]}function dx(s){return s.length>cx&&s[s.length-1]===" "&&s[s.length-2]!==" "}function Lk(s){let e=Nk.exec(s);return e?e[ux]:null}function mx(s,e){return e.schema.checkAttributeInSelection(e.createSelection(s),"linkHref")}function hx(s){let e=s.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}function gx(s){let e=s.plugins.has("ImageInlineEditing"),t=s.plugins.get("ImageUtils");return i=>{i.on("element:a",(n,o,r)=>{let l=o.viewItem,a=t.findViewImgElement(l);if(!a)return;let c=a.findAncestor(h=>t.isBlockImageView(h));if(e&&!c)return;let u={attributes:["href"]};if(!r.consumable.test(l,u))return;let d=l.getAttribute("href"),m=o.modelCursor.parent;m.is("element","imageBlock")&&(r.writer.setAttribute("linkHref",d,m),r.consumable.consume(l,u))},{priority:"high"})}}function fx(s){let e=s.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",(i,n,o)=>{if(!o.consumable.consume(n.item,i.name))return;let r=o.mapper.toViewElement(n.item),l=o.writer,a=Array.from(r.getChildren()).find(d=>d.is("element","a")),c=e.findViewImgElement(r),u=c.parent.is("element","picture")?c.parent:c;if(a)n.attributeNewValue?l.setAttribute("href",n.attributeNewValue,a):(l.move(l.createRangeOn(u),l.createPositionAt(r,0)),l.remove(a));else{let d=l.createContainerElement("a",{href:n.attributeNewValue});l.insert(l.createPositionAt(r,0),d),l.move(l.createRangeOn(u),l.createPositionAt(d,0))}},{priority:"high"})}}function px(s){return e=>{let t=i=>(n,o,r)=>{let l=r.mapper.toViewElement(o.item),a=Array.from(l.getChildren()).find(c=>c.is("element","a"));if(a){if(!i&&o.attributeOldValue){for(let[c,u]of ni(s.attributes))r.writer.removeAttribute(c,u,a);s.classes&&r.writer.removeClass(s.classes,a);for(let c in s.styles)r.writer.removeStyle(c,a)}if(i&&o.attributeNewValue){for(let[c,u]of ni(s.attributes))r.writer.setAttribute(c,u,!1,a);s.classes&&r.writer.addClass(s.classes,a);for(let c in s.styles)r.writer.setStyle(c,s.styles[c],a)}}};e.on(`attribute:${s.id}:imageBlock`,t(!1),{priority:Le.high-1}),e.on(`attribute:${s.id}:imageBlock`,t(!0),{priority:Le.high-2})}}function bx(s,e){let t=s.plugins.has("ImageInlineEditing"),i=s.plugins.get("ImageUtils");return n=>{n.on("element:a",(o,r,l)=>{let a=r.viewItem,c=i.findViewImgElement(a);if(!c)return;let u=c.findAncestor(g=>i.isBlockImageView(g));if(t&&!u)return;let m=new Ct(e._createPattern()).match(a);if(!m||!l.consumable.test(a,m.match))return;let h=r.modelCursor.parent;h?.is("element","imageBlock")&&(l.writer.setAttribute(e.id,!0,h),l.consumable.consume(a,m.match))},{priority:"high"})}}var Pd,WE,zE,$E,jE,qE,Lo,Fd,Od,Dd,nx,Bk,ox,sx,Bi,Nd,Md,Ud,Hd,Wd,Yt,or,cx,Nk,ux,zd,Rk,$d,jd,Fk,Mk=M(()=>{U();at();Ci();j();ve();Me();re();z();zt();re();Pd=class{_definitions=new Set;_conflictChecker;get length(){return this._definitions.size}setConflictChecker(e){this._conflictChecker=e}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{let t=(n,o)=>{let r=o.createAttributeElement("a",n.attributes,{priority:5});n.classes&&o.addClass(n.classes,r);for(let l in n.styles)o.setStyle(l,n.styles[l],r);return o.setCustomProperty("link",!0,r),r},i=n=>(o,r,l)=>{if(r.attributeKey.startsWith("link")&&!(r.attributeKey=="linkHref"&&!l.consumable.test(r.item,"attribute:linkHref"))&&!(!r.item.is("selection")&&!l.schema.isInline(r.item)))for(let a of this._definitions)a.callback(r.item.getAttribute("linkHref"))&&!this._conflictChecker?.(a,r.item)&&n?r.item.is("selection")?l.writer.wrap(l.writer.document.selection.getFirstRange(),t(a,l.writer)):l.writer.wrap(l.mapper.toViewRange(r.range),t(a,l.writer)):l.writer.unwrap(l.mapper.toViewRange(r.range),t(a,l.writer))};e.on("attribute",i(!1),{priority:Le.high-1}),e.on("attribute",i(!0),{priority:Le.high-2})}}getDispatcherForLinkedImage(){return e=>{let t=i=>(n,o,{writer:r,mapper:l})=>{if(!o.item.is("element","imageBlock")||!o.attributeKey.startsWith("link"))return;let a=l.toViewElement(o.item),c=Array.from(a.getChildren()).find(u=>u.is("element","a"));if(c)for(let u of this._definitions){let d=ni(u.attributes);if(u.callback(o.item.getAttribute("linkHref"))&&!this._conflictChecker?.(u,o.item)&&i){for(let[m,h]of d)m==="class"?r.addClass(h,c):r.setAttribute(m,h,!1,c);u.classes&&r.addClass(u.classes,c);for(let m in u.styles)r.setStyle(m,u.styles[m],c)}else{for(let[m,h]of d)m==="class"?r.removeClass(h,c):r.removeAttribute(m,h,c);u.classes&&r.removeClass(u.classes,c);for(let m in u.styles)r.removeStyle(m,c)}}};e.on("attribute",t(!1),{priority:Le.high-1}),e.on("attribute",t(!0),{priority:Le.high-2})}}},WE=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,zE="^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))",$E=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,jE=/^((\w+:(\/{2,})?)|(\W))/i,qE=["https?","ftps?","mailto"],Lo="Ctrl+K";Fd=class extends v{manualDecorators=new ne;automaticDecorators=new Pd;restoreManualDecoratorStates(){for(let e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){let e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||O(t.getSelectedBlocks());Bd(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(let n of this.manualDecorators)n.value=this._getDecoratorStateFromModel(n.id)}execute(e,t={},i){let n=this.editor.model,o=n.document.selection,r=ZE({allDecorators:Array.from(this.manualDecorators),decoratorStates:t}),l=[],a=[];for(let c in r)r[c]?l.push(c):a.push(c);n.change(c=>{let u=h=>{c.setAttribute("linkHref",e,h),l.forEach(g=>c.setAttribute(g,!0,h)),a.forEach(g=>c.removeAttribute(g,h))},d=(h,g)=>{let p=Ld(h);if(!p)return h;let b=i;if(b||(b=g&&g==p?e:p),b!=p){let w=c.createDocumentFragment();for(let Z of h.getItems()){let _e=Z;c.append(c.createText(_e.data,_e.getAttributes()),w)}let k=c.createRangeIn(w),T=tx(p,b),B=0;for(let{offset:Z,actual:_e,expected:ke}of T){let _t=Z+B,Pt=c.createRange(k.start.getShiftedBy(_t),k.start.getShiftedBy(_t+_e.length)),ei=ix(Pt,k).getAttributes(),$n=Array.from(ei).filter(([sn])=>n.schema.getAttributeProperties(sn).isFormatting),ti=c.createText(ke,$n);u(ti),c.remove(Pt),c.insert(ti,Pt.start),B+=ke.length}return n.insertContent(w,h),c.createRange(h.start,h.start.getShiftedBy(b.length))}},m=h=>{let{plugins:g}=this.editor;if(c.setSelection(h.end),g.has("TwoStepCaretMovement"))g.get("TwoStepCaretMovement")._handleForwardMovement();else for(let p of["linkHref",...l,...a])c.removeSelectionAttribute(p)};if(o.isCollapsed){let h=o.getFirstPosition();if(o.hasAttribute("linkHref")){let g=o.getAttribute("linkHref"),p=_n(h,"linkHref",g,n),b=d(p,g);u(b||p),b&&m(b)}else if(e!==""){let g=ni(o.getAttributes());g.set("linkHref",e),l.forEach(b=>{g.set(b,!0)});let p=n.insertContent(c.createText(i||e,g),h);m(p)}}else{let h=Array.from(o.getRanges()),g=n.schema.getValidRanges(h,"linkHref"),p=[];for(let k of o.getSelectedBlocks())n.schema.checkAttribute(k,"linkHref")&&p.push(c.createRangeOn(k));let b=p.slice();for(let k of g)this._isRangeToUpdate(k,p)&&b.push(k);let w=h.map(k=>({start:It.fromPosition(k.start,"toPrevious"),end:It.fromPosition(k.end,"toNext")}));for(let k of b){let T=(k.start.textNode||k.start.nodeAfter).getAttribute("linkHref");k=d(k,T)||k,u(k)}c.setSelection(w.map(k=>{let T=k.start.toPosition(),B=k.end.toPosition();return k.start.detach(),k.end.detach(),n.createRange(T,B)}))}}),this.restoreManualDecoratorStates()}_getDecoratorStateFromModel(e){let t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return Bd(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(let i of t)if(i.containsRange(e))return!1;return!0}};Od=class extends v{refresh(){let e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();Bd(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){let e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change(o=>{let r=i.isCollapsed?[_n(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(let l of r)if(o.removeAttribute("linkHref",l),n)for(let a of n.manualDecorators)o.removeAttribute(a.id,l)})}},Dd=class extends an(){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:n,styles:o,defaultValue:r}){super(),this.id=e,this.set("value",void 0),this.defaultValue=r,this.label=t,this.attributes=i,this.classes=n,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}},nx="ck-link_selected",Bk="automatic",ox="manual",sx=/^(https?:)?\/\//,Bi=class extends f{_linkOpeners=[];static get pluginName(){return"LinkEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[wn,kp,ct]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]})}init(){let e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Pk}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(o,r)=>Pk(Ok(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 Fd(e)),e.commands.add("unlink",new Od(e));let i=XE(e.t,YE(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(o=>o.mode===Bk)),this._enableManualDecorators(i.filter(o=>o.mode===ox)),e.plugins.get(wn).registerAttribute("linkHref"),rs(e,"linkHref","a",nx),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration(),this._enableDecoratorConflictPostfixer()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){let t=this.editor,i=t.commands.get("link"),n=i.automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:Bk,callback:o=>!!o&&sx.test(o),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.setConflictChecker((o,r)=>{for(let l of i.manualDecorators)if(r.hasAttribute(l.id)&&Rd(o,l))return!0}),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;let t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach(o=>{t.model.schema.extend("$text",{allowAttributes:o.id});let r=new Dd(o);n.add(r),t.conversion.for("downcast").add(l=>{let a=u=>{let d=u.createAttributeElement("a",r.attributes,{priority:5});r.classes&&u.addClass(r.classes,d);for(let m in r.styles)u.setStyle(m,r.styles[m],d);return u.setCustomProperty("link",!0,d),d},c=u=>(d,m,h)=>{if(!(!m.item.is("selection")&&!h.schema.isInline(m.item))){if(!u&&m.attributeOldValue){if(!h.consumable.test(m.item,d.name))return;h.writer.unwrap(h.mapper.toViewRange(m.range),a(h.writer))}if(u&&m.attributeNewValue){if(!h.consumable.consume(m.item,d.name))return;m.item.is("selection")?h.writer.wrap(h.writer.document.selection.getFirstRange(),a(h.writer)):h.writer.wrap(h.mapper.toViewRange(m.range),a(h.writer))}}};l.on(`attribute:${r.id}`,c(!1),{priority:Le.high-1}),l.on(`attribute:${r.id}`,c(!0),{priority:Le.high-2})}),t.conversion.for("upcast").elementToAttribute({view:I({name:"a"},r._createPattern()),model:{key:r.id}})})}_enableLinkOpen(){let e=this.editor,i=e.editing.view.document,n=o=>{this._linkOpeners.some(r=>r(o))||JE(o)};this.listenTo(i,"click",(o,r)=>{if(!(Je.isMac?r.domEvent.metaKey:r.domEvent.ctrlKey))return;let a=r.domTarget;if(a.tagName.toLowerCase()!="a"&&(a=a.closest("a")),!a)return;let c=a.getAttribute("href");c&&(o.stop(),r.preventDefault(),n(c))},{context:"$capture"}),this.listenTo(i,"keydown",(o,r)=>{let a=e.commands.get("link").value;a&&r.keyCode===vt.enter&&r.altKey&&(o.stop(),n(a))})}_enableSelectionAttributesFixer(){let t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(n,{attributeKeys:o})=>{!o.includes("linkHref")||i.hasAttribute("linkHref")||t.change(r=>{rx(r,lx(t.schema))})})}_enableClipboardIntegration(){let e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(n,o)=>{t.change(r=>{let l=r.createRangeIn(o.content);for(let a of l.getItems())if(a.hasAttribute("linkHref")){let c=qd(a.getAttribute("linkHref"),i);r.setAttribute("linkHref",c,a)}})})}_enableDecoratorConflictPostfixer(){let e=this.editor,t=e.model,i=e.commands.get("link");t.document.registerPostFixer(n=>{let o=!1,r=t.document.differ.getChanges(),l=new Set,a=new Set(i.manualDecorators.map(c=>c.id));for(let c of r){if(c.type==="attribute"){if(c.attributeKey!=="linkHref"&&!a.has(c.attributeKey))continue;for(let u of c.range.getItems())u.hasAttribute("linkHref")&&l.add(u)}c.type==="insert"&&c.attributes.has("linkHref")&&c.position.nodeAfter&&l.add(c.position.nodeAfter)}for(let c of l){let u=[];for(let d of i.manualDecorators)if(c.hasAttribute(d.id)){for(let m=u.length-1;m>=0;m--){let h=u[m];Rd(h,d)&&(n.removeAttribute(h.id,c),u.splice(m,1),o=!0)}u.push(d)}}return o})}};Nd=class extends y{constructor(e){super(e);let t=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:t.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to(i=>{if(this.href){let n=()=>i.preventDefault();this.fire("navigate",this.href,n)}})}}),this.template.tag="a"}},Md=class extends P{focusTracker=new J;keystrokes=new K;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new ye;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView())}),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].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()}isValid(){this.resetFormStatus();for(let e of this._validators){let t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){let e=this.locale.t,t=new y(this.locale);return t.set({label:e("Insert"),tooltip:!1,withText:!0,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){let e=this.locale.t,t=new Oe(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){let e=new bn(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(t=>{let i=new pn(this.locale);return i.children.add(t),i}),e}_createDisplayedTextInput(){let e=this.locale.t,t=new H(this.locale,ce);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){let e=this.locale.t,t=new H(this.locale,ce);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new q(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new q(this.locale,{children:[this.urlInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}))}get url(){let{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}},Ud=class extends P{focusTracker=new J;keystrokes=new K;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new ye;_focusCycler;constructor(e){super(e),this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",!1),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0}),this.on("change:hasItems",(t,i,n)=>{n?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation))}),this.keystrokes.set("Esc",(t,i)=>{this.fire("cancel"),i()}),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children})}render(){super.render(),[this.listView,this.backButtonView].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()}_createListView(){let e=new bn(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(t=>{let i=new pn(this.locale);return i.children.add(t),i}),e}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){let e=new Oe(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){let e=new P(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}},Hd=class extends P{focusTracker=new J;keystrokes=new K;backButtonView;children;listChildren;_focusables=new ye;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(t,i)=>{this.fire("back"),i()})}render(){super.render(),[...this.listChildren,this.backButtonView].forEach(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()}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){let e=this.locale.t,t=new Oe(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){let e=new bn(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(t=>{let i=new pn(this.locale);return i.children.add(t),i}),e}},Wd=class extends y{arrowView;constructor(e){super(e),this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new gn;return e.content=Cf,e}},Yt="link-ui",or=class extends f{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new ne;static get requires(){return[Ce,Bi]}static get pluginName(){return"LinkUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(qg),this._balloon=e.plugins.get(Ce),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Yt,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Yt,view:(i,{writer:n})=>{if(!i.markerRange.isCollapsed)return null;let o=n.createUIElement("span");return n.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],o),o}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:Lo},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy()}registerLinksListProvider(e){let t=this._linksProviders.filter(i=>(i.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){let e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){let e=this.editor,t=new Ue(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let n=e.config.get("link.toolbar");return i.manualDecorators.length||(n=n.filter(o=>o!=="linkProperties")),t.fillFromConfig(n,e.ui.componentFactory),t.keystrokes.set("Esc",(o,r)=>{this._hideUI(),r()}),t.keystrokes.set(Lo,(o,r)=>{this._addFormView(),r()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){let e=this.editor,t=e.locale.t,i=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),o=new(mt(Md))(e.locale,ax(e));return o.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",r=>r!==void 0),o.urlInputView.bind("isEnabled").to(i,"isEnabled"),o.saveButtonView.bind("isEnabled").to(i,"isEnabled"),o.saveButtonView.bind("label").to(i,"value",r=>t(r?"Update":"Insert")),this.listenTo(o,"submit",()=>{if(o.isValid()){let r=o.urlInputView.fieldView.element.value,l=qd(r,n),a=o.displayedTextInputView.fieldView.element.value;e.execute("link",l,this._getDecoratorSwitchesState(),a!==this.selectedLinkableText?a:void 0),this._closeFormView()}}),this.listenTo(o.urlInputView,"change:errorText",()=>{e.ui.update()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(r,l)=>{this._closeFormView(),l()}),o.providersListChildren.bindTo(this._linksProviders).using(r=>this._createLinksListProviderButton(r)),o}_createLinkProviderListView(e){return e.getListItems().map(({href:t,label:i,icon:n})=>{let o=new y;return o.set({label:i,icon:n,tooltip:!1,withText:!0}),o.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=t,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),o})}_createLinkProviderItemsView(e){let t=this.editor,i=t.locale.t,n=new Ud(t.locale),{emptyListPlaceholder:o,label:r}=e;return n.emptyListPlaceholder=o||i("No links available"),n.title=r,this.listenTo(n,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),n}_createPropertiesView(){let e=this.editor,t=this.editor.commands.get("link"),i=new(mt(Hd))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView()}),i.listChildren.bindTo(t.manualDecorators).using(n=>{let o=new si(e.locale);return o.set({label:n.label,withText:!0}),o.bind("isOn").toMany([n,t],"value",(r,l)=>l===void 0&&r===void 0?!!n.defaultValue:!!r),o.on("execute",()=>{e.execute("link",t.value,N(I({},this._getDecoratorSwitchesState()),{[n.id]:!o.isOn}))}),o}),i}_getDecoratorSwitchesState(){let e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{let n=e.value===void 0&&i.value===void 0?i.defaultValue:i.value;return N(I({},t),{[i.id]:!!n})},{})}_registerEditingOpeners(){this.editor.plugins.get(Bi)._registerLinkOpener(t=>{let i=this._getLinkProviderLinkByHref(t);if(!i)return!1;let{item:n,provider:o}=i;return o.navigate?o.navigate(n):!1})}_registerComponents(){let e=this.editor;e.ui.componentFactory.add("link",()=>{let t=this._createButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:link",()=>{let t=this._createButton(x);return t.set({role:"menuitemcheckbox"}),t}),e.ui.componentFactory.add("linkPreview",t=>{let i=new Nd(t),n=e.config.get("link.allowedProtocols"),o=e.commands.get("link"),r=t.t;i.bind("isEnabled").to(o,"value",a=>!!a),i.bind("href").to(o,"value",a=>a&&Ok(a,n));let l=a=>{if(!a){i.label=void 0,i.icon=void 0,i.tooltip=r("Open link in new tab");return}let c=this._getLinkProviderLinkByHref(a);if(c){let{label:u,tooltip:d,icon:m}=c.item;i.label=u,i.tooltip=d||!1,i.icon=m}else i.label=a,i.icon=void 0,i.tooltip=r("Open link in new tab")};return l(o.value),this.listenTo(o,"change:value",(a,c,u)=>{l(u)}),this.listenTo(i,"navigate",(a,c,u)=>{let d=this._getLinkProviderLinkByHref(c);if(!d)return;let{provider:m,item:h}=d,{navigate:g}=m;g&&g(h)&&(a.stop(),u())}),i}),e.ui.componentFactory.add("unlink",t=>{let i=e.commands.get("unlink"),n=new y(t),o=t.t;return n.set({label:o("Unlink"),icon:sp,tooltip:!0}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{e.execute("unlink"),this._hideUI()}),n}),e.ui.componentFactory.add("editLink",t=>{let i=e.commands.get("link"),n=new y(t),o=t.t;return n.set({label:o("Edit link"),icon:Wi,tooltip:!0}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{this._addFormView()}),n}),e.ui.componentFactory.add("linkProperties",t=>{let i=e.commands.get("link"),n=new y(t),o=t.t;return n.set({label:o("Link properties"),icon:Lf,tooltip:!0}),n.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(r,l,a)=>r&&!!l&&a.length>0),this.listenTo(n,"execute",()=>{this._addPropertiesView()}),n})}_createLinksListProviderButton(e){let t=this.editor.locale,i=new Wd(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e)}),i}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get("link"),o=new e(t.locale),r=i.t;return o.set({label:r("Link"),icon:rl,keystroke:Lo,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value",l=>!!l),this.listenTo(o,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),o}_enableBalloonActivators(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(Lo,(i,n)=>{n(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Xe({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_addPropertiesView(){this.propertiesView||this._createViews(),!this._arePropertiesInPanel&&(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus())}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e)}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus()}_closeFormView(){let e=this.editor.commands.get("link");this.selectedLinkableText=void 0,e.value!==void 0?this._removeFormView():this._hideUI()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(e=!0){let t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection())}_startUpdatingUI(){let e=this.editor,t=e.editing.view.document,i=this._getSelectedLinkElement(),n=r(),o=()=>{let l=this._getSelectedLinkElement(),a=r();i&&!l||!i&&a!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=l,n=a};function r(){return t.selection.focus.getAncestors().reverse().find(l=>l.is("element"))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _arePropertiesInPanel(){return!!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return!!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return!!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return!!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return!!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){let e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(Yt)){let n=this.editor.editing.mapper.markerNameToElements(Yt);if(n){let o=Array.from(n),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));return{target:e.domConverter.viewRangeToDom(r)}}}return{target:()=>{let n=this._getSelectedLinkElement();return n?e.domConverter.mapViewToDom(n):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){let e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&Ht(i))return Vd(t.getFirstPosition());{let n=t.getFirstRange().getTrimmed(),o=Vd(n.start),r=Vd(n.end);return!o||o!=r?null:e.createRangeIn(o).getTrimmed().isEqual(n)?o:null}}_getSelectedLinkableText(){let e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return Ld(e.document.selection.getFirstRange());let n=t.view.createRangeOn(i),o=t.mapper.toModelRange(n);return Ld(o)}_getLinkProviderLinkByHref(e){if(!e)return null;for(let t of this._linksProviders){let i=t.getItem?t.getItem(e):t.getListItems().find(n=>n.href===e);if(i)return{provider:t,item:i}}return null}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let i=e.document.selection.getFirstRange();if(e.markers.has(Yt))t.updateMarker(Yt,{range:i});else if(i.start.isAtEnd){let n=i.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:i});t.addMarker(Yt,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(Yt,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(Yt)&&e.change(t=>{t.removeMarker(Yt)})}};cx=4,Nk=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),ux=2,zd=class extends f{static get requires(){return[it,Bi]}static get pluginName(){return"AutoLink"}static get isOfficialPlugin(){return!0}init(){let t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?_n(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){let n=this.editor.model,o=n.document.selection,r=o.getFirstPosition(),l=o.getLastPosition(),a=t.getJoined(this._expandLinkRange(n,r)||t);a&&(a=a.getJoined(this._expandLinkRange(n,l)||t)),a&&(a.start.isBefore(r)||a.end.isAfter(l))&&e.setSelection(a)}_enablePasteLinking(){let e=this.editor,t=e.model,i=t.document.selection,n=e.plugins.get("ClipboardPipeline"),o=e.commands.get("link");n.on("inputTransformation",(r,l)=>{if(!this.isEnabled||!o.isEnabled||i.isCollapsed||l.method!=="paste"||i.rangeCount>1)return;let a=i.getFirstRange(),c=l.dataTransfer.getData("text/plain");if(!c)return;let u=c.match(Nk);u&&u[2]===c&&(t.change(d=>{this._selectEntireLinks(d,a),o.execute(c)}),r.stop())},{priority:"high"})}_enableTypingHandling(){let e=this.editor,t=new ss(e.model,i=>{let n=i;if(!dx(n))return;n=n.slice(0,-1),"!.:,;?".includes(n[n.length-1])&&(n=n.slice(0,-1));let o=Lk(n);if(o)return{url:o,removedTrailingCharacters:i.length-n.length}});t.on("matched:data",(i,n)=>{let{batch:o,range:r,url:l,removedTrailingCharacters:a}=n;if(!o.isTyping)return;let c=r.end.getShiftedBy(-a),u=c.getShiftedBy(-l.length),d=e.model.createRange(u,c);this._applyAutoLink(l,d)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){let e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{let n=t.document.selection.getFirstPosition(),o;n.parent.previousSibling?.is("element")?o=t.createRangeIn(n.parent.previousSibling):o=t.createRange(t.createPositionAt(n.parent,0),n),this._checkAndApplyAutoLinkOnRange(o)})}_enableShiftEnterHandling(){let e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{let n=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(n.parent,0),n.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(o)})}_checkAndApplyAutoLinkOnRange(e){let t=this.editor.model,{text:i,range:n}=yp(e,t),o=Lk(i);if(o){let r=t.createRange(n.end.getShiftedBy(-o.length),n.end);this._applyAutoLink(o,r)}}_applyAutoLink(e,t){let i=this.editor.model,n=this.editor.config.get("link.defaultProtocol"),o=qd(e,n);!this.isEnabled||!mx(t,i)||!Dk(o)||hx(t)||this._persistAutoLink(o,t)}_persistAutoLink(e,t){let i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange(o=>{o.setAttribute("linkHref",e,t),i.enqueueChange(()=>{n.requestUndoOnBackspace()})})}};Rk=class extends f{static get requires(){return[Bi,or,zd]}static get pluginName(){return"Link"}static get isOfficialPlugin(){return!0}},$d=class extends f{static get requires(){return["ImageEditing","ImageUtils",Bi]}static get pluginName(){return"LinkImageEditing"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(gx(e)),e.conversion.for("downcast").add(fx(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){let e=this.editor,i=e.commands.get("link").automaticDecorators;i.length&&e.conversion.for("downcast").add(i.getDispatcherForLinkedImage())}_enableManualDecorators(){let e=this.editor,t=e.commands.get("link");for(let i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(px(i)),e.conversion.for("upcast").add(bx(e,i))}};jd=class extends f{static get requires(){return[Bi,or,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(i,n)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(n.preventDefault(),i.stop())},{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){let e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{let n=new y(i),o=e.plugins.get("LinkUI"),r=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:rl,keystroke:Lo,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(r,"isEnabled"),n.bind("isOn").to(r,"value",l=>!!l),this.listenTo(n,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addToolbarView():o._showUI(!0)}),n})}_isSelectedLinkedImage(e){let t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}},Fk=class extends f{static get requires(){return[$d,jd]}static get pluginName(){return"LinkImage"}static get isOfficialPlugin(){return!0}}});function Uk(s,e){let t=(i,n,o)=>{if(!o.consumable.consume(n.item,i.name))return;let r=n.attributeNewValue,l=o.writer,a=o.mapper.toViewElement(n.item),c=[...a.getChildren()].find(d=>d.getCustomProperty("media-content"));l.remove(c);let u=s.getMediaViewElement(l,r,e);l.insert(l.createPositionAt(a,0),u)};return i=>{i.on("attribute:url:media",t)}}function wx(s,e,t){return e.setCustomProperty("media",!0,s),We(s,e,{label:t})}function _x(s){let e=s.getSelectedElement();return e&&kx(e)?e:null}function kx(s){return!!s.getCustomProperty("media")&&Ht(s)}function Hk(s,e,t,i){return s.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(s,t,i),s.createSlot()])}function Wk(s){let e=s.getSelectedElement();return e&&e.is("element","media")?e:null}function jk(s,e,t,i){s.change(n=>{let o=n.createElement("media",{url:e});s.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}function yx(s,e){let i=Wt(s,e).start.parent;return i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent),e.schema.checkChild(i,"media")}function vx(s){let e=s.getSelectedElement();return!!e&&e.name==="media"}function Tx(s,e){return[t=>{if(!t.url.length)return s("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return s("This media URL is not supported.")}]}var Gd,Cx,Kd,sr,Dn,Ix,Xd,Yd,Qd,zk,$k,qk=M(()=>{U();zt();j();z();re();ve();Ci();at();us();Gd=class extends v{refresh(){let e=this.editor.model,t=e.document.selection,i=Wk(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=vx(t)||yx(t,e)}execute(e){let t=this.editor.model,i=t.document.selection,n=Wk(i);n?t.change(o=>{o.setAttribute("url",e,n)}):jk(t,e,i,!0)}};Cx="0 0 64 42",Kd=class{locale;providerDefinitions;constructor(e,t){let i=t.providers,n=t.extraProviders||[],o=new Set(t.removeProviders),r=i.concat(n).filter(l=>{let a=l.name;return a?!o.has(a):(Q("media-embed-no-provider-name",{provider:l}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new sr(this.locale);e=e.trim();for(let t of this.providerDefinitions){let i=t.html,n=Ve(t.url);for(let o of n){let r=this._getUrlMatches(e,o);if(r)return new sr(this.locale,e,r,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let n=e.replace(/^https?:\/\//,"");return i=n.match(t),i||(n=n.replace(/^www\./,""),i=n.match(t),i)?i:null}},sr=class{url;_locale;_match;_previewRenderer;constructor(e,t,i,n){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=n}getViewElement(e,t){let i={},n;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");let o=this._getPreviewHtml(t);n=e.createRawElement("div",i,(r,l)=>{l.setContentOf(r,o)})}else this.url&&(i.url=this.url),n=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,n),n}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){let e=new gn,t=this._locale.t;return e.content=yf,e.viewBox=Cx,new Zo({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}},Dn=class extends f{static get pluginName(){return"MediaEmbedEditing"}static get isOfficialPlugin(){return!0}registry;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\/shorts\/([\w-]+)(?:\?t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{let i=t[1],n=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${i}${n?`?start=${n}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay;
30 encrypted-media" referrerpolicy="strict-origin-when-cross-origin" 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+)/,/^instagram\.com\/reel\/(\w+)/]},{name:"twitter",url:[/^twitter\.com/,/^x\.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 Kd(e.locale,e.config.get("mediaEmbed"))}init(){let e=this.editor,t=e.model.schema,i=e.t,n=e.conversion,o=e.config.get("mediaEmbed.previewsInData"),r=e.config.get("mediaEmbed.elementName"),l=this.registry;e.commands.add("mediaEmbed",new Gd(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),n.for("dataDowncast").elementToStructure({model:"media",view:(a,{writer:c})=>{let u=a.getAttribute("url");return Hk(c,l,u,{elementName:r,renderMediaPreview:!!u&&o})}}),n.for("dataDowncast").add(Uk(l,{elementName:r,renderMediaPreview:o})),n.for("editingDowncast").elementToStructure({model:"media",view:(a,{writer:c})=>{let u=a.getAttribute("url"),d=Hk(c,l,u,{elementName:r,renderForEditingView:!0});return wx(d,c,i("media widget"))}}),n.for("editingDowncast").add(Uk(l,{elementName:r,renderForEditingView:!0})),n.for("upcast").elementToElement({view:a=>["oembed",r].includes(a.name)&&a.getAttribute("url")?{name:!0}:null,model:(a,{writer:c})=>{let u=a.getAttribute("url");return l.hasMedia(u)?c.createElement("media",{url:u}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(a,{writer:c})=>{let u=a.getAttribute("data-oembed-url");return l.hasMedia(u)?c.createElement("media",{url:u}):null}}).add(a=>{let c=(u,d,m)=>{if(!m.consumable.consume(d.viewItem,{name:!0,classes:"media"}))return;let{modelRange:h,modelCursor:g}=m.convertChildren(d.viewItem,d.modelCursor);d.modelRange=h,d.modelCursor=g,O(h.getItems())||m.consumable.revert(d.viewItem,{name:!0,classes:"media"})};a.on("element:figure",c)})}},Ix=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/,Xd=class extends f{static get requires(){return[yn,it,vn]}static get pluginName(){return"AutoMediaEmbed"}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){let e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{let o=t.selection.getFirstRange(),r=It.fromPosition(o.start);r.stickiness="toPrevious";let l=It.fromPosition(o.end);l.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(r,l),r.detach(),l.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(W.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){let i=this.editor,n=i.plugins.get(Dn).registry,o=new un(e,t),r=o.getWalker({ignoreElementEnd:!0}),l="";for(let c of r)c.item.is("$textProxy")&&(l+=c.item.data);if(l=l.trim(),!l.match(Ix)){o.detach();return}if(!n.hasMedia(l)){o.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=It.fromPosition(e),this._timeoutId=W.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),jk(i.model,l,u,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(it).requestUndoOnBackspace()},100)}},Yd=class extends P{focusTracker;keystrokes;urlInputView;_validators;_urlInputViewInfoDefault;_urlInputViewInfoTip;constructor(e,t){super(t),this.focusTracker=new J,this.keystrokes=new K,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this._val
vendor: 4,401 bytes, line 30
30idators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView]})}render(){super.render(),Fe({view:this}),this.focusTracker.add(this.urlInputView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.urlInputView.focus()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.value=e.trim()}isValid(){this.resetFormStatus();for(let e of this._validators){let t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){let e=this.locale.t,t=new H(this.locale,ce),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.inputMode="url",i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}},Qd=class extends f{static get requires(){return[Dn,Nt]}static get pluginName(){return"MediaEmbedUI"}static get isOfficialPlugin(){return!0}_formView;init(){let e=this.editor;e.ui.componentFactory.add("mediaEmbed",()=>{let t=this.editor.locale.t,i=this._createDialogButton(y);return i.tooltip=!0,i.label=t("Insert media"),i}),e.ui.componentFactory.add("menuBar:mediaEmbed",()=>{let t=this.editor.locale.t,i=this._createDialogButton(x);return i.label=t("Media"),i})}_createDialogButton(e){let t=this.editor,i=new e(t.locale),n=t.commands.get("mediaEmbed"),o=this.editor.plugins.get("Dialog");return i.icon=vf,i.bind("isEnabled").to(n,"isEnabled"),i.on("execute",()=>{o.id==="mediaEmbed"?o.hide():this._showDialog()}),i}_showDialog(){let e=this.editor,t=e.plugins.get("Dialog"),i=e.commands.get("mediaEmbed"),n=e.locale.t,o=i.value!==void 0;if(!this._formView){let r=e.plugins.get(Dn).registry;this._formView=new(mt(Yd))(Tx(e.t,r),e.locale),this._formView.on("submit",()=>this._handleSubmitForm())}t.show({id:"mediaEmbed",title:n("Media embed"),content:this._formView,isModal:!0,onShow:()=>{this._formView.url=i.value||"",this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select()},actionButtons:[{label:n("Cancel"),withText:!0,onExecute:()=>t.hide()},{label:n(o?"Save":"Insert"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSubmitForm()}]})}_handleSubmitForm(){let e=this.editor,t=e.plugins.get("Dialog");this._formView.isValid()&&(e.execute("mediaEmbed",this._formView.url),t.hide(),e.editing.view.focus())}};zk=class extends f{static get requires(){return[Dn,Qd,Xd,ze]}static get pluginName(){return"MediaEmbed"}static get isOfficialPlugin(){return!0}},$k=class extends f{static get requires(){return[ft]}static get pluginName(){return"MediaEmbedToolbar"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t;e.plugins.get(ft).register("mediaEmbed",{ariaLabel:t("Media toolbar"),items:e.config.get("mediaEmbed.toolbar")||[],getRelatedElement:_x})}}});function Xk(s,e){return Object.assign({uid:yt()},s,e||{})}function Yk(s,e){let t=s.getAttribute("data-mention"),i=s.getChild(0);if(!i)return;let n={id:t,_text:i.data};return Xk(n,e)}function Ax(s){s.on("attribute:mention",(e,t,i)=>{let n=t.attributeNewValue;if(!t.item.is("$textProxy")||!n)return;let o=t.range.start;(o.textNode||o.nodeAfter).data!=n._text&&i.consumable.consume(t.item,e.name)},{priority:"highest"})}function Ex(s,{writer:e}){if(!s)return;let t={class:"mention","data-mention":s.id},i={id:s.uid,priority:20};return e.createAttributeElement("span",t,i)}function xx(s,e){let t=e.selection,i=t.focus;return t.isCollapsed&&t.hasAttribute("mention")&&Sx(i)?(s.removeSelectionAttribute("mention"),!0):!1}function Sx(s){let e=s.isAtStart;return s.nodeBefore&&s.nodeBefore.is("$text")||e}function Vx(s,e,t){let i=e.differ.getChanges(),n=!1;for(let o of i){if(o.type=="attribute")continue;let r=o.position;if(o.name=="$text"){let l=r.textNode&&r.textNode.nextSibling;n=Zi(r.textNode,s)||n,n=Zi(l,s)||n,n=Zi(r.nodeBefore,s)||n,n=Zi(r.nodeAfter,s)||n}if(o.name!="$text"&&o.type=="insert"){let l=r.nodeAfter;for(let a of s.createRangeIn(l).getItems())n=Zi(a,s)||n}
30if(o.type=="insert"&&t.isInline(o.name)){let l=r.nodeAfter&&r.nodeAfter.nextSibling;n=Zi(r.nodeBefore,s)||n,n=Zi(l,s)||n}}return n}function Px(s,e){let t=e.differ.getChanges(),i=!1;for(let n of t)if(n.type==="attribute"&&n.attributeKey!="mention"){let o=n.range.start.nodeBefore,r=n.range.end.nodeAfter;for(let l of[o,r])Qk(l)&&l.getAttribute(n.attributeKey)!=n.attributeNewValue&&(s.setAttribute(n.attributeKey,n.attributeNewValue,l),i=!0)}return i}function Qk(s){if(!s||!(s.is("$text")||s.is("$textProxy"))||!s.hasAttribute("mention"))return!1;let e=s.data,i=s.getAttribute("mention")._text;return e!=i}function Zi(s,e){return Qk(s)?(e.removeAttribute("mention",s),!0):!1}function Rx(s,e){let t={caret_se:i=>({top:i.bottom+rr,left:i.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(i,n)=>({top:i.top-n.height-rr,left:i.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(i,n)=>({top:i.bottom+rr,left:i.right-n.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(i,n)=>({top:i.top-n.height-rr,left:i.right-n.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(t,s)?[t[s]]:e!=="rtl"?[t.caret_se,t.caret_sw,t.caret_ne,t.caret_nw]:[t.caret_sw,t.caret_se,t.caret_nw,t.caret_ne]}function Jk(s,e){let t;for(let i of s){let n=e.lastIndexOf(i.marker);n>0&&!e.substring(n-1).match(i.pattern)||(!t||n>=t.position)&&(t={marker:i.marker,position:n,minimumCharacters:i.minimumCharacters,pattern:i.pattern})}return t}function Zk(s,e){let t=e==0?"*":`{${e},}`,i=Je.features.isRegExpUnicodePropertySupported?`\\p{Ps}\\p{Pi}"'`:`\\(\\[{"'`,n=".";s=s.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&");let o=`(?:^|[ ${i}])(${s})(${n}${t})$`;return new RegExp(o,"u")}function Fx(s){return t=>{let i=Jk(s,t);if(!i)return!1;let n=0;i.position!==0&&(n=i.position-1);let o=t.substring(n);return i.pattern.test(o)}}function Ox(s,e){let t=0;s.position!==0&&(t=s.position-1);let i=Zk(s.marker,0);return e.substring(t).match(i)[2]}function Dx(s){return e=>s.filter(i=>(typeof i=="string"?i:String(i.id)).toLowerCase().includes(e.toLowerCase()))}function Nx(s){let e=s.textNode&&s.textNode.hasAttribute("mention"),t=s.nodeBefore;return e||t&&t.is("$text")&&t.hasAttribute("mention")}function Mx(s){let e=s.nodeAfter;return e&&e.is("$text")&&e.hasAttribute("mention")}function Ux(s){return!!s}function Jd(s){return s.model.markers.has("mention")}var Gk,Zd,em,tm,im,nm,rr,Bx,Lx,om,Kk,ey=M(()=>{U();j();z();at();Me();Gk={"(":")","[":"]","{":"}"},Zd=class extends v{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){let e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){let t=this.editor.model,n=t.document.selection,o=typeof e.mention=="string"?{id:e.mention}:e.mention,r=o.id,l=e.range||n.getFirstRange();if(!t.canEditAt(l))return;let a=e.text||r,c=Xk({_text:a,id:r},o);if(!r.startsWith(e.marker))throw new S("mentioncommand-incorrect-id",this);t.change(u=>{let d=ni(n.getAttributes()),m=new Map(d.entries());m.set("mention",c);let h=t.insertContent(u.createText(a,m),l),g=h.start.nodeBefore,p=h.end.nodeAfter,b=p&&p.is("$text")&&p.data.startsWith(" "),w=!1;if(g&&p&&g.is("$text")&&p.is("$text")){let k=g.data.slice(-1),T=k in Gk,B=T&&p.data.startsWith(Gk[k]);w=T&&B}!w&&!b&&t.insertContent(u.createText(" ",d),l.start.getShiftedBy(a.length))})}},em=class extends f{static get pluginName(){return"MentionEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model,i=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",attributes:"data-mention",classes:"mention"},model:{key:"mention",value:n=>Yk(n)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:Ex}),e.conversion.for("downcast").add(Ax),i.registerPostFixer(n=>Vx(n,i,t.schema)),i.registerPostFixer(n=>Px(n,i)),i.registerPostFixer(n=>xx(n,i)),e.commands.add("mention",new Zd(e))}};tm=class extends bn{selected;position;constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){let e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){let e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);let i=this.items.get(t);this.selected!==i&&(this.selected&&this.selected.removeHighlight(),i.highlight(),this.selected=i,this._isItemVisibleInScrolledArea(i)||(this.element.scrollTop=i.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new ie(this.element).contains(new ie(e.element))}},im=class extends P{domElement;constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",(i,n,o)=>{o?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))}),this.listenTo(this.domElement,"click",()=>{this.fire("execute")})}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}},nm=class extends pn{item;marker;highlight(){let e=this.children.first;e.isOn=!0}removeHighlight(){let e=this.children.first;e.isOn=!1}},rr=3,Bx=[vt.arrowup,vt.arrowdown,vt.esc],Lx=[vt.enter,vt.tab],om=class extends f{_mentionsView;_mentionsConfigurations;_balloon;_items=new ne;_lastRequested;_requestFeedDebounced;static get pluginName(){return"MentionUI"}static get isOfficialPlugin(){return!0}static get requires(){return[Ce]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=kt(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){let e=this.editor,t=e.config.get("mention.commitKeys")||Lx,i=Bx.concat(t);
vendor: 11,506 bytes, lines 30-82
30this._balloon=e.plugins.get(Ce),e.editing.view.document.on("keydown",(r,l)=>{o(l.keyCode)&&this._isUIVisible&&(l.preventDefault(),r.stop(),l.keyCode==vt.arrowdown&&this._mentionsView.selectNext(),l.keyCode==vt.arrowup&&this._mentionsView.selectPrevious(),t.includes(l.keyCode)&&this._mentionsView.executeSelected(),l.keyCode==vt.esc&&this._hideUIAndRemoveMarker())},{priority:"highest"}),Xe({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});let n=e.config.get("mention.feeds");for(let r of n){let{feed:l,marker:a,dropdownLimit:c}=r;if(!Ux(a))throw new S("mentionconfig-incorrect-marker",null,{marker:a});let u=typeof l=="function"?l.bind(this.editor):Dx(l),d=r.itemRenderer,m={marker:a,feedCallback:u,itemRenderer:d,dropdownLimit:c};this._mentionsConfigurations.set(a,m)}this._setupTextWatcher(n),this.listenTo(e,"change:isReadOnly",()=>{this._hideUIAndRemoveMarker()}),this.on("requestFeed:response",(r,l)=>this._handleFeedResponse(l)),this.on("requestFeed:error",()=>this._hideUIAndRemoveMarker());function o(r){return i.includes(r)}}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){let e=this.editor.locale,t=new tm(e);return t.items.bindTo(this._items).using(i=>{let{item:n,marker:o}=i,{dropdownLimit:r}=this._mentionsConfigurations.get(o),l=r||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=l)return null;let a=new nm(e),c=this._renderItem(n,o);return c.delegate("execute").to(a),a.children.add(c),a.item=n,a.marker=o,a.on("execute",()=>{t.fire("execute",{item:n,marker:o})}),a}),t.on("execute",(i,n)=>{let o=this.editor,r=o.model,l=n.item,a=n.marker,c=o.model.markers.get("mention"),u=r.createPositionAt(r.document.selection.focus),d=r.createPositionAt(c.getStart()),m=r.createRange(d,u);this._hideUIAndRemoveMarker(),o.execute("mention",{mention:l,text:l.text,marker:a,range:m}),o.editing.view.focus()}),t}_getItemRenderer(e){let{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;let{feedCallback:i}=this._mentionsConfigurations.get(e),n=i(t);if(!(n instanceof Promise)){this.fire("requestFeed:response",{feed:n,marker:e,feedText:t});return}n.then(r=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:r,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:r,marker:e,feedText:t})}).catch(r=>{this.fire("requestFeed:error",{error:r}),Q("mention-feed-callback-error",{marker:e})})}_setupTextWatcher(e){let t=this.editor,i=e.map(r=>N(I({},r),{pattern:Zk(r.marker,r.minimumCharacters||0)})),n=new ss(t.model,Fx(i));n.on("matched",(r,l)=>{let a=Jk(i,l.text),u=t.model.document.selection.focus,d=t.model.createPositionAt(u.parent,a.position);if(Nx(u)||Mx(d)){this._hideUIAndRemoveMarker();return}let m=Ox(a,l.text),h=a.marker.length+m.length,g=u.getShiftedBy(-h),p=u.getShiftedBy(-m.length),b=t.model.createRange(g,p);if(Jd(t)){let w=t.model.markers.get("mention");t.model.change(k=>{k.updateMarker(w,{range:b})})}else t.model.change(w=>{w.addMarker("mention",{range:b,usingOperation:!1,affectsData:!1})});this._requestFeedDebounced(a.marker,m)}),n.on("unmatched",()=>{this._hideUIAndRemoveMarker()});let o=t.commands.get("mention");return n.bind("isEnabled").to(o),n}_handleFeedResponse(e){let{feed:t,marker:i}=e;if(!Jd(this.editor))return;this._items.clear();for(let o of t){let r=typeof o!="object"?{id:o,text:o}:o;this._items.add({item:r,marker:i})}let n=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(n):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0,balloonClassName:"ck-mention-balloon"}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),Jd(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0}_renderItem(e,t){let i=this.editor,n,o=e.id,r=this._getItemRenderer(t);if(r){let l=r(e);typeof l!="string"?n=new im(i.locale,l):o=l}if(!n){let l=new y(i.locale);l.label=o,l.withText=!0,n=l}return n}_getBalloonPanelPositionData(e,t){let i=this.editor,n=i.editing,o=n.view.domConverter,r=n.mapper,l=i.locale.uiLanguageDirection;return{target:()=>{let a=e.getRange();a.start.root.rootName=="$graveyard"&&(a=i.model.document.selection.getFirstRange());let c=r.toViewRange(a);return ie.getDomRangeRects(o.viewRangeToDom(c)).pop()},limiter:()=>{let a=this.editor.editing.view,u=a.document.selection.editableElement;return u?a.domConverter.mapViewToDom(u.root):null},positions:Rx(t,l)}}};Kk=class extends f{toMentionAttribute(e,t){return Yk(e,t)}static get pluginName(){return"Mention"}static get isOfficialPlugin(){return!0}static get requires(){return[em,om]}}});function Hx(s,e){let t=s.editing.view.document,i=t.getRoot(e),n=new Hg(t),o=new Ug(n,t.selection),r=s.editing.view.getDomRoot().cloneNode();return n.bindElements(r,i),o.markToSync("children",i),o.markToSync("attributes",i),i.on("change:children",(l,a)=>o.markToSync("children",a)),i.on("change:attributes",(l,a)=>o.markToSync("attributes",a)),i.on("change:text",(l,a)=>o.markToSync("text",a)),o.render(),s.editing.view.on("render",()=>o.render()),s.on("destroy",()=>{n.unbindDomElement(r)}),r}function Wx(){return Array.from(W.document.styleSheets).map(s=>s.href&&!s.href.startsWith(W.window.location.origin)?{href:s.href}:Array.from(s.cssRules).filter(e=>!(e instanceof CSSMediaRule)).map(e=>e.cssText).join(` 
31`))}function lr(s){return new ie(s===W.document.body?W.window:s)}function zx(s){return s===W.document.body?W.window.innerHeight:s.clientHeight}function ny(s){return s===W.document.body?W.window:s}var ty,sm,iy,rm,lm,oy,sy=M(()=>{U();j();z();ve();ty=Mi("px"),sm=class extends gp{_options;constructor(e,t){super(e);let i=this.bindTemplate;this.set("top",0),this.set("height",0),this._options=t,this.extendTemplate({attributes:{tabindex:-1,"aria-hidden":"true",class:["ck-minimap__iframe"],style:{top:i.to("top",n=>ty(n)),height:i.to("height",n=>ty(n))}}})}render(){return super.render().then(()=>{this._prepareDocument()})}setHeight(e){this.height=e}setTopOffset(e){this.top=e}_prepareDocument(){let e=this.element.contentWindow.document,t=e.adoptNode(this._options.domRootClone),i=this._options.useSimplePreview?`
32			.ck.ck-editor__editable_inline img {
33				filter: contrast( 0 );
34			}
35
36			p, li, a, figcaption, span {
37				background: hsl(0, 0%, 80%) !important;
38				color: hsl(0, 0%, 80%) !important;
39			}
40
41			h1, h2, h3, h4 {
42				background: hsl(0, 0%, 60%) !important;
43				color: hsl(0, 0%, 60%) !important;
44			}
45		`:"",o=`<!DOCTYPE html><html lang="en">
46			<head>
47				<meta charset="utf-8">
48				<meta name="viewport" content="width=device-width, initial-scale=1">
49				${this._options.pageStyles.map(r=>typeof r=="string"?`<style>${r}</style>`:`<link rel="stylesheet" type="text/css" href="${r.href}">`).join(`
50`)}
51				<style>
52					html, body {
53						margin: 0 !important;
54						padding: 0 !important;
55					}
56
57					html {
58						overflow: hidden;
59					}
60
61					body {
62						transform: scale( ${this._options.scaleRatio} );
63						transform-origin: 0 0;
64						overflow: visible;
65					}
66
67					.ck.ck-editor__editable_inline {
68						margin: 0 !important;
69						border-color: transparent !important;
70						outline-color: transparent !important;
71						box-shadow: none !important;
72					}
73
74					.ck.ck-content {
75						background: white;
76					}
77
78					${i}
79				</style>
80			</head>
81			<body class="${this._options.extraClasses||""}"></body>
82		</html>`;e.open(),e.write(o),e.close(),e.body.appendChild(t)}},iy=Mi("px"),rm=class extends P{constructor(e){super(e);let t=this.bindTemplate;this.set("height",0),this.set("top",0),this.set("scrollProgress",0),this.set("_isDragging",!1),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap__position-tracker",t.if("_isDragging","ck-minimap__position-tracker_dragging")],style:{top:t.to("top",i=>iy(i)),height:t.to("height",i=>iy(i))},"data-progress":t.to("scrollProgress")},on:{mousedown:t.to(()=>{this._isDragging=!0})}})}render(){super.render(),this.listenTo(W.document,"mousemove",(e,t)=>{this._isDragging&&this.fire("drag",t.movementY)},{useCapture:!0}),this.listenTo(W.document,"mouseup",()=>{this._isDragging=!1},{useCapture:!0})}setHeight(e){this.height=e}setTopOffset(e){this.top=e}setScrollProgress(e){this.scrollProgress=e}},lm=class extends P{_positionTrackerView;_scaleRatio;_minimapIframeView;constructor({locale:e,scaleRatio:t,pageStyles:i,extraClasses:n,useSimplePreview:o,domRootClone:r}){super(e);let l=this.bindTemplate;this._positionTrackerView=new rm(e),this._positionTrackerView.delegate("drag").to(this),this._scaleRatio=t,this._minimapIframeView=new sm(e,{useSimplePreview:o,pageStyles:i,extraClasses:n,scaleRatio:t,domRootClone:r}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap"]},children:[this._positionTrackerView],on:{click:l.to(this._handleMinimapClick.bind(this)),wheel:l.to(this._handleMinimapMouseWheel.bind(this))}})}destroy(){this._minimapIframeView.destroy(),super.destroy()}get height(){return new ie(this.element).height}get scrollHeight(){return Math.max(0,Math.min(this.height,this._minimapIframeView.height)-this._positionTrackerView.height)}render(){super.render(),this._minimapIframeView.render(),this.element.appendChild(this._minimapIframeView.element)}setContentHeight(e){this._minimapIframeView.setHeight(e*this._scaleRatio)}setScrollProgress(e){let t=this._minimapIframeView,i=this._positionTrackerView;if(t.height<this.height)t.setTopOffset(0),i.setTopOffset((t.height-i.height)*e);else{let n=t.height-this.height;t.setTopOffset(-n*e),i.setTopOffset((this.height-i.height)*e)}i.setScrollProgress(Math.round(e*100))}setPositionTrackerHeight(e){this._positionTrackerView.setHeight(e*this._scaleRatio)}_handleMinimapClick(e){let t=this._positionTrackerView;if(e.target===t.element)return;let i=new ie(t.element),o=(e.clientY-i.top-i.height/2)/this._minimapIframeView.height;this.fire("click",o)}_handleMinimapMouseWheel(e){this.fire("drag",e.deltaY*this._scaleRatio)}};oy=class extends f{static get pluginName(){return"Minimap"}static get isOfficialPlugin(){return!0}_minimapView;_scrollableRootAncestor;_editingRootElement;init(){let e=this.editor;this._minimapView=null,this._scrollableRootAncestor=null,this.listenTo(e.ui,"ready",this._onUiReady.bind(this))}destroy(){super.destroy(),this._minimapView.destroy(),this._minimapView.element.remove()}_onUiReady(){let e=this.editor,t=this._editingRootElement=e.ui.getEditableElement();if(this._scrollableRootAncestor=Ig(t),!t.ownerDocument.body.contains(t)){e.ui.once("update",this._onUiReady.bind(this));return}this._initializeMinimapView(),this.listenTo(e.editing.view,"render",()=>{e.state==="ready"&&this._syncMinimapToEditingRootScrollPosition()}),this._syncMinimapToEditingRootScrollPosition()}_initializeMinimapView(){let e=this.editor,t=e.locale,i=e.config.get("minimap.useSimplePreview"),n=e.config.get("minimap.container"),o=this._scrollableRootAncestor,r=lr(this._editingRootElement).width,a=lr(n).width/r,c=this._minimapView=new lm({locale:t,scaleRatio:a,pageStyles:Wx(),extraClasse
82s:e.config.get("minimap.extraClasses"),useSimplePreview:i,domRootClone:Hx(e)});c.render(),c.listenTo(W.document,"scroll",(u,d)=>{if(o===W.document.body){if(d.target!==W.document)return}else if(d.target!==o)return;this._syncMinimapToEditingRootScrollPosition()},{useCapture:!0,usePassive:!0}),c.listenTo(W.window,"resize",()=>{this._syncMinimapToEditingRootScrollPosition()}),c.on("drag",(u,d)=>{let m;c.scrollHeight===0?m=0:m=d/c.scrollHeight;let h=m*(o.scrollHeight-zx(o));ny(o).scrollBy(0,Math.round(h))}),c.on("click",(u,d)=>{let m=d*o.scrollHeight;ny(o).scrollBy(0,Math.round(m))}),n.appendChild(c.element)}_syncMinimapToEditingRootScrollPosition(){let e=this._editingRootElement,t=this._minimapView;t.setContentHeight(e.offsetHeight);let i=lr(e),n=lr(this._scrollableRootAncestor),o;n.getIntersection(i)&&(n.contains(i)||i.top>n.top?o=0:(o=(i.top-n.top)/(n.height-i.height),o=Math.max(0,Math.min(o,1))),t.setPositionTrackerHeight(n.getIntersection(i).height),t.setScrollProgress(o))}}});function $x(s,e,t){let i=jx(s,t);return e.checkChild(i,"pageBreak")}function jx(s,e){let i=Wt(s,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function qx(s,e,t){return e.setCustomProperty("pageBreak",!0,s),We(s,e,{label:t})}var am,cm,um,ry,ly=M(()=>{U();zt();re();z();am=class extends v{refresh(){let e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=$x(i,t,e)}execute(){let e=this.editor.model;e.change(t=>{let i=t.createElement("pageBreak");e.insertObject(i,null,null,{setSelection:"after"})})}};cm=class extends f{static get pluginName(){return"PageBreakEditing"}static get licenseFeatureCode(){return"PB"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToStructure({model:"pageBreak",view:(o,{writer:r})=>r.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},r.createContainerElement("span",{style:"display: none"}))}),n.for("editingDowncast").elementToStructure({model:"pageBreak",view:(o,{writer:r})=>{let l=i("Page break"),a=r.createContainerElement("div"),c=r.createRawElement("span",{class:"page-break__label"},function(u){u.innerText=i("Page break")});return r.addClass("page-break",a),r.insert(r.createPositionAt(a,0),c),qx(a,r,l)}}),n.for("upcast").elementToElement({view:o=>{let r=o.getStyle("page-break-before")=="always",l=o.getStyle("page-break-after")=="always";if(!r&&!l)return null;if(o.childCount==1){let a=o.getChild(0);if(!a.is("element","span")||a.getStyle("display")!="none")return null}else if(o.childCount>1)return null;return I({name:!0,styles:[...r?["page-break-before"]:[],...l?["page-break-after"]:[]]},o.hasClass("page-break")&&{classes:["page-break"]})},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new am(e))}};um=class extends f{static get pluginName(){return"PageBreakUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("pageBreak",()=>{let t=this._createButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:pageBreak",()=>this._createButton(x))}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get("pageBreak"),o=new e(t.locale),r=i.t;return o.set({label:r("Page break"),icon:Vf}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute("pageBreak"),t.editing.view.focus()}),o}},ry=class extends f{static get requires(){return[cm,um,ze]}static get pluginName(){return"PageBreak"}static get isOfficialPlugin(){return!0}}});var ar,dm,mm,hm,ay,cy=M(()=>{U();re();z();j();ar="removeFormat",dm=class extends f{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(ar,()=>{let t=this._createButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add(`menuBar:${ar}`,()=>this._createButton(x))}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get(ar),o=new e(t.locale),r=i.t;return o.set({label:r("Remove Format"),icon:Zf}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",()=>{t.execute(ar),t.editing.view.focus()}),o}},mm=class extends v{_customAttributesHandlers=[];refresh(){let e=this.editor.model;this.isEnabled=!!O(this._getFormattingItems(e.document.selection))}execute(){let e=this.editor.model;e.change(t=>{for(let i of this._getFormattingItems(e.document.selection))if(i.is("selection"))for(let n of this._getFormattingAttributes(i))t.removeSelectionAttribute(n);else{let n=t.createRangeOn(i);for(let o of this._getFormattingAttributes(i))this._removeFormatting(o,i,n,t)}})}registerCustomAttribute(e,t){this._customAttributesHandlers.push({isFormatting:e,removeFormatting:t})}_removeFormatting(e,t,i,n){let o=!1;for(let{isFormatting:r,removeFormatting:l}of this._customAttributesHandlers)r(e,t)&&(l(e,i,n),o=!0);o||n.removeAttribute(e,i)}*_getFormattingItems(e){let t=this.editor.model,i=t.schema,n=o=>
vendor: 5,425 bytes, line 82
82!!O(this._getFormattingAttributes(o));for(let o of e.getRanges())for(let r of o.getItems())i.isBlock(r)&&o.end.isTouching(t.createPositionAt(r,0))||n(r)&&(yield r);for(let o of e.getSelectedBlocks())n(o)&&(yield o);n(e)&&(yield e)}*_getFormattingAttributes(e){let t=this.editor.model.schema;for(let[i]of e.getAttributes()){for(let{isFormatting:o}of this._customAttributesHandlers)o(i,e)&&(yield i);let n=t.getAttributeProperties(i);n&&n.isFormatting&&(yield i)}}},hm=class extends f{static get pluginName(){return"RemoveFormatEditing"}static get licenseFeatureCode(){return"RF"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){let e=this.editor;e.commands.add("removeFormat",new mm(e))}},ay=class extends f{static get requires(){return[hm,dm]}static get pluginName(){return"RemoveFormat"}static get isOfficialPlugin(){return!0}}});function Qt(s,e){for(let t of s.model.markers){let i=Nn(t,s.model);if(py(i,e)&&t.name.startsWith("restrictedEditingException:"))return t}}function py(s,e){return s.containsPosition(e)||s.end.isEqual(e)||s.start.isEqual(e)}function Gx(s,e,t){if(!t)return!1;let i=Nn(t,e);return s.isCollapsed?py(i,s.focus):i.containsRange(s.getFirstRange(),!0)}function Nn(s,e){let t=s.getRange(),i=t.getContainedElement();return i&&i.is("element","restrictedEditingException")?e.createRangeIn(i):t}function uy(s,e){let i=s.document.selection.getFirstPosition(),n=[];for(let o of s.markers.getMarkersGroup("restrictedEditingException")){let r=Nn(o,s),l=i.isTouching(r.start)&&i.hasSameParentAs(r.start)||i.isTouching(r.end)&&i.hasSameParentAs(r.end);r.containsPosition(i)||l||(e==="forward"&&r.start.isAfter(i)||e==="backward"&&r.end.isBefore(i))&&n.push(r)}if(n.length)return n.sort((o,r)=>e==="forward"?o.start.isAfter(r.start)?1:-1:o.start.isBefore(r.start)?1:-1).shift()}function Kx(s){let e=s.editing.view,t=s.model,i=new Set;e.document.registerPostFixer(n=>{let o=t.document.selection,r=Qt(s,o.anchor);if(!r)return!1;let l=r.getRange().getContainedElement();if(l&&l.is("element","restrictedEditingException")){let a=s.editing.mapper.toViewElement(l);n.addClass(gm,a),i.add(a)}else for(let a of s.editing.mapper.markerNameToElements(r.name))n.addClass(gm,a),i.add(a);return!1}),s.conversion.for("editingDowncast").add(n=>{n.on("insert",o,{priority:"highest"}),n.on("remove",o,{priority:"highest"}),n.on("attribute",o,{priority:"highest"}),n.on("cleanSelection",o);function o(){e.change(r=>{for(let l of i.values())r.removeClass(gm,l),i.delete(l)})}})}function Xx(s){return e=>{let t=!1;for(let{name:i,data:n}of s.model.document.differ.getChangedMarkers())i.startsWith("restrictedEditingException")&&n.newRange&&n.newRange.root.rootName=="$graveyard"&&(e.updateMarker(i,{range:e.createRange(e.createPositionAt(n.oldRange.start))}),t=!0);return t}}function Yx(s){return e=>{let t=!1,i=s.model.schema;for(let n of s.model.document.differ.getChanges())n.type=="insert"&&i.checkChild("$block",n.name)&&(t=Qx(s,n.position,n.length,e)||t,t=Jx(s,n.position,n.length,e)||t);return t}}function dy(s){return e=>e.on("element",(t,i,n)=>{let{writer:o}=n,l=new Ct(s.view).match(i.viewItem);if(!l)return;let a=l.match;if(a.name=!0,!n.consumable.test(i.viewItem,a))return;let c=i.modelCursor,u=null;if(s.useWrapperElement){if(!n.schema.checkChild(c,"restrictedEditingException"))return;u=o.createElement("restrictedEditingException"),o.insert(u,c),c=o.createPositionAt(u,0)}let{modelRange:d}=n.convertChildren(i.viewItem,c);n.consumable.consume(i.viewItem,a);let m=s.model(),h=o.createElement("$marker",{"data-name":m}),g=o.createElement("$marker",{"data-name":m});u?(o.insert(h,o.createPositionBefore(u)),o.insert(g,o.createPositionAfter(u))):(o.insert(g,d.end),o.insert(h,d.start)),i.modelRange=o.createRange(o.createPositionBefore(h),o.createPositionAfter(g)),i.modelCursor=i.modelRange.end})}function Qx(s,e,t,i){let n=Qt(s,e.getShiftedBy(t));return n&&n.getStart().isEqual(e.getShiftedBy(t))?(i.updateMarker(n,{range:i.createRange(n.getStart().getShiftedBy(-t),n.getEnd())}),!0):!1}function Jx(s,e,t,i){let n=Qt(s,e);return n&&n.getEnd().isEqual(e)?(i.updateMarker(n,{range:i.createRange(n.getStart(),n.getEnd().getShiftedBy(t))}),!0):!1}function Zx(s){return(e,t)=>{if(qn(t)!=Gn("Ctrl+A"))return;let i=s.model,n=s.model.document.selection,o=Qt(s,n.focus);if(!o)return;let r=n.getFirstRange(),l=Nn(o,s.model);(l.containsRange(r,!0)||n.isCollapsed)&&(e.stop(),t.preventDefault(),t.stopPropagation(),i.change(a=>{a.setSelection(l)}))}}function eS(s,e,t){return!!(s=="delete"&&e.isCollapsed&&t.start.isTouching(e.focus)||s=="deleteForward"&&e.isCollapsed&&t.end.isTouching(e.focus))}function tS(s){return(e,t)=>{let[i]=t,n=Qt(s,i.focus)||Qt(s,i.anchor);if(!n){e.stop();return}if(i.isCollapsed)return;let o=Nn(n,s.model).getIntersection(i.getFirstRange());i.is("documentSelection")?s.model.change(r=>{r.setSelection(o)}):i.setTo(o)}}function iS(s){return(e,t)=>{let[i]=t,{range:n}=i;n&&(wm(s,n)||e.stop())}}function wm(s,e){let t=Qt(s,e.start),i=Qt(s,e.end);return t&&i&&i===t}function nS(s){return e=>{let t=!1,i=s.model.document.differ.getChangedMarkers();for(let{data:n,name:o}of i){if(!o.startsWith("restrictedEditingException"))continue;let r=n.newRange;if(!n.oldRange&&!r.isFlat){let l=r.start,a=r.end,c=l.path.length>a.path.length,u=c?r.start:e.createPositionAt(a.parent,0),d=c?e.createPositionAt(l.parent,"end"):r.end;e.updateMarker(o,{range:e.createRange(u,d)}),t=!0}}return t}}
82function pm(s){return s.findAncestor("restrictedEditingException",{includeSelf:!0})}function oS(s){let e=s;for(;e.parent;){if(e.parent.name=="restrictedEditingException")return e;e=e.parent}return null}function hy(s,e){let t,i=0,n=[];for(;i<e.length;){let o=e[i],r=e[i+1];t||(t=s.createPositionBefore(o)),(!r||o.nextSibling!=r)&&(n.push(s.createRange(t,s.createPositionAfter(o))),t=null),i++}return n}function gy(s,e){let t=s.createContext(e.parent);return!(!s.checkChild(t,"restrictedEditingException")||!s.checkChild(t.push("restrictedEditingException"),e))}function sS(s){let e=new Ct({name:"span",classes:"restricted-editing-exception"});s.conversion.for("upcast").add(t=>t.on("element:span",(i,n,o)=>{let r=e.match(n.viewItem);if(!r)return;let l=r.match;if(!o.consumable.test(n.viewItem,l))return;let a=o.writer.createText(" ",{restrictedEditingException:!0});o.safeInsert(a,n.modelCursor)&&(o.consumable.consume(n.viewItem,l),n.modelRange=o.writer.createRange(n.modelCursor,n.modelCursor.getShiftedBy(a.offsetSize)),n.modelCursor=n.modelRange.end)},{priority:"low"}))}var cr,gm,fm,bm,_m,my,km,ym,vm,Cm,Im,fy,by=M(()=>{U();j();
vendor: 19,202 bytes, line 82
82ve();re();z();cr=class extends v{_direction;constructor(e,t){super(e),this.affectsData=!1,this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=uy(this.editor.model,this._direction);e&&this.editor.model.change(t=>{t.setSelection(e)})}_checkEnabled(){return!!uy(this.editor.model,this._direction)}};gm="restricted-editing-exception_selected";fm="RestrictedEditingMode",bm=class extends f{_alwaysEnabled;_allowedInException;static get pluginName(){return"RestrictedEditingModeEditing"}static get licenseFeatureCode(){return"RED"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define("restrictedEditing",{allowedCommands:["bold","italic","link","unlink"],allowedAttributes:["bold","italic","linkHref"]}),this._alwaysEnabled=new Set(["undo","redo"]),this._allowedInException=new Set(["input","insertText","delete","deleteForward"])}init(){let e=this.editor,t=e.editing.view;e.config.get("restrictedEditing.allowedCommands").forEach(n=>this._allowedInException.add(n)),this._setupSchema(),this._setupConversion(),this._setupCommandsToggling(),this._setupRestrictions(),e.commands.add("goToPreviousRestrictedEditingException",new cr(e,"backward")),e.commands.add("goToNextRestrictedEditingException",new cr(e,"forward")),this.listenTo(t.document,"tab",(n,o)=>{let r=o.shiftKey?"goToPreviousRestrictedEditingException":"goToNextRestrictedEditingException";e.commands.get(r).isEnabled&&(e.execute(r),o.preventDefault(),o.stopPropagation()),n.stop()},{context:"$capture"}),this.listenTo(t.document,"keydown",Zx(e),{priority:"high"}),t.change(n=>{for(let o of t.document.roots)n.addClass("ck-restricted-editing_mode_restricted",o)}),e.data.on("set",()=>{e.model.change(n=>{for(let o of e.model.markers.getMarkersGroup("restrictedEditingException"))n.removeMarker(o.name)})},{priority:"high"})}enableCommand(e){this.editor.commands.get(e).clearForceDisabled(fm),this._alwaysEnabled.add(e)}_setupSchema(){this.editor.model.schema.register("restrictedEditingException",{allowWhere:"$block",allowContentOf:"$container",isLimit:!0})}_setupConversion(){let e=this.editor,i=e.model.document,n=0;e.conversion.for("upcast").add(dy({view:{name:"span",classes:"restricted-editing-exception"},model:()=>(n++,`restrictedEditingException:inline:${n}`)})),e.conversion.for("upcast").add(dy({view:{name:"div",classes:"restricted-editing-exception"},model:()=>(n++,`restrictedEditingException:block:${n}`),useWrapperElement:!0})),e.conversion.for("downcast").elementToElement({model:"restrictedEditingException",view:{name:"div",classes:"restricted-editing-exception"}}),e.conversion.for("downcast").add(o=>{o.on("addMarker:restrictedEditingException:inline",(r,l,a)=>{if(!l.item||l.item.is("selection")||!a.schema.isInline(l.item)||!a.consumable.consume(l.item,r.name))return;let c=a.writer,u=c.createAttributeElement("span",{class:"restricted-editing-exception"},{id:l.markerName,priority:-10}),d=a.mapper.toViewRange(l.range),m=c.wrap(d,u);for(let h of m.getItems())if(h.is("attributeElement")&&h.isSimilar(u)){a.mapper.bindElementToMarker(h,l.markerName);break}})}),e.conversion.for("downcast").markerToHighlight({model:"restrictedEditingException:inline",view:()=>({name:"span",classes:"restricted-editing-exception",priority:-10})}),e.conversion.for("editingDowncast").markerToElement({model:"restrictedEditingException:inline",view:(o,{writer:r})=>r.createUIElement("span",{class:"restricted-editing-exception restricted-editing-exception_collapsed"})}),e.conversion.for("dataDowncast").markerToElement({model:"restrictedEditingException:inline",view:(o,{writer:r})=>r.createEmptyElement("span",{class:"restricted-editing-exception"})}),i.registerPostFixer(Yx(e)),i.registerPostFixer(Xx(e)),i.registerPostFixer(nS(e)),Kx(e)}_setupRestrictions(){let e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view.document,o=e.plugins.get("ClipboardPipeline");this.listenTo(t,"deleteContent",tS(e),{priority:"high"});let r=e.commands.get("insertText");r&&this.listenTo(r,"execute",iS(e),{priority:"high"}),this.listenTo(o,"contentInsertion",(l,a)=>{wm(e,i.getFirstRange())||l.stop();let c=Qt(e,i.focus);if(c&&c.name.startsWith("restrictedEditingException:inline:")){let u=e.config.get("restrictedEditing.allowedAttributes");t.change(d=>{let m=d.createDocumentFragment(),h=Array.from(d.createRangeIn(a.content).getItems()).filter(g=>g.is("$textProxy"));for(let g of h){for(let p of g.getAttributeKeys())u.includes(p)||d.removeAttribute(p,g);d.append(g,m)}a.content=m})}}),this.listenTo(n,"clipboardOutput",(l,a)=>{a.method=="cut"&&!wm(e,i.getFirstRange())&&l.stop()},{priority:"high"}),t.schema.addChildCheck(l=>{if(l.startsWith("$clipboardHolder"))return!1},"restrictedEditingException")}_setupCommandsToggling(){let i=this.editor.model.document;this._disableCommands(),this.listenTo(i.selection,"change",this._checkCommands.bind(this)),this.listenTo(i,"change:data",this._checkCommands.bind(this))}_checkCommands(){let e=this.editor,t=e.model.document.selection;if(t.rangeCount>1){this._disableCommands();return}let i=Qt(e,t.focus);this._disableCommands(),Gx(t,e.model,i)&&this._enableCommands(i)}_enableCommands(e){let t=this.editor,i=t.model.document.selection;for(let[n,o]of t.commands)!o.affectsData||this._alwaysEnabled.has(n)||!e.name.startsWith("restrictedEditingException:block:")&&!this._allowedInException.has(n)||eS(n,i,Nn(e,t.model))||o.clearForceDisabled(fm)}_disableCommands(){let e=this.editor;for(let[t,i]of e.commands)!i.affectsData||this._alwaysEnabled.has(t)||i.forceDisabled(fm)}};_m=class extends f{static get pluginName(){return"RestrictedEditingModeUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.ui.componentFactory.add("restrictedEditing",i=>{let n=X(i),o=new ne;return this._getButtonDefinitions().forEach(({commandName:r,label:l,keystroke:a})=>{o.add(this._getButtonDefinition(r,l,a))}),be(n,o,{role:"menu"}),n.buttonView.set({label:t("Navigate editable regions"),icon:Xr,tooltip:!0,isEnabled:!0,isOn:!1}),this.listenTo(n,"execute",r=>{let{_commandName:l}=r.source;e.execute(l),e.editing.view.focus()}),n}),e.ui.componentFactory.add("menuBar:restrictedEditing",i=>{let n=new Ie(i),o=new He(i);return o.set({ariaLabel:t("Navigate editable regions"),role:"menu"}),n.buttonView.set({label:t("Navigate editable regions"),icon:Xr}),n.panelView.children.add(o),this._getButtonDefinitions().forEach(({commandName:r,label:l,keystroke:a})=>{let c=new De(i,n),u=this._createMenuBarButton(l,r,a);u.delegate("execute").to(n),c.children.add(u),o.items.add(c)}),n})}_createMenuBarButton(e,t,i){let n=this.editor,o=n.commands.get(t),r=new x(n.locale);return r.set({label:e,keystroke:i,isEnabled:!0,isOn:!1}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",()=>{n.execute(t),n.editing.view.focus()}),r}_getButtonDefinition(e,t,i){let o=this.editor.commands.get(e),r={type:"button",model:new we({label:t,withText:!0,keystroke:i,withKeystroke:!0,role:"menuitem",_commandName:e})};return r.model.bind("isEnabled").to(o,"isEnabled"),r}_getButtonDefinitions(){let e=this.editor.locale.t;return[{commandName:"goToPreviousRestrictedEditingException",label:e("Previous editable region"),keystroke:"Shift+Tab"},{commandName:"goToNextRestrictedEditingException",label:e("Next editable region"),keystroke:"Tab"}]}},my=class extends f{static get pluginName(){return"RestrictedEditingMode"}static get isOfficialPlugin(){return!0}static get requires(){return[bm,_m]}},km=class extends v{refresh(){let e=this.editor.model,t=e.document;this.value=!!t.selection.getAttribute("restrictedEditingException"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"restrictedEditingException")}execute(e={}){let t=this.editor.model,n=t.document.selection,o=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{let l=t.schema.getValidRanges(n.getRanges(),"restrictedEditingException");if(n.isCollapsed)if(o)r.setSelectionAttribute("restrictedEditingException",o);else{let a=m=>m.item.getAttribute("restrictedEditingException")===this.value,c=n.focus,u=c.getLastMatchingPosition(a,{direction:"backward"}),d=c.getLastMatchingPosition(a);r.removeSelectionAttribute("restrictedEditingException"),c.isEqual(u)||c.isEqual(d)||r.removeAttribute("restrictedEditingException",r.createRange(u,d))}else for(let a of l)o?r.setAttribute("restrictedEditingException",o,a):r.removeAttribute("restrictedEditingException",a)})}},ym=class extends v{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,i=t.schema,n=t.document.selection,o=Array.from(n.getSelectedBlocks()),r=e.forceValue===void 0?!this.value:e.forceValue;t.change(l=>{if(r){let a=o.filter(c=>pm(c)||gy(i,c));this._applyException(l,a)}else{let a=o.map(c=>oS(c)).filter(c=>!!c);this._removeException(l,a)}})}_getValue(){let e=this.editor.model.document.selection,t=O(e.getSelectedBlocks());return!!(t&&pm(t))}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,i=O(e.getSelectedBlocks());return i?gy(t,i):!1}_removeException(e,t){hy(e,t).reverse().forEach(i=>{if(i.start.isAtStart&&i.end.isAtEnd){e.unwrap(i.start.parent);return}if(i.start.isAtStart){let o=e.createPositionBefore(i.start.parent);e.move(i,o);return}i.end.isAtEnd||e.split(i.end);let n=e.createPositionAfter(i.end.parent);e.move(i,n)})}_applyException(e,t){let i=this.editor.model.schema,n=[];if(hy(e,t).reverse().forEach(o=>{let r=pm(o.start);r||(r=e.createElement("restrictedEditingException"),e.wrap(o,r)),n.push(r)}),n.reverse(),n.length){let o=n.at(0).previousSibling,r=n.at(-1).nextSibling;o?.is("element","restrictedEditingException")&&n.unshift(o),r?.is("element","restrictedEditingException")&&n.push(r)}n.reduce((o,r)=>o.nextSibling==r?(e.merge(e.createPositionAfter(o)),o):r),i.removeDisallowedAttributes(t,e)}};vm=class extends v{_inlineCommand;_blockCommand;constructor(e){super(e),this._inlineCommand=e.commands.get("restrictedEditingException"),this._blockCommand=e.commands.get("restrictedEditingExceptionBlock")}refresh(){this.value=this._inlineCommand.value||this._blockCommand.value,this.isEnabled=this._inlineCommand.isEnabled||this._blockCommand.isEnabled}execute(){let e=this.editor;if(this._inlineCommand.value)e.execute("restrictedEditingException");else if(this._blockCommand.value)e.execute("restrictedEditingExceptionBlock");else if(this._inlineCommand.isEnabled&&!this._blockCommand.isEnabled)e.execute("restrictedEditingException");else if(this._blockCommand.isEnabled&&!this._inlineCommand.isEnabled)e.execute("restrictedEditingExceptionBlock");else{let t=e.model.schema,i=e.model.document.selection,n=i.getSelectedElement();i.isCollapsed||n&&t.isObject(n)&&t.isBlock(n)||Cg(i.getSelectedBlocks())>1?e.execute("restrictedEditingExceptionBlock"):e.execute("restrictedEditingException")}}},Cm=class extends f{static get pluginName(){return"StandardEditingModeEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema;t.extend("$text",{allowAttributes:["restrictedEditingException"]}),t.register("restrictedEditingException",{allowWhere:"$container",allowContentOf:"$container"}),t.addChildCheck(i=>{for(let n of i)if(n.name=="restrictedEditingException")return!1},"restrictedEditingException"),t.addAttributeCheck(i=>{for(let n of i)if(n.name=="restrictedEditingException")return!1},"restrictedEditingException"),e.model.document.registerPostFixer(i=>{let n=e.model.document.differ.getChanges(),o=new Set,r=new Set,l=new Set,a=!1;for(let c of n)if(c.type=="insert"){let u=i.createRange(c.position,c.position.getShiftedBy(c.length));for(let d of u.getItems())d.is("element","restrictedEditingException")?t.checkChild(i.createPositionBefore(d),d)?d.isEmpty?r.add(d):l.add(d):o.add(d):d.is("$textProxy")&&d.hasAttribute("restrictedEditingException")&&!t.checkAttribute(d,"restrictedEditingException")&&(i.removeAttribute("restrictedEditingException",d),a=!0)}else if(c.type=="remove"){let u=c.position.parent;u.is("element","restrictedEditingException")&&u.isEmpty&&r.add(u);for(let d of u.getChildren())d.is("element","restrictedEditingException")&&l.add(d)}for(let c of o)i.unwrap(c),a=!0;for(let c of r)i.remove(c),a=!0;for(let c of l){if(c.root.rootName=="$graveyard")continue;let u=c.previousSibling,d=c.nextSibling;u&&u.is("element","restrictedEditingException")&&i.merge(i.createPositionBefore(c)),d&&d.is("element","restrictedEditingException")&&i.merge(i.createPositionAfter(c))}return a}),e.conversion.for("upcast").elementToAttribute({model:"restrictedEditingException",view:{name:"span",classes:"restricted-editing-exception"}}).elementToElement({model:"restrictedEditingException",view:{name:"div",classes:"restricted-editing-exception"}}),sS(e),e.conversion.for("downcast").attributeToElement({model:"restrictedEditingException",view:(i,{writer:n})=>{if(i)return n.createAttributeElement("span",{class:"restricted-editing-exception"},{priority:-10})}}).elementToElement({model:"restrictedEditingException",view:{name:"div",classes:"restricted-editing-exception"}}),e.commands.add("restrictedEditingException",new km(e)),e.commands.add("restrictedEditingExceptionBlock",new ym(e)),e.commands.add("restrictedEditingExceptionAuto",new vm(e)),e.editing.view.change(i=>{for(let n of e.editing.view.document.roots)i.addClass("ck-restricted-editing_mode_standard",n)})}};Im=class extends f{static get pluginName(){return"StandardEditingModeUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.ui.componentFactory;t.add("restrictedEditingException:dropdown",i=>{let n=X(i),o=i.t,r=[t.create("restrictedEditingException:inline"),t.create("restrictedEditingException:block")];for(let l of r)l.set({withText:!0,tooltip:!1});return ki(n,r,{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:o("Enable editing")}),n.buttonView.set({label:o("Enable editing"),icon:Yr,tooltip:!0}),n.extendTemplate({attributes:{class:"ck-restricted-editing-dropdown"}}),n.bind("isEnabled").toMany(r,"isEnabled",(...l)=>l.some(a=>a)),this.listenTo(n,"execute",()=>{e.editing.view.focus()}),n}),t.add("restrictedEditingException:inline",()=>{let i=this._createButton("restrictedEditingException",y);return i.set({tooltip:!0}),i}),t.add("restrictedEditingException:block",()=>{let i=this._createButton("restrictedEditingExceptionBlock",y);return i.set({tooltip:!0}),i}),t.add("menuBar:restrictedEditingException:inline",()=>this._createButton("restrictedEditingException",x)),t.add("menuBar:restrictedEditingException:block",()=>this._createButton("restrictedEditingExceptionBlock",x)),t.add("restrictedEditingException:auto",()=>{let i=this._createButton("restrictedEditingExceptionAuto",y);return i.set({tooltip:!0}),i}),t.add("menuBar:restrictedEditingException:auto",()=>this._createButton("restrictedEditingExceptionAuto",x)),t.add("restrictedEditingException",()=>t.create("restrictedEditingException:inline")),t.add("menuBar:restrictedEditingException",()=>t.create("menuBar:restrictedEditingException:inline"))}_createButton(e,t){let i=this.editor,n=i.locale,o=this.editor.commands.get(e),r=new t(n),l=n.t;return r.icon=Yr,r.isToggleable=!0,r.bind("isOn","isEnabled").to(o,"value","isEnabled"),e=="restrictedEditingExceptionAuto"?r.bind("label").to(o,"value",a=>l(a?"Disable editing":"Enable editing")):e=="restrictedEditingExceptionBlock"?r.bind("label").to(o,"value",a=>l(a?"Disable block editing":"Enable block editing")):r.bind("label").to(o,"value",a=>l(a?"Disable inline editing":"Enable inline editing")),this.listenTo(r,"execute",()=>{i.execute(e),i.editing.view.focus()}),r}},fy=class extends f{static get pluginName(){return"StandardEditingMode"}static get isOfficialPlugin(){return!0}static get requires(){return[Cm,Im]}}});var Tm,Am,Em,wy,_y=M(()=>{U();re();z();Tm=class extends v{constructor(e){super(e),this.affectsData=!1,this.value=!1}execute(){let e="ck-show-blocks",t=this.editor.editing.view;t.change(i=>{for(let n of t.document.roots)n.hasClass(e)?(i.removeClass(e,n),this.value=!1):(i.addClass(e,n),this.value=!0)})}},Am=class extends f{static get pluginName(){return"ShowBlocksEditing"}static get isOfficialPlugin(){return!0}init(){let{editor:e}=this;e.commands.add("showBlocks",new Tm(e))}},Em=class extends f{static get pluginName(){return"ShowBlocksUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add("showBlocks",()=>{let t=this._createButton(y);return t.set({tooltip:!0,icon:Rf}),t}),e.ui.componentFactory.add("menuBar:showBlocks",()=>this._createButton(x))}_createButton(e){let t=this.editor,i=t.locale,n=t.commands.get("showBlocks"),o=new e(i),r=i.t;return o.set({label:r("Show blocks"),isToggleable:!0,role:"menuitemcheckbox"}),o.bind("isEnabled").to(n),o.bind("isOn").to(n,"value",n,"isEnabled",(l,a)=>l&&a),this.listenTo(o,"execute",()=>{t.execute("showBlocks"),t.editing.view.focus()}),o}},wy=class extends f{static get pluginName(){return"ShowBlocks"}static get isOfficialPlugin(){return!0}static get requires(){return[Am,Em]}}});function rS(s){return lS(s)?Bg(s):s}function lS(s){return s.startsWith("<")}var ur,ky,yy=M(()=>{U();re();z();j();ur="SourceEditingMode",ky=class extends f{static get pluginName(){return"SourceEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[oi]}_elementReplacer;_replacedRoots;_dataFromRoots;constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new $o,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();let e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",()=>{let i=this._createButton(y);return i.set({label:t("Source"),icon:Ff,tooltip:!0,class:"ck-source-editing-button"}),i}),e.ui.componentFactory.add("menuBar:sourceEditing",()=>{let i=this._createButton(x);return i.set({label:t("Show source"),role:"menuitemcheckbox"}),i}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(i,n,o)=>{o?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(i,n,o)=>this._handleReadOnlyMode(!o)),this.listenTo(e,"change:isReadOnly",(i,n,o)=>this._handleReadOnlyMode(o))),e.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}updateEditorData(){let e=this.editor,t={};for(let[i,n]of this._replacedRoots){let o=this._dataFromRoots.get(i),r=n.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(){let e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new S("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some(n=>e.plugins.has(n))&&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 c
82ontains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){let e=this.editor,t=e.editing.view,i=e.model;i.change(n=>{n.setSelection(null),n.removeSelectionAttribute(i.document.selection.getAttributeKeys())});for(let[n,o]of t.domRoots){let r=rS(e.data.get({rootName:n})),l=Te(o.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),a=Te(o.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[l]);l.value=r,l.setSelectionRange(0,0),l.addEventListener("input",()=>{a.dataset.value=l.value,e.ui.update()}),t.change(c=>{let u=t.document.getRoot(n);c.addClass("ck-hidden",u)}),e.ui.setEditableElement("sourceEditing:"+n,l),this._replacedRoots.set(n,a),this._elementReplacer.replace(o,a),this._dataFromRoots.set(n,r)}this._hideDocumentOutline(),this._refreshAnnotationsVisibility(),this._focusSourceEditing()}_hideSourceEditing(){let t=this.editor.editing.view;this.updateEditorData(),t.change(i=>{for(let[n]of this._replacedRoots)i.removeClass("ck-hidden",t.document.getRoot(n))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),this._showDocumentOutline(),this._refreshAnnotationsVisibility(),t.focus()}_hideDocumentOutline(){this.editor.plugins.has("DocumentOutlineUI")&&(this.editor.plugins.get("DocumentOutlineUI").view.element.style.display="none")}_showDocumentOutline(){this.editor.plugins.has("DocumentOutlineUI")&&(this.editor.plugins.get("DocumentOutlineUI").view.element.style.display="")}_refreshAnnotationsVisibility(){this.editor.plugins.has("Annotations")&&this.editor.plugins.get("Annotations").refreshVisibility()}_focusSourceEditing(){let e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=!1,i.focus()}_disableCommands(){let e=this.editor;for(let t of e.commands.commands())t.forceDisabled(ur);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(ur)}_enableCommands(){let e=this.editor;for(let t of e.commands.commands())t.clearForceDisabled(ur);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(ur)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(let[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){let t=this.editor.ui.view.editable;return t&&!t.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){let e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}_createButton(e){let t=this.editor,i=new e(t.locale);return i.set({withText:!0,isToggleable:!0}),i.bind("isOn").to(this,"isSourceEditingMode"),i.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(oi),"hasAny",(n,o,r)=>!(!n||o||r)),this.listenTo(i,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),i}}});function aS(s){return s===null?"":"U+"+("0000"+s.codePointAt(0).toString(16)).slice(-4)}var Sm,Vm,Pm,Bm,xm,vy,Lm,Rm,Fm,Om,Dm,Cy,Iy=M(()=>{U();at();re();z();j();Sm=class extends P{tiles;focusTracker;keystrokes;constructor(e){super(e),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new J,this.keystrokes=new K,Dt({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>W.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(e,t){let i=new y(this.locale);return i.set({label:e,withText:!0,class:"ck-character-grid__tile"}),i.extendTemplate({attributes:{title:t},on:{mouseover:i.bindTemplate.to("mouseover"),focus:i.bindTemplate.to("focus")}}),i.on("mouseover",()=>{this.fire("tileHover",{name:t,character:e})}),i.on("focus",()=>{this.fire("tileFocus",{name:t,character:e})}),i.on("execute",()=>{this.fire("execute",{name:t,character:e})}),i}render(){super.render();for(let e of this.tiles)this.focusTracker.add(e.element);this.tiles.on("change",(e,{added:t,removed:i})=>{if(t.length>0)for(let n of t)this.focusTracker.add(n.element);if(i.length>0)for(let n of i)this.focusTracker.remove(n.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}},Vm=class extends P{constructor(e){super(e);let t=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",aS),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:t.to("name",i=>i||"\u200B")}]},{tag:"span",attributes:{class:["ck-character-info__code"]}
vendor: 8,995 bytes, line 82
82,children:[{text:t.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}};Pm=class extends P{items;focusTracker;keystrokes;_focusCycler;categoriesView;gridView;infoView;constructor(e,t,i,n){super(e),this.categoriesView=t,this.gridView=i,this.infoView=n,this.items=this.createCollection(),this.focusTracker=new J,this.keystrokes=new K,this._focusCycler=new me({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.categoriesView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.categoriesView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}},Bm=class extends P{_groupNames;_dropdownView;constructor(e,t){super(e),this.set("currentGroupName",Array.from(t.entries())[0][0]),this._groupNames=t,this._dropdownView=new H(e,yi),this.setTemplate({tag:"div",attributes:{class:["ck","ck-character-categories"]},children:[this._dropdownView]})}render(){super.render(),this._setupDropdown()}focus(){this._dropdownView.focus()}_setupDropdown(){let e=new ne;for(let[n,o]of this._groupNames){let r={type:"button",model:new we({name:n,label:o,role:"menuitemradio",withText:!0})};r.model.bind("isOn").to(this,"currentGroupName",l=>l===n),e.add(r)}let t=this.locale.t,i=t("Category");this._dropdownView.set({label:i,isEmpty:!1}),this._dropdownView.fieldView.panelPosition=this.locale.uiLanguageDirection==="rtl"?"se":"sw",this._dropdownView.fieldView.buttonView.set({withText:!0,tooltip:i,ariaLabel:i,ariaLabelledBy:void 0,isOn:!1}),this._dropdownView.fieldView.buttonView.bind("label").to(this,"currentGroupName",n=>this._groupNames.get(n)),this._dropdownView.fieldView.on("execute",({source:n})=>{this.currentGroupName=n.name}),be(this._dropdownView.fieldView,e,{ariaLabel:i,role:"menu"})}},xm="All",vy=class extends f{_characters;_groups;_allSpecialCharactersGroupLabel;static get requires(){return[$i,Nt]}static get pluginName(){return"SpecialCharacters"}static get licenseFeatureCode(){return"SCH"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e);let t=e.t;this._characters=new Map,this._groups=new Map,this._allSpecialCharactersGroupLabel=t("All")}init(){let e=this.editor;e.ui.componentFactory.add("specialCharacters",()=>{let t=this._createDialogButton(y);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:specialCharacters",()=>this._createDialogButton(x))}addItems(e,t,i={label:e}){if(e===xm)throw new S("special-character-invalid-group-name",null);let n=this._getGroup(e,i.label);for(let o of t)n.items.add(o.title),this._characters.set(o.title,o.character)}getGroups(){let e=Array.from(this._groups.keys()),t=this.editor.config.get("specialCharacters.order")||[],i=t.find(n=>!e.includes(n));if(i)throw new S("special-character-invalid-order-group-name",null,{invalidGroup:i});return new Set([...t,...e])}getCharactersForGroup(e){if(e===xm)return new Set(this._characters.keys());let t=this._groups.get(e);if(t)return t.items}getCharacter(e){return this._characters.get(e)}_getGroup(e,t){return this._groups.has(e)||this._groups.set(e,{items:new Set,label:t}),this._groups.get(e)}_updateGrid(e,t){t.tiles.clear();let i=this.getCharactersForGroup(e);for(let n of i){let o=this.getCharacter(n);t.tiles.add(t.createTile(o,n))}}_createDropdownPanelContent(e){let t=Array.from(this.getGroups()).map(l=>[l,this._groups.get(l).label]),i=new Map([[xm,this._allSpecialCharactersGroupLabel],...t]),n=new Bm(e,i),o=new Sm(e),r=new Vm(e);return o.on("tileHover",(l,a)=>{r.set(a)}),o.on("tileFocus",(l,a)=>{r.set(a)}),n.on("change:currentGroupName",(l,a,c)=>{this._updateGrid(c,o)}),this._updateGrid(n.currentGroupName,o),{categoriesView:n,gridView:o,infoView:r}}_createDialogButton(e){let t=this.editor,i=t.locale,n=new e(t.locale),o=t.commands.get("insertText"),r=i.t,l=this.editor.plugins.get("Dialog");return n.set({label:r("Special characters"),icon:Of,isToggleable:!0}),n.bind("isOn").to(l,"id",a=>a==="specialCharacters"),n.bind("isEnabled").to(o,"isEnabled"),n.on("execute",()=>{if(l.id==="specialCharacters"){l.hide();return}this._showDialog()}),n}_showDialog(){let e=this.editor,t=e.plugins.get("Dialog"),i=e.locale,n=i.t,{categoriesView:o,gridView:r,infoView:l}=this._createDropdownPanelContent(i),a=new Pm(i,o,r,l);r.on("execute",(c,u)=>{e.execute("insertText",{text:u.character})}),t.show({id:"specialCharacters",title:n("Special characters"),className:"ck-special-characters",content:a,position:zi.EDITOR_TOP_SIDE})}},Lm=class extends f{static get pluginName(){return"SpecialCharactersArrows"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Arrows",[{title:t("leftwards simple arrow"),character:"\u2190"},{title:t("rightwards simple arrow"),character:"\u2192"},{title:t("upwards simple arrow"),character:"\u2191"},{title:t("downwards simple arrow"),character:"\u2193"},{title:t("leftwards double arrow"),character:"\u21D0"},{title:t("rightwards double arrow"),character:"\u21D2"},{title:t("upwards double arrow"),character:"\u21D1"},{title:t("downwards double arrow"),character:"\u21D3"},{title:t("leftwards dashed arrow"),character:"\u21E0"},{title:t("rightwards dashed arrow"),character:"\u21E2"},{title:t("upwards dashed arrow"),character:"\u21E1"},{title:t("downwards dashed arrow"),character:"\u21E3"},{title:t("leftwards arrow to bar"),character:"\u21E4"},{title:t("rightwards arrow to bar"),character:"\u21E5"},{title:t("upwards arrow to bar"),character:"\u2912"},{title:t("downwards arrow to bar"),character:"\u2913"},{title:t("up down arrow with base"),character:"\u21A8"},{title:t("back with leftwards arrow above"),character:"\u{1F519}"},{title:t("end with leftwards arrow above"),character:"\u{1F51A}"},{title:t("on with exclamation mark with left right arrow above"),character:"\u{1F51B}"},{title:t("soon with rightwards arrow above"),character:"\u{1F51C}"},{title:t("top with upwards arrow above"),character:"\u{1F51D}"}],{label:t("Arrows")})}},Rm=class extends f{static get pluginName(){return"SpecialCharactersText"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Text",[{character:"\u2039",title:t("Single left-pointing angle quotation mark")},{character:"\u203A",title:t("Single right-pointing angle quotation mark")},{character:"\xAB",title:t("Left-pointing double angle quotation mark")},{character:"\xBB",title:t("Right-pointing double angle quotation mark")},{character:"\u2018",title:t("Left single quotation mark")},{character:"\u2019",title:t("Right single quotation mark")},{character:"\u201C",title:t("Left double quotation mark")},{character:"\u201D",title:t("Right double quotation mark")},{character:"\u201A",title:t("Single low-9 quotation mark")},{character:"\u201E",title:t("Double low-9 quotation mark")},{character:"\xA1",title:t("Inverted exclamation mark")},{character:"\xBF",title:t("Inverted question mark")},{character:"\u2025",title:t("Two dot leader")},{character:"\u2026",title:t("Horizontal ellipsis")},{character:"\u2021",title:t("Double dagger")},{character:"\u2030",title:t("Per mille sign")},{character:"\u2031",title:t("Per ten thousand sign")},{character:"\u203C",title:t("Double exclamation mark")},{character:"\u2048",title:t("Question exclamation mark")},{character:"\u2049",title:t("Exclamation question mark")},{character:"\u2047",title:t("Double question mark")},{character:"\xA9",title:t("Copyright sign")},{character:"\xAE",title:t("Registered sign")},{character:"\u2122",title:t("Trade mark sign")},{character:"\xA7",title:t("Section sign")},{character:"\xB6",title:t("Paragraph sign")},{character:"\u204B",title:t("Reversed paragraph sign")}],{label:t("Text")})}},Fm=class extends f{static get pluginName(){return"SpecialCharactersMathematical"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:t("Less-than sign")},{character:">",title:t("Greater-than sign")},{character:"\u2264",title:t("Less-than or equal to")},{character:"\u2265",title:t("Greater-than or equal to")},{character:"\u2013",title:t("En dash")},{character:"\u2014",title:t("Em dash")},{character:"\xAF",title:t("Macron")},{character:"\u203E",title:t("Overline")},{character:"\xB0",title:t("Degree sign")},{character:"\u2212",title:t("Minus sign")},{character:"\xB1",title:t("Plus-minus sign")},{character:"\xF7",title:t("Division sign")},{character:"\u2044",title:t("Fraction slash")},{character:"\xD7",title:t("Multiplication sign")},{character:"\u0192",title:t("Latin small letter f with hook")},{character:"\u222B",title:t("Integral")}
82,{character:"\u2211",title:t("N-ary summation")},{character:"\u221E",title:t("Infinity")},{character:"\u221A",title:t("Square root")},{character:"\u223C",title:t("Tilde operator")},{character:"\u2245",title:t("Approximately equal to")},{character:"\u2248",title:t("Almost equal to")},{character:"\u2260",title:t("Not equal to")},{character:"\u2261",title:t("Identical to")},{character:"\u2208",title:t("Element of")},{character:"\u2209",title:t("Not an element of")},{character:"\u220B",title:t("Contains as member")},{character:"\u220F",title:t("N-ary product")},{character:"\u2227",title:t("Logical and")},{character:"\u2228",title:t("Logical or")},{character:"\xAC",title:t("Not sign")},{character:"\u2229",title:t("Intersection")},{character:"\u222A",title:t("Union")},{character:"\u2202",title:t("Partial differential")},{character:"\u2200",title:t("For all")},{character:"\u2203",title:t("There exists")},{character:"\u2205",title:t("Empty set")},{character:"\u2207",title:t("Nabla")},{character:"\u2217",title:t("Asterisk operator")},{character:"\u221D",title:t("Proportional to")},{character:"\u2220",title:t("Angle")},{character:"\xBC",title:t("Vulgar fraction one quarter")},{character:"\xBD",title:t("Vulgar fraction one half")},{character:"\xBE",title:t("Vulgar fraction three quarters")}],{label:t("Mathematical")})}},Om=class extends f{static get pluginName(){return"SpecialCharactersLatin"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Latin",[{character:"\u0100",title:t("Latin capital letter a with macron")},{character:"\u0101",title:t("Latin small letter a with macron")},{character:"\u0102",title:t("Latin capital letter a with breve")},{character:"\u0103",title:t("Latin small letter a with breve")},{character:"\u0104",title:t("Latin capital letter a with ogonek")},{character:"\u0105",title:t("Latin small letter a with ogonek")},{character:"\u0106",title:t("Latin capital letter c with acute")},{character:"\u0107",title:t("Latin small letter c with acute")},{character:"\u0108",title:t("Latin capital letter c with circumflex")},{character:"\u0109",title:t("Latin small letter c with circumflex")},{character:"\u010A",title:t("Latin capital letter c with dot above")},{character:"\u010B",title:t("Latin small letter c with dot above")},{character:"\u010C",title:t("Latin capital letter c with caron")},{character:"\u010D",title:t("Latin small letter c with caron")},{character:"\u010E",title:t("Latin capital letter d with caron")},{character:"\u010F",title:t("Latin small letter d with caron")},{character:"\u0110",title:t("Latin capital letter d with stroke")},{character:"\u0111",title:t("Latin small letter d with stroke")},{character:"\u0112",title:t("Latin capital letter e with macron")},{character:"\u0113",title:t("Latin small letter e with macron")},{character:"\u0114",title:t("Latin capital letter e with breve")},{character:"\u0115",title:t("Latin small letter e with breve")},{character:"\u0116",title:t("Latin capital letter e with dot above")},{character:"\u0117",title:t("Latin small letter e with dot above")},{character:"\u0118",title:t("Latin capital letter e with ogonek")},{character:"\u0119",title:t("Latin small letter e with ogonek")},{character:"\u011A",title:t("Latin capital letter e with caron")},{character:"\u011B",title:t("Latin small letter e with caron")},{character:"\u011C",title:t("Latin capital letter g with circumflex")},{character:"\u011D",title:t("Latin small letter g with circumflex")},{character:"\u011E",title:t("Latin capital letter g with breve")},{character:"\u011F",title:t("Latin small letter g with breve")},{character:"\u0120",title:t("Latin capital letter g with dot above")},{character:"\u0121",title:t("Latin small letter g with dot above")},{character:"\u0122",title:t("Latin capital letter g with cedilla")},{character:"\u0123",title:t("Latin small letter g with cedilla")},{character:"\u0124",title:t("Latin capital letter h with circumflex")},{character:"\u0125",title:t("Latin small letter h with circumflex")},{character:"\u0126",title:t("Latin capital letter h with stroke")},{character:"\u0127",title:t("Latin small letter h with stroke")},{character:"\u0128",title:t("Latin capital letter i with tilde")}
82,{character:"\u0129",title:t("Latin small letter i with tilde")},{character:"\u012A",title:t("Latin capital letter i with macron")},{character:"\u012B",title:t("Latin small letter i with macron")},{character:"\u012C",title:t("Latin capital letter i with breve")},{character:"\u012D",title:t("Latin small letter i with breve")},{character:"\u012E",title:t("Latin capital letter i with ogonek")},{character:"\u012F",title:t("Latin small letter i with ogonek")},{character:"\u0130",title:t("Latin capital letter i with dot above")},{character:"\u0131",title:t("Latin small letter dotless i")},{character:"\u0132",title:t("Latin capital ligature ij")},{character:"\u0133",title:t("Latin small ligature ij")},{character:"\u0134",title:t("Latin capital letter j with circumflex")},{character:"\u0135",title:t("Latin small letter j with circumflex")},{character:"\u0136",title:t("Latin capital letter k with cedilla")},{character:"\u0137",title:t("Latin small letter k with cedilla")},{character:"\u0138",title:t("Latin small letter kra")},{character:"\u0139",title:t("Latin capital letter l with acute")},{character:"\u013A",title:t("Latin small letter l with acute")},{character:"\u013B",title:t("Latin capital letter l with cedilla")},{character:"\u013C",title:t("Latin small letter l with cedilla")},{character:"\u013D",title:t("Latin capital letter l with caron")},{character:"\u013E",title:t("Latin small letter l with caron")},{character:"\u013F",title:t("Latin capital letter l with middle dot")},{character:"\u0140",title:t("Latin small letter l with middle dot")},{character:"\u0141",title:t("Latin capital letter l with stroke")},{character:"\u0142",title:t("Latin small letter l with stroke")},{character:"\u0143",title:t("Latin capital letter n with acute")},{character:"\u0144",title:t("Latin small letter n with acute")},{character:"\u0145",title:t("Latin capital letter n with cedilla")},{character:"\u0146",title:t("Latin small letter n with cedilla")},{character:"\u0147",title:t("Latin capital letter n with caron")},{character:"\u0148",title:t("Latin small letter n with caron")},{character:"\u0149",title:t("Latin small letter n preceded by apostrophe")},{character:"\u014A",title:t("Latin capital letter eng")},{character:"\u014B",title:t("Latin small letter eng")},{character:"\u014C",title:t("Latin capital letter o with macron")},{character:"\u014D",title:t("Latin small letter o with macron")},{character:"\u014E",title:t("Latin capital letter o with breve")},{character:"\u014F",title:t("Latin small letter o with breve")},{character:"\u0150",title:t("Latin capital letter o with double acute")},{character:"\u0151",title:t("Latin small letter o with double acute")},{character:"\u0152",title:t("Latin capital ligature oe")},{character:"\u0153",title:t("Latin small ligature oe")},{character:"\u0154",title:t("Latin capital letter r with acute")},{character:"\u0155",title:t("Latin small letter r with acute")},{character:"\u0156",title:t("Latin capital letter r with cedilla")},{character:"\u0157",title:t("Latin small letter r with cedilla")},{character:"\u0158",title:t("Latin capital letter r with caron")},{character:"\u0159",title:t("Latin small letter r with caron")},{character:"\u015A",title:t("Latin capital letter s with acute")},{character:"\u015B",title:t("Latin small letter s with acute")},{character:"\u015C",title:t("Latin capital letter s with circumflex")},{character:"\u015D",title:t("Latin small letter s with circumflex")},{character:"\u015E",title:t("Latin capital letter s with cedilla")},{character:"\u015F",title:t("Latin small letter s with cedilla")},{character:"\u0160",title:t("Latin capital letter s with caron")},{character:"\u0161",title:t("Latin small letter s with caron")},{character:"\u0162",title:t("Latin capital letter t with cedilla")},{character:"\u0163",title:t("Latin small letter t with cedilla")},{character:"\u0164",title:t("Latin capital letter t with caron")},{character:"\u0165",title:t("Latin small letter t with caron")},{character:"\u0166",title:t("Latin capital letter t with stroke")},{character:"\u0167",title:t("Latin small letter t with stroke")},{character:"\u0168",title:t("Latin capital letter u with tilde")}
82,{character:"\u0169",title:t("Latin small letter u with tilde")},{character:"\u016A",title:t("Latin capital letter u with macron")},{character:"\u016B",title:t("Latin small letter u with macron")},{character:"\u016C",title:t("Latin capital letter u with breve")},{character:"\u016D",title:t("Latin small letter u with breve")},{character:"\u016E",title:t("Latin capital letter u with ring above")},{character:"\u016F",title:t("Latin small letter u with ring above")},{character:"\u0170",title:t("Latin capital letter u with double acute")},{character:"\u0171",title:t("Latin small letter u with double acute")},{character:"\u0172",title:t("Latin capital letter u with ogonek")},{character:"\u0173",title:t("Latin small letter u with ogonek")},{character:"\u0174",title:t("Latin capital letter w with circumflex")},{character:"\u0175",title:t("Latin small letter w with circumflex")},{character:"\u0176",title:t("Latin capital letter y with circumflex")},{character:"\u0177",title:t("Latin small letter y with circumflex")},{character:"\u0178",title:t("Latin capital letter y with diaeresis")},{character:"\u0179",title:t("Latin capital letter z with acute")},{character:"\u017A",title:t("Latin small letter z with acute")},{character:"\u017B",title:t("Latin capital letter z with dot above")},{character:"\u017C",title:t("Latin small letter z with dot above")},{character:"\u017D",title:t("Latin capital letter z with caron")},{character:"\u017E",title:t("Latin small letter z with caron")},{character:"\u017F",title:t("Latin small letter long s")}],{label:t("Latin")})}},Dm=class extends f{static get pluginName(){return"SpecialCharactersCurrency"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:t("Dollar sign")},{character:"\u20AC",title:t("Euro sign")},{character:"\xA5",title:t("Yen sign")},{character:"\xA3",title:t("Pound sign")},{character:"\xA2",title:t("Cent sign")},{character:"\u20A0",title:t("Euro-currency sign")},{character:"\u20A1",title:t("Colon sign")},{character:"\u20A2",title:t("Cruzeiro sign")},{character:"\u20A3",title:t("French franc sign")},{character:"\u20A4",title:t("Lira sign")},{character:"\xA4",title:t("Currency sign")},{character:"\u20BF",title:t("Bitcoin sign")},{character:"\u20A5",title:t("Mill sign")},{character:"\u20A6",title:t("Naira sign")},{character:"\u20A7",title:t("Peseta sign")},{character:"\u20A8",title:t("Rupee sign")},{character:"\u20A9",title:t("Won sign")},{character:"\u20AA",title:t("New sheqel sign")},{character:"\u20AB",title:t("Dong sign")},{character:"\u20AD",title:t("Kip sign")},{character:"\u20AE",title:t("Tugrik sign")},{character:"\u20AF",title:t("Drachma sign")},{character:"\u20B0",title:t("German penny sign")},{character:"\u20B1",title:t("Peso sign")},{character:"\u20B2",title:t("Guarani sign")},{character:"\u20B3",title:t("Austral sign")},{character:"\u20B4",title:t("Hryvnia sign")},{character:"\u20B5",title:t("Cedi sign")},{character:"\u20B6",title:t("Livre tournois sign")},{character:"\u20B7",title:t("Spesmilo sign")},{character:"\u20B8",title:t("Tenge sign")},{character:"\u20B9",title:t("Indian rupee sign")},{character:"\u20BA",title:t("Turkish lira sign")},{character:"\u20BB",title:t("Nordic mark sign")},{character:"\u20BC",title:t("Manat sign")},{character:"\u20BD",title:t("Ruble sign")}],{label:t("Currency")})}},Cy=class extends f{static get pluginName(){return"SpecialCharactersEssentials"}static get isOfficialPlugin(){return!0}static get requires(){return[Dm,Rm,Fm,Lm,Om]}}});function uS(s){return!!s.classes&&Array.isArray(s.classes)}function dS(s){return!cS.includes(s)}function Ty({element:s,classes:e}){return{name:s,classes:e}}function mS(s,e){return s.reduce((t,i)=>i.name===e.name?t:t.filter(n=>!i.classes.includes(n)),e.classes)}function hS(s){return"isBlock"in s}function gS(s){let e=Array.from(s.getSelectedBlocks());return e.length?e:[s.getFirstPosition().parent]}function Ay(s,e,t,i){let n=s.textNode||(t?s.nodeAfter:s.nodeBefore);if(!n||!n.hasAttribute(e))return s;let o=n.getAttribute(e);return vp(s,e,o,t,i)}function fS(s){for(let e=1;e<s.length;e++){let t=s[e-1].getJoined(s[e]);t&&s.splice(--e,2,t)}return s}var Nm,Mm,dr,Um,cS,xt,Hm,Wm,zm,$m,jm,qm,Ey,xy=M(()=>{U();z();j();Me();
vendor: 15,298 bytes, line 82
82at();Nm=class extends y{styleDefinition;previewView;constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){let e=new P(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}},Mm=class extends P{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new J,this.keystrokes=new K,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(let i of t){let n=new Nm(e,i);this.children.add(n)}this.on("change:activeStyles",()=>{for(let i of this.children)i.isOn=this.activeStyles.includes(i.styleDefinition.name)}),this.on("change:enabledStyles",()=>{for(let i of this.children)i.isEnabled=this.enabledStyles.includes(i.styleDefinition.name)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(let e of this.children)this.focusTracker.add(e.element);Dt({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}},dr=class extends P{gridView;labelView;constructor(e,t,i){super(e),this.labelView=new Ae(e),this.labelView.text=t,this.gridView=new Mm(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}},Um=class extends P{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);let i=e.t;this.focusTracker=new J,this.keystrokes=new K,this.children=this.createCollection(),this.blockStylesGroupView=new dr(e,i("Block styles"),t.block),this.inlineStylesGroupView=new dr(e,i("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new ye,this._focusCycler=new me({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()}},cS=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"],xt=class extends f{_htmlSupport;static get pluginName(){return"StyleUtils"}static get isOfficialPlugin(){return!0}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=[]){let i={block:[],inline:[]};for(let n of t){let o=[],r=[];for(let a of e.getDefinitionsForView(n.element)){let c="appliesToBlock"in a?a.appliesToBlock:!1;if(a.isBlock||c){if(typeof c=="string")o.push(c);else if(a.isBlock){let u=a;o.push(a.model),u.paragraphLikeModel&&o.push(u.paragraphLikeModel)}}else r.push(a.model)}let l=this.getStylePreview(n,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);o.length?i.block.push(N(I({},n),{previewTemplate:l,modelElements:o,isBlock:!0})):i.inline.push(N(I({},n),{previewTemplate:l,ghsAttributes:r}))}return i}isStyleEnabledForBlock(e,t){let i=this.editor.model,n=this._htmlSupport.getGhsAttributeNameForElement(e.element);return i.schema.checkAttribute(t,n)?e.modelElements.includes(t.name):!1}isStyleActiveForBlock(e,t){let i=this._htmlSupport.getGhsAttributeNameForElement(e.element),n=t.getAttribute(i);return this.hasAllClasses(n,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){let i=this.editor.model;for(let n of e.ghsAttributes)if(i.schema.checkAttributeInSelection(t,n))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(let i of e.ghsAttributes){let n=this._getValueFromFirstAllowedNode(t,i);if(this.hasAllClasses(n,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){let{element:i,classes:n}=e;return{tag:dS(i)?i:"div",attributes:{class:n},children:t}}hasAllClasses(e,t){return Ni(e)&&uS(e)&&t.every(i=>e.classes.includes(i))}configureGHSDataFilter({block:e,inline:t}){let i=this.editor.plugins.get("DataFilter");i.loadAllowedConfig(e.map(Ty)),i.loadAllowedConfig(t.map(Ty))}_getValueFromFirstAllowedNode(e,t){let n=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(let o of e.getRanges())for(let r of o.getItems())if(n.checkAttribute(r,t))return r.getAttribute(t);return null}};Hm=class extends f{static get pluginName(){return"StyleUI"}static get isOfficialPlugin(){return!0}static get requires(){return[xt]}init(){let e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),n=e.config.get("style.definitions"),o=i.normalizeConfig(t,n);e.ui.componentFactory.add("style",r=>{let l=r.t,a=X(r),c=e.commands.get("style");return a.once("change:isOpen",()=>{let u=new Um(r,o);a.panelView.children.add(u),u.delegate("execute").to(a),u.bind("activeStyles").to(c,"value"),u.bind("enabledStyles").to(c,"enabledStyles")}),a.bind("isEnabled").to(c),a.buttonView.withText=!0,a.buttonView.bind("label").to(c,"value",u=>u.length>1?l("Multiple styles"):u.length===1?u[0]:l("Styles")),a.bind("class").to(c,"value",u=>{let d=["ck-style-dropdown"];return u.length>1&&d.push("ck-style-dropdown_multiple-active"),d.join(" ")}),a.on("execute",u=>{e.execute("style",{styleName:u.source.styleDefinition.name}),e.editing.view.focus()}),a})}},Wm=class extends v{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(xt)}refresh(){let e=this.editor.model,t=e.document.selection,i=new Set,n=new Set;for(let r of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(r,t)&&n.add(r.name),this._styleUtils.isStyleActiveForInlineSelection(r,t)&&i.add(r.name);let o=O(t.getSelectedBlocks())||t.getFirstPosition().parent;if(o){let r=o.getAncestors({includeSelf:!0,parentFirst:!0});for(let l of r){if(l.is("rootElement"))break;for(let a of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(a,l)&&(n.add(a.name),this._styleUtils.isStyleActiveForBlock(a,l)&&i.add(a.name));if(e.schema.isObject(l))break}}this.enabledStyles=Array.from(n).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(i).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e)){Q("style-command-executed-with-incorrect-style-name");return}let i=this.editor.model,n=i.document.selection,o=this.editor.plugins.get("GeneralHtmlSupport"),r=[...this._styleDefinitions.inline,...this._styleDefinitions.block],l=r.filter(({name:u})=>this.value.includes(u)),a=r.find(({name:u})=>u==e),c=t===void 0?!this.value.includes(a.name):t;i.change(()=>{let u;hS(a)?u=this._findAffectedBlocks(gS(n),a):u=[this._styleUtils.getAffectedInlineSelectable(a,n)];for(let d of u)c?o.addModelHtmlClass(a.element,a.classes,d):o.removeModelHtmlClass(a.element,mS(l,a),d)})}_findAffectedBlocks(e,t){let i=new Set;for(let n of e){let o=n.getAncestors({includeSelf:!0,parentFirst:!0});for(let r of o){if(r.is("rootElement"))break;let l=this._styleUtils.getAffectedBlocks(t,r);if(l){for(let a of l)i.add(a);break}}}return i}};zm=class extends f{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return"ListStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[xt,"GeneralHtmlSupport"]}init(){let e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(xt),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[i,n])=>{this._isStyleEnabledForBlock(i,n)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(t,[i,n])=>{this._isStyleActiveForBlock(i,n)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[i,n])=>{let o=this._getAffectedBlocks(i,n);o&&(t.return=o,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(t,[i,n])=>{let o=this._getStylePreview(i,n);o&&(t.return=o,t.stop())},{priority:"high"}))}_isStyleEnabledForBlock(e,t){let i=this.editor.model;if(!["ol","ul","li"].includes(e.element)||!this._listUtils.isListItemBlock(t))return!1;let n=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(e.element=="ol"||e.element=="ul"){if(!i.schema.checkAttribute(t,n))return!1;let r=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==r}else return i.schema.checkAttribute(t,n)}_isStyleActiveForBlock(e,t){let i=this._htmlSupport.getGhsAttributeNameForElement(e.element),n=t.getAttribute(i);return this._styleUtils.hasAllClasses(n,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?e.element=="li"?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){let{element:i,classes:n}=e;return i=="ol"||i=="ul"?{tag:i,attributes:{class:n},children:[{tag:"li",children:t}]}:i=="li"?{tag:"ol",children:[{tag:i,attributes:{class:n},children:t}]}:null}},$m=class extends f{_tableUtils;_styleUtils;static get pluginName(){return"TableStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[xt]}init(){let e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(xt),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[i,n])=>{this._isApplicable(i,n)&&(t.return=this._isStyleEnabledForBlock(i,n),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[i,n])=>{this._isApplicable(i,n)&&(t.return=this._getAffectedBlocks(i,n),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(t,[{block:i}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(i.filter(o=>o.element=="figcaption").map(o=>({name:"caption",classes:o.classes})))}))}_isApplicable(e,t){return["td","th"].includes(e.element)?t.name=="tableCell":["thead","tbody"].includes(e.element)?t.name=="table":!1}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){let i=this._tableUtils.getCellLocation(t),o=t.parent.parent,r=o.getAttribute("headingRows")||0,l=o.getAttribute("headingColumns")||0,a=i.row<r||i.column<l;return e.element=="th"?a:!a}if(["thead","tbody"].includes(e.element)){let i=t.getAttribute("headingRows")||0;return e.element=="thead"?i>0:i<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}},jm=class extends f{_styleUtils;_htmlSupport;static get pluginName(){return"LinkStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[xt,"GeneralHtmlSupport"]}init(){let e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(xt),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(t,[i,n])=>{i.element=="a"&&(t.return=this._isStyleEnabled(i,n),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(t,[i,n])=>{i.element=="a"&&(t.return=this._isStyleActive(i,n),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(t,[i,n])=>{if(i.element!="a")return;let o=this._getAffectedSelectable(i,n);o&&(t.return=o,t.stop())},{priority:"high"}))}_isStyleEnabled(e,t){let i=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(let n of t.getRanges())for(let o of n.getItems())if((o.is("$textProxy")||i.schema.isInline(o))&&o.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){let i=this.editor.model,n=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){let o=t.getAttribute(n);if(this._styleUtils.hasAllClasses(o,e.classes))return!0}return!1}for(let o of t.getRanges())for(let r of o.getItems())if((r.is("$textProxy")||i.schema.isInline(r))&&r.hasAttribute("linkHref")){let l=r.getAttribute(n);return this._styleUtils.hasAllClasses(l,e.classes)}return!1}_getAffectedSelectable(e,t){let i=this.editor.model;if(t.isCollapsed){let o=t.getAttribute("linkHref");return _n(t.getFirstPosition(),"linkHref",o,i)}let n=[];for(let o of t.getRanges()){let r=i.createRange(Ay(o.start,"linkHref",!0,i),Ay(o.end,"linkHref",!1,i));for(let l of r.getItems())(l.is("$textProxy")||i.schema.isInline(l))&&l.hasAttribute("linkHref")&&n.push(this.editor.model.createRangeOn(l))}return fS(n)}};qm=class extends f{static get pluginName(){return"StyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["GeneralHtmlSupport",xt,zm,$m,jm]}init(){let e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),n=e.config.get("style.definitions"),o=i.normalizeConfig(t,n);e.commands.add("style",new Wm(e,o)),i.configureGHSDataFilter(o)}},Ey=class extends f{static get pluginName(){return"Style"}static get isOfficialPlugin(){return!0}static get requires(){return[qm,Hm]}}});function ig(s,e){let{modelAttribute:t,styleName:i,attributeName:n,attributeType:o,viewElement:r,defaultValue:l,shouldUpcast:a=()=>!0,reduceBoxSides:c=!1}=e;s.for("upcast").attributeToAttribute({view:{name:r,styles:{[i]:/[\s\S]+/}},model:{key:t,value:(u,d,m)=>{if(!a(u))return;let h=St(l,"",m),g=u.getNormalizedStyle(i),p=c?_r(g):g;if(h!==p)return p;d.consumable.consume(u,{styles:i})}}}),n&&s.for("upcast").attributeToAttribute({view:{name:r,attributes:{[n]:/.+/}},model:{key:t,value:(u,d,m)=>
82{if(u.name=="figure"||u.hasStyle(i)||u.name=="table"&&u.parent.name=="figure"&&u.parent.hasStyle(i))return;let h=St(l,"",m),g=u.getAttribute(n);if(g&&o=="length"){let p=parseFloat(g);isNaN(p)?g=h:g=p+(g.includes("%")?"%":"px")}if(h!==g)return g;d.consumable.consume(u,{attributes:n})}}})}function Ym(s,e,t,i){let{conversion:n}=s;n.for("upcast").add(o=>o.on("element:"+e,(r,l,a)=>{if(!l.modelRange)return;let c=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(b=>l.viewItem.hasStyle(b));if(!c.length)return;let u={styles:c};if(!a.consumable.test(l.viewItem,u))return;let d=[...l.modelRange.getItems({shallow:!0})].pop(),m=d.findAncestor("table",{includeSelf:!0}),h=i;m&&m.getAttribute("tableType")=="layout"&&(h={style:"none",color:"",width:""}),a.consumable.consume(l.viewItem,u);let g={style:l.viewItem.getNormalizedStyle("border-style"),color:l.viewItem.getNormalizedStyle("border-color"),width:l.viewItem.getNormalizedStyle("border-width")},p={style:_r(g.style),color:_r(g.color),width:_r(g.width)};p.style!==h.style&&a.writer.setAttribute(t.style,p.style,d),p.color!==h.color&&a.writer.setAttribute(t.color,p.color,d),p.width!==h.width&&a.writer.setAttribute(t.width,p.width,d)})),s.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&n.for("upcast").add(o=>{o.on(`element:${e}`,(r,l,a)=>{let{modelRange:c,viewItem:u}=l,d=u.is("element","table")?u:u.findAncestor("table");if(!a.consumable.test(d,{attributes:"border"})||d.getAttribute("border")!=="0")return;let m=c?.start?.nodeAfter;!m||Object.values(t).some(h=>m.hasAttribute(h))||(a.writer.setAttribute(t.style,"none",m),u.is("element","table")&&a.consumable.consume(u,{attributes:"border"}))})})}function Ro(s,e){let{modelElement:t,modelAttribute:i,styleName:n}=e;s.for("downcast").attributeToAttribute({model:{name:t,key:i},view:o=>({key:"style",value:{[n]:o}})})}function wr(s,e){let{modelAttribute:t,styleName:i}=e;s.for("downcast").add(n=>n.on(`attribute:${t}:table`,(o,r,l)=>{let{item:a,attributeNewValue:c}=r,{mapper:u,writer:d}=l;if(!l.consumable.consume(r.item,o.name))return;let m=[...u.toViewElement(a).getChildren()].find(h=>h.is("element","table"));c?d.setStyle(i,c,m):d.removeStyle(i,m)}))}function St(s,e,t){let i=t.modelRange&&O(t.modelRange.getItems({shallow:!0})),n=i&&i.is("element")&&i.findAncestor("table",{includeSelf:!0});return n&&n.getAttribute("tableType")==="layout"?e:s}function _r(s){if(!s)return;let e=["top","right","bottom","left"];if(!e.every(o=>s[o]))return s;let i=s.top;return e.every(o=>s[o]===i)?i:s}function Se(s,e,t,i,n=1){e!=null&&n!==void 0&&n!==null&&e>n?i.setAttribute(s,e,t):i.removeAttribute(s,t)}function Fi(s,e,t={}){let i=s.createElement("tableCell",t);return s.insertElement("paragraph",i),s.insert(i,e),i}function Jm(s,e){let t=e.parent.parent,i=parseInt(t.getAttribute("headingColumns")||"0"),{column:n}=s.getCellLocation(e);return!!i&&n<i}function kr(s,e,t){let{modelAttribute:i}=t;s.extend("tableCell",{allowAttributes:[i]}),s.setAttributeProperties(i,{isFormatting:!0}),ig(e,I({viewElement:/^(td|th)$/},t)),Ro(e,I({modelElement:"tableCell"},t))}function Vt(s){let e=s.getSelectedElement();return e&&e.is("element","table")?e:s.getFirstPosition().findAncestor("table")}function _S(s){let e=new Map;for(let t of s){let i=t.findAncestor("table");e.has(i)||e.set(i,[]),e.get(i).push(t)}return e}function Mn({table:s,row:e,column:t}){let i=new $(s,{row:e,column:t});for(let{cell:n}of i)if(n.getAttribute("tableCellType")!=="header")return!1;return!0}function di(s){let{model:e,config:t}=s;return e.schema.checkAttribute("tableCell","tableCellType")&&t.get("experimentalFlags.tableCellTypeSupport")===!0}function av(s,e,t){let{startRow:i,startColumn:n,endRow:o,endColumn:r}=e,l=t.createElement("table"),a=s.getAttribute("tableType");a&&t.setAttribute("tableType",a,l);let c=o-i+1;for(let d=0;d<c;d++)t.insertElement("tableRow",l,"end");let u=[...new $(s,{startRow:i,endRow:o,startColumn:n,endColumn:r,includeAllSlots:!0})];for(let{row:d,column:m,cell:h,isAnchor:g,cellAnchorRow:p,cellAnchorColumn:b}of u){let w=d-i,k=l.getChild(w);if(!g)(p<i||b<n)&&Fi(t,t.createPositionAt(k,"end"));else{let T=t.cloneElement(h);t.append(T,k),hv(T,d,m,o,r,t)}}return kS(l,s,i,n,t),l}function cv(s,e,t=0){let i=[],n=new $(s,{startRow:t,endRow:e-1});for(let o of n){let{row:r,cellHeight:l}=o,a=r+l-1;r<e&&e<=a&&i.push(o)}return i}function uv(s,e,t){let i=s.parent,n=i.parent,o=i.index,r=parseInt(s.getAttribute("rowspan")),l=e-o,a={},c=r-l;c>1&&(a.rowspan=c);let u=parseInt(s.getAttribute("colspan")||"1");u>1&&(a.colspan=u);let d=o,m=d+l,h=[...new $(n,{startRow:d,endRow:m,includeAllSlots:!0})],g=null,p;for(let b of h){let{row:w,column:k,cell:T}=b;T===s&&p===void 0&&(p=k),p!==void 0&&p===k&&w===m&&(g=Fi(t,b.getPositionBefore(),a))}return Se("rowspan",l,s,t),g}function dv(s,e){let t=[],i=new $(s);for(let n of i){let{column:o,cellWidth:r}=n,l=o+r-1;o<e&&e<=l&&t.push(n)}return t}function mv(s,e,t,i){let n=parseInt(s.getAttribute("colspan")),o=t-e,r={},l=n-o;l>1&&(r.colspan=l);let a=parseInt(s.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);let c=Fi(i,i.createPositionAfter(s),r);return Se("colspan",o,s,i),c}function hv(s,e,t,i,n,o){let r=parseInt(s.getAttribute("colspan")||"1"),l=parseInt(s.getAttribute("rowspan")||"1");if(t+r-1>n){let u=n-t+1;Se("colspan",u,s,o,1)}if(e+l-1>i){let u=i-e+1;Se("rowspan",u,s,o,1)}}function kS(s,e,t,i,n){let o=parseInt(e.getAttribute("headingRows")||"0");if(o>0){let l=o-t;Se("headingRows",l,s,n,0)}let r=parseInt(e.getAttribute("headingColumns")||"0");if(r>0){let l=r-i;Se("headingColumns",l,s,n,0)}}function Zm(s,e){let t=e.getColumns(s),i=new Array(t).fill(0);for(let{column:o}of new $(s))i[o]++;let n=i.reduce((o,r,l)=>r?o:[...o,l],[]);if(n.length>0){let o=n[n.length-1];return e.removeColumns(s,{at:o}),!0}return!1}function eh(s,e){let t=[],i=e.getRows(s);for(let n=0;n<i;n++)s.getChild(n).isEmpty&&t.push(n);if(t.length>0){let n=t[t.length-1];return e.removeRows(s,{at:n}),!0}return!1}function ng(s,e){Zm(s,e)||eh(s,e)}
vendor: 4,473 bytes, line 82
82function gv(s,e){let t=Array.from(new $(s,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:o})=>o===1))return e.lastRow;let n=t[0].cellHeight-1;return e.lastRow+n}function fv(s,e){let t=Array.from(new $(s,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:o})=>o===1))return e.lastColumn;let n=t[0].cellWidth-1;return e.lastColumn+n}function pv(s){for(let e of s.getChildren())if(e.is("element","table"))return e}function yS(){return s=>{s.on("element:figure",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;let n=pv(t.viewItem);if(!n||!i.consumable.test(n,{name:!0}))return;i.consumable.consume(t.viewItem,{name:!0,classes:"table"});let o=i.convertItem(n,t.modelCursor),r=O(o.modelRange.getItems());if(!r||!r.is("element","table")){i.consumable.revert(t.viewItem,{name:!0,classes:"table"}),o.modelRange&&!o.modelRange.isCollapsed&&(t.modelRange=o.modelRange,t.modelCursor=o.modelCursor);return}i.convertChildren(t.viewItem,i.writer.createPositionAt(r,"end")),i.updateConversionResult(r,t)})}}function vS(){return s=>{s.on("element:table",(e,t,i)=>{let n=t.viewItem;if(!i.consumable.test(n,{name:!0}))return;let{rows:o,headingRows:r,headingColumns:l}=IS(n),a={};l&&(a.headingColumns=l),r&&(a.headingRows=r);let c=i.writer.createElement("table",a);if(i.safeInsert(c,t.modelCursor)){if(i.consumable.consume(n,{name:!0}),o.forEach(u=>i.convertItem(u,i.writer.createPositionAt(c,"end"))),i.convertChildren(n,i.writer.createPositionAt(c,"end")),c.isEmpty){let u=i.writer.createElement("tableRow");i.writer.insert(u,i.writer.createPositionAt(c,"end")),Fi(i.writer,i.writer.createPositionAt(u,"end"))}i.updateConversionResult(c,t)}})}}function CS(){return s=>{s.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&t.modelCursor.index==0&&e.stop()},{priority:"high"})}}function Sy(s){return e=>{e.on(`element:${s}`,(t,i,{writer:n})=>{if(!i.modelRange)return;let o=i.modelRange.start.nodeAfter,r=n.createPositionAt(o,0);if(i.viewItem.isEmpty){n.insertElement("paragraph",r);return}let l=Array.from(o.getChildren());if(l.every(a=>a.is("element","$marker"))){let a=n.createElement("paragraph");n.insert(a,n.createPositionAt(o,0));for(let c of l)n.move(n.createRangeOn(c),n.createPositionAt(a,"end"))}},{priority:"low"})}}function IS(s){let e,t=!0,i=[],n=[],o;for(let l of Array.from(s.getChildren())){if(l.name!=="tbody"&&l.name!=="thead"&&l.name!=="tfoot")continue;l.name==="thead"&&!o&&(t=!0,o=l);let a=Array.from(l.getChildren()).filter(u=>u.is("element","tr")),c=null;for(let u of a){let d=Array.from(u.getChildren()).filter(m=>m.is("element","td")||m.is("element","th"));o&&l===o||l.name==="tbody"&&d.length>0&&(c===null||d.length===c)&&d.every(m=>m.is("element","th"))&&t?(i.push(u),t=!0):(n.push(u),t=!1),c=Math.max(c||0,d.length)}}let r=TS(n);for(let l of r){let a=0;for(;a<l.length&&l[a]?.name==="th";)a+=1;(e===void 0||a<e)&&(e=a)}return{headingRows:i.length,headingColumns:e||0,rows:[...i,...n]}}function TS(s){let e=new Map,t=0,i=s.map(n=>{let o=[],r=Array.from(n.getChildren()).filter(a=>a.name==="th"||a.name==="td"),l=new Map;for(;r.length||o.length<t;){let a=e.get(o.length);if(a&&a.remaining>0)o.push(a.cell);else{let c=r.shift();if(c){let u=parseInt(c.getAttribute("colspan")||"1"),d=parseInt(c.getAttribute("rowspan")||"1");for(let m=0;m<u;m++)d>1&&l.set(o.length,{cell:c,remaining:d-1}),o.push(c)}else{o.push(null);continue}}}for(let[a,c]of e.entries())c.remaining-=1,c.remaining>0&&!l.has(a)&&l.set(a,c);return e=l,t=Math.max(t,o.length),o});for(let n of i)for(;n.length<t;)n.push(null);return i}function nn(s){if(!s||!Ni(s))return s;let{top:e,right:t,bottom:i,left:n}=s;if(e==t&&t==i&&i==n)return e}function on(s,e){let t=parseFloat(s);return Number.isNaN(t)||String(t)!==String(s)?s:`${t}${e}`}function zn(s,e={}){let t=I({borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:""},s);return e.includeAlignmentProperty&&!t.alignment&&(t.alignment="center"),e.includePaddingProperty&&!t.padding&&(t.padding=""),e.includeVerticalAlignmentProperty&&!t.verticalAlignment&&(t.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!t.horizontalAlignment&&(t.horizontalAlignment=e.isRightToLeftContent?"right":"left"),t}function Pr(s,e){return zn(I({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px"},s),e)}function Br(s,e){return zn(I({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px"},s),e)}
82function Vy(s,e){return(t,{writer:i})=>{let n=t.getAttribute("headingRows")||0,o=i.createContainerElement("table",null,[]),r=i.createContainerElement("figure",{class:"table"},o);n>0&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("thead",null,i.createSlot(l=>l.is("element","tableRow")&&l.index<n))),n<s.getRows(t)&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("tbody",null,i.createSlot(l=>l.is("element","tableRow")&&l.index>=n)));for(let{positionOffset:l,filter:a}of e.additionalSlots)i.insert(i.createPositionAt(o,l),i.createSlot(a));return i.insert(i.createPositionAt(o,"after"),i.createSlot(l=>l.is("element","tableRow")?!1:!e.additionalSlots.some(({filter:a})=>a(l)))),e.asWidget?ES(r,i):r}}function AS(){return(s,{writer:e})=>s.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}function Py(s){return(t,{writer:i})=>{if(s.cellTypeEnabled?.()){let d=t.getAttribute("tableCellType")==="header"?"th":"td";return e(i,d)}let n=t.parent,o=n.parent,r=o.getChildIndex(n),l=new $(o,{row:r}),a=o.getAttribute("headingRows")||0,c=o.getAttribute("headingColumns")||0,u=null;for(let d of l)if(d.cell==t){let m=d.row<a||d.column<c;u=e(i,m?"th":"td");break}return u};function e(t,i){return s.asWidget?ao(t.createEditableElement(i),t,{withAriaRole:!1}):t.createContainerElement(i)}}function By(s={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!bv(e))return null;if(s.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{let i=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,i),i}}}function bv(s){return s.parent.childCount==1&&!xS(s)}function ES(s,e){return e.setCustomProperty("table",!0,s),We(s,e,{hasSelectionHandle:!0})}function xS(s){for(let e of s.getAttributeKeys())if(!(e.startsWith("selection:")||e=="htmlEmptyBlock"))return!0;return!1}function SS(s){return(e,t)=>{let i=s.plugins.has("PlainTableOutput"),n=t.options.isClipboardPipeline,o=s.config.get("experimentalFlags.useExtendedTableBlockAlignment"),r=og(s,e);return i||r||o&&n?PS(e,t,s):null}}function VS(s){return(e,{writer:t,options:i})=>{let n=s.plugins.has("PlainTableOutput"),o=i.isClipboardPipeline,r=s.config.get("experimentalFlags.useExtendedTableBlockAlignment"),l=og(s,e);return(n||l||r&&o)&&e.parent.name==="table"?t.createContainerElement("caption"):null}}function PS(s,e,t){let i=e.writer,n=s.getAttribute("headingRows")||0,o=i.createSlot(m=>m.is("element","tableRow")&&m.index<n),r=i.createSlot(m=>m.is("element","tableRow")&&m.index>=n),l=i.createSlot(m=>!m.is("element","tableRow")),a=i.createContainerElement("thead",null,o),c=i.createContainerElement("tbody",null,r),u=[];n&&u.push(a),n<s.childCount&&u.push(c);let d={class:"table"};if(t.plugins.has("TablePropertiesEditing")&&e.options.isClipboardPipeline){let m=Pr(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),h=s.getAttribute("tableAlignment"),g=m.alignment;s.getAttribute("tableType")==="layout"&&(g="");let p=h||g;p&&(d.class+=" "+mr[p].className,d.style=mr[p].style,mr[p].align!==void 0&&(d.align=mr[p].align))}return i.createContainerElement("table",d,[l,...u])}function BS(s){let e={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(let[t,i]of Object.entries(e))s.conversion.for("dataDowncast").add(n=>n.on(`attribute:${i}:table`,(o,r,l)=>{let{item:a,attributeNewValue:c}=r,{mapper:u,writer:d}=l,m=s.plugins.has("PlainTableOutput"),h=l.options.isClipboardPipeline,g=s.config.get("experimentalFlags.useExtendedTableBlockAlignment"),p=og(s,a);if(!(m||p||g&&h)||!l.consumable.consume(a,o.name))return;let b=u.toViewElement(a);c?d.setStyle(t,c,b):d.removeStyle(t,b)},{priority:"high"}))}function og(s,e){let t=s.plugins.has("TableLayoutEditing"),i=s.config.get("table.tableLayout.stripFigureFromContentTable")??!0,o=e.findAncestor("table",{includeSelf:!0})?.getAttribute("tableType");return t&&(i||o==="layout")}function LS(s,e){let t=s.getFirstPosition().parent,i=t===t.root?t:t.parent;return e.checkChild(i,"table")}function RS(s,e,t){let n=s.parent.parent,o=e=="right"?s.nextSibling:s.previousSibling,r=(n.getAttribute("headingColumns")||0)>0;if(!o)return;let l=e=="right"?s:o,a=e=="right"?o:s,{column:c}
82=t.getCellLocation(l),{column:u}=t.getCellLocation(a),d=parseInt(l.getAttribute("colspan")||"1"),m=Jm(t,l),h=Jm(t,a);return r&&m!=h?void 0:c+d===u?o:void 0}function FS(s,e,t){let i=s.parent,n=i.parent,o=n.getChildIndex(i);if(e=="down"&&o===t.getRows(n)-1||e=="up"&&o===0)return null;let r=parseInt(s.getAttribute("rowspan")||"1"),l=n.getAttribute("headingRows")||0,a=e=="down"&&o+r===l,c=e=="up"&&o===l;if(l&&(a||c))return null;let u=parseInt(s.getAttribute("rowspan")||"1"),d=e=="down"?o+u:o,m=[...new $(n,{endRow:d})],g=m.find(b=>b.cell===s).column,p=m.find(({row:b,cellHeight:w,column:k})=>k!==g?!1:e=="down"?b===d:d===b+w);return p&&p.cell?p.cell:null}function OS(s,e,t){Ly(s)||(Ly(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(s),t.createPositionAt(e,"end"))),t.remove(s)}function Ly(s){let e=s.getChild(0);return s.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function DS(s,e,t,i){let n=s.getChild(Math.min(e,i-1)),o=n.getChild(0),r=0;for(let l of n.getChildren()){if(r>t)return o;o=l,r+=parseInt(l.getAttribute("colspan")||"1")}return o}function NS(s,e,t,i){return parseInt(t.getAttribute("colspan")||"1")>1?t:e.previousSibling||t.nextSibling?t.nextSibling||e.previousSibling:i.first?s.reverse().find(({column:o})=>o<i.first).cell:s.reverse().find(({column:o})=>o>i.last).cell}function MS(s,e){let t=e.getSelectionAffectedTableCells(s),i=t[0],n=t.pop(),o=[i,n];return i.isBefore(n)?o:o.reverse()}function zS(s){let e=new Set;for(let t of s.document.differ.getChanges()){let i=null;switch(t.type){case"insert":i=["table","tableRow","tableCell"].includes(t.name)?t.position:null;break;case"remove":i=["tableRow","tableCell"].includes(t.name)?t.position:null;break;case"attribute":t.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(t.range.start.nodeAfter.name)?t.range.start:null);break}if(!i)continue;let n=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAncestor("table");for(let o of s.createRangeOn(n).getItems())o.is("element","table")&&Oo(o)&&e.add(o)}return e}function $S(s,e){return rh*100/wv(s,e)}function wv(s,e){let t=Ry(s,"tbody",e)||Ry(s,"thead",e),i=e.editing.view.domConverter.mapViewToDom(t);return lh(i)}function Ry(s,e,t){return[...[...t.editing.mapper.toViewElement(s).getChildren()].find(o=>o.is("element","table")).getChildren()].find(o=>o.is("element",e))}function lh(s){let e=W.window.getComputedStyle(s);return e.boxSizing==="border-box"?parseFloat(e.width)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderLeftWidth)-parseFloat(e.borderRightWidth):parseFloat(e.width)}function jS(s,e){let t=e.getCellLocation(s).column,i=s.getAttribute("colspan")||1;return{leftEdge:t,rightEdge:t+i-1}}function st(s){let e=Math.pow(10,HS),t=typeof s=="number"?s:parseFloat(s);return Math.round(t*e)/e}function qS(s,e,t){return s<=e?st(e):s>=t?st(t):st(s)}function GS(s,e){return Array(s).fill(e)}function Fo(s){return s.map(e=>typeof e=="number"?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function sg(s){let e=s.map(n=>n==="auto"||n===void 0?"auto":parseFloat(n.replace("%",""))),t=KS(e),i=Fo(t);return i!==100&&(t=t.map(n=>st(n*100/i)).map((n,o,r)=>{if(!(o===r.length-1))return n;let a=Fo(r);return st(n+100-a)})),t.map(n=>n+"%")}function KS(s){let e=s.filter(n=>n==="auto").length;if(e===0)return s.map(n=>st(n));let t=Fo(s),i=Math.max((100-t)/e,US);return s.map(n=>n==="auto"?i:n).map(n=>st(n))}function XS(s){let e=W.window.getComputedStyle(s);return e.boxSizing==="border-box"?parseInt(e.width):parseFloat(e.width)+parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderWidth)}function _v(s,e,t,i){for(let n=0;n<Math.max(t.length,s.length);n++){let o=s[n],r=t[n];r?o?i.setAttribute("columnWidth",r,o):i.appendElement("tableColumn",{columnWidth:r},e):i.remove(o)}}function Oo(s){if(s.is("element","tableColumnGroup"))return s;let e=s.getChildren();return Array.from(e).find(t=>t.is("element","tableColumnGroup"))}function Do(s){let e=Oo(s);return e?Array.from(e.getChildren()):[]}function YS(s){return Do(s).map(e=>e.getAttribute("columnWidth"))}function QS(s,e){return Do(s).reduce((i,n)=>{let o=n.getAttribute("columnWidth"),r=n.getAttribute("colSpan");if(!r)return i.push(o),i;for(let l=0;l<r;l++)i.push(o);return e.removeAttribute("colSpan",n),i},[])}function Gm(s,e,t,i,n,o={}){let r=[];for(let l=0;l<i;l++){let a=s.createElement("tableRow");s.insert(a,e,t),r.push(Un(n,s,s.createPositionAt(a,"end"),o))}return r}function Un(s,e,t,i={}){let n=[],o=t;for(let r=0;r<s;r++){let l=Fi(e,o,i);n.push(l),o=e.createPositionAfter(l)}return n}function Fy(s,e){if(s<e)return{newCellsSpan:1,updatedSpan:1};let t=Math.floor(s/e),i=s-t*e+t;return{newCellsSpan:t,updatedSpan:i}}function JS(s,e,t){let i=s.getAttribute("headingColumns")||0;if(i&&e.first<i){let n=Math.min(i-1,e.last)-e.first+1;t.setAttribute("headingColumns",i-n,s)}}function ZS(s,{first:e,last:t},i){let n=s.getAttribute("headingRows")||0;if(e<n){let o=t<n?n-(t-e+1):e;Se("headingRows",o,s,i,0)}}function eV(s,{first:e,last:t}){let i=new Map,n=[];for(let{row:o,column:r,cellHeight:l,cell:a}of new $(s,{endRow:t})){let c=o+l-1;if(o>=e&&o<=t&&c>t){let m=t-o+1,h=l-m;i.set(r,{cell:a,rowspan:h})}if(o<e&&c>=e){let m;c>=t?m=t-e+1:m=c-e+1,n.push({cell:a,rowspan:l-m})}}return{cellsToMove:i,cellsToTrim:n}}function tV(s,e,t,i){let o=[...new $(s,{includeAllSlots:!0,row:e})],r=s.getChild(e),l;for(let{column:a,cell:c,isAnchor:u}of o)if(t.has(a)){let{cell:d,rowspan:m}=t.get(a),h=l?i.createPositionAfter(l):i.createPositionAt(r,0);i.move(i.createRangeOn(d),h),Se("rowspan",m,d,i),l=d}else u&&(l=c)}function iV(s,e){let t=s.start,i=e.start;return t.isBefore(i)?-1:1}function nV(s,e){let t=Array.from(s.values()),i=Array.from(e.values()),n=Math.max(...t),o=Math.min(...t),r=Math.max(...i),l=Math.min(...i);return(n-o+1)*(r-l+1)}function hr({writer:s,table:e,row:t,column:i,cell:n}){let o=e.getAttribute("headingRows")||0,r=e.getAttribute("headingColumns")||0;t>=o&&i>=r?s.removeAttribute("tableCellType",n):s.setAttribute("tableCellType","header",n)}function oV(s,e,t){Oy(s)||(Oy(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(s),t.createPositionAt(e,"end"))),t.remove(s)}function Oy(s){let e=s.getChild(0);return s.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function sV(s,e,t){let i=0,n=0;for(let c of e){let{row:u,column:d}=t.getCellLocation(c);i=Dy(c,d,i,"colspan"),n=Dy(c,u,n,"rowspan")}let{row:o,column:r}=t.getCellLocation(s),l=i-r,a=n-o;return{mergeWidth:l,mergeHeight:a}}function Dy(s,e,t,i){let n=parseInt(s.getAttribute(i)||"1");return Math.max(t,e+n)}function rV(s){s.document.registerPostFixer(e=>lV(e,s))}function lV(s,e){let t=e.document.differ.getChanges(),i=!1,n=new Set;for(let o of t){let r=null;o.type=="insert"&&o.name=="table"&&(r=o.position.nodeAfter),(o.type=="insert"||o.type=="remove")&&(o.name=="tableRow"||o.name=="tableCell")&&(r=o.position.findAnce
82stor("table")),mV(o)&&(r=o.range.start.findAncestor("table")),r&&!n.has(r)&&(i=aV(r,s)||i,i=cV(r,s)||i,n.add(r))}return i}function aV(s,e){let t=!1,i=uV(s);if(i.length){t=!0;for(let n of i)Se("rowspan",n.rowspan,n.cell,e,1)}return t}function cV(s,e){let t=!1,i=dV(s),n=[];for(let[a,c]of i.entries())!c&&s.getChild(a).is("element","tableRow")&&n.push(a);if(n.length){t=!0;for(let a of n.reverse())e.remove(s.getChild(a)),i.splice(a,1)}let o=i.filter((a,c)=>s.getChild(c).is("element","tableRow")),r=o[0];if(!o.every(a=>a===r)){let a=o.reduce((c,u)=>u>c?u:c,0);for(let[c,u]of o.entries()){let d=a-u;if(d){for(let m=0;m<d;m++)Fi(e,e.createPositionAt(s.getChild(c),"end"));t=!0}}}return t}function uV(s){let e=parseInt(s.getAttribute("headingRows")||"0"),t=Array.from(s.getChildren()).reduce((n,o)=>o.is("element","tableRow")?n+1:n,0),i=[];for(let{row:n,cell:o,cellHeight:r}of new $(s)){if(r<2)continue;let a=n<e?e:t;if(n+r>a){let c=a-n;i.push({cell:o,rowspan:c})}}return i}function dV(s){let e=new Array(s.childCount).fill(0);for(let{rowIndex:t}of new $(s,{includeAllSlots:!0}))e[t]++;return e}function mV(s){if(s.type!=="attribute")return!1;let e=s.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}function hV(s){s.document.registerPostFixer(e=>gV(e,s))}function gV(s,e){let t=e.document.differ.getChanges(),i=!1;for(let n of t)n.type=="insert"&&n.name=="table"&&(i=fV(n.position.nodeAfter,s)||i),n.type=="insert"&&n.name=="tableRow"&&(i=kv(n.position.nodeAfter,s)||i),n.type=="insert"&&n.name=="tableCell"&&(i=dh(n.position.nodeAfter,s)||i),(n.type=="remove"||n.type=="insert")&&pV(n)&&(i=dh(n.position.parent,s)||i);return i}function fV(s,e){let t=!1;for(let i of s.getChildren())i.is("element","tableRow")&&(t=kv(i,e)||t);return t}function kv(s,e){let t=!1;for(let i of s.getChildren())t=dh(i,e)||t;return t}function dh(s,e){if(s.childCount==0)return e.insertElement("paragraph",s),!0;let t=Array.from(s.getChildren()).filter(i=>i.is("$text"));for(let i of t)e.wrap(e.createRangeOn(i),"paragraph");return!!t.length}function pV(s){return s.position.parent.is("element","tableCell")?s.type=="insert"&&s.name=="$text"||s.type=="remove":!1}function bV(s,e){let t=s.document.differ;for(let i of t.getChanges()){let n,o=!1;if(i.type=="attribute"){let c=i.range.start.nodeAfter;if(!c||!c.is("element","table")||i.attributeKey!="headingRows"&&i.attributeKey!="headingColumns")continue;n=c,o=i.attributeKey=="headingRows"}else(i.name=="tableRow"||i.name=="tableCell")&&(n=i.position.findAncestor("table"),o=i.name=="tableRow");if(!n)continue;let r=n.getAttribute("headingRows")||0,l=n.getAttribute("headingColumns")||0,a=new $(n);for(let c of a){let d=c.row<r||c.column<l?"th":"td",m=e.mapper.toViewElement(c.cell);m&&m.is("element")&&m.name!=d&&e.reconvertItem(o?c.cell.parent:c.cell)}}}function wV(s,e){let t=s.document.differ,i=new Set;for(let n of t.getChanges()){let o=n.type=="attribute"?n.range.start.parent:n.position.parent;o.is("element","tableCell")&&i.add(o)}for(let n of i.values()){let o=Array.from(n.getChildren()).filter(r=>_V(r,e.mapper));for(let r of o)e.reconvertItem(r)}}function _V(s,e){if(!s.is("element","paragraph"))return!1;let t=e.toViewElement(s);return t?bv(s)!==t.is("element","span"):!1}function Ny(s){return e=>{let t=parseInt(e.getAttribute(s));return Number.isNaN(t)||t<=0?null:t}}function kV(s,e,t,i){if(s.type==="button"||s.type==="switchbutton"){let n=s.model=new we(s.model),{commandName:o,bindIsOn:r}=s.model,l=e.commands.get(o);t.push(l),n.set({commandName:o}),n.bind("isEnabled").to(l),r&&n.bind("isOn").to(l,"value"),n.set({withText:!0})}i.add(s)}function yV(s,e,t,i){let n=s[0].findAncestor("table"),o=i.getColumnIndexes(s),r=i.getRowIndexes(s),l={firstColumn:o.first,lastColumn:o.last,firstRow:r.first,lastRow:r.last},a=s.length===1;return a&&(l.lastRow+=e.height-1,l.lastColumn+=e.width-1,vV(n,l.lastRow+1,l.lastColumn+1,i)),a||!i.isSelectionRectangular(s)?IV(n,l,t):(l.lastRow=gv(n,l),l.lastColumn=fv(n,l)),l}function vV(s,e,t,i){let n=i.getColumns(s),o=i.getRows(s);t>n&&i.insertColumns(s,{at:n,columns:t-n}),e>o&&i.insertRows(s,{at:o,rows:e-o})}function CV(s,e,t){let i=new Array(t).fill(null).map(()=>new Array(e).fill(null));for(let{column:n,row:o,cell:r}of new $(s))i[o][n]=r;return i}function IV(s,e,t){let{firstRow:i,lastRow:n,firstColumn:o,lastColumn:r}=e,l={first:i,last:n},a={first:o,last:r};fh(s,o,l,t),fh(s,r+1,l,t),gh(s,i,a,t),gh(s,n+1,a,t,i)}function gh(s,e,t,i,n=0){return e<1?void 0:cv(s,e,n).filter(({column:l,cellWidth:a})=>yv(l,a,t)).map(({cell:l})=>uv(l,e,i))}function fh(s,e,t,i){return e<1?void 0:dv(s,e).filter(({row:r,cellHeight:l})=>yv(r,l,t)).map(({cell:r,column:l})=>mv(r,l,e,i))}function yv(s,e,t){let i=s+e-1,{first:n,last:o}=t,r=s>=n&&s<=o,l=s<n&&i>=n;return r||l}function My(s,e){return s.parent.parent==e.parent.parent}function tn(s){let e=vv(s);return e||No(s)}function vv(s){let e=s.getSelectedElement();return e&&Cv(e)?e:null}function No(s){let e=s.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&Cv(t))return t;t=t.parent}return null}function Cv(s){return s.is("element")&&!!s.getCustomProperty("table")&&Ht(s)}function Wy(s){return s.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}function lg(s){return{none:s("None"),solid:s("Solid"),dotted:s("Dotted"),dashed:s("Dashed"),double:s("Double"),groove:s("Groove"),ridge:s("Ridge"),inset:s("Inset"),outset:s("Outset")}}
vendor: 5,844 bytes, line 82
82function Lr(s){return s('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Rr(s){return s('The value is invalid. Try "10px" or "2em" or simply "2".')}function Li(s){return s=s.trim().toLowerCase(),rg(s)||Gg(s)}function Zt(s){return s=s.trim(),rg(s)||Tv(s)||Xn(s)||Ko(s)}function Fr(s){return s=s.trim(),rg(s)||Tv(s)||Xn(s)}function Iv(s,e){let t=new ne,i=lg(s.t);for(let n in i){let o={type:"button",model:new we({_borderStyleValue:n,label:i[n],role:"menuitemradio",withText:!0})};n==="none"?o.model.bind("isOn").to(s,"borderStyle",r=>e==="none"?!r:r===n):o.model.bind("isOn").to(s,"borderStyle",r=>r===n),t.add(o)}return t}function _h(s){let{view:e,icons:t,toolbar:i,labels:n,propertyName:o,nameToValue:r,defaultValue:l}=s;for(let a in n){let c=new y(e.locale);c.set({role:"radio",isToggleable:!0,label:n[a],icon:t[a],tooltip:n[a]});let u=r?r(a):a;c.bind("isOn").to(e,o,d=>{let m=d;return d===""&&l&&(m=l),u===m}),c.on("execute",()=>{!l&&u&&e[o]===u?e[o]=void 0:e[o]=u}),i.items.add(c)}}function Ar(s){return(e,t,i)=>{let n=new Tr(e.locale,{colorDefinitions:TV(s.colorConfig),columns:s.columns,defaultColorValue:s.defaultColorValue,colorPickerConfig:s.colorPickerConfig});return n.inputView.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",o=>!o),n.bind("hasError").to(e,"errorText",o=>!!o),n.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused").to(n),n}}function Tv(s){let e=parseFloat(s);return!Number.isNaN(e)&&s===String(e)}function TV(s){return s.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))}function gr(s){return s!=="none"}function Or(s,e){let t=s.plugins.get("ContextualBalloon"),i=s.editing.view.document.selection,n;e==="cell"?No(i)&&(n=cg(s)):tn(i)&&(n=ag(s)),n&&t.updatePosition(n)}function ag(s){let e=s.model.document.selection,t=Vt(e),i=s.editing.mapper.toViewElement(t);return{target:s.editing.view.domConverter.mapViewToDom(i),positions:yh}}function cg(s){let e=s.editing.mapper,t=s.editing.view.domConverter,i=s.model.document.selection;if(i.rangeCount>1)return{target:()=>AV(i.getRanges(),s),positions:yh};let n=Av(i.getFirstPosition()),o=e.toViewElement(n);return{target:t.mapViewToDom(o),positions:yh}}function Av(s){return s.nodeAfter&&s.nodeAfter.is("element","tableCell")?s.nodeAfter:s.findAncestor("tableCell")}function AV(s,e){let t=e.editing.mapper,i=e.editing.view.domConverter,n=Array.from(s).map(o=>{let r=Av(o.start),l=t.toViewElement(r);return new ie(i.mapViewToDom(l))});return ie.getBoundingRect(n)}function Ev(s,e,t){let i=!1;for(let n of t){let o=n.getAttribute("headingRows")||0,r=n.getAttribute("headingColumns")||0,l=r>o;if(l){let c=Km(s,n,"column",r,o);c!==r&&(s.setHeadingColumnsCount(e,n,c,{shallow:!0}),r=c,i=!0)}let a=Km(s,n,"row",o,r);if(a!==o&&(s.setHeadingRowsCount(e,n,a,{shallow:!0}),o=a,i=!0),!l){let c=Km(s,n,"column",r,o);c!==r&&(s.setHeadingColumnsCount(e,n,c,{shallow:!0}),i=!0)}}return i}function Km(s,e,t,i,n){let o=t==="row"?s.getRows(e):s.getColumns(e),r=i;for(let l=0;l<o;l++){let a=new $(e,{[t]:l}),c=!0,u=!1;for(let{cell:d,row:m,column:h}of a){if(d.getAttribute("tableCellType")!=="header"){c=!1;break}(t==="row"?h:m)>=n&&(u=!0)}if(!c)return Math.min(r,l);u&&(r=Math.max(r,l+1))}return Math.min(r,o)}function xV(s,e){let{conversion:t}=s,{schema:i}=s.model,n={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};i.extend("tableCell",{allowAttributes:Object.values(n)});for(let o of Object.values(n))i.setAttributeProperties(o,{isFormatting:!0});Ym(s,"td",n,e),Ym(s,"th",n,e),Ro(t,{modelElement:"tableCell",modelAttribute:n.style,styleName:"border-style"}),Ro(t,{modelElement:"tableCell",modelAttribute:n.color,styleName:"border-color"}),Ro(t,{modelElement:"tableCell",modelAttribute:n.width,styleName:"border-width"})}function SV(s,e,t){s.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),s.setAttributeProperties("tableCellHorizontalAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:i=>({key:"style",value:{"text-align":i}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":jy}},model:{key:"tableCellHorizontalAlignment",value:(i,n,o)=>{let r=St(t,"left",o),l=i.getStyle("text-align");if(l!==r)return l;n.consumable.consume(i,{styles:"text-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:jy}},model:{key:"tableCellHorizontalAlignment",value:(i,n,o)=>{let r=St(t,"left",o),l=i.getAttribute("align");if(l!==r)return l;n.consumable.consume(i,{attributes:"align"})}}})}function VV(s,e,t){s.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),s.setAttributeProperties("tableCellVerticalAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:i=>({key:"style",value:{"vertical-align":i}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":$y}},model:{key:"tableCellVerticalAlignment",value:(i,n,o)=>{let r=St(t,"middle",o),l=i.getStyle("vertical-align");if(l!==r)return l;n.consumable.consume(i,{styles:"vertical-align"})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:$y}},model:{key:"tableCellVerticalAlignment",value:(i,n,o)=>{let r=St(t,"middle",o),l=i.getAttribute("valign");if(l!==r)return l;n.consumable.consume(i,{attributes:"valign"})}}})}function PV(s){let{model:e,conversion:t,editing:i}=s,{schema:n}=e,o=s.plugins.get(Ee);n.extend("tableCell",{allowAttributes:["tableCellType"]}),n.setAttributeProperties("tableCellType",{isFormatting:!0}),n.addAttributeCheck(r=>{if(Array.from(r).reverse().find(a=>a.name==="table")?.getAttribute("tableType")==="layout")return!1},"tableCellType"),t.for("upcast").add(r=>{r.on("element:th",(l,a,c)=>
vendor: 4,866 bytes, line 82
82{let{writer:u}=c,{modelRange:d}=a,m=d?.start.nodeAfter;m?.is("element","tableCell")&&u.setAttribute("tableCellType","header",m)}),r.on("element:table",(l,a,c)=>{let{writer:u}=c,{modelRange:d}=a,m=d?.start.nodeAfter;if(m?.is("element","table")&&m.getAttribute("tableType")==="layout"){for(let{cell:h}of new $(m))if(h.getAttribute("tableCellType")==="header"){u.setAttribute("tableType","content",m);break}}},{priority:Le.low-1})}),e.document.registerPostFixer(r=>{let l=e.document.differ.getChanges(),a=new Set;for(let c of l){if(c.type==="attribute"&&(c.attributeKey==="headingRows"||c.attributeKey==="headingColumns")){let u=c.range.start.nodeAfter;u?.is("element","table")&&u.root.rootName!=="$graveyard"&&a.add(u)}if(c.type==="attribute"&&c.attributeKey==="tableCellType"){let u=c.range.start.nodeAfter;if(u?.is("element","tableCell")&&u.root.rootName!=="$graveyard"){let d=u.findAncestor("table");d&&a.add(d)}}if(c.type==="insert"&&c.position.nodeAfter){for(let{item:u}of e.createRangeOn(c.position.nodeAfter))if(u.is("element","tableCell")&&u.getAttribute("tableCellType")&&u.root.rootName!=="$graveyard"){let d=u.findAncestor("table");d&&a.add(d)}}}return Ev(o,r,a)}),e.document.on("change:data",()=>{let{differ:r}=e.document,l=new Set;for(let a of r.getChanges())if(a.type==="attribute"&&a.attributeKey==="tableCellType"){let c=a.range.start.nodeAfter;c.is("element","tableCell")&&l.add(c)}for(let a of l){let c=i.mapper.toViewElement(a),d=a.getAttribute("tableCellType")==="header"?"th":"td";c?.name!==d&&i.reconvertItem(a)}})}function Gy(s,e){let t=s.t,i=s.locale,n=s.commands.get("tableType"),o=X(i,e),r=BV(s);return be(o,r,{ariaLabel:t("Table type options"),role:"menu"}),e.tooltip=t("Choose table type"),o.on("execute",l=>{let a=l.source.tableType;a&&n.execute(a)}),o}function BV(s){let e=s.t,t=s.commands.get("tableType"),i=new ne;return i.add(Ky(t,"layout",e("Layout table"))),i.add(Ky(t,"content",e("Content table"))),i}function Ky(s,e,t){let i=new we({label:t,role:"menuitemradio",withText:!0,tableType:e});return i.bind("isEnabled").to(s,"isEnabled"),i.bind("isOn").to(s,"value",n=>n===e),{type:"button",model:i}}function LV(s,e){let t=s.getFirstPosition().parent,i=t===t.root?t:t.parent;return e.checkChild(i,"table")}function RV(s){return e=>e.on("element:colgroup",(t,i,n)=>{let o=i.modelCursor.findAncestor("table"),r=Oo(o);if(!r)return;let l=Do(r),a=s.getColumns(o),c=QS(r,n.writer);c=Array.from({length:a},(u,d)=>c[d]||"auto"),(c.length!=l.length||c.includes("auto"))&&_v(l,r,sg(c),n.writer)},{priority:"low"})}function FV(){return s=>s.on("insert:table",(e,t,i)=>{let n=i.writer,o=t.item,r=i.mapper.toViewElement(o),l=r.is("element","table")?r:Array.from(r.getChildren()).find(c=>c.is("element","table"));Oo(o)?n.addClass("ck-table-resized",l):n.removeClass("ck-table-resized",l)},{priority:"low"})}function OV(){return s=>{s.on("element:table",(e,t,i)=>{i.consumable.consume(t.viewItem,{classes:"ck-table-resized"})})}}function NV(s,e){return t=>{t.on("element:table",(i,n,o)=>{let r=n.viewItem;if(!o.consumable.test(r,{name:!0})||Yy(r,e)=="content")return;let a=o.writer.createElement("table",{tableType:"layout"});if(o.safeInsert(a,n.modelCursor)){o.consumable.consume(r,{name:!0}),o.consumable.consume(r,{attributes:["role"]}),o.consumable.consume(r,{classes:["layout-table"]}),s.config.get("experimentalFlags.upcastTableBorderZeroAttributes")&&r.getAttribute("border")==="0"&&o.consumable.consume(r,{attributes:["border"]});for(let c of r.getChildren())if(c.is("element"))for(let u of c.getChildren())u.is("element","tr")&&o.convertItem(u,o.writer.createPositionAt(a,"end"));if(o.convertChildren(r,o.writer.createPositionAt(a,"end")),a.isEmpty){let c=o.writer.createElement("tableRow");o.writer.insert(c,o.writer.createPositionAt(a,"end")),Fi(o.writer,o.writer.createPositionAt(c,"end"))}o.updateConversionResult(a,n)}},{priority:"high"}),t.on("element:table",(i,n,o)=>{let{viewItem:r,modelRange:l}=n;l&&(o.writer.setAttribute("tableType",Yy(r,e),l),o.consumable.consume(r,{classes:["layout-table"]}),o.consumable.consume(r,{classes:["content-table"]}))},{priority:"low"})}}function MV(){return s=>s.on("attribute:tableType:table",(e,t,i)=>{let{item:n,attributeNewValue:o}=t,{mapper:r,writer:l}=i;if(!i.consumable.test(n,e.name))return;let a=r.toViewElement(n);l.addClass(`${o}-table`,a),o=="layout"&&l.setAttribute("role","presentation",a),i.consumable.consume(n,e.name)})}function Yy(s,e){return s.hasClass("content-table")?"content":s.hasClass("layout-table")?"layout":e&&DV.includes(e)?e:s.parent.is("element","figure")||Array.from(s.getChildren()).some(i=>i.is("element","caption"))?"content":"layout"}function Xm(s){if(s.endsWith("table")&&s.last.getAttribute("tableType")=="layout")return!1}function UV(s,e){if(!s.is("element","table"))return;let t=s.getAttribute("align"),i=s.getStyle("float"),n=s.getStyle("margin-left"),o=s.get
82Style("margin-right");if(t&&t==="center"||i&&i==="right"&&t&&t==="right"){Jy(e,t,s);return}i===void 0&&n==="auto"&&o==="0"&&Jy(e,"right",s)}function Jy(s,e,t){let i=s.createPositionBefore(t),n=s.createContainerElement("div",{align:e},t);s.insert(i,n)}function HV(s,e){let{conversion:t}=s,{schema:i}=s.model,n={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};i.extend("table",{allowAttributes:Object.values(n)});for(let o of Object.values(n))i.setAttributeProperties(o,{isFormatting:!0});Ym(s,"table",n,e),wr(t,{modelAttribute:n.color,styleName:"border-color"}),wr(t,{modelAttribute:n.style,styleName:"border-style"}),wr(t,{modelAttribute:n.width,styleName:"border-width"})}function WV(s,e,t,i){s.extend("table",{allowAttributes:["tableAlignment"]}),s.setAttributeProperties("tableAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right","blockLeft","blockRight"]},view:{left:i?{key:"style",value:{float:"left","margin-right":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:Ye.left.className},right:i?{key:"style",value:{float:"right","margin-left":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:Ye.right.className},center:i?{key:"style",value:{"margin-left":"auto","margin-right":"auto"}}:{key:"class",value:Ye.center.className},blockLeft:i?{key:"style",value:{"margin-left":"0","margin-right":"auto"}}:{key:"class",value:Ye.blockLeft.className},blockRight:i?{key:"style",value:{"margin-left":"auto","margin-right":"0"}}:{key:"class",value:Ye.blockRight.className}},converterPriority:"high"}),wS.forEach(n=>{e.for("upcast").attributeToAttribute({view:n.view,model:{key:"tableAlignment",value:(o,r,l)=>{if(GV(o))return;let a=St(t,"",l),c=n.getAlign(o),u=n.getConsumables(o);if(r.consumable.consume(o,u),c!==a)return c}}})}),e.for("upcast").add($V(t))}function zV(s,e,t){let i=/^(left|center|right)$/,n=/^(left|none|right)$/;s.extend("table",{allowAttributes:["tableAlignment"]}),s.setAttributeProperties("tableAlignment",{isFormatting:!0}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}},center:(o,r,l)=>({key:"style",value:l.item.getAttribute("tableType")!=="layout"?{float:"none"}:{"margin-left":"auto","margin-right":"auto"}})},converterPriority:"high"}),e.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:n}},model:{key:"tableAlignment",value:(o,r,l)=>{if(o.name=="figure"&&!o.hasClass("table"))return;let a=St(t,"",l),c=o.getStyle("float");if(c==="none"&&(c="center"),c!==a)return c;r.consumable.consume(o,{styles:"float"})}}}).attributeToAttribute({view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},model:{key:"tableAlignment",value:(o,r,l)=>{if(o.name=="figure"&&!o.hasClass("table"))return;let a=St(t,"",l),c="center";if(c!==a)return c;r.consumable.consume(o,{styles:["margin-left","margin-right"]})}}}).attributeToAttribute({view:{name:"table",attributes:{align:i}},model:{key:"tableAlignment",value:(o,r,l)=>{let a=St(t,"",l),c=o.getAttribute("align");if(c!==a)return c;r.consumable.consume(o,{attributes:"align"})}}})}function $V(s){return e=>{e.on("element:div",(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:!0,attributes:"align"}))return;let o=pv(i.viewItem);if(!o||!n.consumable.test(o,{name:!0}))return;n.consumable.consume(i.viewItem,{name:!0,attributes:"align"});let r=n.convertItem(o,i.modelCursor),l=O(r.modelRange.getItems());if(!l||!l.is("element","table")){n.consumable.revert(i.viewItem,{name:!0,attributes:"align"}),r.modelRange&&!r.modelRange.isCollapsed&&(i.modelRange=r.modelRange,i.modelCursor=r.modelCursor);return}let a=i.viewItem.getAttribute("align"),c=o.getAttribute("align"),u=St(s,"",i),d=jV(a,c,u);d&&n.writer.setAttribute("tableAlignment",d,l),n.convertChildren(i.viewItem,n.writer.createPositionAt(l,"end")),n.updateConversionResult(l,i)})}}function jV(s,e,t){if(s)switch(s){case"right":return e==="right"?"right":e==="left"?"left"
82:"blockRight";case"center":return"center";case"left":return e===void 0?"blockLeft":"left";default:return t}}function qV(s,e,t){let{modelAttribute:i}=t;s.extend("table",{allowAttributes:[i]}),s.setAttributeProperties(i,{isFormatting:!0}),ig(e,I({viewElement:"table"},t)),wr(e,t)}function Zy(s,e,t){let{modelAttribute:i}=t;s.extend("table",{allowAttributes:[i]}),s.setAttributeProperties(i,{isFormatting:!0}),ig(e,I({viewElement:/^(table|figure)$/,shouldUpcast:n=>!(n.name=="table"&&n.parent.name=="figure"||n.name=="figure"&&!n.hasClass("table"))},t)),Ro(e,I({modelElement:"table"},t))}function GV(s){return s.name=="figure"&&!s.hasClass("table")}function fr(s){return s!=="none"}function XV(s){s.document.registerPostFixer(e=>YV(e,s))}function YV(s,e){let t=e.document.differ.getChanges(),i=!1;for(let n of t){if(n.type!="insert")continue;let o=n.position.parent;if(o.is("element","table")||n.name=="table"){let r=n.name=="table"?n.position.nodeAfter:o,l=Array.from(r.getChildren()).filter(c=>c.is("element","caption")),a=l.shift();if(!a)continue;for(let c of l)s.move(s.createRangeIn(c),a,"end"),s.remove(c);a.nextSibling&&(s.move(s.createRangeOn(a),r,"end"),i=!0),i=!!l.length||i}}return i}function iv(s){return!!s&&s.is("element","table")}function Sr(s){for(let e of s.getChildren())if(e.is("element","caption"))return e;return null}function QV(s){let e=Vt(s);return e?Sr(e):null}function JV(s){let e=s.parent;return s.name=="figcaption"&&e&&e.is("element","figure")&&e.hasClass("table")?{name:!0}:s.name=="caption"&&e&&e.is("element","table")?{name:!0}:null}function ug(s){return{none:s("None"),solid:s("Solid"),dotted:s("Dotted"),dashed:s("Dashed"),double:s("Double"),groove:s("Groove"),ridge:s("Ridge"),inset:s("Inset"),outset:s("Outset")}}function xv(s,e){let t=new ne,i=ug(s.t);for(let n in i){let o={type:"button",model:new we({_borderStyleValue:n,label:i[n],role:"menuitemradio",withText:!0})};n==="none"?o.model.bind("isOn").to(s,"borderStyle",r=>e==="none"?!r:r===n):o.model.bind("isOn").to(s,"borderStyle",r=>r===n),t.add(o)}return t}function Zh(s){let{view:e,icons:t,toolbar:i,labels:n,propertyName:o,nameToValue:r,defaultValue:l}=s;for(let a in n){let c=new y(e.locale);c.set({role:"radio",isToggleable:!0,label:n[a],icon:t[a],tooltip:n[a]});let u=r?r(a):a;c.bind("isOn").to(e,o,d=>{let m=d;return d===""&&l&&(m=l),u===m}),c.on("execute",()=>{!l&&u&&e[o]===u?e[o]=void 0:e[o]=u}),i.items.add(c)}}function Vr(s){return(e,t,i)=>{let n=new Tr(e.locale,{colorDefinitions:ZV(s.colorConfig),columns:s.columns,defaultColorValue:s.defaultColorValue,colorPickerConfig:s.colorPickerConfig});return n.inputView.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",o=>!o),n.bind("hasError").to(e,"errorText",o=>!!o),n.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused").to(n),n}}function ZV(s){return s.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))}function pr(s){return s!=="none"}function br(s){return s!=="none"}var pS,bS,Ye,wS,mr,$,Qm,th,yr,vr,Cr,Hn,ih,nh,oh,sh,US,rh,HS,WS,Ee,ah,ch,uh,en,Wn,mh,Jt,hh,ph,Ir,bh,wh,Uy,Hy,Tr,rg,Ri,kh,yh,EV,zy,vh,wt,Ch,Er,Ih,Th,Ah,Eh,xh,Sh,Vh,Ph,Bh,$y,jy,Lh,qy,Rh,Fh,Oh,Xy,Dh,xr,Nh,DV,Mh,Qy,mi,Uh,Hh,Wh,zh,$h,jh,qh,Gh,Kh,KV,ev,Xh,tv,Yh,Qh,Jh,nv,eg,eP,ov,sv,tg,tP,rv,lv,Sv=M(()=>{U();zt();j();Me();re();z();Ci();ve();pS=/^(left|center|right)$/,bS=/^(left|none|right)$/;Ye={left:{className:"table-style-align-left"},center:{className:"table-style-align-center"},right:{className:"table-style-align-right"},blockLeft:{className:"table-style-block-align-left"},blockRight:{className:"table-style-block-align-right"}},wS=[{view:{name:/^(table|figure)$/,styles:{float:bS}},getAlign:s=>{let e=s.getStyle("float");return e==="none"&&(e="center"),e},getConsumables(s){let e=s.getStyle("float"),t=["float"];return e==="left"&&s.hasStyle("margin-right")?t.push("margin-right"):e==="right"&&s.hasStyle("margin-left")&&t.push("margin-left"),{styles:t}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},getAlign:()=>"center",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,key:"class",value:"table-style-align-left"},getAlign:()=>"left",getConsumables(){return{classes:Ye.left.className}}},{view:{name:/^(table|figure)$/,key:"class",value:Ye.right.className},getAlign:()=>"right",getConsumables(){return{classes:Ye.right.className}}},{view:{name:/^(table|figure)$/,key:"class",value:Ye.center.className},getAlign:()=>"center",getConsumables(){return{classes:Ye.center.className}}},{view:{name:/^(table|figure)$/,key:"class",value:Ye.blockLeft.className},getAlign:()=>"blockLeft",getConsumables(){return{classes:Ye.blockLeft.className}}},{view:{name:/^(table|figure)$/,key:"class",value:Ye.blockRight.className},getAlign:()=>"blockRight",getConsumables(){return{classes:Ye.blockRight.className}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"0","margin-right":"auto"}},getAlign:()=>"blockLeft",getConsumables(){return{styles:["margin-left","margin-right"]}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"0"}},getAlign:()=>"blockRight",getConsumables(){return{styles:["margin-left","margin-right"]}}},{view:{name:"table",attributes:{align:pS}},getAlign:s=>s.getAttribute("align"),getConsumables(){return{attributes:"align"}}}],mr={center:{align:"center",style:"margin-left: auto; margin-right: auto;",className:"table-style-align-center"},left:{align:"left",style:"float: left;",className:"table-style-align-left"},right:{align:"right",style:"float: right;",className:"table-style-align-right"},blockLeft:{align:void 0,style:"margin-left: 0; margin-right: auto;",className:Ye.blockLeft.className},blockRight:{align:void 0,style:"margin-left: auto; margin-right: 0;",className:Ye.blockRight.className}};$=class{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();let e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null,i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{let n=e.getChild(this._cellIndex);if(!n)return this._advanceToNextRow();let o=parseInt(n.getAttribute("colspan")||"1"),r=parseInt(n.getAttribute("rowspan")||"1");(o>1||r>1)&&this._recordSpans(n,r,o),this._shouldSkipSlot()||(t=this._formatOutValue(n)),this._nextCellAtColumn=this._column+o}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}
vendor: 4,766 bytes, line 82
82skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,i=this._column){return{done:!1,value:new Qm(this,e,t,i)}}_shouldSkipSlot(){let e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,n=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||i||n}_getSpanned(){let e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){let n={cell:e,row:this._row,column:this._column};for(let o=this._row;o<this._row+t;o++)for(let r=this._column;r<this._column+i;r++)(o!=this._row||r!=this._column)&&this._markSpannedCell(o,r,n)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,i)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){let e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((i,n)=>i+parseInt(n.getAttribute("colspan")||"1"),0)}},Qm=class{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,i,n){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=n,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}};th=class extends v{refresh(){let e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=LS(t,i)}execute(e={}){let t=this.editor,i=t.model,n=t.plugins.get("TableUtils"),o=t.config.get("table.defaultHeadings.rows"),r=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&o&&(e.headingRows=o),e.headingColumns===void 0&&r&&(e.headingColumns=r),i.change(l=>{let a=n.createTable(l,e);i.insertObject(a,null,null,{findOptimalPosition:"auto"}),l.setSelection(l.createPositionAt(a.getNodeByPath([0,0,0]),0))})}};yr=class extends v{order;constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){let e=this.editor.model.document.selection,i=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=i}execute(){let e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),n=this.order==="above",o=i.getSelectionAffectedTableCells(t),r=i.getRowIndexes(o),l=n?r.first:r.last,a=o[0].findAncestor("table");i.insertRows(a,{at:n?l:l+1,copyStructureFromAbove:!n})}},vr=class extends v{order;constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){let e=this.editor.model.document.selection,i=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=i}execute(){let e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),n=this.order==="left",o=i.getSelectionAffectedTableCells(t),r=i.getColumnIndexes(o),l=n?r.first:r.last,a=o[0].findAncestor("table");i.insertColumns(a,{columns:1,at:n?l:l+1})}},Cr=class extends v{direction;constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){let t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length===1}execute(){let 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)}},Hn=class extends v{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){let e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){let e=this.editor.model,t=e.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],o=this.value,r=this.direction;e.change(l=>{let a=r=="right"||r=="down",c=a?n:o,u=a?o:n,d=u.parent;OS(u,c,l);let m=this.isHorizontal?"colspan":"rowspan",h=parseInt(n.getAttribute(m)||"1"),g=parseInt(o.getAttribute(m)||"1");l.setAttribute(m,h+g,c),l.setSelection(l.createRangeIn(c));
82let p=this.editor.plugins.get("TableUtils"),b=d.findAncestor("table");ng(b,p)})}_getMergeableCell(){let t=this.editor.model.document,i=this.editor.plugins.get("TableUtils"),n=i.getTableCellsContainingSelection(t.selection)[0];if(!n)return;let o=this.isHorizontal?RS(n,this.direction,i):FS(n,this.direction,i);if(!o)return;let r=this.isHorizontal?"rowspan":"colspan",l=parseInt(n.getAttribute(r)||"1");if(parseInt(o.getAttribute(r)||"1")===l)return o}};ih=class extends v{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){let n=i.findAncestor("table"),r=e.getRows(n)-1,l=e.getRowIndexes(t),a=l.first===0&&l.last===r;this.isEnabled=!a}else this.isEnabled=!1}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),o=i[0],r=o.findAncestor("table"),l=t.getCellLocation(o).column;e.change(a=>{let c=n.last-n.first+1;t.removeRows(r,{at:n.first,rows:c});let u=DS(r,n.first,l,t.getRows(r));a.setSelection(a.createPositionAt(u,0))})}};nh=class extends v{refresh(){let e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){let n=i.findAncestor("table"),o=e.getColumns(n),{first:r,last:l}=e.getColumnIndexes(t);this.isEnabled=l-r<o-1}else this.isEnabled=!1}execute(){let e=this.editor.plugins.get("TableUtils"),[t,i]=MS(this.editor.model.document.selection,e),n=t.parent.parent,o=[...new $(n)],r={first:o.find(a=>a.cell===t).column,last:o.find(a=>a.cell===i).column},l=NS(o,t,i,r);this.editor.model.change(a=>{let c=r.last-r.first+1;e.removeColumns(n,{at:r.first,columns:c}),a.setSelection(a.createPositionAt(l,0))})}};oh=class extends v{refresh(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection);if(i.length===0){this.isEnabled=!1,this.value=!1;return}let n=i[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(n,"headingRows"),this.value=i.every(o=>this._isInHeading(o,o.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),o=n[0].findAncestor("table"),{first:r,last:l}=t.getRowIndexes(n),a=this.value?r:l+1,c=o.getAttribute("headingRows")||0;i.change(u=>{if(a){let d=a>c?c:0,m=cv(o,a,d);for(let{cell:h}of m)uv(h,a,u)}t.setHeadingRowsCount(u,o,a)})}_isInHeading(e,t){let i=parseInt(t.getAttribute("headingRows")||"0");return!!i&&e.parent.index<i}},sh=class extends v{refresh(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection);if(i.length===0){this.isEnabled=!1,this.value=!1;return}let n=i[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(n,"headingColumns"),this.value=i.every(o=>Jm(e,o))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),o=n[0].findAncestor("table"),{first:r,last:l}=t.getColumnIndexes(n),a=this.value?r:l+1;i.change(c=>{if(a){let u=dv(o,a);for(let{cell:d,column:m}of u)mv(d,m,a,c)}t.setHeadingColumnsCount(c,o,a)})}};US=5,rh=40,HS=2,WS=3;Ee=class extends f{static get pluginName(){return"TableUtils"}static get isOfficialPlugin(){return!0}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){let t=e.parent,i=t.parent,n=i.getChildIndex(t),o=new $(i,{row:n});for(let{cell:r,row:l,column:a}of o)if(r===e)return{row:l,column:a};}createTable(e,t){let i=e.createElement("table"),n=t.rows||2,o=t.columns||2;return Gm(e,i,0,n,o),t.headingRows&&this.setHeadingRowsCount(e,i,Math.min(t.headingRows,n)),t.headingColumns&&this.setHeadingColumnsCount(e,i,Math.min(t.headingColumns,o)),i}insertRows(e,t={}){let i=this.editor.model,n=t.at||0,o=t.rows||1,r=t.copyStructureFromAbove!==void 0,l=t.copyStructureFromAbove?n-1:n,a=di(this.editor),c=this.getRows(e),u=this.getColumns(e);if(n>c)throw new S("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change(d=>{let m=e.getAttribute("headingRows")||0,h=e.getAttribute("headingColumns")||0;if(m>n&&(m+=o,this.setHeadingRowsCount(d,e,m,{shallow:!0})),!r&&(n===0||n===c)){let w=Gm(d,e,n,o,u);if(a)for(let k=0;k<w.length;k++){let T=w[k];for(let B=0;B<u;B++){let Z=T[B];(n+k<m||B<h)&&d.setAttribute("tableCellType","header",Z)}}return}let g=r?Math.max(n,l):n,p=new $(e,{endRow:g}),b=new Array(u).fill(1);for(let{row:w,column:k,cellHeight:T,cellWidth:B,cell:Z}of p){let _e=w+T-1,ke=w<n&&n<=_e,_t=w<=l&&l<=_e;ke?(d.setAttribute("rowspan",T+o,Z),b[k]=-B):r&&_t&&(b[k]=B)}for(let w=0;w<o;w++){let k=d.createElement("tableRow");d.insert(k,e,n);for(let T=0;T<b.length;T++){let B=b[T],Z=d.createPositionAt(k,"end");if(B>0){let _e=Fi(d,Z,B>1?{colspan:B}:void 0);a&&(n+w<m||T<h)&&d.setAttribute("tableCellType","header",_e)}T+=Math.abs(B)-1}}})}insertColumns(e,t={}){let i=this.editor.model,n=t.at||0,o=t.columns||1,r=di(this.editor);i.change(l=>{let a=e.getAttribute("headingRows")||0,c=e.getAttribute("headingColumns");n<c&&(c+=o,this.setHeadingColumnsCount(l,e,c,{shallow:!0}));let u=this.getColumns(e);if(n===0||u===n){let m=0;for(let h of e.getChildren()){if(!h.is("element","tableRow"))continue;let g=Un(o,l,l.createPositionAt(h,n?"end":0));if(r)for(let p=0;p<g.length;p++)(n+p<c||m<a)&&l.setAttribute("tableCellType","header",g[p]);m++}return}let d=new $(e,{column:n,includeAllSlots:!0});for(let m of d){let{row:h,cell:g,cellAnchorColumn:p,cellAnchorRow:b,cellWidth:w,cellHeight:k}=m;if(p<n){l.setAttribute("colspan",w+o,g);let T=b+k-1;for(let B=h;B<=T;B++)d.skipRow(B)}else{let T=Un(o,l,m.getPositionBefore());if(r)for(let B=0;B<T.length;B++)(n+B<c||h<a)&&l.setAttribute("tableCellType","header",T[B])}}})}removeRows(e,t){let i=this.editor.model,n=t.rows||1,o=this.getRows(e),r=t.at,l=r+n-1;if(l>o-1)throw new S("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change(a=>{let c={first:r,last:l},{cellsToMove:u,cellsToTrim:d}=eV(e,c);if(u.size){let m=l+1;tV(e,m,u,a)}for(let m=l;m>=r;m--)a.remove(e.getChild(m));for(let{rowspan:m,cell:h}of d)Se("rowspan",m,h,a);if(ZS(e,c,a),Zm(e,this)||eh(e,this),di(this.editor)){let m=e.getAttribute("headingRows")||0,h=this.getRows(e);for(;m<h&&Mn({table:e,row:m});)m++;this.setHeadingRowsCount(a,e,m,{shallow:!0})}})}
82removeColumns(e,t){let i=this.editor.model,n=t.at,o=t.columns||1,r=t.at+o-1;i.change(l=>{JS(e,{first:n,last:r},l);let a=Do(e);for(let c=r;c>=n;c--){for(let{cell:u,column:d,cellWidth:m}of[...new $(e)])d<=c&&m>1&&d+m>c?Se("colspan",m-1,u,l):d===c&&l.remove(u);if(a[c]){let u=c===0?a[1]:a[c-1],d=parseFloat(a[c].getAttribute("columnWidth")),m=parseFloat(u.getAttribute("columnWidth"));l.remove(a[c]),l.setAttribute("columnWidth",d+m+"%",u)}}if(eh(e,this)||Zm(e,this),di(this.editor)){let c=e.getAttribute("headingColumns")||0,u=this.getColumns(e);for(;c<u&&Mn({table:e,column:c});)c++;this.setHeadingColumnsCount(l,e,c,{shallow:!0})}})}splitCellVertically(e,t=2){let i=this.editor.model,o=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");i.change(a=>{if(l>1){let{newCellsSpan:c,updatedSpan:u}=Fy(l,t);Se("colspan",u,e,a);let d={};c>1&&(d.colspan=c),r>1&&(d.rowspan=r);let m=l>t?t-1:l-1;Un(m,a,a.createPositionAfter(e),d)}if(l<t){let c=t-l,u=[...new $(o)],{column:d}=u.find(({cell:p})=>p===e),m=u.filter(({cell:p,cellWidth:b,column:w})=>{let k=p!==e&&w===d,T=w<d&&w+b>d;return k||T});for(let{cell:p,cellWidth:b}of m)a.setAttribute("colspan",b+c,p);let h={};r>1&&(h.rowspan=r),Un(c,a,a.createPositionAfter(e),h);let g=o.getAttribute("headingColumns")||0;g>d&&Se("headingColumns",g+c,o,a)}})}splitCellHorizontally(e,t=2){let i=this.editor.model,n=e.parent,o=n.parent,r=o.getChildIndex(n),l=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");i.change(c=>{if(l>1){let u=[...new $(o,{startRow:r,endRow:r+l-1,includeAllSlots:!0})],{newCellsSpan:d,updatedSpan:m}=Fy(l,t);Se("rowspan",m,e,c);let{column:h}=u.find(({cell:b})=>b===e),g={};d>1&&(g.rowspan=d),a>1&&(g.colspan=a);let p=0;for(let b of u){let{column:w,row:k}=b,T=k>=r+m,B=w===h;p>=d&&B&&(p=0),T&&B&&(p||Un(1,c,b.getPositionBefore(),g),p++)}}if(l<t){let u=t-l,d=[...new $(o,{startRow:0,endRow:r})];for(let{cell:g,cellHeight:p,row:b}of d)if(g!==e&&b+p>r){let w=p+u;c.setAttribute("rowspan",w,g)}let m={};a>1&&(m.colspan=a),Gm(c,o,r+1,u,1,m);let h=o.getAttribute("headingRows")||0;h>r&&Se("headingRows",h+u,o,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(i=>i.is("element","tableCell")).reduce((i,n)=>{let o=parseInt(n.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 $(e,t)}getSelectedTableCells(e){let t=[];for(let i of this.sortRanges(e.getRanges())){let n=i.getContainedElement();n&&n.is("element","tableCell")&&t.push(n)}return t}setHeadingRowsCount(e,t,i,n={}){let{shallow:o,resetFormerHeadingCells:r=!0,autoExpand:l=!0}=n,a=t.getAttribute("headingRows")||0;if(i!==a&&(Se("headingRows",i,t,e,0),!(o||!di(this.editor)))){for(let{cell:c,row:u,column:d}of new $(t,{endRow:i-1}))hr({table:t,writer:e,cell:c,row:u,column:d});if(r&&i<a)for(let c=i;c<a&&Mn({table:t,row:c});c++)for(let{cell:u,row:d,column:m}of new $(t,{row:c}))hr({table:t,writer:e,cell:u,row:d,column:m});if(l&&i>a){let c=this.getRows(t);for(;i<c&&Mn({table:t,row:i});)i++;Se("headingRows",i,t,e,0)}}}setHeadingColumnsCount(e,t,i,n={}){let{shallow:o,resetFormerHeadingCells:r=!0,autoExpand:l=!0}=n,a=t.getAttribute("headingColumns")||0;if(i!==a&&(Se("headingColumns",i,t,e,0),!(o||!di(this.editor)))){for(let{cell:c,row:u,column:d}of new $(t,{endColumn:i-1}))hr({table:t,writer:e,cell:c,row:u,column:d});if(r&&i<a)for(let c=i;c<a&&Mn({table:t,column:c});c++)for(let{cell:u,row:d,column:m}of new $(t,{column:c}))hr({table:t,writer:e,cell:u,row:d,column:m});if(l&&i>a){let c=this.getColumns(t);for(;i<c&&Mn({table:t,column:i});)i++;Se("headingColumns",i,t,e,0)}}}getTableCellsContainingSelection(e){let t=[];for(let i of e.getRanges()){let n=i.start.findAncestor("tableCell");n&&t.push(n)}return t}getSelectionAffectedTableCells(e){let t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){let t=e.map(i=>i.parent.index);return this._getFirstLastIndexesObject(t)}
82getColumnIndexes(e){let t=e[0].findAncestor("table"),n=[...new $(t)].filter(o=>e.includes(o.cell)).map(o=>o.column);return this._getFirstLastIndexesObject(n)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;let t=new Set,i=new Set,n=0;for(let r of e){let{row:l,column:a}=this.getCellLocation(r),c=parseInt(r.getAttribute("rowspan"))||1,u=parseInt(r.getAttribute("colspan"))||1;t.add(l),i.add(a),c>1&&t.add(l+c-1),u>1&&i.add(a+u-1),n+=c*u}return nV(t,i)==n}sortRanges(e){return Array.from(e).sort(iV)}_getFirstLastIndexesObject(e){let t=e.sort((o,r)=>o-r),i=t[0],n=t[t.length-1];return{first:i,last:n}}_areCellInTheSameTableSection(e){let t=e[0].findAncestor("table"),i=this.getRowIndexes(e),n=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(i,n))return!1;let o=this.getColumnIndexes(e),r=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,r)}_areIndexesInSameSection({first:e,last:t},i){let n=e<i,o=t<i;return n===o}};ah=class extends v{refresh(){let e=this.editor.plugins.get(Ee),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){let e=this.editor.model,t=this.editor.plugins.get(Ee);e.change(i=>{let n=t.getSelectedTableCells(e.document.selection),o=n.shift(),{mergeWidth:r,mergeHeight:l}=sV(o,n,t);Se("colspan",r,o,i),Se("rowspan",l,o,i);for(let c of n)oV(c,o,i);
vendor: 24,633 bytes, line 82
82let a=o.findAncestor("table");ng(a,t),i.setSelection(o,"in")})}};ch=class extends v{constructor(e){super(e),this.affectsData=!1}refresh(){let t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){let e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),o=i[0].findAncestor("table"),r=[];for(let l=n.first;l<=n.last;l++)for(let a of o.getChild(l).getChildren())r.push(e.createRangeOn(a));e.change(l=>{l.setSelection(r)})}},uh=class extends v{constructor(e){super(e),this.affectsData=!1}refresh(){let t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){let e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),n=i[0],o=i.pop(),r=n.findAncestor("table"),l=e.getCellLocation(n),a=e.getCellLocation(o),c=Math.min(l.column,a.column),u=Math.max(l.column,a.column),d=[];for(let m of new $(r,{startColumn:c,endColumn:u}))d.push(t.createRangeOn(m.cell));t.change(m=>{m.setSelection(d)})}};en=class extends f{_additionalSlots;static get pluginName(){return"TableEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[Ee]}constructor(e){super(e),this._additionalSlots=[]}init(){let e=this.editor,t=e.model,i=t.schema,n=e.conversion,o=e.plugins.get(Ee);i.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),n.for("upcast").add(yS()),n.for("upcast").add(vS()),n.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Vy(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),n.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Vy(o,{additionalSlots:this._additionalSlots})}),n.for("upcast").elementToElement({model:"tableRow",view:"tr"}),n.for("upcast").add(CS()),n.for("downcast").elementToElement({model:"tableRow",view:AS()}),n.for("upcast").elementToElement({model:"tableCell",view:"td"}),n.for("upcast").elementToElement({model:"tableCell",view:"th"}),n.for("upcast").add(Sy("td")),n.for("upcast").add(Sy("th")),n.for("editingDowncast").elementToElement({model:"tableCell",view:Py({asWidget:!0,cellTypeEnabled:()=>di(this.editor)})}),n.for("dataDowncast").elementToElement({model:"tableCell",view:Py({cellTypeEnabled:()=>di(this.editor)})}),n.for("editingDowncast").elementToElement({model:"paragraph",view:By({asWidget:!0}),converterPriority:"high"}),n.for("dataDowncast").elementToElement({model:"paragraph",view:By(),converterPriority:"high"}),n.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),n.for("upcast").attributeToAttribute({model:{key:"colspan",value:Ny("colspan")},view:"colspan"}),n.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),n.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Ny("rowspan")},view:"rowspan"}),this._addPlainTableOutputConverters(),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.config.define("table.showHiddenBorders",!0),e.config.get("table.showHiddenBorders")&&e.editing.view.change(r=>{for(let l of e.editing.view.document.roots)r.addClass("ck-table-show-hidden-borders",l)}),e.commands.add("insertTable",new th(e)),e.commands.add("insertTableRowAbove",new yr(e,{order:"above"})),e.commands.add("insertTableRowBelow",new yr(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new vr(e,{order:"left"})),e.commands.add("insertTableColumnRight",new vr(e,{order:"right"})),e.commands.add("removeTableRow",new ih(e)),e.commands.add("removeTableColumn",new nh(e)),e.commands.add("splitTableCellVertically",new Cr(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Cr(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new ah(e)),e.commands.add("mergeTableCellRight",new Hn(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Hn(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Hn(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Hn(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new sh(e)),e.commands.add("setTableRowHeader",new oh(e)),e.commands.add("selectTableRow",new ch(e)),e.commands.add("selectTableColumn",new uh(e)),rV(t),hV(t),this.listenTo(t.document,"change:data",()=>{di(e)||bV(t,e.editing),wV(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}_addPlainTableOutputConverters(){let e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:SS(e),converterPriority:"high"}),e.plugins.has("TableCaptionEditing")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:VS(e),converterPriority:"high"}),e.plugins.has("TablePropertiesEditing")&&BS(e)}};Wn=class extends P{items;keystrokes;focusTracker;constructor(e){super(e);let t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new K,this.focusTracker=new J,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(i,n)=>`${n} \xD7 ${i}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"[email protected]":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,n)=>{let{row:o,column:r}=n.target.dataset;this.items.get((parseInt(o,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(i,n,o)=>{if(!o)return;let{row:r,column:l}=o.dataset;this.set({rows:parseInt(r),columns:parseInt(l)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Dt({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(let e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){let e=this.rows,t=this.columns;this.items.map((i,n)=>{let o=Math.floor(n/10),r=n%10,l=o<e&&r<t;i.set("isOn",l)})}_createGridButton(e,t,i,n){let o=new y(e);return o.set({label:n,class:"ck-insert-table-dropdown-grid-box"}),o.extendTemplate({attributes:{"data-row":t,"data-column":i}}),o}_createGridCollection(){let e=[];for(let t=0;t<100;t++){let i=Math.floor(t/10),n=t%10,o=`${i+1} \xD7 ${n+1}`;e.push(this._createGridButton(this.locale,i+1,n+1,o))}return this.createCollection(e)}},mh=class extends f{static get pluginName(){return"TableUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t,n=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",o=>{let r=e.commands.get("insertTable"),l=X(o);l.bind("isEnabled").to(r),l.buttonView.set({icon:al,label:t("Insert table"),tooltip:!0});let a;return l.on("change:isOpen",()=>{a||(a=new Wn(o),l.panelView.children.add(a),a.delegate("execute").to(l),l.on("execute",()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()}))}),l}),e.ui.componentFactory.add("menuBar:insertTable",o=>{let r=e.commands.get("insertTable"),l=new Ie(o),a=new Wn(o);return a.delegate("execute").to(l),l.on("change:isOpen",(c,u,d)=>{d||a.reset()}),a.on("execute",()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()}),l.buttonView.set({label:t("Table"),icon:al}),l.panelView.children.add(a),l.bind("isEnabled").to(r),l}),e.ui.componentFactory.add("tableColumn",o=>{let r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:n?"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"),Df,r,o)}),e.ui.componentFactory.add("tableRow",o=>{let 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"),Mf,r,o)}),e.ui.componentFactory.add("mergeTableCells",o=>{let r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:n?"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"),Nf,r,o)})}_prepareDropdown(e,t,i,n){let o=this.editor,r=X(n),l=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(l,"isEnabled",(...a)=>a.some(c=>c)),this.listenTo(r,"execute",a=>{o.execute(a.source.commandName),a.source instanceof si||o.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,i,n){let o=this.editor,r=X(n,ht),l="mergeTableCells",a=o.commands.get(l),c=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([a,...c],"isEnabled",(...u)=>u.some(d=>d)),this.listenTo(r.buttonView,"execute",()=>{o.execute(l),o.editing.view.focus()}),this.listenTo(r,"execute",u=>{o.execute(u.source.commandName),o.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){let i=this.editor,n=[],o=new ne;for(let r of t)kV(r,i,n,o);return be(e,o),n}};Jt=class extends f{static get pluginName(){return"TableSelection"}static get isOfficialPlugin(){return!0}static get requires(){return[Ee,Ee]}init(){let e=this.editor,t=e.model,i=e.editing.view;this.listenTo(t,"deleteContent",(n,o)=>this._handleDeleteContent(n,o),{priority:"high"}),this.listenTo(i.document,"insertText",(n,o)=>this._handleInsertTextEvent(n,o),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){let e=this.editor.plugins.get(Ee),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return i.length==0?null:i}getSelectionAsFragment(){let e=this.editor.plugins.get(Ee),t=this.getSelectedTableCells();return t?this.editor.model.change(i=>{let n=i.createDocumentFragment(),{first:o,last:r}=e.getColumnIndexes(t),{first:l,last:a}=e.getRowIndexes(t),c=t[0].findAncestor("table"),u=a,d=r;if(e.isSelectionRectangular(t)){let g={firstColumn:o,lastColumn:r,firstRow:l,lastRow:a};u=gv(c,g),d=fv(c,g)}let h=av(c,{startRow:l,startColumn:o,endRow:u,endColumn:d},i);return i.insert(h,n,0),n}):null}setCellSelection(e,t){let i=this._getCellsToSelect(e,t);this.editor.model.change(n=>{n.setSelection(i.cells.map(o=>n.createRangeOn(o)),{backward:i.backward})})}getFocusCell(){let i=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return i&&i.is("element","tableCell")?i:null}getAnchorCell(){let e=this.editor.model.document.selection,i=O(e.getRanges()).getContainedElement();return i&&i.is("element","tableCell")?i:null}_defineSelectionConverter(){let e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(n=>n.on("selection",(o,r,l)=>{let a=l.writer;i(a);let c=this.getSelectedTableCells();if(!c)return;for(let d of c){let m=l.mapper.toViewElement(d);a.addClass("ck-editor__editable_selected",m),t.add(m)}let u=l.mapper.toViewElement(c[c.length-1]);a.setSelection(u,0)},{priority:"lowest"}));function i(n){for(let o of t)n.removeClass("ck-editor__editable_selected",o);t.clear()}}_enablePluginDisabling(){let e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){let t=this.getSelectedTableCells();if(!t)return;e.model.change(i=>{let n=i.createPositionAt(t[0],0),o=e.model.schema.getNearestSelectionRange(n);i.setSelection(o)})}})}_handleDeleteContent(e,t){let i=this.editor.plugins.get(Ee),n=t[0],o=t[1],r=this.editor.model,l=!o||o.direction=="backward",a=i.getSelectedTableCells(n);a.length&&(e.stop(),r.change(c=>{let u=a[l?a.length-1:0];r.change(m=>{for(let h of a)r.deleteContent(m.createSelection(h,"in"))});let d=r.schema.getNearestSelectionRange(c.createPositionAt(u,0));n.is("documentSelection")?c.setSelection(d):n.setTo(d)}))}_handleInsertTextEvent(e,t){let i=this.editor,n=this.getSelectedTableCells();if(!n)return;let o=i.editing.view,r=i.editing.mapper,l=n.map(a=>o.createRangeOn(r.toViewElement(a)));t.selection=o.createSelection(l),t.preventDefault()}_getCellsToSelect(e,t){let i=this.editor.plugins.get("TableUtils"),n=i.getCellLocation(e),o=i.getCellLocation(t),r=Math.min(n.row,o.row),l=Math.max(n.row,o.row),a=Math.min(n.column,o.column),c=parseInt(t.getAttribute("colspan")||"1")-1,u=Math.max(n.column,o.column+c),d=new Array(l-r+1).fill(null).map(()=>[]),m={startRow:r,endRow:l,startColumn:a,endColumn:u};for(let{row:p,cell:b}of new $(e.findAncestor("table"),m))d[p-r].push(b);let h=o.row<n.row,g=o.column<n.column;return h&&d.reverse(),g&&d.forEach(p=>p.reverse()),{cells:d.flat(),backward:h||g}}},hh=class extends f{static get pluginName(){return"TableClipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[cs,ct,Jt,Ee]}init(){let t=this.editor.editing.view.document;this.listenTo(t,"copy",(i,n)=>this._onCopyCut(i,n)),this.listenTo(t,"cut",(i,n)=>this._onCopyCut(i,n)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell")}_listenToContentInsertion(){let{editor:e}=this,t=e.plugins.get(ct),i=e.plugins.get(Jt),n=!1;t.on("contentInsertion",(o,r)=>{n=r.method==="paste"}),this.listenTo(e.model,"insertContent",(o,[r,l])=>{(n||i.getSelectedTableCells()!==null)&&this._onInsertContent(o,r,l)},{priority:"high"}),t.on("contentInsertion",()=>{n=!1},{priority:"lowest"})}_onCopyCut(e,t){let i=this.editor.editing.view,n=this.editor.plugins.get(Jt),o=this.editor.plugins.get(cs);n.getSelectedTableCells()&&(e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name==="cut"},()=>{let r=o._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>n.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;let n=this.editor.model,o=this.editor.plugins.get(Ee),r=this.editor.plugins.get(cs),l=this.getTableIfOnlyTableInContent(t,n);if(!l)return;let a=o.getSelectionAffectedTableCells(n.document.selection);if(!a.length){ng(l,o);return}e.stop(),t.is("documentFragment")?r._pasteMarkersIntoTransformedElement(t.markers,c=>this._replaceSelectedCells(l,a,c)):this.editor.model.change(c=>{this._replaceSelectedCells(l,a,c)})}_replaceSelectedCells(e,t,i){let n=this.editor.plugins.get(Ee),o={width:n.getColumns(e),height:n.getRows(e)},r=yV(t,o,i,n),l=r.lastRow-r.firstRow+1,a=r.lastColumn-r.firstColumn+1,c={startRow:0,startColumn:0,endRow:Math.min(l,o.height)-1,endColumn:Math.min(a,o.width)-1};e=av(e,c,i);let u=t[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(e,o,u,r,i);if(this.editor.plugins.get("TableSelection").isEnabled){let m=n.sortRanges(d.map(h=>i.createRangeOn(h)));i.setSelection(m)}else i.setSelection(d[0],0);return u}_replaceSelectedCellsWithPasted(e,t,i,n,o){let{width:r,height:l}=t,a=CV(e,r,l),c=[...new $(i,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:!0})],u=[],d;for(let b of c){let{row:w,column:k}=b;k===n.firstColumn&&(d=b.getPositionBefore());let T=w-n.firstRow,B=k-n.firstColumn,Z=a[T%l][B%r],_e=Z?o.cloneElement(Z):null,ke=this._replaceTableSlotCell(b,_e,d,o);ke&&(hv(ke,w,k,n.lastRow,n.lastColumn,o),u.push(ke),d=o.createPositionAfter(ke))}let m=parseInt(i.getAttribute("headingRows")||"0"),h=parseInt(i.getAttribute("headingColumns")||"0"),g=n.firstRow<m&&m<=n.lastRow,p=n.firstColumn<h&&h<=n.lastColumn;if(g){let b={first:n.firstColumn,last:n.lastColumn},w=gh(i,m,b,o,n.firstRow);u.push(...w)}if(p){let b={first:n.firstRow,last:n.lastRow},w=fh(i,h,b,o);u.push(...w)}return u}_replaceTableSlotCell(e,t,i,n){let{cell:o,isAnchor:r}=e;return r&&n.remove(o),t?(n.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);let i=t.createRangeIn(e);for(let n of i.getItems())if(n.is("element","table")){let o=t.createRange(i.start,t.createPositionBefore(n));if(t.hasContent(o,{ignoreWhitespaces:!0}))return null;let r=t.createRange(t.createPositionAfter(n),i.end);return t.hasContent(r,{ignoreWhitespaces:!0})?null:n}return null}};ph=class extends f{static get pluginName(){return"TableKeyboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Jt,Ee]}init(){let e=this.editor,i=e.editing.view.document,n=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:n("Keystrokes that can be used in a table cell"),keystrokes:[{label:n("Move the selection to the next cell"),keystroke:"Tab"},{label:n("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:n("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:n("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){let o=this.editor.model.document.selection.getSelectedElement();!o||!o.is("element","table")||t.stopPropagation()}_handleTab(e,t){let i=this.editor,n=this.editor.plugins.get(Ee),o=this.editor.plugins.get("TableSelection"),r=i.model.document.selection,l=!t.shiftKey,a=n.getTableCellsContainingSelection(r)[0];if(a||(a=o.getFocusCell()),!a)return;t.stopPropagation();let c=a.parent,u=c.parent,d=u.getChildIndex(c),h=c.getChildIndex(a)===c.childCount-1,g=d===n.getRows(u)-1;l&&g&&h&&i.execute("insertTableRowBelow")}_onArrowKey(e,t){let i=this.editor,n=t.keyCode,o=Kn(n,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){let i=this.editor.plugins.get(Ee),n=this.editor.plugins.get("TableSelection"),o=this.editor.model,r=o.document.selection,l=["right","down"].includes(e),a=i.getSelectedTableCells(r);if(a.length){let u;return t?u=n.getFocusCell():u=l?a[a.length-1]:a[0],this._navigateFromCellInDirection(u,e,t),!0}let c=r.focus.findAncestor("tableCell");if(!c)return!1;if(!r.isCollapsed)if(t){if(r.isBackward==l&&!r.containsEntireContent(c))return!1}else{let u=r.getSelectedElement();if(!u||!o.schema.isObject(u))return!1}return this._isSelectionAtCellEdge(r,c,l)?(this._navigateFromCellInDirection(c,e,t),!0):!1}_isSelectionAtCellEdge(e,t,i){let n=this.editor.model,o=this.editor.model.schema,r=i?e.getLastPosition():e.getFirstPosition();if(!o.getLimitElement(r).is("element","tableCell"))return n.createPositionAt(t,i?"end":0).isTouching(r);let l=n.createSelection(r);return n.modifySelection(l,{direction:i?"forward":"backward"}),r.isEqual(l.focus)}_navigateFromCellInDirection(e,t,i=!1){let n=this.editor.model,o=e.findAncestor("table"),r=[...new $(o,{includeAllSlots:!0})],{row:l,column:a}=r[r.length-1],c=r.find(({cell:k})=>k==e),{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}let m=u<0||u>l,h=d<0&&u<=0,g=d>a&&u>=l;if(m||h||g){n.change(k=>{k.setSelection(k.createRangeOn(o))});return}d<0?(d=i?0:a,u--):d>a&&(d=i?a:0,u++);let p=r.find(k=>k.row==u&&k.column==d).cell,b=["right","down"].includes(t),w=this.editor.plugins.get("TableSelection");if(i&&w.isEnabled){let k=w.getAnchorCell()||e;w.setCellSelection(k,p)}else{let k=n.createPositionAt(p,b?0:"end");n.change(T=>{T.setSelection(k)})}}},Ir=class extends qo{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e)}},bh=class extends f{static get pluginName(){return"TableMouse"}static get isOfficialPlugin(){return!0}static get requires(){return[Jt,Ee]}init(){this.editor.editing.view.addObserver(Ir),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){let e=this.editor,t=e.plugins.get(Ee),i=!1,n=e.plugins.get(Jt);this.listenTo(e.editing.view.document,"mousedown",(o,r)=>{let l=e.model.document.selection;if(!this.isEnabled||!n.isEnabled||!r.domEvent.shiftKey)return;let a=n.getAnchorCell()||t.getTableCellsContainingSelection(l)[0];if(!a)return;let c=this._getModelTableCellFromDomEvent(r);c&&My(a,c)&&(i=!0,n.setCellSelection(a,c),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1}),this.listenTo(e.editing.view.document,"selectionChange",o=>{i&&o.stop()},{priority:"highest"})}_enableMouseDragSelection(){let e=this.editor,t,i,n=!1,o=!1,r=e.plugins.get(Jt);this.listenTo(e.editing.view.document,"mousedown",(l,a)=>{!this.isEnabled||!r.isEnabled||a.domEvent.shiftKey||a.domEvent.ctrlKey||a.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(a))}),this.listenTo(e.editing.view.document,"mousemove",(l,a)=>{if(!a.domEvent.buttons||!t)return;let c=this._getModelTableCellFromDomEvent(a);c&&My(t,c)&&(i=c,!n&&i!=t&&(n=!0)),n&&(o=!0,r.setCellSelection(t,i),a.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1,o=!1,t=null,i=null}),this.listenTo(e.editing.view.document,"selectionChange",l=>{o&&l.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){let t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}};wh=class extends f{static get requires(){return[en,mh,Jt,bh,ph,hh,ze]}static get pluginName(){return"Table"}static get isOfficialPlugin(){return!0}},Uy=class extends f{static get pluginName(){return"PlainTableOutput"}static get isOfficialPlugin(){return!0}static get requires(){return[wh]}init(){this.editor.conversion.for("upcast").add(t=>{t.on("element:table",(i,n,o)=>{o.consumable.consume(n.viewItem,{classes:"table"})})})}};Hy=class extends f{static get requires(){return[ft]}static get pluginName(){return"TableToolbar"}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t,i=e.plugins.get(ft),n=e.config.get("table.contentToolbar"),o=e.config.get("table.tableToolbar");n&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:No}),o&&i.register("table",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:vv})}},Tr=class extends P{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new J,this._focusables=new ye,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new K,this._stillTyping=!1,this.focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}
vendor: 4,436 bytes, line 82
82),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(i,n,o)=>this._setInputValue(o))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){let e=this.locale,t=e.t,i=this.bindTemplate,n=this._createColorSelector(e),o=X(e),r=new P;return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:i.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",i.if("value","ck-hidden",l=>l!="")]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(r),o.buttonView.label=t("Color picker"),o.buttonView.tooltip=!0,o.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",o.panelView.children.add(n),o.bind("isEnabled").to(this,"isReadOnly",l=>!l),o.on("change:isOpen",(l,a,c)=>{c&&(n.updateSelectedColors(),n.showColorGridsFragment())}),o}_createInputTextView(){let e=this.locale,t=new up(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{let i=t.element.value,n=this.options.colorDefinitions.find(o=>i===o.label);this._stillTyping=!0,this.value=n&&n.color||i}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createColorSelector(e){let t=e.t,i=this.options.defaultColorValue||"",n=t(i?"Restore default":"Remove color"),o=new lo(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:n,colorPickerLabel:t("Color picker"),colorPickerViewConfig:this.options.colorPickerConfig===!1?!1:N(I({},this.options.colorPickerConfig),{hideInput:!0})});o.appendUI(),o.on("execute",(l,a)=>{if(a.source==="colorPickerSaveButton"){this.dropdownView.isOpen=!1;return}this.value=a.value||i,this.fire("input"),a.source!=="colorPicker"&&(this.dropdownView.isOpen=!1)});let r=this.value;return o.on("colorPicker:cancel",()=>{this.value=r,this.fire("input"),this.dropdownView.isOpen=!1}),o.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{r=this.value}),o.bind("selectedColor").to(this,"value"),o}_setInputValue(e){if(!this._stillTyping){let t=Wy(e),i=this.options.colorDefinitions.find(n=>t===Wy(n.color));i?this.inputView.value=i.label:this.inputView.value=e||""}}};rg=s=>s==="";Ri=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];kh=class extends P{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;let{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:l,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:d,dimensionsLabel:m}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:g,alignmentLabel:p}=this._createAlignmentFields();this.focusTracker=new J,this.keystrokes=new K,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput
vendor: 7,281 bytes, line 82
82=a,this.paddingInput=this._createPaddingField(),this.widthInput=c,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=g;let{saveButtonView:b,cancelButtonView:w}=this._createActionButtons();this.saveButtonView=b,this.cancelButtonView=w,this._focusables=new ye,this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Oe(e,{label:this.t("Cell properties")})),this.children.add(new q(e,{labelView:r,children:[r,i,o,n],class:"ck-table-form__border-row"})),this.children.add(new q(e,{labelView:l,children:[l,a],class:"ck-table-form__background-row"})),this.children.add(new q(e,{children:[new q(e,{labelView:m,children:[m,c,u,d],class:"ck-table-form__dimensions-row"}),new q(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new q(e,{labelView:p,children:[p,h,g],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new q(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=Ar({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,r=o("Style"),l=new Ae(n);l.text=o("Border");let a=lg(o),c=new H(n,yi);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>a[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),be(c.fieldView,Iv(this,t.style),{role:"menu",ariaLabel:r});let u=new H(n,ce);u.set({label:o("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",gr),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});let d=new H(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",gr),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(m,h,g,p)=>{gr(g)||(this.borderColor="",this.borderWidth=""),gr(p)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:l,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:u}}_createBackgroundFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Background");let n=Ar({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new H(e,n);return o.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",()=>{this.backgroundColor=o.fieldView.value}),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Dimensions");let n=new H(e,ce);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",()=>{this.width=n.fieldView.element.value});let o=new P(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let r=new H(e,ce);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:r}}_createPaddingField(){let e=this.locale,t=this.t,i=new H(e,ce);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",()=>{this.padding=i.fieldView.element.value}),i}_createAlignmentFields(){let e=this.locale,t=this.t,i=new Ae(e),n={left:to,center:Zn,right:io,justify:eo,top:Kr,middle:Gr,bottom:qr};i.text=t("Table cell text alignment");let o=new Ue(e),r=e.contentLanguageDirection==="rtl";o.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar")}),_h({view:this,icons:n,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:a=>{if(r){if(a==="left")return"right";if(a==="right")return"left"}return a},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});let l=new Ue(e);return l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar")}),_h({view:this,icons:n,toolbar:l,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:l,alignmentLabel:i}}_createActionButtons(){let e=this.locale,t=this.t,i=new y(e),n=new y(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),icon:oo,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(o,"errorText",(...r)=>r.every(l=>!l)),n.set({label:t("Cancel"),icon:no,class:"ck-button-cancel",withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:n}}get _horizontalAlignmentLabels(){let e=this.locale,t=this.t,i=t("Align cell text to the left"),n=t("Align cell text to the center"),o=t("Align cell text to the right"),r=t("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:o,center:n,left:i,justify:r}:{left:i,center:n,right:o,justify:r}}get _verticalAlignmentLabels(){let e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}};yh=[tt.defaultPositions.northArrowSouth,tt.defaultPositions.northArrowSouthWest,tt.defaultPositions.northArrowSouthEast,tt.defaultPositions.southArrowNorth,tt.defaultPositions.southArrowNorthWest,tt.defaultPositions.southArrowNorthEast,tt.defaultPositions.viewportStickyNorth];EV=500,zy={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroun
82dColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"},vh=class extends f{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[Ce]}static get pluginName(){return"TableCellPropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:Ri,backgroundColors:Ri})}init(){let e=this.editor,t=e.t;this._defaultContentTableCellProperties=Br(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._defaultLayoutTableCellProperties=zn(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._balloon=e.plugins.get(Ce),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",i=>{let n=new y(i);n.set({label:t("Cell properties"),icon:tl,tooltip:!0}),this.listenTo(n,"execute",()=>this._showView());let o=Object.values(zy).map(r=>e.commands.get(r));return n.bind("isEnabled").toMany(o,"isEnabled",(...r)=>r.some(l=>l)),n})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){let t=this.editor,i=t.config.get("table.tableCellProperties"),n=At(i.borderColors),o=Tt(t.locale,n),r=At(i.backgroundColors),l=Tt(t.locale,r),a=i.colorPicker!==!1,c=new kh(t.locale,{borderColors:o,backgroundColors:l,defaultTableCellProperties:e,colorPickerConfig:a?i.colorPicker||{}:!1}),u=t.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._und
vendor: 1,208 bytes, line 82
82oStepBatch),this._hideView()}),c.keystrokes.set("Esc",(h,g)=>{this._hideView(),g()}),Xe({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Lr(u),m=Rr(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:Li})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableCellBorderWidth",errorText:m,validator:Fr})),c.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:c.paddingInput,commandName:"tableCellPadding",errorText:m,validator:Zt})),c.on("change:width",this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:"tableCellWidth",errorText:m,validator:Zt})),c.on("change:height",this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:"tableCellHeight",errorText:m,validator:Zt})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableCellBackgroun
82dColor",errorText:d,validator:Li})),c.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),c.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),c}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(zy).map(([i,n])=>{let o=i,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[o]||"":this._defaultLayoutTableCellProperties[o]||"";return[i,e.get(n).value||r]}).forEach(([i,n])=>{(i==="borderColor"||i==="borderWidth")&&t.value==="none"||this.view.set(i,n)}),this._isReady=!0}_showView(){let e=this.editor,t=tn(e.editing.view.document.selection),i=t&&e.editing.mapper.toModelElement(t),n=!i||i.getAttribute("tableType")!=="layout";n&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):!n&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=n?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:cg(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor,t=e.editing.view.document;No(t.selection)?this._isViewVisible&&Or(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:i,validator:n,errorText:o}=e,r=kt(()=>{i.errorText=o},EV);return(l,a,c)=>{r.cancel(),this._isReady&&(n(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),i.errorText=null):r())}}},wt=class extends v{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,i){switch(super(e),this.attributeName=t,this._defaultContentTableValue=i,t){case"tableCellType":this._defaultLayoutTableValue="data";break;case"tableCellBorderStyle":this._defaultLayoutTableValue="none";break;case"tableCellHorizontalAlignment":this._defaultLayoutTableValue="left";break;case"tableCellVerticalAlignment":this._defaultLayoutTableValue="middle";break;default:this._defaultLayoutTableValue=void 0}}refresh(){let t=this.editor.model.document.selection,n=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t),o=Vt(t);this._defaultValue=!o||o.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!n.length,this.value=this._getSingleValue(n)}execute(e={}){let{value:t,batch:i}=e,n=this.editor.model,r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(n.document.selection),l=this._getValueToSet(t);n.enqueueChange(i,a=>{l?r.forEach(c=>a.setAttribute(this.attributeName,l,c)):r.forEach(c=>a.removeAttribute(this.attributeName,c)),this.fire("afterExecute",{writer:a,tableCells:r,valueToSet:l})})}_getAttribute(e){if(!e)return;let t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){let t=this._getAttribute(e[0]);return e.every(n=>this._getAttribute(n)===t)?t:void 0}},Ch=class extends wt{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if(e=on(e,"px"),e!==this._defaultValue)return e}},Er=class extends f{static get pluginName(){return"TableCellWidthEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[en]}init(){let e=this.editor,t=Br(e.config.get("table.tableCellProperties.defaultProperties"));kr(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:t.width}),e.commands.add("tableCellWidth",new Ch(e,t.width))}},Ih=class extends wt{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=on(e,"px");if(t!==this._defaultValue)return t}},Th=class extends wt{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){let t=on(e,"px");if(t!==this._defaultValue)return t}},Ah=class extends wt{constructor(e,t){super(e,"tableCellBackgroun
82dColor",t)}},Eh=class extends wt{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}},xh=class extends wt{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}},Sh=class extends wt{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},Vh=class extends wt{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},Ph=class extends wt{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=on(e,"px");if(t!==this._defaultValue)return t}},Bh=class extends wt{constructor(e){super(e,"tableCellType","data"),this.on("afterExecute",(t,i)=>{let{writer:n,tableCells:o}=i,r=this.editor.plugins.get(Ee),l=_S(o);Ev(r,n,l.keys())})}refresh(){super.refresh();let e=Vt(this.editor.model.document.selection);this.isEnabled&&e&&e.getAttribute("tableType")==="layout"&&(this.isEnabled=!1)}_getAttribute(e){return e?.getAttribute(this.attributeName)||"data"}};$y=/^(top|middle|bottom)$/,jy=/^(left|center|right|justify)$/,Lh=class extends f{static get pluginName(){return"TableCellPropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[en,Er]}init(){let e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});let n=Br(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"});e.data.addStyleProcessorRules(zr),xV(e,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableCellBorderStyle",new Sh(e,n.borderStyle)),e.commands.add("tableCellBorderColor",new Vh(e,n.borderColor)),e.commands.add("tableCellBorderWidth",new Ph(e,n.borderWidth)),kr(t,i,{modelAttribute:"tableCellHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:n.height}),e.commands.add("tableCellHeight",new Th(e,n.height)),e.data.addStyleProcessorRules(Kg),kr(t,i,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:n.padding}),e.commands.add("tableCellPadding",new Ih(e,n.padding)),e.data.addStyleProcessorRules(Yn),kr(t,i,{modelAttribute:"tableCellBackgroun
82dColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:n.backgroundColor}),e.commands.add("tableCellBackgroundColor",new Ah(e,n.backgroundColor)),SV(t,i,n.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new xh(e,n.horizontalAlignment)),VV(t,i,n.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Eh(e,n.verticalAlignment)),e.config.get("experimentalFlags.tableCellTypeSupport")&&(PV(e),e.commands.add("tableCellType",new Bh(e)))}};qy=class extends f{static get pluginName(){return"TableCellProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[Lh,vh]}},Rh=class extends f{static get pluginName(){return"TableLayoutUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.ui.componentFactory.add("insertTableLayout",i=>{let n=e.commands.get("insertTableLayout"),o=X(i);o.bind("isEnabled").to(n),o.buttonView.set({icon:il,label:t("Insert table layout"),tooltip:!0});let r;return o.on("change:isOpen",()=>{r||(r=new Wn(i),o.panelView.children.add(r),r.delegate("execute").to(o),o.on("execute",()=>{e.execute("insertTableLayout",{rows:r.rows,columns:r.columns}),e.editing.view.focus()}))}),o}),e.ui.componentFactory.add("menuBar:insertTableLayout",i=>{let n=e.commands.get("insertTableLayout"),o=new Ie(i),r=new Wn(i);return r.delegate("execute").to(o),o.on("change:isOpen",(l,a,c)=>{c||r.reset()}),r.on("execute",()=>{e.execute("insertTableLayout",{rows:r.rows,columns:r.columns}),e.editing.view.focus()}),o.buttonView.set({label:t("Table layout"),icon:il}),o.panelView.children.add(r),o.bind("isEnabled").to(n),o}),e.ui.componentFactory.add("tableType",()=>{let i=this.editor,n=i.t,o=new es(i.locale);return o.set({label:n("Table type"),icon:Xo,tooltip:!0}),Gy(i,o)})}afterInit(){let{editor:e}=this,{ui:t,plugins:i}=e,n;if(i.has("TablePropertiesUIExperimental"))n=i.get("TablePropertiesUIExperimental");else if(i.has("TablePropertiesUI"))n=i.get("TablePropertiesUI");else return;t.componentFactory.add("tableProperties",o=>{let r=n._createTablePropertiesButton(),l=new ht(o,r);return Gy(e,l)})}};Fh=class extends v{refresh(){let e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=LV(t,i)}execute(e={}){let t=this.editor,i=t.model,n=t.plugins.get("TableUtils");i.change(o=>{let r={rows:e.rows||2,columns:e.columns||2},l=n.createTable(o,r);o.setAttribute("tableType","layout",l),i.insertObject(l,null,null,{findOptimalPosition:"auto"});let a=`${100/r.columns}%`,c=Array(r.columns).fill(a);t.commands.get("resizeColumnWidths").execute({tableWidth:"100%",columnWidths:c,table:l}),o.setSelection(o.createPositionAt(l.getNodeByPath([0,0,0]),0))})}};Oh=class extends v{refresh(){this.isEnabled=!0}execute(e={}){let{model:t,plugins:i}=this.editor,{table:n=t.document.selection.getSelectedElement(),columnWidths:o,tableWidth:r}=e;o&&(o=Array.isArray(o)?o:o.split(",")),t.change(l=>{r?l.setAttribute("tableWidth",r,n):l.removeAttribute("tableWidth",n);let a=i.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!o&&!a)return;if(!o)return l.remove(a);let c=sg(o);if(a)Array.from(a.getChildren()).forEach((u,d)=>l.setAttribute("columnWidth",c[d],u));else{let u=l.createElement("tableColumnGroup");
82c.forEach(d=>l.appendElement("tableColumn",{columnWidth:d},u)),l.append(u,n)}})}};Xy=Mi("px"),Dh=class extends f{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;_initialMouseEventData=null;static get requires(){return[en,Ee]}static get pluginName(){return"TableColumnResizeEditing"}static get licenseFeatureCode(){return"TCR"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(cn()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(t,i,n)=>{let o=n?"removeClass":"addClass";e.editing.view.change(r=>{for(let l of e.editing.view.document.roots)r[o]("ck-column-resize_disabled",e.editing.view.document.getRoot(l.rootName))})})}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();let e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:o=>o.is("element","tableColumnGroup"),positionOffset:0});let n=new Oh(e);e.commands.add("resizeTableWidth",n),e.commands.add("resizeColumnWidths",n),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",n,"isEnabled",(o,r,l)=>!o&&r&&l)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return Oo(e)}getTableColumnElements(e){return Do(e)}getTableColumnsWidths(e){return YS(e)}_extendSchema(){let e=this.editor.model.schema;e.extend("table",{allowAttributes:["tableWidth"]}),e.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),e.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0}),e.setAttributeProperties("columnWidth",{isFormatting:!0})}_registerPostFixer(){let t=this.editor.model;t.document.registerPostFixer(o=>{let r=!1;for(let l of zS(t)){let a=this.getColumnGroupElement(l),c=this.getTableColumnElements(a),u=this.getTableColumnsWidths(a),d=sg(u);d=i(d,l,this),!fi(u,d)&&(_v(c,a,d,o),r=!0)}return r});function i(o,r,l){let a=l._tableUtilsPlugin.getColumns(r);if(a-o.length===0)return o;let u=o.map(m=>Number(m.replace("%",""))),d=n(l.editor.model.document.differ,r);for(let m of d){let h=a-u.length;if(h===0)continue;let g=h>0,p=l._tableUtilsPlugin.getCellLocation(m).column;if(g){let b=$S(r,l.editor),w=GS(h,b);u.splice(p,0,...w)}else{let b=u.splice(p,Math.abs(h));u[p]+=Fo(b)}}return u.map(m=>m+"%")}function n(o,r){let l=new Set;for(let a of o.getChanges())if(a.type=="insert"&&a.position.nodeAfter&&a.position.nodeAfter.name=="tableCell"&&a.position.nodeAfter.getAncestors().includes(r))l.add(a.position.nodeAfter);else if(a.type=="remove"){let c=a.position.nodeBefore||a.position.nodeAfter;c.name=="tableCell"&&c.getAncestors().includes(r)&&l.add(c)}return l}}_registerConverters(){let t=this.editor.conversion;t.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{key:"tableWidth",value:i=>{if(!i.parent.is("element","figure"))return i.getStyle("width")}}}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:i=>({name:"figure",key:"style",value:{width:i}})}),t.elementToElement({model:"tableColumnGroup",view:"colgroup"}),t.elementToElement({model:"tableColumn",view:"col"}),t.for("downcast").add(FV()),t.for("upcast").add(OV()),t.for("upcast").add(RV(this._tableUtilsPlugin)),t.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:i=>{let n=i.getStyle("width");return!n||!n.endsWith("%")&&!n.endsWith("pt")?"auto":n}}}),t.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),t.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:i=>({key:"style",value:{width:i}})})}_registerResizingListeners(){let e=this.editor.editing.view;e.addObserver(Ir),e.document.on("mouseover",this._onMouseOverHandler.bind(this),{priority:"high"}),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),e.document.on("mouseout",this._onMouseOutHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(W.window.document,"mousemove",Ho(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(W.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){let t=this.editor,i=t.editing.view.domConverter,n=i.mapViewToDom(e.findAnce
82stor("table")),o=i.mapViewToDom(e.findAncestor(u=>["td","th"].includes(u.name))),r=new ie(n),l=new ie(o),a=Xy(Number((r.top-l.top).toFixed(4))),c=Xy(Number((l.bottom-r.bottom).toFixed(4)));t.editing.view.change(u=>{u.setStyle("top",a,e),u.setStyle("bottom",c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(t=>{t.removeStyle("top",e),t.removeStyle("bottom",e)})}_onMouseOverHandler(e,t){let i=t.target;i.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(i)}_onMouseOutHandler(e,t){let i=t.target;i.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(i))}_onMouseDownHandler(e,t){let i=t.target;if(!i.hasClass("ck-table-column-resizer")||!this._isResizingAllowed)return;let n=this.editor,o=n.editing.mapper.toModelElement(i.findAncestor("figure"));n.model.canEditAt(o)&&(t.preventDefault(),e.stop(),this._initialMouseEventData=t)}_startResizingAfterThreshold(){let e=this._initialMouseEventData,{target:t}=e,i=this.editor.editing.mapper.toModelElement(t.findAncestor("figure")),n=t.findAncestor("table"),o=r(i,this._tableUtilsPlugin,this.editor);Array.from(n.getChildren()).find(c=>c.is("element","colgroup"))||this.editor.editing.view.change(c=>{l(c,o,n)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,o),this.editor.editing.view.change(c=>a(c,n,this._resizingData));function r(c,u,d){let m=Array(u.getColumns(c)),h=new $(c);for(let g of h){let p=d.editing.mapper.toViewElement(g.cell),b=d.editing.view.domConverter.mapViewToDom(p),w=XS(b);(!m[g.column]||w<m[g.column])&&(m[g.column]=st(w))}return m}function l(c,u,d){let m=c.createContainerElement("colgroup");for(let h=0;h<u.length;h++){let g=c.createEmptyElement("col"),p=`${st(u[h]/Fo(u)*100)}%`;c.setStyle("width",p,g),c.insert(c.createPositionAt(m,"end"),g)}c.insert(c.createPositionAt(d,0),m)}function a(c,u,d){let m=d.widths.viewFigureWidth/d.widths.viewFigureParentWidth;c.addClass("ck-table-resized",u),c.addClass("ck-table-column-resizer__active",d.elements.viewResizer),c.setStyle("width",`${st(m*100)}%`,u.findAncestor("figure"))}}_onMouseMoveHandler(e,t){if(this._initialMouseEventData){let T=this._initialMouseEventData.domEvent;if(Math.abs(t.clientX-T.clientX)>=WS)this._startResizingAfterThreshold(),this._initialMouseEventData=null;else return}if(!this._isResizingActive)return;if(!this._isResizingAllowed){this._onMouseUpHandler();return}let{columnPosition:i,flags:{isRightEdge:n,isTableCentered:o,isLtrContent:r},elements:{viewFigure:l,viewLeftColumn:a,viewRightColumn:c,viewResizer:u},widths:{viewFigureParentWidth:d,tableWidth:m,leftColumnWidth:h,rightColumnWidth:g}}=this._resizingData,p=-h+rh,b=n?d-m:g-rh,w=(r?1:-1)*(n&&o?2:1),k=qS((t.clientX-i)*w,Math.min(p,0),Math.max(b,0));k!==0&&(this.editor.editing.view.change(T=>{let B=st((h+k)*100/m);if(T.setStyle("width",`${B}%`,a),n){let Z=st((m+k)*100/d);T.setStyle("width",`${Z}%`,l)}else{let Z=st((g-k)*100/m);T.setStyle("width",`${Z}%`,c)}}),this._recalculateResizerElement(u))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;let{viewResizer:e,modelTable:t,viewFigure:i,viewColgroup:n}=this._resizingData.elements,o=this.editor,r=o.editing.view,l=this.getColumnGroupElement(t),a=Array.from(n.getChildren()).filter(b=>b.is("view:element")),c=l?this.getTableColumnsWidths(l):null,u=a.map(b=>b.getStyle("width")),d=!fi(c,u),m=t.getAttribute("tableWidth"),h=i.getStyle("width"),g=m!==h;(d||g)&&(this._isResizingAllowed?o.execute("resizeTableWidth",{table:t,tableWidth:`${st(h)}%`,columnWidths:u}):r.change(b=>{if(c)for(let w of a)b.setStyle("width",c.shift(),w);else b.remove(n);g&&(m?b.setStyle("width",m,i):b.removeStyle("width",i)),!c&&!m&&b.removeClass("ck-table-resized",[...i.getChildren()].find(w=>w.name==="table"))})),r.change(b=>{b.removeClass("ck-table-column-resizer__active",e)}),r.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){let i=this.editor,n=e.domEvent.clientX,o=e.target,r=o.findAnce
vendor: 14,339 bytes, line 82
82stor("td")||o.findAncestor("th"),l=i.editing.mapper.toModelElement(r),a=l.findAncestor("table"),c=jS(l,this._tableUtilsPlugin).rightEdge,u=this._tableUtilsPlugin.getColumns(a)-1,d=a.getAttribute("tableAlignment");a.getAttribute("tableType")!=="layout"&&(d||=i.config.get("table.tableProperties.defaultProperties.alignment"),d||="center");let m=c===u,h=i.locale.contentLanguageDirection!=="rtl",g=d==="center",p=r.findAncestor("table"),b=p.findAncestor("figure"),w=[...p.getChildren()].find(Pt=>Pt.is("element","colgroup")),k=w.getChild(c),T=m?void 0:w.getChild(c+1),B=lh(i.editing.view.domConverter.mapViewToDom(b.parent)),Z=lh(i.editing.view.domConverter.mapViewToDom(b)),_e=wv(a,i),ke=t[c],_t=m?void 0:t[c+1];return{columnPosition:n,flags:{isRightEdge:m,isTableCentered:g,isLtrContent:h},elements:{viewResizer:o,modelTable:a,viewFigure:b,viewColgroup:w,viewLeftColumn:k,viewRightColumn:T},widths:{viewFigureParentWidth:B,viewFigureWidth:Z,tableWidth:_e,leftColumnWidth:ke,rightColumnWidth:_t}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(t,i,n)=>{let o=i.item,r=n.mapper.toViewElement(o),l=n.writer;l.insert(l.createPositionAt(r,"end"),l.createUIElement("div",{class:"ck-table-column-resizer"}))},{priority:"lowest"})})}},xr=class extends f{static get requires(){return[Dh,Er]}static get pluginName(){return"TableColumnResize"}static get isOfficialPlugin(){return!0}},Nh=class extends v{refresh(){let t=this.editor.model.document.selection,i=Vt(t);i?(this.isEnabled=!0,this.value=i.getAttribute("tableType")):(this.isEnabled=!1,this.value=null)}execute(e){let i=this.editor.model,n=i.document.selection,o=Vt(n);o.getAttribute("tableType")!==e&&i.change(l=>{l.setAttribute("tableType",e,o),i.schema.removeDisallowedAttributes([o],l);let a=o.getChildren();for(let c of a)i.schema.checkChild(o,c)||l.remove(c)})}},DV=["content","layout"],Mh=class extends f{static get pluginName(){return"TableLayoutEditing"}static get licenseFeatureCode(){return"TL"}static get requires(){return[xr]}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this._defineSchema(),this._defineConverters(),this._defineClipboardPasteHandlers(),this._registerTableTypeAttributePostfixer(),this.editor.commands.add("insertTableLayout",new Fh(this.editor)),this.editor.commands.add("tableType",new Nh(this.editor))}_defineSchema(){let{schema:e}=this.editor.model;e.extend("table",{allowAttributes:"tableType"}),e.addChildCheck(Xm,"caption"),e.addAttributeCheck(Xm,"headingRows"),e.addAttributeCheck(Xm,"headingColumns")}_defineConverters(){let{editor:e}=this,{conversion:t}=e,i=e.config.get("table.tableLayout.preferredExternalTableType");t.for("upcast").add(NV(e,i)),t.for("dataDowncast").add(MV()),t.for("editingDowncast").attributeToAttribute({model:{key:"tableType",values:["layout","content"]},view:{layout:{key:"class",value:["layout-table"]},content:{key:"class",value:["content-table"]}}})}_defineClipboardPasteHandlers(){let{plugins:e}=this.editor;if(!e.has("ClipboardPipeline"))return;let t=e.get("ClipboardPipeline");this.listenTo(t,"contentInsertion",(i,n)=>{n.sourceEditorId||this.editor.model.change(o=>{for(let{item:r}of o.createRangeIn(n.content))r.is("element","table")&&o.setAttribute("tableType","content",r)})})}_registerTableTypeAttributePostfixer(){let e=this.editor;e.model.document.registerPostFixer(t=>{let i=e.model.document.differ.getChanges(),n=!1;for(let o of i){if(o.type=="insert"&&o.name!="$text"){let r=o.position.nodeAfter,l=t.createRangeOn(r);for(let a of l.getItems())a.is("element","table")&&!a.hasAttribute("tableType")&&(t.setAttribute("tableType","content",a),n=!0)}if(o.type=="attribute"&&o.attributeKey=="tableType"){for(let r of o.range.getItems())if(r.is("element","table")){e.model.schema.removeDisallowedAttributes([r],t);let l=r.getChildren();for(let a of l)e.model.schema.checkChild(r,a)||(t.remove(a),n=!0)}}}return n})}};Qy=class extends f{static get pluginName(){return"TableLayout"}static get isOfficialPlugin(){return!0}static get requires(){return[xr,Mh,Rh]}},mi=class extends v{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,i){super(e),this.attributeName=t,this._defaultContentTableValue=i,this._defaultLayoutTableValue=t==="tableBorderStyle"?"none":void 0}refresh(){let t=this.editor.model.document.selection,i=Vt(t);this._defaultValue=!i||i.getAttribute("tableType")!=="layout"?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!i,this.value=this._getValue(i)}execute(e={}){let t=this.editor.model,i=t.document.selection,{value:n,batch:o}=e,r=Vt(i),l=this._getValueToSet(n);t.enqueueChange(o,a=>{l?a.setAttribute(this.attributeName,l,r):a.removeAttribute(this.attributeName,r)})}_getValue(e){if(!e)return;let t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}},Uh=class extends mi{constructor(e,t){super(e,"tableBackgroundColor",t)}},Hh=class extends mi{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},Wh=class extends mi{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},zh=class extends mi{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;let t=nn(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=on(e,"px");if(t!==this._defaultValue)return t}},$h=class extends mi{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if(e=on(e,"px"),e!==this._defaultValue)return e}},jh=class extends mi{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if(e=on(e,"px"),e!==this._defaultValue)return e}},qh=class extends mi{constructor(e,t){super(e,"tableAlignment",t)}},Gh=class extends f{static get pluginName(){return"TablePropertiesEditing"}static get licenseFeatureCode(){return"TCP"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[en]}init(){let e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});let n=Pr(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),o=e.config.get("table.tableProperties.alignment.useInlineStyles")!==!1;if(e.data.addStyleProcessorRules(Qn),e.data.addStyleProcessorRules(zr),HV(e,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableBorderColor",new Hh(e,n.borderColor)),e.commands.add("tableBorderStyle",new Wh(e,n.borderStyle)),e.commands.add("tableBorderWidth",new zh(e,n.borderWidth)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")?WV(t,i,n.alignment,o):zV(t,i,n.alignment),e.commands.add("tableAlignment",new qh(e,n.alignment)),Zy(t,i,{modelAttribute:"tableWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:n.width}),e.commands.add("tableWidth",new $h(e,n.width)),Zy(t,i,{modelAttribute:"tableHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:n.height}),e.commands.add("tableHeight",new jh(e,n.height)),e.data.addStyleProcessorRules(Yn),qV(t,i,{modelAttribute:"tableBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:n.backgroundColor}),e.commands.add("tableBackgroundColor",new Uh(e,n.backgroundColor)),e.config.get("experimentalFlags.useExtendedTableBlockAlignment")){let r=e.editing.view.document;this.listenTo(r,"clipboardOutput",(l,a)=>{e.editing.view.change(c=>{for(let{item:u}of c.createRangeIn(a.content))UV(u,c);a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content))})},{priority:"lowest"})}}};Kh=class extends P{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;let{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:l,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:d,dimensionsLabel:m}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new J,this.keystrokes=new K,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput=a,this.widthInput=c,this.heightInput=d,this.alignmentToolbar=h;let{saveButtonView:p,cancelButtonView:b}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=b,this._focusables=new ye,this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Oe(e,{label:this.t("Table properties")})),this.children.add(new q(e,{labelView:r,children:[r,i,o,n],class:"ck-table-form__border-row"})),this.children.add(new q(e,{labelView:l,children:[l,a],class:"ck-table-form__background-row"})),this.children.add(new q(e,{children:[new q(e,{labelView:m,children:[m,c,u,d],class:"ck-table-form__dimensions-row"}),new q(e,{labelView:g,children:[g,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new q(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=Ar({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,r=o("Style"),l=new Ae(n);l.text=o("Border");let a=lg(o),c=new H(n,yi);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>a[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),be(c.fieldView,Iv(this,t.style),{role:"menu",ariaLabel:r});let u=new H(n,ce);u.set({label:o("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",fr),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});let d=new H(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",fr),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(m,h,g,p)=>{fr(g)||(this.borderColor="",this.borderWidth=""),fr(p)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:l,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:u}}_createBackgroundFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Background");let n=Ar({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new H(e,n);return o.set({label:t("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",()=>{this.backgroundColor=o.fieldView.value}),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Dimensions");let n=new H(e,ce);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",()=>{this.width=n.fieldView.element.value});let o=new P(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let r=new H(e,ce);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:r}}_createAlignmentFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Alignment");let n=new Ue(e);return n.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),_h({view:this,icons:{left:hn,center:Hi,right:Ui},toolbar:n,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:n}}_createActionButtons(){let e=this.locale,t=this.t,i=new y(e),n=new y(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),icon:oo,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(o,"errorText",(...r)=>r.every(l=>!l)),n.set({label:t("Cancel"),icon:no,class:"ck-button-cancel",withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:n}}get _alignmentLabels(){let e=this.locale,t=this.t,i=t("Align table to the left"),n=t("Center table"),o=t("Align table to the right");return e.uiLanguageDirection==="rtl"?{right:o,center:n,left:i}:{left:i,center:n,right:o}}};KV=500,ev={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroun
82dColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"},Xh=class extends f{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[Ce]}static get pluginName(){return"TablePropertiesUI"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:Ri,backgroundColors:Ri})}init(){let e=this.editor;this._defaultContentTableProperties=Pr(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=zn(),this._balloon=e.plugins.get(Ce),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){let e=this.editor,t=e.t,i=new y(e.locale);i.set({label:t("Table properties"),icon:Xo,tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());let n=Object.values(ev).map(o=>e.commands.get(o));return i.bind("isEnabled").toMany(n,"isEnabled",(...o)=>o.some(r=>r)),i}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){let t=this.editor,i=t.config.get("table.tableProperties"),n=At(i.borderColors),o=Tt(t.locale,n),r=At(i.backgroundColors),l=Tt(t.locale,r),a=i.colorPicker!==!1,c=new Kh(t.locale,{borderColors:o,backgroundColors:l,defaultTableProperties:e,colorPickerConfig:a?i.colorPicker||{}:!1}),u=t.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._und
vendor: 13,775 bytes, line 82
82oStepBatch),this._hideView()}),c.keystrokes.set("Esc",(h,g)=>{this._hideView(),g()}),Xe({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Lr(u),m=Rr(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Li})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableBorderWidth",errorText:m,validator:Fr})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Li})),c.on("change:width",this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:"tableWidth",errorText:m,validator:Zt})),c.on("change:height",this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:"tableHeight",errorText:m,validator:Zt})),c.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),c}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(ev).map(([i,n])=>{let o=i,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[o]||"":this._defaultLayoutTableProperties[o]||"";return[o,e.get(n).value||r]}).forEach(([i,n])=>{(i==="borderColor"||i==="borderWidth")&&t.value==="none"||this.view.set(i,n)}),this._isReady=!0}_showView(){let e=this.editor,t=tn(e.editing.view.document.selection),i=t&&e.editing.mapper.toModelElement(t),n=!i||i.getAttribute("tableType")!=="layout";n&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):!n&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=n?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ag(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor,t=e.editing.view.document;tn(t.selection)?this._isViewVisible&&Or(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:i,validator:n,errorText:o}=e,r=kt(()=>{i.errorText=o},KV);return(l,a,c)=>{r.cancel(),this._isReady&&(n(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),i.errorText=null):r())}}},tv=class extends f{static get pluginName(){return"TableProperties"}static get isOfficialPlugin(){return!0}static get requires(){return[Gh,Xh]}};Yh=class extends v{refresh(){let e=this.editor,t=Vt(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,"caption"),this.isEnabled?this.value=!!Sr(t):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)})}_showTableCaption(e,t){let i=this.editor.model,n=Vt(i.document.selection),l=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||e.createElement("caption");i.insertContent(l,n,"end"),t&&e.setSelection(l,"in")}_hideTableCaption(e){let t=this.editor.model,i=Vt(t.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),o=Sr(i);n._saveCaption(i,o),t.deleteContent(e.createSelection(o,"on"))}},Qh=class extends f{_savedCaptionsMap=new WeakMap;_captionIdsMapping=new WeakMap;static get pluginName(){return"TableCaptionEditing"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,i=e.editing.view,n=e.t,o=e.config.get("table.tableCaption.useCaptionElement");t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new Yh(this.editor)),o&&e.plugins.get("TableEditing").registerAdditionalSlot({filter:l=>l.is("element","caption"),positionOffset:"end"}),e.conversion.for("upcast").elementToElement({view:JV,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(r,{writer:l})=>iv(r.parent)?l.createContainerElement(o?"caption":"figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(r,{writer:l})=>{if(!iv(r.parent))return null;let a=l.createEditableElement(o?"caption":"figcaption");return l.setCustomProperty("tableCaption",!0,a),a.placeholder=n("Enter table caption"),Ge({view:i,element:a,keepOnFocus:!0}),ao(a,l)}}),e.conversion.for("editingDowncast").add(r=>{r.on("insert:table",(l,a,{writer:c,mapper:u})=>{let d=a.item,m=u.toViewElement(d);if(!m)return;let h=Array.from(m.getChildren()).find(w=>w.is("element","table"));if(!h)return;let g=Sr(d);if(!g){c.removeAttribute("aria-labelledby",h);return}let p=u.toViewElement(g);if(!p)return;let b;p.hasAttribute("id")?b=p.getAttribute("id"):b=this._captionIdsMapping.get(g)??`ck-editor__caption_${yt()}`,this._captionIdsMapping.set(g,b),c.setAttribute("id",b,p),c.setAttribute("aria-labelledby",b,h)},{priority:"low"})}),XV(e.model)}_getSavedCaption(e){let t=this._savedCaptionsMap.get(e);return t?Go.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}},Jh=class extends f{static get pluginName(){return"TableCaptionUI"}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,i=e.t;e.ui.componentFactory.add("toggleTableCaption",n=>{let o=e.commands.get("toggleTableCaption"),r=new y(n);return r.set({icon:Qo,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.bind("label").to(o,"value",l=>i(l?"Toggle caption off":"Toggle caption on")),this.listenTo(r,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),o.value){let l=QV(e.model.document.selection),a=e.editing.mapper.toViewElement(l);if(!a)return;t.scrollToTheSelection(),t.change(c=>{c.addClass("table__caption_highlighted",a)})}e.editing.view.focus()}),r})}},nv=class extends f{static get pluginName(){return"TableCaption"}static get isOfficialPlugin(){return!0}static get requires(){return[Qh,Jh]}};eg=class extends P{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;let{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:l,backgroundInput:a}=this._createBackgroundFields(),{widthInput:c,operatorLabel:u,heightInput:d,dimensionsLabel:m}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new J,this.keystrokes=new K,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput=a,this.widthInput=c,this.heightInput=d,this.alignmentToolbar=h;let{saveButtonView:p,cancelButtonView:b}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=b,this.backButtonView=this._createBackButton(),this._focusables=new ye,this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});let w=new Oe(e,{label:this.t("Table properties")});w.children.add(this.backButtonView,0),this.children.add(w),this.children.add(new q(e,{labelView:r,children:[r,i,n,o],class:"ck-table-form__border-row"})),this.children.add(new q(e,{children:[new q(e,{labelView:m,children:[m,c,u,d],class:"ck-table-form__dimensions-row"}),new q(e,{labelView:l,children:[l,a],class:"ck-table-form__background-row"})]})),this.children.add(new q(e,{labelView:g,children:[g,h],class:"ck-table-properties-form__alignment-row"})),this.children.add(new q(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form","ck-table-properties-form_experimental"],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderWidthInput,this.borderColorInput,this.widthInput,this.heightInput,this.backgroundInput,this.alignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=Vr({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,r=o("Style"),l=new Ae(n);l.text=o("Border");let a=ug(o),c=new H(n,yi);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>a[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),be(c.fieldView,xv(this,t.style),{role:"menu",ariaLabel:r});let u=new H(n,ce);u.set({label:o("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",pr),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});let d=new H(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",pr),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(m,h,g,p)=>{pr(g)||(this.borderColor="",this.borderWidth=""),pr(p)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:l,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:u}}_createBackgroundFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Background");let n=Vr({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new H(e,n);return o.set({label:t("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",()=>{this.backgroundColor=o.fieldView.value}),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Dimensions");let n=new H(e,ce);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",()=>{this.width=n.fieldView.element.value});let o=new P(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let r=new H(e,ce);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:r}}_createAlignmentFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Table Alignment");let n=new Ue(e);return n.set({role:"radiogroup",isCompact:!0,ariaLabel:t("Table alignment toolbar")}),Zh({view:this,icons:{left:hn,center:Hi,right:Ui,blockLeft:so,blockRight:ro},toolbar:n,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:n}}_createActionButtons(){let e=this.locale,t=this.t,i=new y(e),n=new y(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:!0}),i.bind("isEnabled").toMany(o,"errorText",(...r)=>r.every(l=>!l)),n.set({label:t("Cancel"),withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:n}}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}get _alignmentLabels(){let e=this.locale,t=this.t,i=t("Align table to the left with no text wrapping"),n=t("Align table to the right with no text wrapping"),o=t("Align table to the left with text wrapping"),r=t("Center table with no text wrapping"),l=t("Align table to the right with text wrapping");return e.uiLanguageDirection==="rtl"?{right:l,left:o,blockRight:n,center:r,blockLeft:i}:{blockLeft:i,center:r,blockRight:n,left:o,right:l}}};eP=500,ov={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroun
82dColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"},sv=class extends f{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[Ce]}static get pluginName(){return"TablePropertiesUIExperimental"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:Ri,backgroundColors:Ri})}init(){let e=this.editor;this._defaultContentTableProperties=Pr(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=zn(),this._balloon=e.plugins.get(Ce),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){let e=this.editor,t=e.t,i=new y(e.locale);i.set({label:t("Table properties"),icon:Xo,tooltip:!0}),this.listenTo(i,"execute",()=>this._showView());let n=Object.values(ov).map(o=>e.commands.get(o));return i.bind("isEnabled").toMany(n,"isEnabled",(...o)=>o.some(r=>r)),i}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){let t=this.editor,i=t.config.get("table.tableProperties"),n=At(i.borderColors),o=Tt(t.locale,n),r=At(i.backgroundColors),l=Tt(t.locale,r),a=i.colorPicker!==!1,c=new eg(t.locale,{borderColors:o,backgroundColors:l,defaultTableProperties:e,colorPickerConfig:a?i.colorPicker||{}:!1}),u=t.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView()}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._und
vendor: 4,246 bytes, line 82
82oStepBatch),this._hideView()}),c.keystrokes.set("Esc",(h,g)=>{this._hideView(),g()}),Xe({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=Lr(u),m=Rr(u);return c.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableBorderColor",errorText:d,validator:Li})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableBorderWidth",errorText:m,validator:Fr})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableBackgroundColor",errorText:d,validator:Li})),c.on("change:width",this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:"tableWidth",errorText:m,validator:Zt})),c.on("change:height",this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:"tableHeight",errorText:m,validator:Zt})),c.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),c}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(ov).map(([i,n])=>{let o=i,r=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[o]||"":this._defaultLayoutTableProperties[o]||"";return[o,e.get(n).value||r]}).forEach(([i,n])=>{(i==="borderColor"||i==="borderWidth")&&t.value==="none"||this.view.set(i,n)}),this._isReady=!0}_showView(){let e=this.editor,t=tn(e.editing.view.document.selection),i=t&&e.editing.mapper.toModelElement(t),n=!i||i.getAttribute("tableType")!=="layout";n&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):!n&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=n?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:ag(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor,t=e.editing.view.document;tn(t.selection)?this._isViewVisible&&Or(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:i,validator:n,errorText:o}=e,r=kt(()=>{i.errorText=o},eP);return(l,a,c)=>{r.cancel(),this._isReady&&(n(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),i.errorText=null):r())}}},tg=class extends P{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;cellTypeDropdown;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:"",cellType:""}),this.options=t;let{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:l,backgroundInput:a}=this._createBackgroundFields(),{cellTypeRowLabel:c,cellTypeDropdown:u}=this._createCellTypeField(),{widthInput:d,operatorLabel:m,heightInput:h,dimensionsLabel:g}=this._createDimensionFields(),{horizontalAlignmentToolbar:p,verticalAlignmentToolbar:b,alignmentLabel:w}=this._createAlignmentFields();this.focusTracker=new J,this.keystrokes=new K,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput
82=a,this.cellTypeDropdown=u,this.paddingInput=this._createPaddingField(),this.widthInput=d,this.heightInput=h,this.horizontalAlignmentToolbar=p,this.verticalAlignmentToolbar=b;let{saveButtonView:k,cancelButtonView:T}=this._createActionButtons();this.saveButtonView=k,this.cancelButtonView=T,this.backButtonView=this._createBackButton(),this._focusables=new ye,this._focusCycler=new me({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});let B=new Oe(e,{label:this.t("Cell properties")});B.children.add(this.backButtonView,0),this.children.add(B),this.children.add(new q(e,{labelView:r,children:this.options.isTableCellTypeSupported?[r,i,n,o]:[r,i,o,n],class:`ck-table-form__border-row${this.options.isTableCellTypeSupported?" ck-table-form__border-row_experimental":""}`})),this.children.add(new q(e,{children:this.options.isTableCellTypeSupported?[new q(e,{labelView:c,children:[c,u],class:"ck-table-form__cell-type-row"}),new q(e,{labelView:l,children:[l,a],class:"ck-table-form__background-row"})]:[new q(e,{labelView:l,children:[l,a],class:"ck-table-form__background-row"})]})),this.children.add(new q(e,{children:[new q(e,{labelView:g,children:[g,d,m,h],class:"ck-table-form__dimensions-row"}),new q(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new q(e,{labelView:w,children:[w,p,b],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new q(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form","ck-table-cell-properties-form_experimental",this.options.isTableCellTypeSupported?"ck-table-cell-properties-form_experimental-no-cell-type":""],tabindex:"-1"},children:this.children})}render(){super.render(),Fe({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler)}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.cellTypeDropdown,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){let e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=Vr({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,r=o("Style"),l=new Ae(n);l.text=o("Border");let a=ug(o),c=new H(n,yi);c.set({label:r,class:"ck-table-form__border-style"}),c.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.fieldView.buttonView.bind("label").to(this,"borderStyle",m=>a[m||"none"]),c.fieldView.on("execute",m=>{this.borderStyle=m.source._borderStyleValue}),c.bind("isEmpty").to(this,"borderStyle",m=>!m),be(c.fieldView,xv(this,t.style),{role:"menu",ariaLabel:r});let u=new H(n,ce);u.set({label:o("Width"),class:"ck-table-form__border-width"}),u.fieldView.bind("value").to(this,"borderWidth"),u.bind("isEnabled").to(this,"borderStyle",br),u.fieldView.on("input",()=>{this.borderWidth=u.fieldView.element.value});let d=new H(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",br),d.fieldView.on("input",()=>{this.borderColor=d.fieldView.value}),this.on("change:borderStyle",(m,h,g,p)=>{br(g)||(this.borderColor="",this.borderWidth=""),br(p)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:l,borderStyleDropdown:c,borderColorInput:d,borderWidthInput:u}}_createBackgroundFields(){let e=this.locale,t=this.t,i=new Ae(e);
vendor: 4,783 bytes, line 82
82i.text=t("Background");let n=Vr({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new H(e,n);return o.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",()=>{this.backgroundColor=o.fieldView.value}),{backgroundRowLabel:i,backgroundInput:o}}_createCellTypeField(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Cell type");let n=this._cellTypeLabels,o=new H(e,yi);return o.set({label:t("Cell type"),class:"ck-table-cell-properties-form__cell-type"}),o.fieldView.buttonView.set({ariaLabel:t("Cell type"),ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:t("Cell type")}),o.fieldView.buttonView.bind("label").to(this,"cellType",r=>n[r||"data"]),o.fieldView.on("execute",r=>{this.cellType=r.source._cellTypeValue}),o.bind("isEmpty").to(this,"cellType",r=>!r),be(o.fieldView,this._getCellTypeDefinitions(),{role:"menu",ariaLabel:t("Cell type")}),{cellTypeRowLabel:i,cellTypeDropdown:o}}_createDimensionFields(){let e=this.locale,t=this.t,i=new Ae(e);i.text=t("Dimensions");let n=new H(e,ce);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",()=>{this.width=n.fieldView.element.value});let o=new P(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"\xD7"}]});let r=new H(e,ce);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:r}}_createPaddingField(){let e=this.locale,t=this.t,i=new H(e,ce);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",()=>{this.padding=i.fieldView.element.value}),i}_createAlignmentFields(){let e=this.locale,t=this.t,i=new Ae(e),n={left:to,center:Zn,right:io,justify:eo,top:Kr,middle:Gr,bottom:qr};i.text=t("Table cell text alignment");let o=new Ue(e),r=e.contentLanguageDirection==="rtl";o.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar"),class:"ck-table-cell-properties-form__horizontal-alignment-toolbar"}),Zh({view:this,icons:n,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:a=>{if(r){if(a==="left")return"right";if(a==="right")return"left"}return a},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});let l=new Ue(e);return l.set({isCompact:!0,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar"),class:"ck-table-cell-properties-form__vertical-alignment-toolbar"}),Zh({view:this,icons:n,toolbar:l,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:l,alignmentLabel:i}}_createActionButtons(){let e=this.locale,t=this.t,i=new y(e),n=new y(e),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:!0}),i.bind("isEnabled").toMany(o,"errorText",(...r)=>r.every(l=>!l)),n.set({label:t("Cancel"),withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:n}}_createBackButton(){let e=this.locale.t,t=new y(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:xe,tooltip:!0}),t.delegate("execute").to(this,"cancel"),t}_getCellTypeDefinitions(){let e=new ne,t=this._cellTypeLabels;for(let i of["data","header"]){let n={type:"button",model:new we({_cellTypeValue:i,label:t[i],role:"menuitemradio",withText:!0})};n.model.bind("isOn").to(this,"cellType",o=>o===i),e.add(n)}return e}get _horizontalAlignmentLabels(){let e=this.locale,t=this.t,i=t("Align cell text to the left"),n=t("Align cell text to the center"),o=t("Align cell text to the right"),r=t("Justify cell text");return e.uiLanguageDirection==="rtl"?{right:o,center:n,left:i,justify:r}:{left:i,center:n,right:o,justify:r}}get _verticalAlignmentLabels(){let e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}get _cellTypeLabels(){let e=this.t;return{data:e("Data cell"),header:e("Header cell")}}};tP=500,rv={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroun
82dColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment",cellType:"tableCellType"},lv=class extends f{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[Ce]}static get pluginName(){return"TableCellPropertiesUIExperimental"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:Ri,backgroundColors:Ri})}init(){let e=this.editor,t=e.t;this._defaultContentTableCellProperties=Br(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._defaultLayoutTableCellProperties=zn(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection==="rtl"}),this._balloon=e.plugins.get(Ce),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",i=>{let n=new y(i);n.set({label:t("Cell properties"),icon:tl,tooltip:!0}),this.listenTo(n,"execute",()=>this._showView());let o=Object.values(rv).map(r=>e.commands.get(r)).filter(r=>!!r);return n.bind("isEnabled").toMany(o,"isEnabled",(...r)=>r.some(l=>l)),n})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){let t=this.editor,i=t.config.get("table.tableCellProperties"),n=At(i.borderColors),o=Tt(t.locale,n),r=At(i.backgroundColors),l=Tt(t.locale,r),a=i.colorPicker!==!1,c=!!t.config.get("experimentalFlags.tableCellTypeSupport"),u=new tg(t.locale,{borderColors:o,backgroundColors:l,defaultTableCellProperties:e,colorPickerConfig:a?i.colorPicker||{}:!1,isTableCellTypeSupported:c}),d=t.t;u.render(),this.listenTo(u,"submit",()=>{this._hideView()}),this.listenTo(u,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._und
vendor: 1,201 bytes, line 82
82oStepBatch),this._hideView()}),u.keystrokes.set("Esc",(p,b)=>{this._hideView(),b()}),Xe({emitter:u,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let m=Lr(d),h=Rr(d);u.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),u.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:u.borderColorInput,commandName:"tableCellBorderColor",errorText:m,validator:Li})),u.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:u.borderWidthInput,commandName:"tableCellBorderWidth",errorText:h,validator:Fr})),u.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:u.paddingInput,commandName:"tableCellPadding",errorText:h,validator:Zt})),u.on("change:width",this._getValidatedPropertyChangeCallback({viewField:u.widthInput,commandName:"tableCellWidth",errorText:h,validator:Zt})),u.on("change:height",this._getValidatedPropertyChangeCallback({viewField:u.heightInput,commandName:"tableCellHeight",errorText:h,validator:Zt})),u.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:u.backgroundInput,commandName:"tableCellBackgroun
82dColor",errorText:m,validator:Li})),u.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),u.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment"));let g=t.commands.get("tableCellType");return g&&(u.cellTypeDropdown.bind("isEnabled").to(g,"isEnabled"),u.on("change:cellType",this._getPropertyChangeCallback("tableCellType"))),u}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(rv).flatMap(([i,n])=>{let o=e.get(n);if(!o)return[];let r=i,l;return r==="cellType"?l="":l=this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[r]||"":this._defaultLayoutTableCellProperties[r]||"",[[i,o.value||l]]}).forEach(([i,n])=>{(i==="borderColor"||i==="borderWidth")&&t.value==="none"||this.view.set(i,n)}),this._isReady=!0}_showView(){let e=this.editor,t=tn(e.editing.view.document.selection),i=t&&e.editing.mapper.toModelElement(t),n=!i||i.getAttribute("tableType")!=="layout";n&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):!n&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=n?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:cg(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor,t=e.editing.view.document;No(t.selection)?this._isViewVisible&&Or(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:i,validator:n,errorText:o}=e,r=kt(()=>{i.errorText=o},tP);return(l,a,c)=>{r.cancel(),this._isReady&&(n(c)?(this.editor.execute(t,{value:c,batch:this._undoStepBatch}),i.errorText=null):r())}}}});function Pv(s){if(s.is("$text")||s.is("$textProxy"))return s.data;let e=s,t="",i=null;for(let n of e.getChildren()){let o=Pv(n);i&&i.is("element")&&(t+=`
83`),t+=o,i=n}return t}var Vv,Bv=M(()=>{U();z();j();Me();Vv=class extends f{_config;_outputView;_wordsMatchRegExp;constructor(e){super(e),this.set("characters",0),this.set("words",0),Object.defineProperties(this,{characters:{get(){return this.characters=this._getCharacters(this._getText())}},words:{get(){return this.words=this._getWords(this._getText())}}}),this.set("_wordsLabel",void 0),this.set("_charactersLabel",void 0),this._config=e.config.get("wordCount")||{},this._outputView=void 0,this._wordsMatchRegExp=Je.features.isRegExpUnicodePropertySupported?new RegExp("([\\p{L}\\p{N}]+\\S?)+","gu"):/([a-zA-Z0-9À-ž]+\S?)+/gu}static get pluginName(){return"WordCount"}static get licenseFeatureCode(){return"WC"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this.editor.model.document.on("change:data",Ho(this._refreshStats.bind(this),250)),typeof this._config.onUpdate=="function"&&this.on("update",(t,i)=>{this._config.onUpdate(i)}),dt(this._config.container)&&this._config.container.appendChild(this.wordCountContainer)}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy()}get wordCountContainer(){let e=this.editor,t=e.t,i=e.config.get("wordCount.displayWords"),n=e.config.get("wordCount.displayCharacters"),o=Zo.bind(this,this),r=[];return this._outputView||(this._outputView=new P,(i||i===void 0)&&(this.bind("_wordsLabel").to(this,"words",l=>t("Words: %0",l)),r.push({tag:"div",children:[{text:[o.to("_wordsLabel")]}],attributes:{class:"ck-word-count__words"}})),(n||n===void 0)&&(this.bind("_charactersLabel").to(this,"characters",l=>t("Characters: %0",l)),r.push({tag:"div",children:[{text:[o.to("_charactersLabel")]}],attributes:{class:"ck-word-count__characters"}})),this._outputView.setTemplate({tag:"div",attributes:{class:["ck","ck-word-count"]},children:r}),this._outputView.render()),this._outputView.element}_getText(){let e="";for(let t of this.editor.model.document.getRoots())e!==""&&(e+=`
84`),e+=Pv(t);return e}_getCharacters(e){return e.replace(/\n/g,"").length}_getWords(e){return(e.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){let e=this._getText(),t=this.words=this._getWords(e),i=this.characters=this._getCharacters(e);this.fire("update",{words:t,characters:i})}}});var iP=M(()=>{Pp();Op();Mp();Hp();Xp();Zp();nb();fb();wb();Ci();yb();Vb();U();Bb();Rb();Ob();Nb();Ub();zb();Xb();ve();kn();Qb();ew();pc();dw();vw();Iw();Aw();Sw();Ww();re();S_();xk();Vk();Mk();kd();Ov();qk();ey();sy();ly();Ap();Dv();cy();by();Ip();_y();yy();Iy();xy();Sv();at();z();us();Jn();j();Fv();zt();Bv();});export{Nv as a,Mv as b,Uv as c,Vp as d,pl as e,Lp as f,Rp as g,Fp as h,hl as i,gl as j,fl as k,Bp as l,Ii as m,Cn as n,Np as o,Up as p,ai as q,Tl as r,qi as s,Al as t,Wp as u,El as v,xl as w,zp as x,Sl as y,Vl as z,$p as A,Pl as B,Bl as C,jp as D,Ll as E,Rl as F,qp as G,Fl as H,Ol as I,Gp as J,Dl as K,Nl as L,Kp as M,Ml as N,Ul as O,Hl as P,Jp as Q,zl as R,ib as S,$l as T,jl as U,Gi as V,Gl as W,tb as X,Ql as Y,mb as Z,l
84C as _,aC as $,hs as aa,uC as ba,dC as ca,mC as da,Jl as ea,hb as fa,Ti as ga,Zl as ha,bo as ia,ub as ja,TC as ka,ta as la,ia as ma,na,db as oa,oa as pa,sa as qa,ra,bb as sa,la as ta,da as ua,kb as va,gs as wa,fs as xa,_a as ya,PC as za,ha as Aa,Eb as Ba,vb as Ca,Cb as Da,xb as Ea,ga as Fa,fa as Ga,pa as Ha,Tb as Ia,LC as Ja,RC as Ka,FC as La,OC as Ma,ba as Na,wa as Oa,Ab as Pa,ka as Qa,Pb as Ra,va as Sa,Ca as Ta,Lb as Ua,Ia as Va,Ta as Wa,Fb as Xa,Aa as Ya,Ea as Za,Db as _a,xa as $a,Sa as ab,Mb as bb,Va as cb,Pa as db,Hb as eb,qC as fb,YC as gb,Kb as hb,Ra as ib,Fa as jb,Oa as kb,Da as lb,Na as mb,Ma as nb,Ua as ob,Ha as pb,Wa as qb,qb as rb,Yb as sb,za as tb,$a as ub,ja as vb,qa as wb,Zb as xb,vs as yb,Ga as zb,Ka as Ab,Cs as Bb,Xa as Cb,Ya as Db,Qa as Eb,Jb as Fb,En as Gb,ow as Hb,sw as Ib,rw as Jb,iI as Kb,Ja as Lb,lw as Mb,ec as Nb,tc as Ob,ic as Pb,nc as Qb,xn as Rb,sc as Sb,rc as Tb,lc as Ub,ac as Vb,cc as Wb,Is as Xb,uc as Yb,dc as Zb,mc as _b,hc as $b,gc as ac,fc as bc,nw as cc,wo as dc,bc as ec,wc as fc,_c as gc,Ts as hc,kc as ic,uw as jc,vc as kc,Cc as lc,yw as mc,Ic as nc,gw as oc,fw as pc,bw as qc,Tc as rc,Ac as sc,Ec as tc,Cw as uc,xc as vc,Sc as wc,Vc as xc,Tw as yc,Bc as zc,Lc as Ac,Rc as Bc,xw as Cc,Gt as Dc,Kt as Ec,EI as Fc,xI as Gc,Sn as Hc,VI as Ic,pt as Jc,Yc as Kc,PI as Lc,Es as Mc,BI as Nc,Vw as Oc,LI as Pc,Pn as Qc,_o as Rc,Pw as Sc,Ei as Tc,pe as Uc,Dc as Vc,Nc as Wc,Mc as Xc,ko as Yc,Uc as Zc,Hc as _c,Wc as $c,zc as ad,$c as bd,jc as cd,qc as dd,Gc as ed,Kc as fd,Ow as gd,Dw as hd,Xc as id,Nw as jd,Uw as kd,NT as ld,i_ as md,w_ as nd,Ou as od,Ss as pd,Vs as qd,Pe as rd,n_ as sd,ru as td,lu as ud,au as vd,$T as wd,Du as xd,cu as yd,Ps as zd,jT as Ad,qT as Bd,k_ as Cd,GT as Dd,Bs as Ed,Io as Fd,uu as Gd,du as Hd,To as Id,Ls as Jd,Rs as Kd,Fs as Ld,Os as Md,mu as Nd,Xi as Od,hu as Pd,gu as Qd,fu as Rd,o_ as Sd,Ds as Td,pu as Ud,bu as Vd,wu as Wd,s_ as Xd,y_ as Yd,KT as Zd,XT as _d,_u as $d,ku as ae,yu as be,vu as ce,sA as de,Cu as ee,Iu as fe,Tu as ge,Au as he,c_ as ie,Eu as je,Ns as ke,xu as le,Vu as me,T_ as ne,A_ as oe,E_ as pe,cA as qe,Pu as re,uA as se,Bu as te,u_ as ue,Lu as ve,xs as we,mA as xe,hA as ye,Ms as ze,kA as Ae,yA as Be,Us as Ce,Fu as De,g_ as Ee,f_ as Fe,p_ as Ge,Ze as He,Qi as Ie,Uu as Je,G as Ke,ui as Le,Si as Me,IA as Ne,sk as Oe,Xt as Pe,V_ as Qe,Bo as Re,er as Se,fd as Te,Hu as Ue,Wu as Ve,TA as We,tr as Xe,xo as Ye,AA as Ze,Ji as _e,So as $e,Nu as af,$s as bf,js as cf,Yi as df,qs as ef,Gs as ff,zu as gf,$u as hf,ju as if,qu as jf,Gu as kf,Ku as lf,Xu as mf,LA as nf,Yu as of,RA as pf,FA as qf,OA as rf,rk as sf,lk as tf,Et as uf,DA as vf,NA as wf,MA as xf,UA as yf,L_ as zf,HA as Af,R_ as Bf,WA as Cf,zA as Df,$e as Ef,Qu as Ff,Ks as Gf,D_ as Hf,Ju as If,gk as Jf,pd as Kf,fk as Lf,Zu as Mf,pk as Nf,ed as Of,td as Pf,N_ as Qf,id as Rf,bk as Sf,nd as Tf,Xs as Uf,Ys as Vf,H_ as Wf,od as Xf,sd as Yf,rd as Zf,Qs as _f,$_ as $f,Vo as ag,Js as bg,ld as cg,Po as dg,Q_ as eg,cd as fg,ud as gg,dd as hg,md as ig,Z_ as jg,hd as kg,gd as lg,ik as mg,nk as ng,Cd as og,Id as pg,Tk as qg,Rn as rg,Vi as sg,Pi as tg,Fn as ug,On as vg,Td as wg,Ek as xg,Sd as yg,HE as zg,Ad as Ag,Ed as Bg,xd as Cg,Sk as Dg,Pd as Eg,Lo as Fg,GE as Gg,Pk as Hg,Ok as Ig,XE as Jg,YE as Kg,Bd as Lg,QE as Mg,qd as Ng,Dk as Og,JE as Pg,Ld as Qg,Fd as Rg,Od as Sg,Dd as Tg,Bi as Ug,Nd as Vg,Md as Wg,Ud as Xg,Hd as Yg,Wd as Zg,or as _g,zd as $g,Rk as ah,$d as bh,jd as ch,Fk as dh,Uk as eh,wx as fh,_x as gh,kx as hh,Hk as ih,Wk as jh,jk as kh,Gd as lh,Kd as mh,Dn as nh,Xd as oh,Yd as ph,Qd as qh,zk as rh,$k as sh,Zd as th,em as uh,Xk as vh,Yk as wh,tm as xh,im as yh,nm as zh,om as Ah,Zk as Bh,Kk as Ch,sm as Dh,rm as Eh,lm as Fh,Hx as Gh,Wx as Hh,lr as Ih,zx as Jh,ny as Kh,oy as Lh,am as Mh,cm as Nh,um as Oh,ry as Ph,dm as Qh,mm as Rh,hm as Sh,ay as Th,Qt as Uh,py as Vh,Gx as Wh,cr as Xh,Kx as Yh,Xx as Zh,Yx as _h,dy as $h,bm as ai,_m as bi,my as ci,km as di,ym as ei,vm as fi,Cm as gi,Im as hi,fy as ii,Tm as ji,Am as ki,Em as li,wy as mi,ky as ni,Sm as oi,Vm as pi,Pm as qi,Bm as ri,vy as si,Lm as ti,Rm as ui,Fm as vi,Om as wi,Dm as xi,Cy as yi,Nm as zi,Mm as Ai,dr as Bi,Um as Ci,xt as Di,Hm as Ei,Wm as Fi,zm as Gi,$m as Hi,jm as Ii,qm as Ji,Ey as Ki,ig as Li,Ym as Mi,Ro as Ni,wr as Oi,St as Pi,$ as Qi,Se as Ri,Fi as Si,Jm as Ti,kr as Ui,Vt as Vi,av as Wi,cv as Xi,uv as Yi,dv as Zi,mv as _i,hv as $i,Zm as aj,eh as b
84j,ng as cj,gv as dj,fv as ej,yS as fj,vS as gj,CS as hj,Sy as ij,nn as jj,on as kj,zn as lj,Pr as mj,Br as nj,Vy as oj,AS as pj,Py as qj,By as rj,bv as sj,th as tj,yr as uj,vr as vj,Cr as wj,Hn as xj,ih as yj,nh as zj,oh as Aj,sh as Bj,US as Cj,rh as Dj,HS as Ej,WS as Fj,zS as Gj,$S as Hj,wv as Ij,lh as Jj,jS as Kj,st as Lj,qS as Mj,GS as Nj,Fo as Oj,sg as Pj,XS as Qj,_v as Rj,Oo as Sj,Do as Tj,YS as Uj,QS as Vj,Ee as Wj,ah as Xj,ch as Yj,uh as Zj,rV as _j,hV as $j,bV as ak,wV as bk,en as ck,Wn as dk,mh as ek,Jt as fk,hh as gk,ph as hk,Ir as ik,bh as jk,wh as kk,Uy as lk,tn as mk,vv as nk,No as ok,Hy as pk,Tr as qk,lg as rk,Lr as sk,Rr as tk,Li as uk,Zt as vk,Fr as wk,Iv as xk,_h as yk,Ri as zk,Ar as Ak,kh as Bk,Or as Ck,ag as Dk,cg as Ek,vh as Fk,wt as Gk,Ch as Hk,Er as Ik,Ih as Jk,Th as Kk,Ah as Lk,Eh as Mk,xh as Nk,Sh as Ok,Vh as Pk,Ph as Qk,Bh as Rk,Lh as Sk,qy as Tk,Rh as Uk,Fh as Vk,Oh as Wk,RV as Xk,FV as Yk,Dh as Zk,xr as _k,Nh as $k,Mh as al,Qy as bl,mi as cl,Uh as dl,Hh as el,Wh as fl,zh as gl,$h as hl,jh as il,qh as jl,Gh as kl,Kh as ll,Xh as ml,tv as nl,XV as ol,iv as pl,Sr as ql,QV as rl,JV as sl,Yh as tl,Qh as ul,Jh as vl,nv as wl,eg as xl,sv as yl,tg as zl,lv as Al,Pv as Bl,Vv as Cl,iP as Dl};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.