diff --git a/libraries/ckeditor/ckeditor.js b/libraries/ckeditor/ckeditor.js
index 14fede1df2..89f4c95eb4 100644
--- a/libraries/ckeditor/ckeditor.js
+++ b/libraries/ckeditor/ckeditor.js
@@ -3,5 +3,5 @@
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/
-function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BalloonEditor=e():t.BalloonEditor=e()}(self,(()=>(()=>{var t={4959:(t,e,n)=>{const i=n(1103),o={};for(const t of Object.keys(i))o[i[t]]=t;const r={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};t.exports=r;for(const t of Object.keys(r)){if(!("channels"in r[t]))throw new Error("missing channels property: "+t);if(!("labels"in r[t]))throw new Error("missing channel labels property: "+t);if(r[t].labels.length!==r[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:n}=r[t];delete r[t].channels,delete r[t].labels,Object.defineProperty(r[t],"channels",{value:e}),Object.defineProperty(r[t],"labels",{value:n})}r.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.min(e,n,i),r=Math.max(e,n,i),s=r-o;let a,c;r===o?a=0:e===r?a=(n-i)/s:n===r?a=2+(i-e)/s:i===r&&(a=4+(e-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const l=(o+r)/2;return c=r===o?0:l<=.5?s/(r+o):s/(2-r-o),[a,100*c,100*l]},r.rgb.hsv=function(t){let e,n,i,o,r;const s=t[0]/255,a=t[1]/255,c=t[2]/255,l=Math.max(s,a,c),d=l-Math.min(s,a,c),h=function(t){return(l-t)/6/d+.5};return 0===d?(o=0,r=0):(r=d/l,e=h(s),n=h(a),i=h(c),s===l?o=i-n:a===l?o=1/3+e-i:c===l&&(o=2/3+n-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*r,100*l]},r.rgb.hwb=function(t){const e=t[0],n=t[1];let i=t[2];const o=r.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(n,i));return i=1-1/255*Math.max(e,Math.max(n,i)),[o,100*s,100*i]},r.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.min(1-e,1-n,1-i);return[100*((1-e-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*o]},r.rgb.keyword=function(t){const e=o[t];if(e)return e;let n,r=1/0;for(const e of Object.keys(i)){const o=i[e],c=(a=o,((s=t)[0]-a[0])**2+(s[1]-a[1])**2+(s[2]-a[2])**2);c.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;return[100*(.4124*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},r.rgb.lab=function(t){const e=r.rgb.xyz(t);let n=e[0],i=e[1],o=e[2];n/=95.047,i/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(n-i),200*(i-o)]},r.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;let o,r,s;if(0===n)return s=255*i,[s,s,s];o=i<.5?i*(1+n):i+n-i*n;const a=2*i-o,c=[0,0,0];for(let t=0;t<3;t++)r=e+1/3*-(t-1),r<0&&r++,r>1&&r--,s=6*r<1?a+6*(o-a)*r:2*r<1?o:3*r<2?a+(o-a)*(2/3-r)*6:a,c[t]=255*s;return c},r.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[2]/100,o=n;const r=Math.max(i,.01);i*=2,n*=i<=1?i:2-i,o*=r<=1?r:2-r;return[e,100*(0===i?2*o/(r+o):2*n/(i+n)),100*((i+n)/2)]},r.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const o=Math.floor(e)%6,r=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*r),c=255*i*(1-n*(1-r));switch(i*=255,o){case 0:return[i,c,s];case 1:return[a,i,s];case 2:return[s,i,c];case 3:return[s,a,i];case 4:return[c,s,i];case 5:return[i,s,a]}},r.hsv.hsl=function(t){const e=t[0],n=t[1]/100,i=t[2]/100,o=Math.max(i,.01);let r,s;s=(2-n)*i;const a=(2-n)*o;return r=n*o,r/=a<=1?a:2-a,r=r||0,s/=2,[e,100*r,100*s]},r.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const o=n+i;let r;o>1&&(n/=o,i/=o);const s=Math.floor(6*e),a=1-i;r=6*e-s,0!=(1&s)&&(r=1-r);const c=n+r*(a-n);let l,d,h;switch(s){default:case 6:case 0:l=a,d=c,h=n;break;case 1:l=c,d=a,h=n;break;case 2:l=n,d=a,h=c;break;case 3:l=n,d=c,h=a;break;case 4:l=c,d=n,h=a;break;case 5:l=a,d=n,h=c}return[255*l,255*d,255*h]},r.cmyk.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o))]},r.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let o,r,s;return o=3.2406*e+-1.5372*n+-.4986*i,r=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.204*n+1.057*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),[255*o,255*r,255*s]},r.xyz.lab=function(t){let e=t[0],n=t[1],i=t[2];e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(e-n),200*(n-i)]},r.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const o=n**3,r=e**3,s=i**3;return n=o>.008856?o:(n-16/116)/7.787,e=r>.008856?r:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},r.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let o;o=360*Math.atan2(i,n)/2/Math.PI,o<0&&(o+=360);return[e,Math.sqrt(n*n+i*i),o]},r.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},r.rgb.ansi16=function(t,e=null){const[n,i,o]=t;let s=null===e?r.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===s&&(a+=60),a},r.hsv.ansi16=function(t){return r.rgb.ansi16(r.hsv.rgb(t),t[2])},r.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];if(e===n&&n===i)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},r.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},r.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},r.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},r.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},r.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.max(Math.max(e,n),i),r=Math.min(Math.min(e,n),i),s=o-r;let a,c;return a=s<1?r/(1-s):0,c=s<=0?0:o===e?(n-i)/s%6:o===n?2+(i-e)/s:4+(e-n)/s,c/=6,c%=1,[360*c,100*s,100*a]},r.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let o=0;return i<1&&(o=(n-.5*i)/(1-i)),[t[0],100*i,100*o]},r.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],100*i,100*o]},r.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const o=[0,0,0],r=e%1*6,s=r%1,a=1-s;let c=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*i,[255*(n*o[0]+c),255*(n*o[1]+c),255*(n*o[2]+c)]},r.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},r.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},r.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},r.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],100*i,100*o]},r.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},r.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},r.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},r.gray.hsl=function(t){return[0,0,t[0]]},r.gray.hsv=r.gray.hsl,r.gray.hwb=function(t){return[0,100,t[0]]},r.gray.cmyk=function(t){return[0,0,0,t[0]]},r.gray.lab=function(t){return[t[0],0,0]},r.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},r.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},841:(t,e,n)=>{const i=n(4959),o=n(9325),r={};Object.keys(i).forEach((t=>{r[t]={},Object.defineProperty(r[t],"channels",{value:i[t].channels}),Object.defineProperty(r[t],"labels",{value:i[t].labels});const e=o(t);Object.keys(e).forEach((n=>{const i=e[n];r[t][n]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(i)}))})),t.exports=r},9325:(t,e,n)=>{const i=n(4959);function o(t){const e=function(){const t={},e=Object.keys(i);for(let n=e.length,i=0;i{"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},6299:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(1799),o=n.n(i),r=n(2609),s=n.n(r)()(o());s.push([t.id,".ck.ck-math-form{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:nowrap}@media screen and (max-width:600px){.ck.ck-math-form{flex-wrap:wrap}.ck.ck-math-form .ck-math-view,.ck.ck-math-form .ck-math-view .ck-label,.ck.ck-math-form .ck-math-view .ck-labeled-view{flex-basis:100%}.ck.ck-math-form .ck-button{flex-basis:50%}}.ck-math-tex.ck-placeholder:before{display:none!important}.ck.ck-toolbar-container{z-index:calc(var(--ck-z-modal) + 2)}.ck.ck-math-form{padding:var(--ck-spacing-standard)}.ck.ck-math-form:focus{outline:none}[dir=ltr] .ck.ck-math-form>:not(:first-child),[dir=rtl] .ck.ck-math-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-math-form{padding:0}.ck.ck-math-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-math-form .ck-label,.ck.ck-math-form .ck-math-view .ck-button,.ck.ck-math-form .ck-math-view .ck.ck-math-preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form>.ck-button{border:0;border-radius:0;border-top:1px solid var(--ck-color-base-border);margin-top:var(--ck-spacing-standard);padding:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-math-form>.ck-button{margin-left:0}[dir=ltr] .ck.ck-math-form>.ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-math-form>.ck-button{margin-left:0}[dir=rtl] .ck.ck-math-form>.ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}","",{version:3,sources:["webpack://./../../node_modules/@isaul32/ckeditor5-math/theme/mathform.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-math/mathform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAAA,iBAEC,sBAAuB,CADvB,YAAa,CAEb,kBAAmB,CACnB,gBAsBD,CAnBC,oCAPD,iBAQE,cAkBF,CATG,wHACC,eACD,CAGD,4BACC,cACD,CACD,CAGD,mCACC,sBACD,CAEA,yBACC,mCACD,CC/BA,iBACI,kCAsEJ,CApEI,uBAEF,YACD,CASC,2FACC,sCACD,CCdD,oCDHD,iBAqBE,SAkDF,CAhDE,mCACC,8DAMD,CAJC,kDACC,WAAY,CACZ,UACD,CAYA,wHACC,8DACD,CAGD,4BAKC,QAAS,CADT,eAAgB,CAEhB,gDAAiD,CAJjD,qCAAsC,CADtC,kCAsBD,CAvBA,sCASE,aAcF,CAZE,oDACC,kDACD,CAbF,sCAiBE,aAMF,CAJE,mDACC,kDACD,CC9DH",sourcesContent:[".ck.ck-math-form {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\tpadding: var(--ck-spacing-standard);\n\n\t@media screen and (max-width: 600px) {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-math-view {\n\t\t\tflex-basis: 100%;\n\n\t\t\t& .ck-labeled-view {\n\t\t\t\tflex-basis: 100%;\n\t\t\t}\n\n\t\t\t& .ck-label {\n\t\t\t\tflex-basis: 100%;\n\t\t\t}\n\t\t}\n\n\t\t& .ck-button {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n\n.ck-math-tex.ck-placeholder::before {\n\tdisplay: none !important;\n}\n\n.ck.ck-toolbar-container {\n\tz-index: calc(var(--ck-z-modal) + 2);\n}\n",'@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-math-form {\n padding: var(--ck-spacing-standard);\n\n &:focus {\n\t\t/* https://github.com/ckeditor/ckeditor5-link/issues/90 */\n\t\toutline: none;\n\t}\n\n @mixin ck-dir ltr {\n\t\t& > :not(:first-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-dir rtl {\n\t\t& > :not(:last-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-media-phone {\n\t\tpadding: 0;\n\n\t\t& .ck-labeled-input {\n\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\n\t\t\t& .ck-input-text {\n\t\t\t\tmin-width: 0;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t}\n\n & .ck-label {\n margin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n }\n\n\t\t& .ck-math-view {\n\t\t\t& .ck-button {\n\t\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\t\t\t}\n\n\t\t\t& .ck.ck-math-preview {\n\t\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\t\t\t}\n\t\t}\n\n\t\t& > .ck-button {\n\t\t\tpadding: var(--ck-spacing-standard);\n\t\t\tmargin-top: var(--ck-spacing-standard);\n\n\t\t\tborder-radius: 0;\n\t\t\tborder: 0;\n\t\t\tborder-top: 1px solid var(--ck-color-base-border);\n\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:first-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:last-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},8603:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(1799),o=n.n(i),r=n(2609),s=n.n(r)()(o());s.push([t.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content code {\n\tbackground-color: hsla(0, 0%, 78%, 0.3);\n\tpadding: .15em;\n\tborder-radius: 2px;\n}\n\n.ck.ck-editor__editable .ck-code_selected {\n\tbackground-color: hsla(0, 0%, 78%, 0.5);\n}\n"],sourceRoot:""}]);const a=s},3062:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(1799),o=n.n(i),r=n(2609),s=n.n(r)()(o());s.push([t.id,".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}","",{version:3,sources:["webpack://./../ckeditor5-block-quote/theme/blockquote.css"],names:[],mappings:"AAKA,uBAWC,0BAAsC,CADtC,iBAAkB,CAFlB,aAAc,CACd,cAAe,CAPf,eAAgB,CAIhB,kBAAmB,CADnB,mBAOD,CAEA,gCACC,aAAc,CACd,2BACD",sourcesContent:['/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content blockquote {\n\t/* See #12 */\n\toverflow: hidden;\n\n\t/* https://github.com/ckeditor/ckeditor5-block-quote/issues/15 */\n\tpadding-right: 1.5em;\n\tpadding-left: 1.5em;\n\n\tmargin-left: 0;\n\tmargin-right: 0;\n\tfont-style: italic;\n\tborder-left: solid 5px hsl(0, 0%, 80%);\n}\n\n.ck-content[dir="rtl"] blockquote {\n\tborder-left: 0;\n\tborder-right: solid 5px hsl(0, 0%, 80%);\n}\n'],sourceRoot:""}]);const a=s},9932:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(1799),o=n.n(i),r=n(2609),s=n.n(r)()(o());s.push([t.id,".ck-find-result{background:var(--ck-color-highlight-background);color:var(--ck-color-text)}.ck-find-result_selected{background:#ff9633}","",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-find-and-replace/theme/findandreplace.css"],names:[],mappings:"AAKA,gBACC,+CAAgD,CAChD,0BACD,CAEA,yBACC,kBACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-find-result {\n\tbackground: var(--ck-color-highlight-background);\n\tcolor: var(--ck-color-text);\n}\n\n.ck-find-result_selected {\n\tbackground: hsl(29, 100%, 60%);\n}\n"],sourceRoot:""}]);const a=s},2822:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(1799),o=n.n(i),r=n(2609),s=n.n(r)()(o());s.push([t.id,".ck.ck-find-and-replace-form{max-width:100%;& .ck-find-and-replace-form__inputs,.ck-find-and-replace-form__actions{display:flex}& .ck-find-and-replace-form__inputs.ck-find-and-replace-form__inputs .ck-results-counter,.ck-find-and-replace-form__actions.ck-find-and-replace-form__inputs .ck-results-counter{position:absolute}}.ck.ck-find-and-replace-form{width:400px}.ck.ck-find-and-replace-form:focus{outline:none}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-content:stretch;align-items:center;flex:1 1 auto;flex-direction:row;flex-wrap:wrap;margin:0;padding:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view .ck-input,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view .ck-input{min-width:50px;width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-items:flex-start}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{color:var(--ck-color-base-border)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{flex:0 0 100%;padding-top:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-right:0}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-switchbutton{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{max-width:100%;width:300px}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input{flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input .ck-labeled-field-view{flex:1 0 auto;margin-bottom:var(--ck-spacing-standard);width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type .ck-button__label{text-align:center;width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view){flex:1 1 auto;flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button .ck-button__label{text-align:center;width:100%}}","",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-find-and-replace/theme/findandreplaceform.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-find-and-replace/findandreplaceform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAKA,6BACC,cAAe,CAEf,uEACC,YAMD,CAHC,iLACC,iBACD,CAEF,CCRA,6BACC,WAoHD,CA9GC,mCACC,YACD,CAGA,+HAMC,qBAAsB,CADtB,kBAAmB,CAHnB,aAAc,CACd,kBAAmB,CACnB,cAAe,CAKf,QAAS,CADT,+BA4BD,CAzBC,qJACC,aACD,CAGC,2JACC,sCACD,CAIA,2JACC,uCACD,CAGD,6KACC,aAMD,CAJC,iMAEC,cAAe,CADf,UAED,CAMF,+DAEC,sBAqCD,CAnCC,wFACC,uBACD,CAEA,wFACC,wBACD,CAEA,mFACC,OAAQ,CACR,0BAWD,CAbA,6FAKE,gCAQF,CAbA,6FASE,+BAIF,CAbA,mFAYC,iCACD,CAEA,yFACC,aAAc,CACd,sCASD,CAXA,mGAKE,aAMF,CAXA,mGASE,cAEF,CAID,gEACC,cAAe,CACf,wBAAyB,CACzB,2CAWD,CATC,gFACC,eAOD,CAJC,kGACC,oCAAqC,CACrC,qCACD,CAIF,8CAMC,kBAAmB,CAJnB,YAAa,CACb,kBAAmB,CACnB,gBAAiB,CACjB,6BAA8B,CAJ9B,UAMD,CCtHA,oCD0HA,6BAIC,cAAe,CAHf,WA+DD,CAzDC,6DACC,cA4BD,CA1BC,oFACC,aAAc,CAEd,wCAAyC,CADzC,UAED,CAEA,wEACC,iBAkBD,CAhBC,sFACC,aAcD,CAfA,gGAIE,aAWF,CAfA,gGAQE,cAOF,CAJC,wGAEC,iBAAkB,CADlB,UAED,CAMH,4FAEC,aAAc,CADd,cAuBD,CApBC,uGACC,iBAkBD,CAhBC,qHACC,aASD,CAVA,+HAIE,aAMF,CAVA,+HAQE,cAEF,CAEA,yHAEC,iBAAkB,CADlB,UAED,CCrLH",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-find-and-replace-form {\n\tmax-width: 100%;\n\n\t& .ck-find-and-replace-form__inputs, .ck-find-and-replace-form__actions {\n\t\tdisplay: flex;\n\n\t\t/* The inputs area styles */\n\t\t&.ck-find-and-replace-form__inputs .ck-results-counter {\n\t\t\tposition: absolute;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-find-and-replace-form {\n\twidth: 400px;\n\n\t/*\n\t * The
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||r.includes("
"))&&(r=`
${r}
`),t=r),o=this.editor.data.htmlProcessor.toView(t)}var r;const s=new h(this,"inputTransformation");this.fire(s,{content:o,dataTransfer:i,targetRanges:e.targetRanges,method:e.method}),s.stop.called&&t.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(t.stop(),e.change((()=>{this.fire("contentInsertion",{content:i,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,n)=>{n.resultRange=e.insertContent(n.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,i=(t,n)=>{const i=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(i,e.selection,t.name)};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.model.canEditAt(t.model.document.selection)?i(e,n):n.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((e,i)=>{const o=t.data.toView(i.content);n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:o,method:i.method})}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",gC(i.content))),"cut"==i.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class fC extends(D()){constructor(){super(...arguments),this._stack=[]}add(t,e){const n=this._stack,i=n[0];this._insertDescriptor(t);const o=n[0];i===o||bC(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}remove(t,e){const n=this._stack,i=n[0];this._removeDescriptor(t);const o=n[0];i===o||bC(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(bC(t,e[n]))return;n>-1&&e.splice(n,1);let i=0;for(;e[i]&&kC(e[i],t);)i++;e.splice(i,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function bC(t,e){return t&&e&&t.priority==e.priority&&wC(t.classes)==wC(e.classes)}function kC(t,e){return t.priority>e.priority||!(t.prioritywC(e.classes)}function wC(t){return Array.isArray(t)?t.sort().join(","):t}const AC='',CC="ck-widget",_C="ck-widget_selected";function vC(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function yC(t,e,n={}){if(!t.is("containerElement"))throw new b("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass(CC,t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=IC,e.setCustomProperty("widgetLabel",[],t),n.label&&function(t,e){const n=t.getCustomProperty("widgetLabel");n.push(e)}(t,n.label),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new Mg;return n.set("content",AC),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),DC(t,e),t}function xC(t,e,n){if(e.classes&&n.addClass(wo(e.classes),t),e.attributes)for(const i in e.attributes)n.setAttribute(i,e.attributes[i],t)}function EC(t,e,n){if(e.classes&&n.removeClass(wo(e.classes),t),e.attributes)for(const i in e.attributes)n.removeAttribute(i,t)}function DC(t,e,n=xC,i=EC){const o=new fC;o.on("change:top",((e,o)=>{o.oldDescriptor&&i(t,o.oldDescriptor,o.writer),o.newDescriptor&&n(t,o.newDescriptor,o.writer)}));e.setCustomProperty("addHighlight",((t,e,n)=>o.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>o.remove(e,n)),t)}function BC(t,e,n={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("role","textbox",t),n.label&&e.setAttribute("aria-label",n.label,t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,i,o)=>{e.setAttribute("contenteditable",o?"false":"true",t)})),t.on("change:isFocused",((n,i,o)=>{o?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),DC(t,e),t}function SC(t,e){const n=t.getSelectedElement();if(n){const i=VC(t);if(i)return e.createRange(e.createPositionAt(n,i))}return e.schema.findOptimalInsertionRange(t)}function TC(t,e){return(n,i)=>{const{mapper:o,viewPosition:r}=i,s=o.findMappedViewAncestor(r);if(!e(s))return;const a=o.toModelElement(s);i.modelPosition=t.createPositionAt(a,r.isAtStart?"before":"after")}}function IC(){return null}const PC="widget-type-around";function RC(t,e,n){return!!t&&vC(t)&&!n.isInline(e)}function VC(t){return t.getAttribute(PC)}var LC=n(4921),OC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(LC.Z,OC);LC.Z.locals;const zC=["before","after"],FC=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,MC="ck-widget__type-around_disabled";class NC extends Vo{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[OA,Sw]}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,i,o)=>{e.change((t=>{for(const n of e.document.roots)o?t.removeClass(MC,n):t.addClass(MC,n)})),o||t.model.change((t=>{t.removeSelectionAttribute(PC)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,i=n.editing.view,o=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:o}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(t,e,n,i){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),i)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=VC(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,o,r)=>{const s=r.mapper.toViewElement(o.item);if(s&&RC(s,o.item,e)){!function(t,e,n){const i=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of zC){const i=new pg({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n],"aria-hidden":"true"},children:[t.ownerDocument.importNode(FC,!0)]});t.appendChild(i.render())}}(n,e),function(t){const e=new pg({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),i)}(r.writer,i,s);s.getCustomProperty("widgetLabel").push((()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))}}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,i=e.schema,o=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(o.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[vC,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(PC)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(RC(t.editing.mapper.toViewElement(e),e,i))return}t.model.change((t=>{t.removeSelectionAttribute(PC)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const o=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(o.removeClass(zC.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!RC(a,s,i))return;const c=VC(e.selection);c&&(o.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,i)=>{i||t.model.change((t=>{t.removeSelectionAttribute(PC)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,i=n.model,o=i.document.selection,r=i.schema,s=n.editing.view,a=function(t,e){const n=ko(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;RC(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):o.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=VC(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(PC,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(PC),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,i=n.schema,o=e.plugins.get("Widget"),r=o._getObjectElementNextToSelection(t);return!!RC(e.editing.mapper.toViewElement(r),r,i)&&(n.change((e=>{o._setSelectionOverElement(r),e.setSelectionAttribute(PC,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,i=n.schema,o=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!RC(o.toViewElement(s),s,i)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(PC,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,i)=>{const o=i.domTarget.closest(".ck-widget__type-around__button");if(!o)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(o),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(o,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),i.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,i)=>{if("atTarget"!=n.eventPhase)return;const o=e.getSelectedElement(),r=t.editing.mapper.toViewElement(o),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:RC(r,o,s)&&(this._insertParagraph(o,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:vC})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",((e,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=t.selection)}),{priority:"high"}),o.isAndroid?this._listenToIfEnabled(t,"keydown",((t,e)=>{229==e.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(t,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,i=n.schema;this._listenToIfEnabled(e.document,"delete",((e,o)=>{if("atTarget"!=e.eventPhase)return;const r=VC(n.document.selection);if(!r)return;const s=o.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=i.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const o=n.createSelection(e.start);if(n.modifySelection(o,{direction:s}),o.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||t.isLimit(i))break;n=i}return n}(i,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}o.preventDefault(),e.stop()}),{context:vC})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[i,o])=>{if(o&&!o.is("documentSelection"))return;const r=VC(n);return r?(t.stop(),e.change((t=>{const o=n.getSelectedElement(),s=e.createPositionAt(o,r),a=t.createSelection(s),c=e.insertContent(i,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,i,o={}]=n;if(i&&!i.is("documentSelection"))return;const r=VC(e);r&&(o.findOptimalPosition=r,n[3]=o)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;VC(e)&&t.stop()}),{priority:"high"})}}function HC(t){const e=t.model;return(n,i)=>{const o=i.keyCode==go.arrowup,r=i.keyCode==go.arrowdown,s=i.shiftKey,a=e.document.selection;if(!o&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const i=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=jC(i,t,"forward");if(!n)return null;const o=i.createRange(t,n),r=qC(i.schema,o,"backward");return r?i.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=jC(i,t,"backward");if(!n)return null;const o=i.createRange(n,t),r=qC(i.schema,o,"forward");return r?i.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const i=t.model,o=t.view.domConverter;if(n){const t=i.createSelection(e.start);i.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=i.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=o.viewRangeToDom(r),a=Oi.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const i=e.createSelection(a.anchor);i.setFocus(n),t.setSelection(i)}else t.setSelection(n)})),n.stop(),i.preventDefault(),i.stopPropagation())}}}function jC(t,e,n){const i=t.schema,o=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of o.getWalker({startPosition:e,direction:n})){if(i.isLimit(s)&&!i.isInline(s))return t;if(a==r&&i.isBlock(s))return null}return null}function qC(t,e,n){const i="backward"==n?e.end:e.start;if(t.checkChild(i,"$text"))return i;for(const{nextPosition:i}of e.getWalker({direction:n}))if(t.checkChild(i,"$text"))return i;return null}var WC=n(3488),UC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(WC.Z,UC);WC.Z.locals;class GC extends Vo{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[NC,Sw]}init(){const t=this.editor,e=t.editing.view,n=e.document;this.editor.editing.downcastDispatcher.on("selection",((e,n,i)=>{const o=i.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);var c;vC(a)&&(i.consumable.consume(r,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:(c=a,c.getCustomProperty("widgetLabel").reduce(((t,e)=>"function"==typeof e?t?t+". "+e():e():t?t+". "+e:e),""))}))})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const i=n.writer,o=i.document.selection;let r=null;for(const t of o.getRanges())for(const e of t){const t=e.item;vC(t)&&!$C(t,r)&&(i.addClass(_C,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(hu),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[vC,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",HC(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,i=n.editing.view,r=i.document;let s=e.target;if(e.domEvent.detail>=3)return void(this._selectBlockContent(s)&&e.preventDefault());if(function(t){let e=t;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(vC(e))return!1;e=e.parent}return!1}(s))return;if(!vC(s)&&(s=s.findAncestor(vC),!s))return;o.isAndroid&&e.preventDefault(),r.isFocused||i.focus();const a=n.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_selectBlockContent(t){const e=this.editor,n=e.model,i=e.editing.mapper,o=n.schema,r=i.findMappedViewAncestor(this.editor.editing.view.createPositionAt(t,0)),s=function(t,e){for(const n of t.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(n,"$text"))return n;if(e.isLimit(n)&&!e.isObject(n))break}return null}(i.toModelElement(r),n.schema);return!!s&&(n.change((t=>{const e=o.isLimit(s)?null:function(t,e){const n=new xc({startPosition:t});for(const{item:t}of n){if(e.isLimit(t)||!t.is("element"))return null;if(e.checkChild(t,"$text"))return t}return null}(t.createPositionAfter(s),o),n=t.createPositionAt(s,0),i=e?t.createPositionAt(e,0):t.createPositionAt(s,"end");t.setSelection(t.createRange(n,i))})),!0)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,i=this.editor.model,o=i.schema,r=i.document.selection,s=r.getSelectedElement(),a=ko(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&o.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=o.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(i.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&o.isObject(a)||l&&o.isObject(l))&&(i.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,i=n.schema,o=n.document.selection.getSelectedElement();o&&i.isObject(o)&&(e.preventDefault(),t.stop())}_handleDelete(t){const e=this.editor.model.document.selection;if(!this.editor.model.canEditAt(e))return;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let i=e.anchor.parent;for(;i.isEmpty;){const e=i;i=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,i=e.document.selection,o=e.createSelection(i);if(e.modifySelection(o,{direction:t?"forward":"backward"}),o.isEqual(i))return null;const r=t?o.focus.nodeBefore:o.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(_C,e);this._previouslySelected.clear()}}function $C(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}class KC extends Vo{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Hb]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!vC(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:i,balloonClassName:o="ck-toolbar-container"}){if(!n.length)return void k("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new Up(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new b("widget-toolbar-duplicated",this,{toolbarId:t});const c={view:a,getRelatedElement:i,balloonClassName:o,itemsConfig:n,initialized:!1};r.ui.addToolbar(a,{isContextual:!0,beforeFocus:()=>{const t=i(r.editing.view.document.selection);t&&this._showToolbar(c,t)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(t,c)}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const i of this._toolbarDefinitions.values()){const o=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&o)if(this.editor.ui.focusTracker.isFocused){const r=o.getAncestors().length;r>t&&(t=r,e=o,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?ZC(this.editor,e):this._isToolbarInBalloon(t)||(t.initialized||(t.initialized=!0,t.view.fillFromConfig(t.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:t.view,position:JC(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);ZC(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function ZC(t,e){const n=t.plugins.get("ContextualBalloon"),i=JC(t,e);n.updatePosition(i)}function JC(t,e){const n=t.editing.view,i=$f.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class YC extends(j()){constructor(t){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(t,e,n){const i=new Oi(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(QC(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new Oi(t),i=e.split("-"),o={x:"right"==i[1]?n.right:n.left,y:"bottom"==i[0]?n.bottom:n.top};return o.x+=t.ownerDocument.defaultView.scrollX,o.y+=t.ownerDocument.defaultView.scrollY,o}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this._originalWidth=i.width,this._originalHeight=i.height,this._aspectRatio=i.width/i.height;const o=n.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=function(t,e){const n=t.parentElement;let i=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);const o=5;let r=0,s=n;for(;isNaN(i);){if(s=s.parentElement,++r>o)return 0;i=parseFloat(n.ownerDocument.defaultView.getComputedStyle(s).width)}return e.width/i*100}(n,i)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function QC(t){return`ck-widget__resizer__handle-${t}`}class XC extends gg{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,i)=>"px"===t.unit?`${e}×${n}`:`${i}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}var t_=Object.defineProperty,e_=Object.defineProperties,n_=Object.getOwnPropertyDescriptors,i_=Object.getOwnPropertySymbols,o_=Object.prototype.hasOwnProperty,r_=Object.prototype.propertyIsEnumerable,s_=(t,e,n)=>e in t?t_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class a_ extends(j()){constructor(t){super(),this._viewResizerWrapper=null,this._options=t,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((t,e)=>t&&e)),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change((t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)}))}hide(){this._options.editor.editing.view.change((t=>{t.addClass("ck-hidden",this._viewResizerWrapper)}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),n}));n.insert(n.createPositionAt(e,"end"),i),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=i,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(t){this._state=new YC(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",i=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",i,this._options.viewElement)}));const n=this._getHandleHost(),i=new Oi(n),o=Math.round(i.width),r=Math.round(i.height),s=new Oi(n);var a;e.width=Math.round(s.width),e.height=Math.round(s.height),this.redraw(i),this.state.update((a=((t,e)=>{for(var n in e||(e={}))o_.call(e,n)&&s_(t,n,e[n]);if(i_)for(var n of i_(e))r_.call(e,n)&&s_(t,n,e[n]);return t})({},e),e_(a,n_({handleHostWidth:o,handleHostHeight:r}))))}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const i=e.parentElement,o=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(i.isSameNode(o)){const e=t||new Oi(o);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[o.offsetWidth+"px",o.offsetHeight+"px",o.offsetLeft+"px",o.offsetTop+"px"];"same"!==J(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(i=t).pageX,y:i.pageY};var i;const o=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};o&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),o&&(r.x*=2);let s=Math.abs(e.originalWidth+r.x),a=Math.abs(e.originalHeight+r.y);return"width"==(s/e.aspectRatio>a?"width":"height")?a=s/e.aspectRatio:s=a*e.aspectRatio,{width:Math.round(s),height:Math.round(a),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*s*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const i of e)t.appendChild(new pg({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new XC,this._sizeView.render(),t.appendChild(this._sizeView.element)}}var c_=n(8506),l_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(c_.Z,l_);c_.Z.locals;class d_ extends Vo{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=Ti.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),t.view.addObserver(hu),this._observer=new(Ei()),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=nb((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(Ti.window,"resize",this._redrawSelectedResizerThrottled);const n=this.editor.editing.view.document.selection;n.on("change",(()=>{const t=n.getSelectedElement(),e=this.getResizerByViewElement(t)||null;e?this.select(e):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawSelectedResizerThrottled.cancel()}select(t){this.deselect(),this.selectedResizer=t,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(t){const e=new a_(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const i=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(i)==e&&this.select(e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;a_.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n)||null,this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}const h_=Wi("px");class u_ extends gg{constructor(){super();const t=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",t.if("isVisible","ck-hidden",(t=>!t))],style:{left:t.to("left",(t=>h_(t))),top:t.to("top",(t=>h_(t))),width:t.to("width",(t=>h_(t)))}}})}}class g_ extends Vo{constructor(){super(...arguments),this.removeDropMarkerDelayed=So((()=>this.removeDropMarker()),40),this._updateDropMarkerThrottled=nb((t=>this._updateDropMarker(t)),40),this._reconvertMarkerThrottled=nb((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0),this._dropTargetLineView=new u_,this._domEmitter=new(Ei()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:t}of this._scrollables.values())t.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(t,e,n,i,o,r){this.removeDropMarkerDelayed.cancel();const s=p_(this.editor,t,e,n,i,o,r);if(s)return r&&r.containsRange(s)?this.removeDropMarker():void this._updateDropMarkerThrottled(s)}getFinalDropRange(t,e,n,i,o,r){const s=p_(this.editor,t,e,n,i,o,r);return this.removeDropMarker(),s}removeDropMarker(){const t=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_setupDropMarker(){const t=this.editor;t.ui.view.body.add(this._dropTargetLineView),t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);e.markerRange.isCollapsed?this._updateDropTargetLine(e.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_createDropTargetPosition(t){return t.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.append("",t.createElement("span"),""),e}))}_updateDropTargetLine(t){const e=this.editor.editing,n=t.start.nodeBefore,i=t.start.nodeAfter,o=t.start.parent,r=n?e.mapper.toViewElement(n):null,s=r?e.view.domConverter.mapViewToDom(r):null,a=i?e.mapper.toViewElement(i):null,c=a?e.view.domConverter.mapViewToDom(a):null,l=e.mapper.toViewElement(o);if(!l)return;const d=e.view.domConverter.mapViewToDom(l),h=this._getScrollableRect(l),{scrollX:u,scrollY:g}=Ti.window,p=s?new Oi(s):null,m=c?new Oi(c):null,f=new Oi(d).excludeScrollbarsAndBorders(),b=p?p.bottom:f.top,k=m?m.top:f.bottom,w=Ti.window.getComputedStyle(d),A=b<=k?(b+k)/2:k;if(h.topa.schema.checkChild(r,t)))){if(a.schema.checkChild(r,"$text"))return a.createRange(r);if(e)return f_(t,k_(t,e.parent),i,o)}}}else if(a.schema.isInline(l))return f_(t,l,i,o);if(a.schema.isBlock(l))return f_(t,l,i,o);if(a.schema.checkChild(l,"$block")){const e=Array.from(l.getChildren()).filter((e=>e.is("element")&&!m_(t,e)));let n=0,r=e.length;if(0==r)return a.createRange(a.createPositionAt(l,"end"));for(;ne in t?w_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class E_ extends Vo{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(Ei())}static get pluginName(){return"DragDropBlockToolbar"}init(){const t=this.editor;if(this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),o.isAndroid&&this.forceDisabled("noAndroidSupport"),t.plugins.has("BlockToolbar")){const e=t.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(e,"dragstart",((t,e)=>this._handleBlockDragStart(e))),this._domEmitter.listenTo(Ti.document,"dragover",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(Ti.document,"drop",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(Ti.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&e.setAttribute("draggable","true"),this.on("change:isEnabled",((t,n,i)=>{e.setAttribute("draggable",i?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(t){if(!this.isEnabled)return;const e=this.editor.model,n=e.document.selection,i=this.editor.editing.view,o=Array.from(n.getSelectedBlocks()),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));e.change((t=>t.setSelection(r))),this._isBlockDragging=!0,i.focus(),i.getObserver(dC).onDomEvent(t)}_handleBlockDragging(t){if(!this.isEnabled||!this._isBlockDragging)return;const e=t.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),n=t.clientY,i=document.elementFromPoint(e,n),o=this.editor.editing.view;var r,s;i&&i.closest(".ck-editor__editable")&&o.getObserver(dC).onDomEvent((r=((t,e)=>{for(var n in e||(e={}))v_.call(e,n)&&x_(t,n,e[n]);if(__)for(var n of __(e))y_.call(e,n)&&x_(t,n,e[n]);return t})({},t),s={type:t.type,dataTransfer:t.dataTransfer,target:i,clientX:e,clientY:n,preventDefault:()=>t.preventDefault(),stopPropagation:()=>t.stopPropagation()},A_(r,C_(s))))}_handleBlockDragEnd(){this._isBlockDragging=!1}}var D_=n(903),B_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(D_.Z,B_);D_.Z.locals;class S_ extends Vo{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=So((()=>this._clearDraggableAttributes()),40),this._blockMode=!1,this._domEmitter=new(Ei())}static get pluginName(){return"DragDrop"}static get requires(){return[mC,GC,g_,E_]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,e.addObserver(dC),e.addObserver(hu),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),o.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,r=t.plugins.get(g_);this.listenTo(i,"dragstart",((t,n)=>{if(n.target&&n.target.is("editableElement"))return void n.preventDefault();if(this._prepareDraggedRange(n.target),!this._draggedRange)return void n.preventDefault();this._draggingUid=g(),n.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const i=e.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,i,"dragstart");const{dataTransfer:o,domTarget:r,domEvent:s}=n,{clientX:a}=s;this._updatePreview({dataTransfer:o,domTarget:r,clientX:a}),n.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(Ti.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&n.focus()})),this.listenTo(i,"dragleave",(()=>{r.removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((t,e)=>{if(!this.isEnabled)return void(e.dataTransfer.dropEffect="none");const{clientX:n,clientY:i}=e.domEvent;r.updateDropMarker(e.target,e.targetRanges,n,i,this._blockMode,this._draggedRange),this._draggedRange||(e.dataTransfer.dropEffect="copy"),o.isGecko||("copy"==e.dataTransfer.effectAllowed?e.dataTransfer.dropEffect="copy":["all","copyMove"].includes(e.dataTransfer.effectAllowed)&&(e.dataTransfer.dropEffect="move")),t.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get(g_);this.listenTo(e,"clipboardInput",((e,i)=>{if("drop"!=i.method)return;const{clientX:o,clientY:r}=i.domEvent,s=n.getFinalDropRange(i.target,i.targetRanges,o,r,this._blockMode,this._draggedRange);if(!s)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==T_(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(s,!0))return this._finalizeDragging(!1),void e.stop();i.targetRanges=[t.editing.mapper.toViewRange(s)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(mC);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==T_(e.dataTransfer),i=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(i&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((i,r)=>{if(o.isAndroid||!r)return;this._clearDraggableAttributesDelayed.cancel();let s=I_(r.target);if(o.isBlink&&!t.isReadOnly&&!s&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&vC(t)||(s=n.selection.editableElement)}s&&(e.change((t=>{t.setAttribute("draggable","true",s)})),this._draggableElement=t.editing.mapper.toModelElement(s))})),this.listenTo(n,"mouseup",(()=>{o.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_finalizeDragging(t){const e=this.editor,n=e.model;if(e.plugins.get(g_).removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")){e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop")}this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(t&&this.isEnabled&&n.change((t=>{const e=n.createSelection(this._draggedRange);n.deleteContent(e,{doNotAutoparagraph:!0});const i=e.getFirstPosition().parent;i.isEmpty&&!n.schema.checkChild(i,"$text")&&n.schema.checkChild(i,"paragraph")&&t.insertElement("paragraph",i,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(t){const e=this.editor,n=e.model,i=n.document.selection,o=t?I_(t):null;if(o){const t=e.editing.mapper.toModelElement(o);if(this._draggedRange=nl.fromRange(n.createRangeOn(t)),this._blockMode=n.schema.isBlock(t),e.plugins.has("WidgetToolbarRepository")){e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}return}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const r=Array.from(i.getSelectedBlocks()),s=i.getFirstRange();if(0==r.length)return void(this._draggedRange=nl.fromRange(s));const a=P_(n,r);if(r.length>1)this._draggedRange=nl.fromRange(a),this._blockMode=!0;else if(1==r.length){const t=s.start.isTouching(a.start)&&s.end.isTouching(a.end);this._draggedRange=nl.fromRange(t?a:s),this._blockMode=t}n.change((t=>t.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:t,domTarget:e,clientX:n}){const i=this.editor.editing.view,r=i.document.selection.editableElement,s=i.domConverter.mapViewToDom(r),a=Ti.window.getComputedStyle(s);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=pt(Ti.document,"div",{style:"position: fixed; left: -999999px;"}),Ti.document.body.appendChild(this._previewContainer));const c=new Oi(s);if(s.contains(e))return;const l=parseFloat(a.paddingLeft),d=pt(Ti.document,"div");d.className="ck ck-content",d.style.width=a.width,d.style.paddingLeft=`${c.left-n+l}px`,o.isiOS&&(d.style.backgroundColor="white"),d.innerHTML=t.getData("text/html"),t.setDragImage(d,0,0),this._previewContainer.appendChild(d)}}function T_(t){return o.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function I_(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(vC);if(vC(t))return t;const e=t.findAncestor((t=>vC(t)||t.is("editableElement")));return vC(e)?e:null}function P_(t,e){const n=e[0],i=e[e.length-1],o=n.getCommonAncestor(i),r=t.createPositionBefore(n),s=t.createPositionAfter(i);if(o&&o.is("element")&&!t.schema.isLimit(o)){const e=t.createRangeOn(o),n=r.isTouching(e.start),i=s.isTouching(e.end);if(n&&i)return P_(t,[o])}return t.createRange(r,s)}class R_ extends Vo{static get pluginName(){return"PastePlainText"}static get requires(){return[mC]}init(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=e.document.selection;let r=!1;n.addObserver(dC),this.listenTo(i,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(mC).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==Array.from(n.getAttributeKeys()).length}(n.content,e.schema))&&e.change((t=>{const i=Array.from(o.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0}),i.push(...o.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(i,e)}))}))}}class V_ extends Vo{static get pluginName(){return"Clipboard"}static get requires(){return[mC,S_,R_]}}var L_=Object.defineProperty,O_=Object.getOwnPropertySymbols,z_=Object.prototype.hasOwnProperty,F_=Object.prototype.propertyIsEnumerable,M_=(t,e,n)=>e in t?L_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class N_ extends Oo{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(t.data,"set",((t,e)=>{e[1]=((t,e)=>{for(var n in e||(e={}))z_.call(e,n)&&M_(t,n,e[n]);if(O_)for(var n of O_(e))F_.call(e,n)&&M_(t,n,e[n]);return t})({},e[1]);const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const i=this.editor.model,o=i.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=o.graveyard)).filter((t=>!j_(t,a)));e.length&&(H_(e),r.push(e[0]))}r.length&&i.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,i=n.document;this._createdBatches.add(e);const o=t.operations.slice().filter((t=>t.isDocumentOperation));o.reverse();for(const t of o){const o=t.baseVersion+1,r=Array.from(i.history.getOperations(o)),s=Kd([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let o of s){const r=o.affectedSelectable;r&&!n.canEditAt(r)&&(o=new Fd(o.baseVersion)),e.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(t,o)}}}}function H_(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class q_ extends N_{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,(()=>{this._undo(n.batch,i);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t)})),this.fire("revert",n.batch,i),this.refresh()}}class W_ extends N_{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,i),this._undo(t.batch,e)})),this.refresh()}}class U_ extends Vo{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const t=this.editor;this._undoCommand=new q_(t),this._redoCommand=new W_(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const i=n.batch,o=this._redoCommand.createdBatches.has(i),r=this._undoCommand.createdBatches.has(i);this._batchRegistry.has(i)||(this._batchRegistry.add(i),i.isUndoable&&(o?this._undoCommand.addBatch(i):r||(this._undoCommand.addBatch(i),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}class G_ extends Vo{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?rg.undo:rg.redo,o="ltr"==e.uiLanguageDirection?rg.redo:rg.undo;this._addButton("undo",n("Undo"),"CTRL+Z",i),this._addButton("redo",n("Redo"),"CTRL+Y",o)}_addButton(t,e,n,i){const o=this.editor;o.ui.componentFactory.add(t,(r=>{const s=o.commands.get(t),a=new qg(r);return a.set({label:e,icon:i,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{o.execute(t),o.editing.view.focus()})),a}))}}class $_ extends Vo{static get requires(){return[U_,G_]}static get pluginName(){return"Undo"}}function K_(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot("children")])}function Z_(t,e){const n=t.plugins.get("ImageUtils"),i=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!i)return o(t);return("block"==t.getStyle("display")||t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:o(t)};function o(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function J_(t,e){const n=xo(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}function Y_(t){return t&&t.endsWith("px")?parseInt(t):null}function Q_(t){const e=Y_(t.getStyle("width")),n=Y_(t.getStyle("height"));return!(!e||!n)}var X_=Object.defineProperty,tv=Object.getOwnPropertySymbols,ev=Object.prototype.hasOwnProperty,nv=Object.prototype.propertyIsEnumerable,iv=(t,e,n)=>e in t?X_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ov=(t,e)=>{for(var n in e||(e={}))ev.call(e,n)&&iv(t,n,e[n]);if(tv)for(var n of tv(e))nv.call(e,n)&&iv(t,n,e[n]);return t};const rv=/^(image|image-inline)$/;class sv extends Vo{constructor(){super(...arguments),this._domEmitter=new(Ei())}static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null,i={}){const o=this.editor,r=o.model,s=r.document.selection,a=av(o,e||s,n);t=ov(ov({},Object.fromEntries(s.getAttributes())),t);for(const e in t)r.schema.checkAttribute(a,e)||delete t[e];return r.change((n=>{const{setImageSizes:o=!0}=i,s=n.createElement(a,t);return r.insertObject(s,e,null,{setSelection:"on",findOptimalPosition:e||"imageInline"==a?void 0:"auto"}),s.parent?(o&&this.setImageNaturalSizeAttributes(s),s):null}))}setImageNaturalSizeAttributes(t){const e=t.getAttribute("src");e&&(t.getAttribute("width")||t.getAttribute("height")||this.editor.model.change((n=>{const i=new Ti.window.Image;this._domEmitter.listenTo(i,"load",(()=>{t.getAttribute("width")||t.getAttribute("height")||this.editor.model.enqueueChange(n.batch,(e=>{e.setAttribute("width",i.naturalWidth,t),e.setAttribute("height",i.naturalHeight,t)})),this._domEmitter.stopListening(i,"load")})),i.src=e})))}getClosestSelectedImageWidget(t){const e=t.getFirstPosition();if(!e)return null;const n=t.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=e.parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(t){return t.findAncestor({classes:rv})}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){const n=av(t,e,null);if("imageBlock"==n){const n=function(t,e){const n=SC(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return yC(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&vC(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function av(t,e,n){const i=t.model.schema,o=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===o?"imageInline":"auto"!==o?"imageBlock":e.is("selection")?J_(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;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));class cv extends Oo{refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled&&t.hasAttribute("alt")?this.value=t.getAttribute("alt"):this.value=!1}execute(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i=e.model,o=n.getClosestSelectedImageElement(i.document.selection);i.change((e=>{e.setAttribute("alt",t.newValue,o)}))}}class lv extends Vo{static get requires(){return[sv]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new cv(this.editor))}}var dv=n(1905),hv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(dv.Z,hv);dv.Z.locals;class uv extends gg{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Eo,this.keystrokes=new Do,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),rg.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),rg.cancel,"ck-button-cancel","cancel"),this._focusables=new dg,this._focusCycler=new Sp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),cg({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,i){const o=new qg(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createLabeledInputView(){const t=this.locale.t,e=new mp(this.locale,mm);return e.label=t("Text alternative"),e}}function gv(t){const e=t.editing.view,n=$f.defaultPositions,i=t.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class pv extends Vo{static get requires(){return[Hb]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const i=t.commands.get("imageTextAlternative"),o=new qg(n);return o.set({label:e("Change image text alternative"),icon:rg.textAlternative,tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>{this._showForm()})),o}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(ag(uv))(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=gv(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),sg({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:gv(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&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)}}class mv extends Vo{static get requires(){return[lv,pv]}static get pluginName(){return"ImageTextAlternative"}}function fv(t,e){const n=(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);null===n.attributeNewValue?(o.removeAttribute("srcset",s),o.removeAttribute("sizes",s)):n.attributeNewValue&&(o.setAttribute("srcset",n.attributeNewValue,s),o.setAttribute("sizes","100vw",s))};return t=>{t.on(`attribute:srcset:${e}`,n)}}function bv(t,e,n){const i=(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);o.setAttribute(n.attributeKey,n.attributeNewValue||"",s)};return t=>{t.on(`attribute:${n}:${e}`,i)}}class kv extends Ca{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}stopObserving(t){this.stopListening(t)}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}var wv=Object.defineProperty,Av=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,vv=(t,e,n)=>e in t?wv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yv=(t,e)=>{for(var n in e||(e={}))Cv.call(e,n)&&vv(t,n,e[n]);if(Av)for(var n of Av(e))_v.call(e,n)&&vv(t,n,e[n]);return t};class xv extends Oo{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&k("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&k("image-inline-plugin-required")}refresh(){const t=this.editor.plugins.get("ImageUtils");this.isEnabled=t.isImageAllowed()}execute(t){const e=wo(t.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);i.insertImage(yv(yv({},t),o),e)}else i.insertImage(yv(yv({},t),o))}))}}class Ev extends Oo{constructor(t){super(t),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(e),this.value=this.isEnabled?e.getAttribute("src"):null}execute(t){const e=this.editor.model.document.selection.getSelectedElement(),n=this.editor.plugins.get("ImageUtils");this.editor.model.change((i=>{i.setAttribute("src",t.source,e),this.cleanupImage(i,e),n.setImageNaturalSizeAttributes(e)}))}cleanupImage(t,e){t.removeAttribute("srcset",e),t.removeAttribute("sizes",e),t.removeAttribute("sources",e),t.removeAttribute("width",e),t.removeAttribute("height",e),t.removeAttribute("alt",e)}}class Dv extends Vo{static get requires(){return[sv]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(kv),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const n=new xv(t),i=new Ev(t);t.commands.add("insertImage",n),t.commands.add("replaceImageSource",i),t.commands.add("imageInsert",n)}}class Bv extends Vo{static get requires(){return[sv]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i="imageBlock"===t?"figure":"img";function o(e,i,o,r){e.on(`attribute:${i}:${t}`,((e,i,s)=>{if(!s.consumable.consume(i.item,e.name))return;const a=s.writer,c=s.mapper.toViewElement(i.item),l=n.findViewImgElement(c);if(null!==i.attributeNewValue?a.setAttribute(o,i.attributeNewValue,l):a.removeAttribute(o,l),i.item.hasAttribute("sources"))return;const d=i.item.hasAttribute("resizedWidth");if("imageInline"===t&&!d&&!r)return;const h=i.item.getAttribute("width"),u=i.item.getAttribute("height");h&&u&&a.setStyle("aspect-ratio",`${h}/${u}`,l)}))}e.conversion.for("upcast").attributeToAttribute({view:{name:i,styles:{width:/.+/}},model:{key:"width",value:t=>Q_(t)?Y_(t.getStyle("width")):null}}).attributeToAttribute({view:{name:i,key:"width"},model:"width"}).attributeToAttribute({view:{name:i,styles:{height:/.+/}},model:{key:"height",value:t=>Q_(t)?Y_(t.getStyle("height")):null}}).attributeToAttribute({view:{name:i,key:"height"},model:"height"}),e.conversion.for("editingDowncast").add((t=>{o(t,"width","width",!0),o(t,"height","height",!0)})),e.conversion.for("dataDowncast").add((t=>{o(t,"width","width",!1),o(t,"height","height",!1)}))}}class Sv extends Oo{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(t={}){const e=this.editor,n=this.editor.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(n.document.selection),r=Object.fromEntries(o.getAttributes());return r.src||r.uploadId?n.change((e=>{const{setImageSizes:s=!0}=t,a=Array.from(n.markers).filter((t=>t.getRange().containsItem(o))),c=i.insertImage(r,n.createSelection(o,"on"),this._modelElementName,{setImageSizes:s});if(!c)return null;const l=e.createRangeOn(c);for(const t of a){const n=t.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(l,!0):l;e.updateMarker(t,{range:i})}return{oldElement:o,newElement:c}})):null}}var Tv=n(2873),Iv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Tv.Z,Iv);Tv.Z.locals;class Pv extends Vo{static get requires(){return[sv]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const t=this.editor.model.schema;t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["placeholder"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const t=this.editor,e=t.conversion,n=t.plugins.get("ImageUtils");e.for("editingDowncast").add((t=>{t.on("attribute:placeholder",((t,e,i)=>{if(!i.consumable.test(e.item,t.name))return;if(!e.item.is("element","imageBlock")&&!e.item.is("element","imageInline"))return;i.consumable.consume(e.item,t.name);const o=i.writer,r=i.mapper.toViewElement(e.item),s=n.findViewImgElement(r);e.attributeNewValue?(o.addClass("image_placeholder",s),o.setStyle("background-image",`url(${e.attributeNewValue})`,s),o.setCustomProperty("editingPipeline:doNotReuseOnce",!0,s)):(o.removeClass("image_placeholder",s),o.removeStyle("background-image",s))}))}))}_setupLoadListener(){const t=this.editor,e=t.model,n=t.editing,i=n.view,o=t.plugins.get("ImageUtils");i.addObserver(kv),this.listenTo(i.document,"imageLoaded",((t,r)=>{const s=i.domConverter.mapDomToView(r.target);if(!s)return;const a=o.getImageWidgetFromImageView(s);if(!a)return;const c=n.mapper.toModelElement(a);c&&c.hasAttribute("placeholder")&&e.enqueueChange({isUndoable:!1},(t=>{t.removeAttribute("placeholder",c)}))}))}}class Rv extends Vo{static get requires(){return[Dv,Bv,sv,Pv,mC]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new Sv(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>K_(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>i.toImageWidget(K_(n),n,e("image widget"))}),n.for("downcast").add(bv(i,"imageBlock","src")).add(bv(i,"imageBlock","alt")).add(fv(i,"imageBlock")),n.for("upcast").elementToElement({view:Z_(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)}).add(function(t){const e=(e,n,i)=>{if(!i.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const o=t.findViewImgElement(n.viewItem);if(!o||!i.consumable.test(o,{name:!0}))return;i.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=xo(i.convertItem(o,n.modelCursor).modelRange.getItems());r?(i.convertChildren(n.viewItem,r),i.updateConversionResult(r,n)):i.consumable.revert(n.viewItem,{name:!0,classes:"image"})};return t=>{t.on("element:figure",e)}}(i))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===J_(e.schema,c)){const t=new uu(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageBlock")&&i.setImageNaturalSizeAttributes(t)}))}))}}var Vv=n(3535),Lv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Vv.Z,Lv);Vv.Z.locals;class Ov extends gg{constructor(t,e=[]){super(t),this.focusTracker=new Eo,this.keystrokes=new Do,this._focusables=new dg,this.children=this.createCollection(),this._focusCycler=new Sp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const t of e)this.children.add(t),this._focusables.add(t),t instanceof Jg&&this._focusables.addMany(t.children);if(this._focusables.length>1)for(const t of this._focusables)zv(t)&&(t.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),t.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()})));this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),cg({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}function zv(t){return"focusCycler"in t}class Fv extends Vo{constructor(t){super(t),this._integrations=new Map,t.config.define("image.insert.integrations",["upload","assetManager","url"])}static get pluginName(){return"ImageInsertUI"}static get requires(){return[sv]}init(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(t.model.document,"change",(()=>{this.isImageSelected=n.isImage(e.getSelectedElement())}));const i=t=>this._createToolbarComponent(t);t.ui.componentFactory.add("insertImage",i),t.ui.componentFactory.add("imageInsert",i)}registerIntegration({name:t,observable:e,buttonViewCreator:n,formViewCreator:i,requiresForm:o}){this._integrations.has(t)&&k("image-insert-integration-exists",{name:t}),this._integrations.set(t,{observable:e,buttonViewCreator:n,formViewCreator:i,requiresForm:!!o})}_createToolbarComponent(t){const e=this.editor,n=t.t,i=this._prepareIntegrations();if(!i.length)return null;let o;const r=i[0];if(1==i.length){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const e=r.buttonViewCreator(!1);o=new im(t,e),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",(t=>n(t?"Replace image":"Insert image")))}const s=this.dropdownView=cm(t,o),a=i.map((({observable:t})=>t));return s.bind("isEnabled").toMany(a,"isEnabled",((...t)=>t.some((t=>t)))),s.once("change:isOpen",(()=>{const t=i.map((({formViewCreator:t})=>t(1==i.length))),n=new Ov(e.locale,t);s.panelView.children.add(n)})),s}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),e=[];if(!t.length)return k("image-insert-integrations-not-specified"),e;for(const n of t)this._integrations.has(n)?e.push(this._integrations.get(n)):["upload","assetManager","url"].includes(n)||k("image-insert-unknown-integration",{item:n});return e.length||k("image-insert-integrations-not-registered"),e}}var Mv=n(3508),Nv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Mv.Z,Nv);Mv.Z.locals;class Hv extends Vo{static get requires(){return[Rv,GC,mv,Fv]}static get pluginName(){return"ImageBlock"}}class jv extends Vo{static get requires(){return[Dv,Bv,sv,Pv,mC]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new Sv(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>i.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(bv(i,"imageInline","src")).add(bv(i,"imageInline","alt")).add(fv(i,"imageInline")),n.for("upcast").elementToElement({view:Z_(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===J_(e.schema,c)){const t=new uu(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,i.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageInline")&&i.setImageNaturalSizeAttributes(t)}))}))}}class qv extends Vo{static get requires(){return[jv,GC,mv,Fv]}static get pluginName(){return"ImageInline"}}class Wv extends Vo{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[sv]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class Uv extends Oo{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils"),n=t.plugins.get("ImageUtils");if(!t.plugins.has(Rv))return this.isEnabled=!1,void(this.value=!1);const i=t.model.document.selection,o=i.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(i);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=n.isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageCaptionEditing"),o=this.editor.plugins.get("ImageUtils");let r=n.getSelectedElement();const s=i._getSavedCaption(r);o.isInlineImage(r)&&(this.editor.execute("imageTypeBlock"),r=n.getSelectedElement());const a=s||t.createElement("caption");t.append(a,r),e&&t.setSelection(a,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,i=e.plugins.get("ImageCaptionEditing"),o=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=o.getCaptionFromImageModelElement(s):(r=o.getCaptionFromModelSelection(n),s=r.parent),i._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class Gv extends Vo{constructor(t){super(t),this._savedCaptionsMap=new WeakMap}static get requires(){return[sv,Wv]}static get pluginName(){return"ImageCaptionEditing"}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new Uv(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils"),o=t.t;t.conversion.for("upcast").elementToElement({view:t=>i.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:i})=>{if(!n.isBlockImage(t.parent))return null;const r=i.createEditableElement("figcaption");i.setCustomProperty("imageCaption",!0,r),r.placeholder=o("Enter image caption"),Zo({view:e,element:r,keepOnFocus:!0});const s=t.parent.getAttribute("alt");return BC(r,i,{label:s?o("Caption for image: %0",[s]):o("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),i=t.commands.get("imageTypeInline"),o=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:i,newElement:o}=t.return;if(!i)return;if(e.isBlockImage(i)){const t=n.getCaptionFromImageModelElement(i);if(t)return void this._saveCaption(o,t)}const r=this._getSavedCaption(i);r&&this._saveCaption(o,r)};i&&this.listenTo(i,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?yc.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}_registerCaptionReconversion(){const t=this.editor,e=t.model,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils");e.document.on("change:data",(()=>{const o=e.document.differ.getChanges();for(const e of o){if("alt"!==e.attributeKey)continue;const o=e.range.start.nodeAfter;if(n.isBlockImage(o)){const e=i.getCaptionFromImageModelElement(o);if(!e)return;t.editing.reconvertItem(e)}}}))}}class $v extends Vo{static get requires(){return[Wv]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),i=t.t;t.ui.componentFactory.add("toggleImageCaption",(o=>{const r=t.commands.get("toggleImageCaption"),s=new qg(o);return s.set({icon:rg.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>i(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const i=n.getCaptionFromModelSelection(t.model.document.selection);if(i){const n=t.editing.mapper.toViewElement(i);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}t.editing.view.focus()})),s}))}}var Kv=n(2640),Zv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Kv.Z,Zv);Kv.Z.locals;function Jv(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function Yv(t){return new Promise(((e,n)=>{const i=t.getAttribute("src");fetch(i).then((t=>t.blob())).then((t=>{const n=Qv(t,i),o=n.replace("image/",""),r=new File([t],`image.${o}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const i=Ti.document.createElement("img");i.addEventListener("load",(()=>{const t=Ti.document.createElement("canvas");t.width=i.width,t.height=i.height;t.getContext("2d").drawImage(i,0,0),t.toBlob((t=>t?e(t):n()))})),i.addEventListener("error",(()=>n())),i.src=t}))}(t).then((e=>{const n=Qv(e,t),i=n.replace("image/","");return new File([e],`image.${i}`,{type:n})}))}(i).then(e).catch(n):n(t)))}))}function Qv(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Xv extends Vo{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const i=new dw(n),o=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=Jv(r);return i.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0,label:e("Upload image from computer"),icon:rg.imageUpload,tooltip:!0}),i.bind("isEnabled").to(o),i.on("done",((e,n)=>{const i=Array.from(n).filter((t=>s.test(t.type)));i.length&&(t.execute("uploadImage",{file:i}),t.editing.view.focus())})),i};if(t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n),t.plugins.has("ImageInsertUI")){const n=t.plugins.get("ImageInsertUI"),i=t.commands.get("uploadImage");n.registerIntegration({name:"upload",observable:i,buttonViewCreator:()=>{const i=t.ui.componentFactory.create("uploadImage");return i.bind("label").to(n,"isImageSelected",(t=>e(t?"Replace image from computer":"Upload image from computer"))),i},formViewCreator:()=>{const i=t.ui.componentFactory.create("uploadImage");return i.withText=!0,i.bind("label").to(n,"isImageSelected",(t=>e(t?"Replace from computer":"Upload from computer"))),i.on("execute",(()=>{n.dropdownView.isOpen=!1})),i}})}}}var ty=n(3689),ey={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(ty.Z,ey);ty.Z.locals;var ny=n(4036),iy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(ny.Z,iy);ny.Z.locals;var oy=n(3773),ry={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(oy.Z,ry);oy.Z.locals;class sy extends Vo{constructor(t){super(t),this.uploadStatusChange=(t,e,n)=>{const i=this.editor,o=e.item,r=o.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=i.plugins.get("ImageUtils"),a=i.plugins.get(cw),c=r?e.attributeNewValue:null,l=this.placeholder,d=i.editing.mapper.toViewElement(o),h=n.writer;if("reading"==c)return ay(d,h),void cy(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return ay(d,h),void(t?(ly(d,h),function(t,e,n,i){const o=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),o),n.on("change:uploadedPercent",((t,e,n)=>{i.change((t=>{t.setStyle("width",n+"%",o)}))}))}(d,h,t,i.editing.view),function(t,e,n,i){if(i.data){const o=t.findViewImgElement(e);n.setAttribute("src",i.data,o)}}(s,d,h,t)):cy(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),i),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(i))))}),3e3)}(d,h,i.editing.view),function(t,e){hy(t,e,"progressBar")}(d,h),ly(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function ay(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function cy(t,e,n,i){n.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",n);const o=t.findViewImgElement(n);o.getAttribute("src")!==e&&i.setAttribute("src",e,o),dy(n,"placeholder")||i.insert(i.createPositionAfter(o),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(i))}function ly(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),hy(t,e,"placeholder")}function dy(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function hy(t,e,n){const i=dy(t,n);i&&e.remove(e.createRangeOn(i))}var uy=Object.defineProperty,gy=Object.defineProperties,py=Object.getOwnPropertyDescriptors,my=Object.getOwnPropertySymbols,fy=Object.prototype.hasOwnProperty,by=Object.prototype.propertyIsEnumerable,ky=(t,e,n)=>e in t?uy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class wy extends Oo{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=wo(t.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,o,e)}else this._uploadImage(t,o)}))}_uploadImage(t,e,n){const i=this.editor,o=i.plugins.get(cw).createLoader(t),r=i.plugins.get("ImageUtils");var s,a;o&&r.insertImage((s=((t,e)=>{for(var n in e||(e={}))fy.call(e,n)&&ky(t,n,e[n]);if(my)for(var n of my(e))by.call(e,n)&&ky(t,n,e[n]);return t})({},e),a={uploadId:o.id},gy(s,py(a))),n)}}class Ay extends Vo{constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[cw,Vb,mC,sv]}static get pluginName(){return"ImageUploadEditing"}init(){const t=this.editor,e=t.model.document,n=t.conversion,i=t.plugins.get(cw),o=t.plugins.get("ImageUtils"),r=t.plugins.get("ClipboardPipeline"),s=Jv(t.config.get("image.upload.types")),a=new wy(t);t.commands.add("uploadImage",a),t.commands.add("imageUpload",a),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(i=n.dataTransfer,Array.from(i.types).includes("text/html")&&""!==i.getData("text/html"))return;var i;const o=Array.from(n.dataTransfer.files).filter((t=>!!t&&s.test(t.type)));o.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.execute("uploadImage",{file:o})})))})),this.listenTo(r,"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).map((t=>t.item)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src")||!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!e.getAttribute("src").match(/^blob:/g))}(o,t)&&!t.getAttribute("uploadProcessed"))).map((t=>({promise:Yv(t),imageElement:t})));if(!r.length)return;const s=new uu(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=i.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),o=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of Cy(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=i.loaders.get(t);n&&(r?o.has(t)||n.abort():(o.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const i=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",i.default,e),this._parseAndSetSrcsetAttributeOnImage(i,e,t),o.setImageNaturalSizeAttributes(e)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,i=e.locale.t,r=e.plugins.get(cw),s=e.plugins.get(Vb),a=e.plugins.get("ImageUtils"),c=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",c.get(t.id))})),t.read().then((()=>{const i=t.upload(),r=c.get(t.id);if(o.isSafari){const t=e.editing.mapper.toViewElement(r),n=a.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const i=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=i}))}return n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",r)})),i})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const i=c.get(t.id);n.setAttribute("uploadStatus","complete",i),this.fire("uploadComplete",{data:e,imageElement:i})})),l()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&s.showWarning(e,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(c.get(t.id))})),l()}));function l(){n.enqueueChange({isUndoable:!1},(e=>{const n=c.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),c.delete(t.id)})),r.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let i=0;const o=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return i=Math.max(i,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");if(""!=o){const t={srcset:o};e.hasAttribute("width")||e.hasAttribute("height")||(t.width=i),n.setAttributes(t,e)}}}function Cy(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}class _y extends Oo{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);this.isEnabled=!!e,e&&e.hasAttribute("resizedWidth")?this.value={width:e.getAttribute("resizedWidth"),height:null}:this.value=null}execute(t){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(n.document.selection);this.value={width:t.width,height:null},o&&n.change((e=>{e.setAttribute("resizedWidth",t.width,o),e.removeAttribute("resizedHeight",o),i.setImageNaturalSizeAttributes(o)}))}}class vy extends Vo{static get requires(){return[sv]}static get pluginName(){return"ImageResizeEditing"}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const t=this.editor,e=new _y(t);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(t){const e=this.editor,n=e.plugins.get("ImageUtils");e.conversion.for("downcast").add((e=>e.on(`attribute:resizedWidth:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=n.writer,o=n.mapper.toViewElement(e.item);null!==e.attributeNewValue?(i.setStyle("width",e.attributeNewValue,o),i.addClass("image_resized",o)):(i.removeStyle("width",o),i.removeClass("image_resized",o))})))),e.conversion.for("dataDowncast").attributeToAttribute({model:{name:t,key:"resizedHeight"},view:t=>({key:"style",value:{height:t}})}),e.conversion.for("editingDowncast").add((e=>e.on(`attribute:resizedHeight:${t}`,((e,i,o)=>{if(!o.consumable.consume(i.item,e.name))return;const r=o.writer,s=o.mapper.toViewElement(i.item),a="imageInline"===t?n.findViewImgElement(s):s;null!==i.attributeNewValue?r.setStyle("height",i.attributeNewValue,a):r.removeStyle("height",a)})))),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:t=>Q_(t)?null:t.getStyle("width")}}),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:t=>Q_(t)?null:t.getStyle("height")}})}}const yy={small:rg.objectSizeSmall,medium:rg.objectSizeMedium,large:rg.objectSizeLarge,original:rg.objectSizeFull};class xy extends Vo{constructor(t){super(t),this._resizeUnit=t.config.get("image.resizeUnit")}static get requires(){return[vy]}static get pluginName(){return"ImageResizeButtons"}init(){const t=this.editor,e=t.config.get("image.resizeOptions"),n=t.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const t of e)this._registerImageResizeButton(t);this._registerImageResizeDropdown(e)}_registerImageResizeButton(t){const e=this.editor,{name:n,value:i,icon:o}=t,r=i?i+this._resizeUnit:null;e.ui.componentFactory.add(n,(n=>{const i=new qg(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!yy[o])throw new b("imageresizebuttons-missing-icon",e,t);return i.set({label:a,icon:yy[o],tooltip:a,isToggleable:!0}),i.bind("isEnabled").to(this),i.bind("isOn").to(s,"value",Ey(r)),this.listenTo(i,"execute",(()=>{e.execute("resizeImage",{width:r})})),i}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,i=t.find((t=>!t.value)),o=o=>{const r=e.commands.get("resizeImage"),s=cm(o,Bp),a=s.buttonView,c=n("Resize image");return a.set({tooltip:c,commandValue:i.value,icon:yy.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:c,ariaLabelledBy:void 0}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(i))),s.bind("isEnabled").to(this),hm(s,(()=>this._getResizeDropdownListItemDefinitions(t,r)),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(s,"execute",(t=>{e.execute(t.source.commandName,{width:t.source.commandValue}),e.editing.view.focus()})),s};e.ui.componentFactory.add("resizeImage",o),e.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(t,e=!1){const n=this.editor.t;return t.label?t.label:e?t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const n=new yo;return t.map((t=>{const i=t.value?t.value+this._resizeUnit:null,o={type:"button",model:new Lb({commandName:"resizeImage",commandValue:i,label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null})};o.model.bind("isOn").to(e,"value",Ey(i)),n.add(o)})),n}}function Ey(t){return e=>null===t&&e===t||null!==e&&e.width===t}const Dy="image_resized";class By extends Vo{static get requires(){return[d_,sv]}static get pluginName(){return"ImageResizeHandles"}init(){const t=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(t),this._setupResizerCreator()}_setupResizerCreator(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils");e.addObserver(kv),this.listenTo(e.document,"imageLoaded",((i,o)=>{if(!o.target.matches("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"))return;const r=t.editing.view.domConverter,s=r.domToView(o.target),a=n.getImageWidgetFromImageView(s);let c=this.editor.plugins.get(d_).getResizerByViewElement(a);if(c)return void c.redraw();const l=t.editing.mapper,d=l.toModelElement(a);c=t.plugins.get(d_).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:d,viewElement:a,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>r.mapViewToDom(l.toViewElement(d.parent)),isCentered(){const t=d.getAttribute("imageStyle");return!t||"block"==t||"alignCenter"==t},onCommit(n){e.change((t=>{t.removeClass(Dy,a)})),t.execute("resizeImage",{width:n})}}),c.on("updateSize",(()=>{a.hasClass(Dy)||e.change((t=>{t.addClass(Dy,a)}));const t="imageInline"===d.name?s:a;t.getStyle("height")&&e.change((e=>{e.removeStyle("height",t)}))})),c.bind("isEnabled").to(this)}))}}var Sy=n(6270),Ty={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Sy.Z,Ty);Sy.Z.locals;class Iy extends Oo{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils");n.change((e=>{const o=t.value,{setImageSizes:r=!0}=t;let s=i.getClosestSelectedImageElement(n.document.selection);o&&this.shouldConvertImageType(o,s)&&(this.editor.execute(i.isBlockImage(s)?"imageTypeInline":"imageTypeBlock",{setImageSizes:r}),s=i.getClosestSelectedImageElement(n.document.selection)),!o||this._styles.get(o).isDefault?e.removeAttribute("imageStyle",s):e.setAttribute("imageStyle",o,s),r&&i.setImageNaturalSizeAttributes(s)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}var Py=Object.defineProperty,Ry=Object.getOwnPropertySymbols,Vy=Object.prototype.hasOwnProperty,Ly=Object.prototype.propertyIsEnumerable,Oy=(t,e,n)=>e in t?Py(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zy=(t,e)=>{for(var n in e||(e={}))Vy.call(e,n)&&Oy(t,n,e[n]);if(Ry)for(var n of Ry(e))Ly.call(e,n)&&Oy(t,n,e[n]);return t};const{objectFullWidth:Fy,objectInline:My,objectLeft:Ny,objectRight:Hy,objectCenter:jy,objectBlockLeft:qy,objectBlockRight:Wy}=rg,Uy={get inline(){return{name:"inline",title:"In line",icon:My,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Ny,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:qy,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:jy,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Hy,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Wy,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:jy,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Hy,modelElements:["imageBlock"],className:"image-style-side"}}},Gy={full:Fy,left:qy,right:Wy,center:jy,inlineLeft:Ny,inlineRight:Hy,inline:My},$y=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function Ky(t){k("image-style-configuration-definition-invalid",t)}const Zy={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?Uy[t]?zy({},Uy[t]):{name:t}:function(t,e){const n=zy({},e);for(const i in t)Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);return n}(Uy[t.name],t);"string"==typeof t.icon&&(t.icon=Gy[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:i,name:o}=t;if(!(i&&i.length&&o))return Ky({style:t}),!1;{const o=[e?"imageBlock":null,n?"imageInline":null];if(!i.some((t=>o.includes(t))))return k("image-style-missing-dependency",{style:t,missingPlugins:i.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...$y]:[]},warnInvalidStyle:Ky,DEFAULT_OPTIONS:Uy,DEFAULT_ICONS:Gy,DEFAULT_DROPDOWN_DEFINITIONS:$y};function Jy(t,e){for(const n of e)if(n.name===t)return n}class Yy extends Vo{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[sv]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=Zy,n=this.editor,i=n.plugins.has("ImageBlockEditing"),o=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(i,o)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:o}),this._setupConversion(i,o),this._setupPostFixer(),n.commands.add("imageStyle",new Iy(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,i=n.model.schema,o=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=Jy(e.attributeNewValue,r),o=Jy(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;o&&a.removeClass(o.className,s),i&&a.addClass(i.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,i)=>{if(!n.modelRange)return;const o=n.viewItem,r=xo(n.modelRange.getItems());if(r&&i.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])i.consumable.consume(o,{classes:t.className})&&i.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",o),n.data.downcastDispatcher.on("attribute:imageStyle",o),t&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(sv),i=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let o=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=i.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),o=!0)}return o}))}}var Qy=n(5083),Xy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Qy.Z,Xy);Qy.Z.locals;class tx extends Vo{static get requires(){return[Yy]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=ex(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const i=ex([...e.filter(L),...Zy.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of i)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(i=>{let o;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>nx(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(o=e),e}));s.length!==c.length&&Zy.warnInvalidStyle({dropdown:t});const l=cm(i,im),d=l.buttonView,h=d.arrowView;return lm(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:ix(a,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:a}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(Nr);return e<0?o.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(Nr);return ix(a,e<0?o.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(Nr))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(Nr)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:o.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(Nr))),this.listenTo(l,"execute",(()=>{this.editor.editing.view.focus()})),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(nx(e),(n=>{const i=this.editor.commands.get("imageStyle"),o=new qg(n);return o.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>t===e)),o.on("execute",this._executeCommand.bind(this,e)),o}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function ex(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function nx(t){return`imageStyle:${t}`}function ix(t,e){return(t?t+": ":"")+e}class ox{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const i=n.writer,o=i.document.selection;for(const t of this._definitions){const r=i.createAttributeElement("a",t.attributes,{priority:5});t.classes&&i.addClass(t.classes,r);for(const e in t.styles)i.setStyle(e,t.styles[e],r);i.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?i.wrap(o.getFirstRange(),r):i.wrap(n.mapper.toViewRange(e.range),r):i.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:i})=>{const o=i.toViewElement(e.item),r=Array.from(o.getChildren()).find((t=>t.is("element","a")));for(const t of this._definitions){const i=Bo(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of i)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of i)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const rx=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:Br(t,e,n)};var sx=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const ax=function(t){return sx.test(t)};const cx=function(t){return t.split("")};var lx="\\ud800-\\udfff",dx="["+lx+"]",hx="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",ux="\\ud83c[\\udffb-\\udfff]",gx="[^"+lx+"]",px="(?:\\ud83c[\\udde6-\\uddff]){2}",mx="[\\ud800-\\udbff][\\udc00-\\udfff]",fx="(?:"+hx+"|"+ux+")"+"?",bx="[\\ufe0e\\ufe0f]?",kx=bx+fx+("(?:\\u200d(?:"+[gx,px,mx].join("|")+")"+bx+fx+")*"),wx="(?:"+[gx+hx+"?",hx,px,mx,dx].join("|")+")",Ax=RegExp(ux+"(?="+ux+")|"+wx+kx,"g");const Cx=function(t){return t.match(Ax)||[]};const _x=function(t){return ax(t)?Cx(t):cx(t)};const vx=function(t){return function(e){e=vr(e);var n=ax(e)?_x(e):void 0,i=n?n[0]:e.charAt(0),o=n?rx(n,1).join(""):e.slice(1);return i[t]()+o}}("toUpperCase"),yx=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,xx=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,Ex=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Dx=/^((\w+:(\/{2,})?)|(\W))/i,Bx="Ctrl+K";function Sx(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function Tx(t){const e=String(t);return function(t){const e=t.replace(yx,"");return!!e.match(xx)}(e)?e:"#"}function Ix(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function Px(t,e){const n=(i=t,Ex.test(i)?"mailto:":e);var i;const o=!!n&&!Rx(t);return t&&o?n+t:t}function Rx(t){return Dx.test(t)}function Vx(t){window.open(t,"_blank","noopener")}class Lx extends Oo{constructor(){super(...arguments),this.manualDecorators=new yo,this.automaticDecorators=new ox}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||xo(e.getSelectedBlocks());Ix(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,i=n.document.selection,o=[],r=[];for(const t in e)e[t]?o.push(t):r.push(t);n.change((e=>{if(i.isCollapsed){const s=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=Ox(i);let c=$w(s,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(c=this._updateLinkContent(n,e,c,t)),e.setAttribute("linkHref",t,c),o.forEach((t=>{e.setAttribute(t,!0,c)})),r.forEach((t=>{e.removeAttribute(t,c)})),e.setSelection(e.createPositionAfter(c.end.nodeBefore))}else if(""!==t){const r=Bo(i.getAttributes());r.set("linkHref",t),o.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...o,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const t of i.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const s of c){let a=s;if(1===c.length){const o=Ox(i);i.getAttribute("linkHref")===o&&(a=this._updateLinkContent(n,e,s,t),e.setSelection(e.createSelection(a)))}e.setAttribute("linkHref",t,a),o.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)}))}}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,i=n.getSelectedElement();return Ix(i,e.schema)?i.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}_updateLinkContent(t,e,n,i){const o=e.createText(i,{linkHref:i});return t.insertContent(o,n)}}function Ox(t){if(t.isCollapsed){const e=t.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(t.getFirstRange().getItems());if(e.length>1)return null;const n=e[0];return n.is("$text")||n.is("$textProxy")?n.data:null}}class zx extends Oo{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();Ix(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,i=t.commands.get("link");e.change((t=>{const o=n.isCollapsed?[$w(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of o)if(t.removeAttribute("linkHref",e),i)for(const n of i.manualDecorators)t.removeAttribute(n.id,e)}))}}class Fx extends(j()){constructor({id:t,label:e,attributes:n,classes:i,styles:o,defaultValue:r}){super(),this.id=t,this.set("value",void 0),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=i,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var Mx=n(1134),Nx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Mx.Z,Nx);Mx.Z.locals;var Hx=Object.defineProperty,jx=Object.getOwnPropertySymbols,qx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,Ux=(t,e,n)=>e in t?Hx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gx=(t,e)=>{for(var n in e||(e={}))qx.call(e,n)&&Ux(t,n,e[n]);if(jx)for(var n of jx(e))Wx.call(e,n)&&Ux(t,n,e[n]);return t};const $x="automatic",Kx=/^(https?:)?\/\//;class Zx extends Vo{static get pluginName(){return"LinkEditing"}static get requires(){return[Rw,Aw,mC]}constructor(t){super(t),t.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Sx}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>Sx(Tx(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new Lx(t)),t.commands.add("unlink",new zx(t));const e=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>("label"in t&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,i]of Object.entries(t)){const t=Object.assign({},i,{id:`link${vx(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===$x))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode)));t.plugins.get(Rw).registerAttribute("linkHref"),Zw(t,"linkHref","a","ck-link_selected"),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:$x,callback:t=>!!t&&Kx.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id});const i=new Fx(t);n.add(i),e.conversion.for("downcast").attributeToElement({model:i.id,view:(t,{writer:e,schema:n},{item:o})=>{if((o.is("selection")||n.isInline(o))&&t){const t=e.createAttributeElement("a",i.attributes,{priority:5});i.classes&&e.addClass(i.classes,t);for(const n in i.styles)e.setStyle(n,i.styles[n],t);return e.setCustomProperty("link",!0,t),t}}}),e.conversion.for("upcast").elementToAttribute({view:Gx({name:"a"},i._createPattern()),model:{key:i.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",((t,e)=>{if(!(o.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const i=n.getAttribute("href");i&&(t.stop(),e.preventDefault(),Vx(i))}),{context:"$capture"}),this.listenTo(e,"keydown",((e,n)=>{const i=t.commands.get("link").value;!!i&&n.keyCode===go.enter&&n.altKey&&(e.stop(),Vx(i))}))}_enableSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(e,"change:attribute",((n,{attributeKeys:i})=>{i.includes("linkHref")&&!e.hasAttribute("linkHref")&&t.change((e=>{var n;!function(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}(e,(n=t.schema,n.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))))}))}))}_enableClipboardIntegration(){const t=this.editor,e=t.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(t.plugins.get("ClipboardPipeline"),"contentInsertion",((t,i)=>{e.change((t=>{const e=t.createRangeIn(i.content);for(const i of e.getItems())if(i.hasAttribute("linkHref")){const e=Px(i.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,i)}}))}))}}var Jx=n(8117),Yx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Jx.Z,Yx);Jx.Z.locals;class Qx extends gg{constructor(t,e){super(t),this.focusTracker=new Eo,this.keystrokes=new Do,this._focusables=new dg;const n=t.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),rg.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),rg.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusCycler=new Sp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),cg({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const t=this.locale.t,e=new mp(this.locale,mm);return e.label=t("Link URL"),e}_createButton(t,e,n,i){const o=new qg(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const i=new Gg(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?!!n.defaultValue:!!t)),i.on("execute",(()=>{n.set("value",!i.isOn)})),e.add(i)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new gg;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}}var Xx=n(9376),tE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(Xx.Z,tE);Xx.Z.locals;class eE extends gg{constructor(t){super(t),this.focusTracker=new Eo,this.keystrokes=new Do,this._focusables=new dg;const e=t.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),'',"unlink"),this.editButtonView=this._createButton(e("Edit link"),rg.pencil,"edit"),this.set("href",void 0),this._focusCycler=new Sp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(t,e,n){const i=new qg(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const t=new qg(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&Tx(t))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const nE="link-ui";class iE extends Vo{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Hb]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(du),this._balloon=t.plugins.get(Hb),this._createToolbarLinkButton(),this._enableBalloonActivators(),t.conversion.for("editingDowncast").markerToHighlight({model:nE,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:nE,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const t=this.editor,e=new eE(t.locale),n=t.commands.get("link"),i=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(Bx,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),i=t.config.get("link.allowCreatingEmptyLinks"),o=new(ag(Qx))(t.locale,e);return o.urlInputView.fieldView.bind("value").to(e,"value"),o.urlInputView.bind("isEnabled").to(e,"isEnabled"),o.saveButtonView.bind("isEnabled").to(e,"isEnabled",o.urlInputView,"isEmpty",((t,e)=>t&&(i||!e))),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,i=Px(e,n);t.execute("link",i,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.ui.componentFactory.add("link",(t=>{const i=new qg(t);return i.isEnabled=!0,i.label=n("Link"),i.icon='',i.keystroke=Bx,i.tooltip=!0,i.isToggleable=!0,i.bind("isEnabled").to(e,"isEnabled"),i.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(i,"execute",(()=>this._showUI(!0))),i}))}_enableBalloonActivators(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),t.keystrokes.set(Bx,((e,n)=>{n(),t.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),sg({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=t.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),i=r();const o=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,i=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const t=this._balloon.visibleView;return!!this.formView&&t==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let i;if(e.markers.has(nE)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(nE)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));i=t.domConverter.viewRangeToDom(n)}else i=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&vC(n))return oE(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),i=oE(n.start),o=oE(n.end);return i&&i==o&&t.createRangeIn(i).getTrimmed().isEqual(n)?i:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(nE))e.updateMarker(nE,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(nE,{usingOperation:!1,affectsData:!1,range:e.createRange(i,n.end)})}else e.addMarker(nE,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(nE)&&t.change((t=>{t.removeMarker(nE)}))}}function oE(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))||null}const rE=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class sE extends Vo{static get requires(){return[Sw,Zx]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(t,e){return e.textNode&&e.textNode.hasAttribute("linkHref")?$w(e,"linkHref",e.textNode.getAttribute("linkHref"),t):null}_selectEntireLinks(t,e){const n=this.editor.model,i=n.document.selection,o=i.getFirstPosition(),r=i.getLastPosition();let s=e.getJoined(this._expandLinkRange(n,o)||e);s&&(s=s.getJoined(this._expandLinkRange(n,r)||e)),s&&(s.start.isBefore(o)||s.end.isAfter(r))&&t.setSelection(s)}_enablePasteLinking(){const t=this.editor,e=t.model,n=e.document.selection,i=t.plugins.get("ClipboardPipeline"),o=t.commands.get("link");i.on("inputTransformation",((t,i)=>{if(!this.isEnabled||!o.isEnabled||n.isCollapsed)return;if(n.rangeCount>1)return;const r=n.getFirstRange(),s=i.dataTransfer.getData("text/plain");if(!s)return;const a=s.match(rE);a&&a[2]===s&&(e.change((t=>{this._selectEntireLinks(t,r),o.execute(s)})),t.stop())}),{priority:"high"})}_enableTypingHandling(){const t=this.editor,e=new Pw(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=aE(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:i,range:o,url:r}=n;if(!i.isTyping)return;const s=o.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:i}=Iw(t,e),o=aE(n);if(o){const t=e.createRange(i.end.getShiftedBy(-o.length),i.end);this._applyAutoLink(o,t)}}_applyAutoLink(t,e){const n=this.editor.model,i=Px(t,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&Rx(i)&&!function(t){const e=t.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}(e)&&this._persistAutoLink(i,e)}_persistAutoLink(t,e){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange((o=>{o.setAttribute("linkHref",t,e),n.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function aE(t){const e=rE.exec(t);return e?e[2]:null}var cE=n(3088),lE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(cE.Z,lE);cE.Z.locals;class dE{constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward="forward"==e.direction,this._includeSelf=!!e.includeSelf,this._sameAttributes=wo(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){return xo(new this(t,e)[Symbol.iterator]())}*[Symbol.iterator](){const t=[];for(const{node:e}of hE(this._getStartNode(),this._isForward?"forward":"backward")){const n=e.getAttribute("listIndent");if(nthis._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some((t=>e.getAttribute(t)!==this._startElement.getAttribute(t))))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*hE(t,e="forward"){const n="forward"==e,i=[];let o=null;for(;vE(t);){let e=null;if(o){const n=t.getAttribute("listIndent"),r=o.getAttribute("listIndent");n>r?i[r]=o:ne in t?gE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,AE=(t,e)=>{for(var n in e||(e={}))bE.call(e,n)&&wE(t,n,e[n]);if(fE)for(var n of fE(e))kE.call(e,n)&&wE(t,n,e[n]);return t},CE=(t,e)=>pE(t,mE(e));class _E{static next(){return g()}}function vE(t){return!!t&&t.is("element")&&t.hasAttribute("listItemId")}function yE(t,e={}){return[...xE(t,CE(AE({},e),{direction:"backward"})),...xE(t,CE(AE({},e),{direction:"forward"}))]}function xE(t,e={}){const n="forward"==e.direction,i=Array.from(new dE(t,CE(AE({},e),{includeSelf:n,sameIndent:!0,sameAttributes:"listItemId"})));return n?i:i.reverse()}function EE(t){const e=new dE(t,{sameIndent:!0,sameAttributes:"listType"}),n=new dE(t,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward"});return[...Array.from(e).reverse(),...n]}function DE(t){return!dE.first(t,{sameIndent:!0,sameAttributes:"listItemId"})}function BE(t){return!dE.first(t,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function SE(t,e={}){t=wo(t);const n=!1!==e.withNested,i=new Set;for(const e of t)for(const t of yE(e,{higherIndent:n}))i.add(t);return LE(i)}function TE(t,e){const n=xE(t,{direction:"forward"}),i=_E.next();for(const t of n)e.setAttribute("listItemId",i,t);return n}function IE(t,e,n){const i={};for(const[t,n]of e.getAttributes())t.startsWith("list")&&(i[t]=n);const o=xE(t,{direction:"forward"});for(const t of o)n.setAttributes(i,t);return o}function PE(t,e,{expand:n,indentBy:i=1}={}){t=wo(t);const o=n?SE(t):t;for(const t of o){const n=t.getAttribute("listIndent")+i;n<0?RE(t,e):e.setAttribute("listIndent",n,t)}return o}function RE(t,e){t=wo(t);for(const n of t)n.is("element","listItem")&&e.rename(n,"paragraph");for(const n of t)for(const t of n.getAttributeKeys())t.startsWith("list")&&e.removeAttribute(t,n);return t}function VE(t){if(!t.length)return!1;const e=t[0].getAttribute("listItemId");return!!e&&!t.some((t=>t.getAttribute("listItemId")!=e))}function LE(t){return Array.from(t).filter((t=>"$graveyard"!==t.root.rootName)).sort(((t,e)=>t.index-e.index))}function OE(t){const e=t.document.selection.getSelectedElement();return e&&t.schema.isObject(e)&&t.schema.isBlock(e)?e:null}function zE(t,e){return e.checkChild(t.parent,"listItem")&&e.checkChild(t,"$text")&&!e.isObject(t)}function FE(t,e,n){return xE(e,{direction:"forward"}).pop().index>t.index?IE(t,e,n):[]}class ME extends Oo{constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=NE(t.document.selection);t.change((t=>{const n=[];VE(e)&&!DE(e[0])?("forward"==this._direction&&n.push(...PE(e,t)),n.push(...TE(e[0],t))):"forward"==this._direction?n.push(...PE(e,t,{expand:!0})):n.push(...function(t,e){const n=SE(t=wo(t)),i=new Set,o=Math.min(...n.map((t=>t.getAttribute("listIndent")))),r=new Map;for(const t of n)r.set(t,dE.first(t,{lowerIndent:!0}));for(const t of n){if(i.has(t))continue;i.add(t);const n=t.getAttribute("listIndent")-1;if(n<0)RE(t,e);else{if(t.getAttribute("listIndent")==o){const n=FE(t,r.get(t),e);for(const t of n)i.add(t);if(n.length)continue}e.setAttribute("listIndent",n,t)}}return LE(i)}(e,t));for(const e of n){if(!e.hasAttribute("listType"))continue;const n=dE.first(e,{sameIndent:!0});n&&t.setAttribute("listType",n.getAttribute("listType"),e)}this._fireAfterExecute(n)}))}_fireAfterExecute(t){this.fire("afterExecute",LE(new Set(t)))}_checkEnabled(){let t=NE(this.editor.model.document.selection),e=t[0];if(!e)return!1;if("backward"==this._direction)return!0;if(VE(t)&&!DE(t[0]))return!0;t=SE(t),e=t[0];const n=dE.first(e,{sameIndent:!0});return!!n&&n.getAttribute("listType")==e.getAttribute("listType")}}function NE(t){const e=Array.from(t.getSelectedBlocks()),n=e.findIndex((t=>!vE(t)));return-1!=n&&(e.length=n),e}class HE extends Oo{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,i=OE(e),o=Array.from(n.selection.getSelectedBlocks()).filter((t=>e.schema.checkAttribute(t,"listType")||zE(t,e.schema))),r=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(r){const e=o[o.length-1],n=xE(e,{direction:"forward"}),i=[];n.length>1&&i.push(...TE(n[1],t)),i.push(...RE(o,t)),i.push(...function(t,e){const n=[];let i=Number.POSITIVE_INFINITY;for(const{node:o}of hE(t.nextSibling,"forward")){const t=o.getAttribute("listIndent");if(0==t)break;t{const{firstElement:r,lastElement:s}=this._getMergeSubjectElements(n,t),a=r.getAttribute("listIndent")||0,c=s.getAttribute("listIndent"),l=s.getAttribute("listItemId");if(a!=c){const t=(d=s,Array.from(new dE(d,{direction:"forward",higherIndent:!0})));i.push(...PE([s,...t],o,{indentBy:a-c,expand:a{const e=TE(this._getStartBlock(),t);this._fireAfterExecute(e)}))}_fireAfterExecute(t){this.fire("afterExecute",LE(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&vE(e)&&!DE(e)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?t:t.nextSibling}}class WE extends Vo{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(t){return function(t){t=wo(t);const e=new Set;for(const n of t)for(const t of EE(n))e.add(t);return LE(e)}(t)}isFirstBlockOfListItem(t){return DE(t)}isListItemBlock(t){return vE(t)}expandListBlocksToCompleteItems(t,e={}){return SE(t,e)}}function UE(t){return t.is("element","ol")||t.is("element","ul")}function GE(t){return t.is("element","li")}function $E(t,e,n,i=JE(n,e)){return t.createAttributeElement(ZE(n),null,{priority:2*e/100-100,id:i})}function KE(t,e,n){return t.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:n})}function ZE(t){return"numbered"==t?"ol":"ul"}function JE(t,e){return`list-${t}-${e}`}function YE(t,e){const n=t.nodeBefore;if(vE(n)){let t=n;for(const{node:n}of hE(t,"backward"))if(t=n,e.has(t))return;e.set(n,t)}else{const n=t.nodeAfter;vE(n)&&e.set(n,n)}}function QE(){return(t,e,n)=>{const{writer:i,schema:o}=n;if(!e.modelRange)return;const r=Array.from(e.modelRange.getItems({shallow:!0})).filter((t=>o.checkAttribute(t,"listItemId")));if(!r.length)return;const s=_E.next(),a=function(t){let e=0,n=t.parent;for(;n;){if(GE(n))e++;else{const t=n.previousSibling;t&&GE(t)&&e++}n=n.parent}return e}(e.viewItem);let c=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const l=r[0].getAttribute("listType");l&&(c=l);const d={listItemId:s,listIndent:a,listType:c};for(const t of r)t.hasAttribute("listItemId")||i.setAttributes(d,t);r.length>1&&r[1].getAttribute("listItemId")!=d.listItemId&&n.keepEmptyElement(r[0])}}function XE(){return(t,e,n)=>{if(!n.consumable.test(e.viewItem,{name:!0}))return;const i=new uu(e.viewItem.document);for(const t of Array.from(e.viewItem.getChildren()))GE(t)||UE(t)||i.remove(t)}}function tD(t,e,n,{dataPipeline:i}={}){const o=function(t){return(e,n)=>{const i=[];for(const n of t)e.hasAttribute(n)&&i.push(`attribute:${n}`);return!!i.every((t=>!1!==n.test(e,t)))&&(i.forEach((t=>n.consume(e,t))),!0)}}(t);return(r,s,a)=>{const{writer:c,mapper:l,consumable:d}=a,h=s.item;if(!t.includes(s.attributeKey))return;if(!o(h,d))return;const u=function(t,e,n){const i=n.createRangeOn(t),o=e.toViewRange(i).getTrimmed();return o.end.nodeBefore}(h,l,n);!function(t,e,n){for(;t.parent.is("attributeElement")&&t.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeIn(t.parent),t.parent);const i=e.createPositionBefore(t).getWalker({direction:"backward"}),o=[];for(const{item:t}of i){if(t.is("element")&&n.toModelElement(t))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&o.push(t)}for(const t of o)e.remove(t)}(u,c,l),function(t,e){let n=t.parent;for(;n.is("attributeElement")&&["ul","ol","li"].includes(n.name);){const i=n.parent;e.unwrap(e.createRangeOn(t),n),n=i}}(u,c);const g=function(t,e,n,i,{dataPipeline:o}){let r=i.createRangeOn(e);if(!DE(t))return r;for(const s of n){if("itemMarker"!=s.scope)continue;const n=s.createElement(i,t,{dataPipeline:o});if(!n)continue;if(i.setCustomProperty("listItemMarker",!0,n),i.insert(r.start,n),r=i.createRange(i.createPositionBefore(n),i.createPositionAfter(e)),!s.createWrapperElement||!s.canWrapElement)continue;const a=s.createWrapperElement(i,t,{dataPipeline:o});i.setCustomProperty("listItemWrapper",!0,a),s.canWrapElement(t)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(n),a),r=i.createRange(r.start,i.createPositionAfter(e)))}return r}(h,u,e,c,{dataPipeline:i});!function(t,e,n,i){if(!t.hasAttribute("listIndent"))return;const o=t.getAttribute("listIndent");let r=t;for(let t=o;t>=0;t--){const o=KE(i,t,r.getAttribute("listItemId")),s=$E(i,t,r.getAttribute("listType"));for(const t of n)"list"!=t.scope&&"item"!=t.scope||!r.hasAttribute(t.attributeName)||t.setAttributeOnDowncast(i,r.getAttribute(t.attributeName),"list"==t.scope?s:o);if(e=i.wrap(e,o),e=i.wrap(e,s),0==t)break;if(r=dE.first(r,{lowerIndent:!0}),!r)break}}(h,g,e,c)}}function eD(t,{dataPipeline:e}={}){return(n,{writer:i})=>{if(!nD(n,t))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const o=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}function nD(t,e,n=yE(t)){if(!vE(t))return!1;for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return n.length<2}var iD=n(5730),oD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(iD.Z,oD);iD.Z.locals;var rD=n(4564),sD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(rD.Z,sD);rD.Z.locals;const aD=["listType","listIndent","listItemId"];class cD extends Vo{constructor(t){super(t),this._downcastStrategies=[],t.config.define("list.multiBlock",!0)}static get pluginName(){return"ListEditing"}static get requires(){return[OA,Sw,WE,mC]}init(){const t=this.editor,e=t.model,n=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new b("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:aD}),n?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const t of aD)e.schema.setAttributeProperties(t,{copyOnReplace:!0});t.commands.add("numberedList",new HE(t,"numbered")),t.commands.add("bulletedList",new HE(t,"bulleted")),t.commands.add("indentList",new ME(t,"forward")),t.commands.add("outdentList",new ME(t,"backward")),t.commands.add("splitListItemBefore",new qE(t,"before")),t.commands.add("splitListItemAfter",new qE(t,"after")),n&&(t.commands.add("mergeListItemBackward",new jE(t,"backward")),t.commands.add("mergeListItemForward",new jE(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration()}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...aD,...this._downcastStrategies.map((t=>t.attributeName))]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),n=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",((i,o)=>{const r=t.model.document.selection;OE(t.model)||t.model.change((()=>{const s=r.getFirstPosition();if(r.isCollapsed&&"backward"==o.direction){if(!s.isAtStart)return;const n=s.parent;if(!vE(n))return;if(dE.first(n,{sameAttributes:"listType",sameIndent:!0})||0!==n.getAttribute("listIndent")){if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:lD(t.model,"backward")})}else BE(n)||t.execute("splitListItemAfter"),t.execute("outdentList");o.preventDefault(),i.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd)return;if(!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:lD(t.model,"forward")}),o.preventDefault(),i.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,n=t.commands,i=n.get("enter");this.listenTo(t.editing.view.document,"enter",((n,i)=>{const o=e.document,r=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&vE(r)&&r.isEmpty&&!i.isSoft){const e=DE(r),o=BE(r);e&&o?(t.execute("outdentList"),i.preventDefault(),n.stop()):e&&!o?(t.execute("splitListItemAfter"),i.preventDefault(),n.stop()):o&&(t.execute("splitListItemBefore"),i.preventDefault(),n.stop())}}),{context:"li"}),this.listenTo(i,"afterExecute",(()=>{const e=n.get("splitListItemBefore");if(e.refresh(),!e.isEnabled)return;2===yE(t.model.document.selection.getLastPosition().parent).length&&e.execute()}))}_setupTabIntegration(){const t=this.editor;this.listenTo(t.editing.view.document,"tab",((e,n)=>{const i=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(i).isEnabled&&(t.execute(i),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}_setupConversion(){const t=this.editor,e=t.model,n=this.getListAttributeNames(),i=t.config.get("list.multiBlock"),o=i?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(t,{writer:e})=>e.createElement(o,{listType:""})}).elementToElement({view:"p",model:(t,{writer:e})=>t.parent&&t.parent.is("element","li")?e.createElement(o,{listType:""}):null,converterPriority:"high"}).add((t=>{t.on("element:li",QE()),t.on("element:ul",XE(),{priority:"high"}),t.on("element:ol",XE(),{priority:"high"})})),i||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:o,view:eD(n),converterPriority:"high"}).add((t=>{t.on("attribute",tD(n,this._downcastStrategies,e))})),t.conversion.for("dataDowncast").elementToElement({model:o,view:eD(n,{dataPipeline:!0}),converterPriority:"high"}).add((t=>{t.on("attribute",tD(n,this._downcastStrategies,e,{dataPipeline:!0}))})),this.listenTo(e.document,"change:data",function(t,e,n,i){return()=>{const i=t.document.differ.getChanges(),s=[],a=new Map,c=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name)YE(t.position,a),t.attributes.has("listItemId")?c.add(t.position.nodeAfter):YE(t.position.getShiftedBy(t.length),a);else if("remove"==t.type&&t.attributes.has("listItemId"))YE(t.position,a);else if("attribute"==t.type){const e=t.range.start.nodeAfter;n.includes(t.attributeKey)?(YE(t.range.start,a),null===t.attributeNewValue?(YE(t.range.start.getShiftedBy(1),a),r(e)&&s.push(e)):c.add(e)):vE(e)&&r(e)&&s.push(e)}for(const t of a.values())s.push(...o(t,c));for(const t of new Set(s))e.reconvertItem(t)};function o(t,e){const i=[],o=new Set,a=[];for(const{node:c,previous:l}of hE(t,"forward")){if(o.has(c))continue;const t=c.getAttribute("listIndent");l&&tn.includes(t))));const d=xE(c,{direction:"forward"});for(const t of d)o.add(t),(r(t,d)||s(t,a,e))&&i.push(t)}return i}function r(t,o){const r=e.mapper.toViewElement(t);if(!r)return!1;if(i.fire("checkElement",{modelElement:t,viewElement:r}))return!0;if(!t.is("element","paragraph")&&!t.is("element","listItem"))return!1;const s=nD(t,n,o);return!(!s||!r.is("element","p"))||!(s||!r.is("element","span"))}function s(t,n,o){if(o.has(t))return!1;const r=e.mapper.toViewElement(t);let s=n.length-1;for(let t=r.parent;!t.is("editableElement");t=t.parent){const e=GE(t),o=UE(t);if(!o&&!e)continue;const r="checkAttributes:"+(e?"item":"list");if(i.fire(r,{viewElement:t,modelAttributes:n[s]}))break;if(o&&(s--,s<0))return!1}return!0}}(e,t.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",((t,{viewElement:e,modelAttributes:n})=>{e.id!=n.listItemId&&(t.return=!0,t.stop())})),this.on("checkAttributes:list",((t,{viewElement:e,modelAttributes:n})=>{e.name==ZE(n.listType)&&e.id==JE(n.listType,n.listIndent)||(t.return=!0,t.stop())}))}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer((n=>function(t,e,n,i){const o=t.document.differ.getChanges(),r=new Map,s=i.editor.config.get("list.multiBlock");let a=!1;for(const i of o){if("insert"==i.type&&"$text"!=i.name){const o=i.position.nodeAfter;if(!t.schema.checkAttribute(o,"listItemId"))for(const t of Array.from(o.getAttributeKeys()))n.includes(t)&&(e.removeAttribute(t,o),a=!0);YE(i.position,r),i.attributes.has("listItemId")||YE(i.position.getShiftedBy(i.length),r);for(const{item:e,previousPosition:n}of t.createRangeIn(o))vE(e)&&YE(n,r)}else"remove"==i.type?YE(i.position,r):"attribute"==i.type&&n.includes(i.attributeKey)&&(YE(i.range.start,r),null===i.attributeNewValue&&YE(i.range.start.getShiftedBy(1),r));if(!s&&"attribute"==i.type&&aD.includes(i.attributeKey)){const t=i.range.start.nodeAfter;null===i.attributeNewValue&&t&&t.is("element","listItem")?(e.rename(t,"paragraph"),a=!0):null===i.attributeOldValue&&t&&t.is("element")&&"listItem"!=t.name&&(e.rename(t,"listItem"),a=!0)}}const c=new Set;for(const t of r.values())a=i.fire("postFixer",{listNodes:new uE(t),listHead:t,writer:e,seenIds:c})||a;return a}(t,n,e,this))),this.on("postFixer",((t,{listNodes:e,writer:n})=>{t.return=function(t,e){let n=0,i=-1,o=null,r=!1;for(const{node:s}of t){const t=s.getAttribute("listIndent");if(t>n){let a;null===o?(o=t-n,a=n):(o>t&&(o=t),a=t-o),a>i+1&&(a=i+1),e.setAttribute("listIndent",a,s),r=!0,i=a}else o=null,n=t+1,i=t}return r}(e,n)||t.return}),{priority:"high"}),this.on("postFixer",((t,{listNodes:e,writer:n,seenIds:i})=>{t.return=function(t,e,n){const i=new Set;let o=!1;for(const{node:r}of t){if(i.has(r))continue;let t=r.getAttribute("listType"),s=r.getAttribute("listItemId");if(e.has(s)&&(s=_E.next()),e.add(s),r.is("element","listItem"))r.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,r),o=!0);else for(const e of xE(r,{direction:"forward"}))i.add(e),e.getAttribute("listType")!=t&&(s=_E.next(),t=e.getAttribute("listType")),e.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,e),o=!0)}return o}(e,i,n)||t.return}),{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",function(t){return(e,[n,i])=>{const o=n.is("documentFragment")?Array.from(n.getChildren()):[n];if(!o.length)return;const r=(i?t.createSelection(i):t.document.selection).getFirstPosition();let s;if(vE(r.parent))s=r.parent;else{if(!vE(r.nodeBefore))return;s=r.nodeBefore}t.change((t=>{const e=s.getAttribute("listType"),n=s.getAttribute("listIndent"),i=o[0].getAttribute("listIndent")||0,r=Math.max(n-i,0);for(const n of o){const i=vE(n);s.is("element","listItem")&&n.is("element","paragraph")&&t.rename(n,"listItem"),t.setAttributes({listIndent:(i?n.getAttribute("listIndent"):0)+r,listItemId:i?n.getAttribute("listItemId"):_E.next(),listType:e},n)}}))}}(t),{priority:"high"}),this.listenTo(e,"outputTransformation",((e,n)=>{t.change((t=>{const e=Array.from(n.content.getChildren()),i=e[e.length-1];if(e.length>1&&i.is("element")&&i.isEmpty){e.slice(0,-1).every(vE)&&t.remove(i)}if("copy"==n.method||"cut"==n.method){const e=Array.from(n.content.getChildren());VE(e)&&RE(e,t)}}))}))}}function lD(t,e){const n=t.document.selection;if(!n.isCollapsed)return!OE(t);if("forward"===e)return!0;const i=n.getFirstPosition().parent,o=i.previousSibling;return!t.schema.isObject(o)&&(!!o.isEmpty||VE([i,o]))}function dD(t,e,n,i){t.ui.componentFactory.add(e,(o=>{const r=t.commands.get(e),s=new qg(o);return s.set({label:n,icon:i,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}class hD extends Vo{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;dD(this.editor,"numberedList",t("Numbered List"),rg.numberedList),dD(this.editor,"bulletedList",t("Bulleted List"),rg.bulletedList)}}const uD={},gD={},pD={},mD=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:t,typeAttribute:e,listType:n}of mD)uD[t]=n,gD[t]=e,e&&(pD[e]=t);var fD=n(6082),bD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(fD.Z,bD);fD.Z.locals;var kD=n(2417),wD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(kD.Z,wD);kD.Z.locals;class AD extends Oo{constructor(t){super(t),this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){const t=this._getSelectedItems();this.value=this._getValue(t),this.isEnabled=!!t.length}execute(t={}){this.editor.model.change((e=>{const n=this._getSelectedItems(),i=void 0===t.forceValue?!this._getValue(n):t.forceValue;for(const t of n)i?e.setAttribute("todoListChecked",!0,t):e.removeAttribute("todoListChecked",t)}))}_getValue(t){return t.every((t=>t.getAttribute("todoListChecked")))}_getSelectedItems(){const t=this.editor.model,e=t.schema,n=t.document.selection.getFirstRange(),i=n.start.parent,o=[];e.checkAttribute(i,"todoListChecked")&&o.push(...yE(i));for(const t of n.getItems({shallow:!0}))e.checkAttribute(t,"todoListChecked")&&!o.includes(t)&&o.push(...yE(t));return o}}class CD extends ya{constructor(){super(...arguments),this.domEventType=["change"]}onDomEvent(t){if(t.target){const e=this.view.domConverter.mapDomToView(t.target);e&&e.is("element","input")&&"checkbox"==e.getAttribute("type")&&e.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",t)}}}var _D=Object.defineProperty,vD=Object.getOwnPropertySymbols,yD=Object.prototype.hasOwnProperty,xD=Object.prototype.propertyIsEnumerable,ED=(t,e,n)=>e in t?_D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DD=(t,e)=>{for(var n in e||(e={}))yD.call(e,n)&&ED(t,n,e[n]);if(vD)for(var n of vD(e))xD.call(e,n)&&ED(t,n,e[n]);return t};const BD=fo("Ctrl+Enter");class SD extends Vo{static get pluginName(){return"TodoListEditing"}static get requires(){return[cD]}init(){const t=this.editor,e=t.model,n=t.editing,i=t.plugins.get(cD),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new HE(t,"todo")),t.commands.add("checkTodoList",new AD(t)),n.view.addObserver(CD),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck(((t,e)=>{const n=t.last;if("todoListChecked"==e)return!(!n.getAttribute("listItemId")||"todo"!=n.getAttribute("listType"))&&void 0})),t.conversion.for("upcast").add((t=>{t.on("element:input",((t,e,n)=>{const i=e.modelCursor,o=i.parent,r=e.viewItem;if(!n.consumable.test(r,{name:!0}))return;if("checkbox"!=r.getAttribute("type")||!i.isAtStart||!o.hasAttribute("listType"))return;n.consumable.consume(r,{name:!0});const s=n.writer;s.setAttribute("listType","todo",o),e.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,o),e.modelRange=s.createRange(i)})),t.on("element:label",TD({name:"label",classes:"todo-list__label"})),t.on("element:label",TD({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),t.on("element:span",TD({name:"span",classes:"todo-list__label__description"})),t.on("element:ul",function(t){const e=new rr(t);return(t,n,i)=>{const o=e.match(n.viewItem);if(!o)return;const r=o.match;r.name=!1,i.consumable.consume(n.viewItem,r)}}({name:"ul",classes:"todo-list"}))})),t.conversion.for("downcast").elementToElement({model:o,view:(t,{writer:e})=>{if(ID(t,i.getListAttributeNames()))return e.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),i.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(t,e,n){"todo"==e?t.addClass("todo-list",n):t.removeClass("todo-list",n)}}),i.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(t,e,{dataPipeline:n}){if("todo"!=e.getAttribute("listType"))return null;const i=t.createEmptyElement("input",DD(DD({type:"checkbox"},e.getAttribute("todoListChecked")?{checked:"checked"}:null),n?{disabled:"disabled"}:{tabindex:"-1"}));return n?i:t.createContainerElement("span",{contenteditable:"false"},i)},canWrapElement:t=>ID(t,i.getListAttributeNames()),createWrapperElement(t,e,{dataPipeline:n}){const o=["todo-list__label"];return ID(e,i.getListAttributeNames())||o.push("todo-list__label_without-description"),t.createAttributeElement(n?"label":"span",{class:o.join(" ")})}}),n.mapper.registerViewToModelLength("input",(t=>"checkbox"==t.getAttribute("type")&&t.findAncestor({classes:"todo-list__label"})?0:n.mapper.toModelElement(t)?1:0)),i.on("checkElement",((t,{modelElement:e,viewElement:n})=>{const o=ID(e,i.getListAttributeNames());n.hasClass("todo-list__label__description")!=o&&(t.return=!0,t.stop())})),i.on("checkElement",((e,{modelElement:n,viewElement:i})=>{const o="todo"==n.getAttribute("listType")&&DE(n);let r=!1;const s=t.editing.view.createPositionBefore(i).getWalker({direction:"backward"});for(const{item:e}of s){if(e.is("element")&&t.editing.mapper.toModelElement(e))break;e.is("element","input")&&"checkbox"==e.getAttribute("type")&&(r=!0)}r!=o&&(e.return=!0,e.stop())})),i.on("postFixer",((t,{listNodes:e,writer:n})=>{for(const{node:i,previousNodeInList:o}of e){if(!o)continue;if(o.getAttribute("listItemId")!=i.getAttribute("listItemId"))continue;const e=o.hasAttribute("todoListChecked"),r=i.hasAttribute("todoListChecked");r&&!e?(n.removeAttribute("todoListChecked",i),t.return=!0):!r&&e&&(n.setAttribute("todoListChecked",!0,i),t.return=!0)}})),e.document.registerPostFixer((t=>{const n=e.document.differ.getChanges();let i=!1;for(const e of n)if("attribute"==e.type&&"listType"==e.attributeKey){const n=e.range.start.nodeAfter;"todo"==e.attributeOldValue&&n.hasAttribute("todoListChecked")&&(t.removeAttribute("todoListChecked",n),i=!0)}else if("insert"==e.type&&"$text"!=e.name)for(const{item:n}of t.createRangeOn(e.position.nodeAfter))n.is("element")&&"todo"!=n.getAttribute("listType")&&n.hasAttribute("todoListChecked")&&(t.removeAttribute("todoListChecked",n),i=!0);return i})),this.listenTo(n.view.document,"keydown",((e,n)=>{mo(n)===BD&&(t.execute("checkTodoList"),e.stop())}),{priority:"high"}),this.listenTo(n.view.document,"todoCheckboxChange",((t,e)=>{const i=e.target;if(!i||!i.is("element","input"))return;const o=n.view.createPositionAfter(i),r=n.mapper.toModelPosition(o).parent;r&&vE(r)&&"todo"==r.getAttribute("listType")&&this._handleCheckmarkChange(r)})),this.listenTo(n.view.document,"arrowKey",function(t,e){return(n,i)=>{const o=ko(i.keyCode,e.contentLanguageDirection),r=t.schema,s=t.document.selection;if(!s.isCollapsed)return;const a=s.getFirstPosition(),c=a.parent;if("right"==o&&a.isAtEnd){const e=r.getNearestSelectionRange(t.createPositionAfter(c),"forward");if(!e)return;const o=e.start.parent;o&&vE(o)&&"todo"==o.getAttribute("listType")&&(t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop())}else if("left"==o&&a.isAtStart&&vE(c)&&"todo"==c.getAttribute("listType")){const e=r.getNearestSelectionRange(t.createPositionBefore(c),"backward");if(!e)return;t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop()}}}(e,t.locale),{context:"$text"}),this.listenTo(n.mapper,"viewToModelPosition",((t,n)=>{const i=n.viewPosition.parent,o=i.is("attributeElement","li")&&0==n.viewPosition.offset,r=PD(i)&&n.viewPosition.offset<=1,s=i.is("element","span")&&"false"==i.getAttribute("contenteditable")&&PD(i.parent);if(!o&&!r&&!s)return;const a=n.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(n.modelPosition=e.createPositionAt(a,0))}),{priority:"low"})}_handleCheckmarkChange(t){const e=this.editor,n=e.model,i=Array.from(n.document.selection.getRanges());n.change((n=>{n.setSelection(t,"end"),e.execute("checkTodoList"),n.setSelection(i)}))}}function TD(t){const e=new rr(t);return(t,n,i)=>{const o=e.match(n.viewItem);o&&i.consumable.consume(n.viewItem,o.match)&&Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor))}}function ID(t,e){return(t.is("element","paragraph")||t.is("element","listItem"))&&"todo"==t.getAttribute("listType")&&DE(t)&&function(t,e){for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return!0}(t,e)}function PD(t){return!!t&&t.is("attributeElement")&&t.hasClass("todo-list__label")}class RD extends Vo{static get pluginName(){return"TodoListUI"}init(){const t=this.editor.t;dD(this.editor,"todoList",t("To-do List"),rg.todoList)}}var VD=n(1199),LD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Wo()(VD.Z,LD);VD.Z.locals;fo("Ctrl+Enter");function OD(t,e){if(!t.childCount)return;const n=new uu(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new rr({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),o=[];for(const t of n)if("elementStart"===t.type&&i.match(t.item)){const e=MD(t.item);o.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return o}(t,n);if(!i.length)return;let o=null,r=1;i.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;if(!n)return!0;return i=n,!(i.is("element","ol")||i.is("element","ul"));var i}(i[s-1],t),c=a?null:i[s-1],l=(h=t,(d=c)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(o=null,r=1),!o||0!==l){const i=function(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),i=/mso-level-number-format:([^;]{0,100});/gi,o=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=n.exec(e);let s="decimal",a="ol",c=null;if(r&&r[1]){const e=i.exec(r[1]);if(e&&e[1]&&(s=e[1].trim(),a="bullet"!==s&&"image"!==s?"ol":"ul"),"bullet"===s){const e=function(t){const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);if(t)return t.is("$text")?t:t.getChild(0)}return null}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(s=e)}else{const t=o.exec(r[1]);t&&t[1]&&(c=parseInt(t[1]))}}return{type:a,startIndex:c,style:zD(s)}}(t,e);if(o){if(t.indent>r){const t=o.getChild(o.childCount-1),e=t.getChild(t.childCount-1);o=FD(i,e,n),r+=1}else if(t.indent1&&n.setAttribute("start",t.startIndex,o),o}function MD(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),i=n.match(/\s{0,100}lfo(\d+)/i),o=n.match(/\s{0,100}level(\d+)/i);t&&i&&o&&(e.id=t[2],e.order=i[1],e.indent=parseInt(o[1]))}return e}function ND(t,e){if(!t.childCount)return;const n=new uu(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new rr({name:/v:(.+)/}),o=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling,r=n&&n.is("element")?n.name:null;i.match(e)&&e.getAttribute("o:gfxdata")&&"v:shapetype"!==r&&o.push(t.item.getAttribute("id"))}return o}(t,n);!function(t,e,n){const i=n.createRangeIn(e),o=new rr({name:"img"}),r=[];for(const e of i)if(e.item.is("element")&&o.match(e.item)){const n=e.item,i=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];i.length&&i.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(i,t,n),function(t,e,n){const i=n.createRangeIn(e),o=[];for(const e of i)if("elementStart"==e.type&&e.item.is("element","v:shape")){const n=e.item.getAttribute("id");if(t.includes(n))continue;r(e.item.parent.getChildren(),n)||o.push(e.item)}for(const t of o){const e={src:s(t)};t.hasAttribute("alt")&&(e.alt=t.getAttribute("alt"));const i=n.createElement("img",e);n.insertChild(t.index+1,i,t.parent)}function r(t,e){for(const n of t)if(n.is("element")){if("img"==n.name&&n.getAttribute("v:shapes")==e)return!0;if(r(n.getChildren(),e))return!0}return!1}function s(t){for(const e of t.getChildren())if(e.is("element")&&e.getAttribute("src"))return e.getAttribute("src")}}(i,t,n),function(t,e){const n=e.createRangeIn(t),i=new rr({name:/v:(.+)/}),o=[];for(const t of n)"elementStart"==t.type&&i.match(t.item)&&o.push(t.item);for(const t of o)e.remove(t)}(t,n);const o=function(t,e){const n=e.createRangeIn(t),i=new rr({name:"img"}),o=[];for(const t of n)t.item.is("element")&&i.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&o.push(t.item);return o}(t,n);o.length&&function(t,e,n){if(t.length===e.length)for(let i=0;iString.fromCharCode(parseInt(t,16)))).join(""))}const jD=//i,qD=/xmlns:o="urn:schemas-microsoft-com/i;class WD{constructor(t){this.document=t}isActive(t){return jD.test(t)||qD.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;OD(e,n),ND(e,t.dataTransfer.getData("text/rtf")),function(t){const e=[],n=new uu(t.document);for(const{item:i}of n.createRangeIn(t))if(i.is("element")){for(const t of i.getClassNames())/\bmso/gi.exec(t)&&n.removeClass(t,i);for(const t of i.getStyleNames())/\bmso/gi.exec(t)&&n.removeStyle(t,i);i.is("element","w:sdt")&&e.push(i)}for(const t of e){const e=t.parent,i=e.getChildIndex(t);n.insertChild(i,t.getChildren(),e),n.remove(t)}}(e),t.content=e}}function UD(t,e,n,{blockElements:i,inlineObjectElements:o}){let r=n.createPositionAt(t,"forward"==e?"after":"before");return r=r.getLastMatchingPosition((({item:t})=>t.is("element")&&!i.includes(t.name)&&!o.includes(t.name)),{direction:e}),"forward"==e?r.nodeAfter:r.nodeBefore}function GD(t,e){return!!t&&t.is("element")&&e.includes(t.name)}const $D=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class KD{constructor(t){this.document=t}isActive(t){return $D.test(t)}execute(t){const e=new uu(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const i=t.getChildIndex(n);e.remove(n),e.insertChild(i,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),function(t,e){const n=new xs(e.document.stylesProcessor),i=new fa(n,{renderingMode:"data"}),o=i.blockElements,r=i.inlineObjectElements,s=[];for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","br")){const n=UD(t,"forward",e,{blockElements:o,inlineObjectElements:r}),i=UD(t,"backward",e,{blockElements:o,inlineObjectElements:r}),a=GD(n,o);(GD(i,o)||a)&&s.push(t)}}for(const t of s)t.hasClass("Apple-interchange-newline")?e.remove(t):e.replace(t,e.createElement("p"))}(n,e),t.content=n}}const ZD=/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join(" ").substr(0,e.length)))}function QD(t,e){const n=new DOMParser,i=function(t){return YD(YD(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="