/*!
 * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md.
 */
!function(e){const t=e.tr=e.tr||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0/%1","Align cell text to the bottom":"Hücre içindeki metni alta hizala","Align cell text to the center":"Hücre içindeki metnini ortaya hizalama","Align cell text to the left":"Hücre içindeki metnini sola hizala","Align cell text to the middle":"Hücre içindeki metni ortaya hizala","Align cell text to the right":"Hücre içindeki metnini sağa hizala","Align cell text to the top":"Hücre içindeki metni üste hizala","Align table to the left":"Tabloyu sola hizala","Align table to the right":"Tabloyu sağa hizala",Alignment:"Hizalama",Aquamarine:"Su Yeşili",Background:"Arkaplan",Big:"Büyük",Black:"Siyah","Block quote":"Alıntı",Blue:"Mavi",Bold:"Kalın",Border:"Kenar","Break text":"","Bulleted List":"Simgeli Liste",Cancel:"İptal","Cannot upload file:":"Dosya yüklenemedi:","Cell properties":"Hücre özellikleri","Center table":"Tabloyu ortala","Centered image":"Ortalanmış görsel","Change image text alternative":"Görsel alternatif yazısını değiştir","Choose heading":"Başlık tipi seç",Color:"Renk","Color picker":"Renk seçici",Column:"Kolon","Could not insert image at the current position.":"Resim mevcut konumda eklenemedi.","Could not obtain resized image URL.":"Yeniden boyutlandırılmış resim URL’si alınamadı",Dashed:"Kesik çizgili","Decrease indent":"Girintiyi azalt",Default:"Varsayılan","Delete column":"Kolonu sil","Delete row":"Satırı sil","Dim grey":"Koyu Gri",Dimensions:"Ölçüler","Document colors":"Belge Rengi",Dotted:"Noktalı",Double:"Çift",Downloadable:"İndirilebilir","Dropdown toolbar":"Açılır araç çubuğu","Edit block":"Bloğu Düzenle","Edit link":"Bağlantıyı değiştir","Editor toolbar":"Düzenleme araç çubuğu","Enter image caption":"Resim açıklaması gir","Font Background Color":"Yazı Tipi Arkaplan Rengi","Font Color":"Yazı Tipi Rengi","Font Family":"Yazı Tipi Ailesi","Font Size":"Yazı Boyutu","Full size image":"Tam Boyut Görsel",Green:"Yeşil",Grey:"Gri",Groove:"Yiv","Header column":"Başlık kolonu","Header row":"Başlık satırı",Heading:"Başlık","Heading 1":"1. Seviye Başlık","Heading 2":"2. Seviye Başlık","Heading 3":"3. Seviye Başlık","Heading 4":"4. Seviye Başlık","Heading 5":"5. Seviye Başlık","Heading 6":"6. Seviye Başlık",Height:"Yükseklik","Horizontal text alignment toolbar":"Yatay metin hizalama araç çubuğu",Huge:"Çok Büyük","Image resize list":"","Image toolbar":"Resim araç çubuğu","image widget":"resim aracı","In line":"","Increase indent":"Girintiyi arttır","Insert column left":"Sola kolon ekle","Insert column right":"Sağa kolon ekle","Insert image":"Görsel Ekle","Insert image or file":"Resim veya dosya ekleyin","Insert media":"Medya Ekle","Insert paragraph after block":"","Insert paragraph before block":"","Insert row above":"Üste satır ekle","Insert row below":"Alta satır ekle","Insert table":"Tablo Ekle","Inserting image failed":"Resim eklenemedi",Inset:"İçe",Italic:"İtalik","Justify cell text":"Hücre içindeki metini iki yana yasla","Left aligned image":"Sola hizalı görsel","Light blue":"Açık Mavi","Light green":"Açık Yeşil","Light grey":"Açık Gri",Link:"Bağlantı","Link URL":"Bağlantı Adresi","Media URL":"Medya URL'si","media widget":"medya aracı","Merge cell down":"Aşağıya doğru birleştir","Merge cell left":"Sola doğru birleştir","Merge cell right":"Sağa doğru birleştir","Merge cell up":"Yukarı doğru birleştir","Merge cells":"Hücreleri birleştir",Next:"Sonraki",None:"Yok","Numbered List":"Numaralı Liste","Open in a new tab":"Yeni sekmede aç","Open link in new tab":"Yeni sekmede aç",Orange:"Turuncu",Original:"Orijinal",Outset:"Dışarıya",Padding:"İç boşluk","Page break":"Sayfa sonu",Paragraph:"Paragraf","Paste the media URL in the input.":"Medya URL'siini metin kutusuna yapıştırınız.",Previous:"Önceki",Purple:"Mor",Red:"Kırmızı",Redo:"Tekrar yap","Remove color":"Rengi Sil","Resize image":"Resmi boyutlandır","Resize image to %0":"Resmi %0 ölçülerine boyutlandır","Resize image to the original size":"Resmi orijinal büyüklüğüne al","Restore default":"","Rich Text Editor":"Zengin İçerik Editörü","Rich Text Editor, %0":"Zengin İçerik Editörü, %0",Ridge:"Yükselti","Right aligned image":"Sağa hizalı görsel",Row:"Satır",Save:"Kaydet","Select all":"Hepsini seç","Select column":"Kolon seç","Select row":"Satır seç","Selecting resized image failed":"Yeniden boyutlandırılan resim seçilemedi","Show more items":"Daha fazla öğe göster","Side image":"Yan Görsel",Small:"Küçük",Solid:"Dolu","Split cell horizontally":"Hücreyi yatay böl","Split cell vertically":"Hücreyi dikey böl",Style:"Stil","Table alignment toolbar":"Tablo hizalama araç çubuğu","Table cell text alignment":"Tablo hücresi metin hizalaması","Table properties":"Tablo özellikleri","Table toolbar":"Tablo araç çubuğu","Text alternative":"Yazı alternatifi",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'Geçersiz renk. "#FF0000" veya "rgb(255,0,0)" veya "red" deneyin.',"The URL must not be empty.":"URL boş olamaz.",'The value is invalid. Try "10px" or "2em" or simply "2".':'Geçersiz değer. "10px" veya "2em" veya sadece "2" deneyin.',"This link has no URL":"Bağlantı adresi yok","This media URL is not supported.":"Desteklenmeyen Medya URL'si.",Tiny:"Çok Küçük","Tip: Paste the URL into the content to embed faster.":"İpucu: İçeriği daha hızlı yerleştirmek için URL'yi yapıştırın.","Toggle caption off":"","Toggle caption on":"",Turquoise:"Turkuaz",Undo:"Geri al",Unlink:"Bağlantıyı kaldır","Upload failed":"Yükleme başarsız","Upload in progress":"Yükleme işlemi devam ediyor","Vertical text alignment toolbar":"Dikey metin hizalama araç çubuğu",White:"Beyaz","Widget toolbar":"Bileşen araç çubuğu",Width:"Genişlik","Wrap text":"",Yellow:"Sarı"}),t.getPluralForm=function(e){return e>1}}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClassicEditor=t():e.ClassicEditor=t()}(window,(function(){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=160)}([function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return n}));class o extends Error{constructor(e,t,i){super(`${e}${i?" "+JSON.stringify(i):""}${r(e)}`),this.name="CKEditorError",this.context=t,this.data=i}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new o(e.message,t);throw i.stack=e.stack,i}}function n(e,t){console.warn(...s(e,t))}function r(e){return"\nRead more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-"+e}function s(e,t){const i=r(e);return t?[e,t,i]:[e,i]}},function(e,t,i){"use strict";var o,n=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),s=[];function a(e){for(var t=-1,i=0;i<s.length;i++)if(s[i].identifier===e){t=i;break}return t}function l(e,t){for(var i={},o=[],n=0;n<e.length;n++){var r=e[n],l=t.base?r[0]+t.base:r[0],c=i[l]||0,d="".concat(l," ").concat(c);i[l]=c+1;var u=a(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(s[u].references++,s[u].updater(h)):s.push({identifier:d,updater:p(h,t),references:1}),o.push(d)}return o}function c(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var n=i.nc;n&&(o.nonce=n)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=r(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,i,o){var n=i?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var r=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function m(e,t,i){var o=i.css,n=i.media,r=i.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var g=null,f=0;function p(e,t){var i,o,n;if(t.singleton){var r=f++;i=g||(g=c(t)),o=h.bind(null,i,r,!1),n=h.bind(null,i,r,!0)}else i=c(t),o=m.bind(null,i,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var i=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<i.length;o++){var n=a(i[o]);s[n].references--}for(var r=l(e,t),c=0;c<i.length;c++){var d=a(i[c]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}i=r}}}},,function(e,t,i){"use strict";var o=i(9),n="object"==typeof self&&self&&self.Object===Object&&self,r=o.a||n||Function("return this")();t.a=r},function(e,t,i){"use strict";var o=i(17),n=Object.prototype.toString;function r(e){return"[object Array]"===n.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==n.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===n.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),r(e))for(var i=0,o=e.length;i<o;i++)t.call(null,e[i],i,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}e.exports={isArray:r,isArrayBuffer:function(e){return"[object ArrayBuffer]"===n.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:l,isUndefined:s,isDate:function(e){return"[object Date]"===n.call(e)},isFile:function(e){return"[object File]"===n.call(e)},isBlob:function(e){return"[object Blob]"===n.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:d,merge:function e(){var t={};function i(i,o){l(t[o])&&l(i)?t[o]=e(t[o],i):l(i)?t[o]=e({},i):r(i)?t[o]=i.slice():t[o]=i}for(var o=0,n=arguments.length;o<n;o++)d(arguments[o],i);return t},extend:function(e,t,i){return d(t,(function(t,n){e[n]=i&&"function"==typeof t?o(t,i):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,i){"use strict";(function(e){var o=i(3),n=i(27),r="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=r&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===r?o.a.Buffer:void 0,l=(a?a.isBuffer:void 0)||n.a;t.a=l}).call(this,i(11)(e))},function(e,t,i){"use strict";(function(e){var o=i(9),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===n&&o.a.process,a=function(){try{var e=r&&r.require&&r.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();t.a=a}).call(this,i(11)(e))},function(e,t,i){"use strict";(function(e){var t=i(0);const o="object"==typeof window?window:e;if(o.CKEDITOR_VERSION)throw new t.a("ckeditor-duplicated-modules",null);o.CKEDITOR_VERSION="29.2.0"}).call(this,i(15))},function(e,t,i){var o=i(1),n=i(89);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){"use strict";(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e;t.a=i}).call(this,i(15))},function(e,t,i){"use strict";(function(e){var o=i(3),n="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=n&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===n?o.a.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var i=e.length,o=a?a(i):new e.constructor(i);return e.copy(o),o}}).call(this,i(11)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,i){var o=i(1),n=i(90);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){"use strict";(function(t){var o=i(4),n=i(127),r=i(19),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(l=i(20)),l),transformRequest:[function(e,t){return n(t,"Accept"),n(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,i){if(o.isString(e))try{return(t||JSON.parse)(e),o.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,i=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,s=!i&&"json"===this.responseType;if(s||n&&o.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw r(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){c.headers[e]=o.merge(s)})),e.exports=c}).call(this,i(126))},function(e,t,i){e.exports=i(121)},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){var o=i(1),n=i(84);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){"use strict";e.exports=function(e,t){return function(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];return e.apply(t,i)}}},function(e,t,i){"use strict";var o=i(4);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,i){if(!t)return e;var r;if(i)r=i(t);else if(o.isURLSearchParams(t))r=t.toString();else{var s=[];o.forEach(t,(function(e,t){null!=e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,(function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(n(t)+"="+n(e))})))})),r=s.join("&")}if(r){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}},function(e,t,i){"use strict";e.exports=function(e,t,i,o,n){return e.config=t,i&&(e.code=i),e.request=o,e.response=n,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,i){"use strict";var o=i(4),n=i(128),r=i(129),s=i(18),a=i(130),l=i(133),c=i(134),d=i(21);e.exports=function(e){return new Promise((function(t,i){var u=e.data,h=e.headers,m=e.responseType;o.isFormData(u)&&delete h["Content-Type"];var g=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",p=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";h.Authorization="Basic "+btoa(f+":"+p)}var b=a(e.baseURL,e.url);function w(){if(g){var o="getAllResponseHeaders"in g?l(g.getAllResponseHeaders()):null,r={data:m&&"text"!==m&&"json"!==m?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:o,config:e,request:g};n(t,i,r),g=null}}if(g.open(e.method.toUpperCase(),s(b,e.params,e.paramsSerializer),!0),g.timeout=e.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(w)},g.onabort=function(){g&&(i(d("Request aborted",e,"ECONNABORTED",g)),g=null)},g.onerror=function(){i(d("Network Error",e,null,g)),g=null},g.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",g)),g=null},o.isStandardBrowserEnv()){var k=(e.withCredentials||c(b))&&e.xsrfCookieName?r.read(e.xsrfCookieName):void 0;k&&(h[e.xsrfHeaderName]=k)}"setRequestHeader"in g&&o.forEach(h,(function(e,t){void 0===u&&"content-type"===t.toLowerCase()?delete h[t]:g.setRequestHeader(t,e)})),o.isUndefined(e.withCredentials)||(g.withCredentials=!!e.withCredentials),m&&"json"!==m&&(g.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&g.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&g.upload&&g.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){g&&(g.abort(),i(e),g=null)})),u||(u=null),g.send(u)}))}},function(e,t,i){"use strict";var o=i(19);e.exports=function(e,t,i,n,r){var s=new Error(e);return o(s,t,i,n,r)}},function(e,t,i){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,i){"use strict";var o=i(4);e.exports=function(e,t){t=t||{};var i={},n=["url","method","data"],r=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function l(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function c(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(i[n]=l(void 0,e[n])):i[n]=l(e[n],t[n])}o.forEach(n,(function(e){o.isUndefined(t[e])||(i[e]=l(void 0,t[e]))})),o.forEach(r,c),o.forEach(s,(function(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(i[n]=l(void 0,e[n])):i[n]=l(void 0,t[n])})),o.forEach(a,(function(o){o in t?i[o]=l(e[o],t[o]):o in e&&(i[o]=l(void 0,e[o]))}));var d=n.concat(r).concat(s).concat(a),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return o.forEach(u,c),i}},function(e,t,i){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,i){var o=i(1),n=i(152);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){var o=i(1),n=i(153);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t,i){"use strict";t.a=function(){return!1}},function(e,t,i){var o=i(1),n=i(29);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-hidden{display:none!important}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{box-sizing:border-box;width:auto;height:auto;position:static}:root{--ck-z-default:1;--ck-z-modal:calc(var(--ck-z-default) + 999)}.ck-transitions-disabled,.ck-transitions-disabled *{transition:none!important}:root{--ck-color-base-foreground:#fafafa;--ck-color-base-background:#fff;--ck-color-base-border:#c4c4c4;--ck-color-base-action:#61b045;--ck-color-base-focus:#6cb5f9;--ck-color-base-text:#333;--ck-color-base-active:#198cf0;--ck-color-base-active-focus:#0e7fe1;--ck-color-base-error:#db3700;--ck-color-focus-border-coordinates:208,79%,51%;--ck-color-focus-border:hsl(var(--ck-color-focus-border-coordinates));--ck-color-focus-outer-shadow:#bcdefb;--ck-color-focus-disabled-shadow:rgba(119,186,248,0.3);--ck-color-focus-error-shadow:rgba(255,64,31,0.3);--ck-color-text:var(--ck-color-base-text);--ck-color-shadow-drop:rgba(0,0,0,0.15);--ck-color-shadow-drop-active:rgba(0,0,0,0.2);--ck-color-shadow-inner:rgba(0,0,0,0.1);--ck-color-button-default-background:transparent;--ck-color-button-default-hover-background:#e6e6e6;--ck-color-button-default-active-background:#d9d9d9;--ck-color-button-default-active-shadow:#bfbfbf;--ck-color-button-default-disabled-background:transparent;--ck-color-button-on-background:#dedede;--ck-color-button-on-hover-background:#c4c4c4;--ck-color-button-on-active-background:#bababa;--ck-color-button-on-active-shadow:#a1a1a1;--ck-color-button-on-disabled-background:#dedede;--ck-color-button-action-background:var(--ck-color-base-action);--ck-color-button-action-hover-background:#579e3d;--ck-color-button-action-active-background:#53973b;--ck-color-button-action-active-shadow:#498433;--ck-color-button-action-disabled-background:#7ec365;--ck-color-button-action-text:var(--ck-color-base-background);--ck-color-button-save:#008a00;--ck-color-button-cancel:#db3700;--ck-color-switch-button-off-background:#b0b0b0;--ck-color-switch-button-off-hover-background:#a3a3a3;--ck-color-switch-button-on-background:var(--ck-color-button-action-background);--ck-color-switch-button-on-hover-background:#579e3d;--ck-color-switch-button-inner-background:var(--ck-color-base-background);--ck-color-switch-button-inner-shadow:rgba(0,0,0,0.1);--ck-color-dropdown-panel-background:var(--ck-color-base-background);--ck-color-dropdown-panel-border:var(--ck-color-base-border);--ck-color-input-background:var(--ck-color-base-background);--ck-color-input-border:#c7c7c7;--ck-color-input-error-border:var(--ck-color-base-error);--ck-color-input-text:var(--ck-color-base-text);--ck-color-input-disabled-background:#f2f2f2;--ck-color-input-disabled-border:#c7c7c7;--ck-color-input-disabled-text:#757575;--ck-color-list-background:var(--ck-color-base-background);--ck-color-list-button-hover-background:var(--ck-color-button-default-hover-background);--ck-color-list-button-on-background:var(--ck-color-base-active);--ck-color-list-button-on-background-focus:var(--ck-color-base-active-focus);--ck-color-list-button-on-text:var(--ck-color-base-background);--ck-color-panel-background:var(--ck-color-base-background);--ck-color-panel-border:var(--ck-color-base-border);--ck-color-toolbar-background:var(--ck-color-base-foreground);--ck-color-toolbar-border:var(--ck-color-base-border);--ck-color-tooltip-background:var(--ck-color-base-text);--ck-color-tooltip-text:var(--ck-color-base-background);--ck-color-engine-placeholder-text:#707070;--ck-color-upload-bar-background:#6cb5f9;--ck-color-link-default:#0000f0;--ck-color-link-selected-background:rgba(31,177,255,0.1);--ck-color-link-fake-selection:rgba(31,177,255,0.3);--ck-disabled-opacity:.5;--ck-focus-outer-shadow-geometry:0 0 0 3px;--ck-focus-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-outer-shadow);--ck-focus-disabled-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-disabled-shadow);--ck-focus-error-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-error-shadow);--ck-focus-ring:1px solid var(--ck-color-focus-border);--ck-font-size-base:13px;--ck-line-height-base:1.84615;--ck-font-face:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;--ck-font-size-tiny:0.7em;--ck-font-size-small:0.75em;--ck-font-size-normal:1em;--ck-font-size-big:1.4em;--ck-font-size-large:1.8em;--ck-ui-component-min-height:2.3em}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{margin:0;padding:0;border:0;background:transparent;text-decoration:none;vertical-align:middle;transition:none;word-wrap:break-word}.ck.ck-reset_all,.ck.ck-reset_all *{border-collapse:collapse;font:normal normal normal var(--ck-font-size-base)/var(--ck-line-height-base) var(--ck-font-face);color:var(--ck-color-text);text-align:left;white-space:nowrap;cursor:auto;float:none}.ck.ck-reset_all .ck-rtl *{text-align:right}.ck.ck-reset_all iframe{vertical-align:inherit}.ck.ck-reset_all textarea{white-space:pre-wrap}.ck.ck-reset_all input[type=password],.ck.ck-reset_all input[type=text],.ck.ck-reset_all textarea{cursor:text}.ck.ck-reset_all input[type=password][disabled],.ck.ck-reset_all input[type=text][disabled],.ck.ck-reset_all textarea[disabled]{cursor:default}.ck.ck-reset_all fieldset{padding:10px;border:2px groove #dfdee3}.ck.ck-reset_all button::-moz-focus-inner{padding:0;border:0}.ck[dir=rtl],.ck[dir=rtl] .ck{text-align:right}:root{--ck-border-radius:2px;--ck-inner-shadow:2px 2px 3px var(--ck-color-shadow-inner) inset;--ck-drop-shadow:0 1px 2px 1px var(--ck-color-shadow-drop);--ck-drop-shadow-active:0 3px 6px 1px var(--ck-color-shadow-drop-active);--ck-spacing-unit:0.6em;--ck-spacing-large:calc(var(--ck-spacing-unit)*1.5);--ck-spacing-standard:var(--ck-spacing-unit);--ck-spacing-medium:calc(var(--ck-spacing-unit)*0.8);--ck-spacing-small:calc(var(--ck-spacing-unit)*0.5);--ck-spacing-tiny:calc(var(--ck-spacing-unit)*0.3);--ck-spacing-extra-tiny:calc(var(--ck-spacing-unit)*0.16)}"},function(e,t,i){var o=i(1),n=i(31);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-icon{vertical-align:middle}:root{--ck-icon-size:calc(var(--ck-line-height-base)*var(--ck-font-size-normal))}.ck.ck-icon{width:var(--ck-icon-size);height:var(--ck-icon-size);font-size:.8333350694em;will-change:transform}.ck.ck-icon,.ck.ck-icon *{color:inherit;cursor:inherit}.ck.ck-icon :not([fill]){fill:currentColor}"},function(e,t,i){var o=i(1),n=i(33);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{position:absolute;pointer-events:none;-webkit-backface-visibility:hidden}.ck.ck-tooltip{visibility:hidden;opacity:0;display:none;z-index:var(--ck-z-modal)}.ck.ck-tooltip .ck-tooltip__text{display:inline-block}.ck.ck-tooltip .ck-tooltip__text:after{content:"";width:0;height:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{left:50%;top:0;transition:opacity .2s ease-in-out .2s}.ck.ck-tooltip .ck-tooltip__text{border-radius:0}.ck-rounded-corners .ck.ck-tooltip .ck-tooltip__text,.ck.ck-tooltip .ck-tooltip__text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-tooltip .ck-tooltip__text{font-size:.9em;line-height:1.5;color:var(--ck-color-tooltip-text);padding:var(--ck-spacing-small) var(--ck-spacing-medium);background:var(--ck-color-tooltip-background);position:relative;left:-50%}.ck.ck-tooltip .ck-tooltip__text:after{transition:opacity .2s ease-in-out .2s;border-style:solid;left:50%}.ck.ck-tooltip.ck-tooltip_s,.ck.ck-tooltip.ck-tooltip_se,.ck.ck-tooltip.ck-tooltip_sw{bottom:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after,.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text:after,.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text:after{top:calc(var(--ck-tooltip-arrow-size)*-1 + 1px);transform:translateX(-50%);border-left-color:transparent;border-bottom-color:var(--ck-color-tooltip-background);border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:0}.ck.ck-tooltip.ck-tooltip_sw{right:50%;left:auto}.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text{left:auto;right:calc(var(--ck-tooltip-arrow-size)*-2)}.ck.ck-tooltip.ck-tooltip_sw .ck-tooltip__text:after{left:auto;right:0}.ck.ck-tooltip.ck-tooltip_se{left:50%;right:auto}.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text{right:auto;left:calc(var(--ck-tooltip-arrow-size)*-2)}.ck.ck-tooltip.ck-tooltip_se .ck-tooltip__text:after{right:auto;left:0;transform:translateX(50%)}.ck.ck-tooltip.ck-tooltip_n{top:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{bottom:calc(var(--ck-tooltip-arrow-size)*-1);transform:translateX(-50%);border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:var(--ck-color-tooltip-background);border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:0;border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}.ck.ck-tooltip.ck-tooltip_e{left:calc(100% + var(--ck-tooltip-arrow-size));top:50%}.ck.ck-tooltip.ck-tooltip_e .ck-tooltip__text{left:0;transform:translateY(-50%)}.ck.ck-tooltip.ck-tooltip_e .ck-tooltip__text:after{left:calc(var(--ck-tooltip-arrow-size)*-1);top:calc(50% - var(--ck-tooltip-arrow-size)*1);border-left-color:transparent;border-bottom-color:transparent;border-right-color:var(--ck-color-tooltip-background);border-top-color:transparent;border-left-width:0;border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}.ck.ck-tooltip.ck-tooltip_w{right:calc(100% + var(--ck-tooltip-arrow-size));left:auto;top:50%}.ck.ck-tooltip.ck-tooltip_w .ck-tooltip__text{left:0;transform:translateY(-50%)}.ck.ck-tooltip.ck-tooltip_w .ck-tooltip__text:after{left:100%;top:calc(50% - var(--ck-tooltip-arrow-size)*1);border-left-color:var(--ck-color-tooltip-background);border-bottom-color:transparent;border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:0;border-top-width:var(--ck-tooltip-arrow-size)}'},function(e,t,i){var o=i(1),n=i(35);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-button,a.ck.ck-button{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:block}@media (hover:none){.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:none}}.ck.ck-button,a.ck.ck-button{position:relative;display:inline-flex;align-items:center;justify-content:left}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{display:none}.ck.ck-button.ck-button_with-text .ck-button__label,a.ck.ck-button.ck-button_with-text .ck-button__label{display:inline-block}.ck.ck-button:not(.ck-button_with-text),a.ck.ck-button:not(.ck-button_with-text){justify-content:center}.ck.ck-button:hover .ck-tooltip,a.ck.ck-button:hover .ck-tooltip{visibility:visible;opacity:1}.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button:focus:not(:hover) .ck-tooltip{display:none}.ck.ck-button,a.ck.ck-button{background:var(--ck-color-button-default-background)}.ck.ck-button:not(.ck-disabled):hover,a.ck.ck-button:not(.ck-disabled):hover{background:var(--ck-color-button-default-hover-background)}.ck.ck-button:not(.ck-disabled):active,a.ck.ck-button:not(.ck-disabled):active{background:var(--ck-color-button-default-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-default-active-shadow)}.ck.ck-button.ck-disabled,a.ck.ck-button.ck-disabled{background:var(--ck-color-button-default-disabled-background)}.ck.ck-button,a.ck.ck-button{border-radius:0}.ck-rounded-corners .ck.ck-button,.ck-rounded-corners a.ck.ck-button,.ck.ck-button.ck-rounded-corners,a.ck.ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-button,a.ck.ck-button{white-space:nowrap;cursor:default;vertical-align:middle;padding:var(--ck-spacing-tiny);text-align:center;min-width:var(--ck-ui-component-min-height);min-height:var(--ck-ui-component-min-height);line-height:1;font-size:inherit;border:1px solid transparent;transition:box-shadow .2s ease-in-out,border .2s ease-in-out;-webkit-appearance:none}.ck.ck-button:active,.ck.ck-button:focus,a.ck.ck-button:active,a.ck.ck-button:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-button .ck-button__icon use,.ck.ck-button .ck-button__icon use *,a.ck.ck-button .ck-button__icon use,a.ck.ck-button .ck-button__icon use *{color:inherit}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{font-size:inherit;font-weight:inherit;color:inherit;cursor:inherit;vertical-align:middle}[dir=ltr] .ck.ck-button .ck-button__label,[dir=ltr] a.ck.ck-button .ck-button__label{text-align:left}[dir=rtl] .ck.ck-button .ck-button__label,[dir=rtl] a.ck.ck-button .ck-button__label{text-align:right}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{color:inherit}[dir=ltr] .ck.ck-button .ck-button__keystroke,[dir=ltr] a.ck.ck-button .ck-button__keystroke{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-button .ck-button__keystroke,[dir=rtl] a.ck.ck-button .ck-button__keystroke{margin-right:var(--ck-spacing-large)}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{font-weight:700;opacity:.7}.ck.ck-button.ck-disabled:active,.ck.ck-button.ck-disabled:focus,a.ck.ck-button.ck-disabled:active,a.ck.ck-button.ck-disabled:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-button.ck-disabled .ck-button__icon,a.ck.ck-button.ck-disabled .ck-button__icon{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__label,a.ck.ck-button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__keystroke,a.ck.ck-button.ck-disabled .ck-button__keystroke{opacity:.3}.ck.ck-button.ck-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}[dir=ltr] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=ltr] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:calc(var(--ck-spacing-small)*-1);margin-right:var(--ck-spacing-small)}[dir=rtl] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=rtl] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-right:calc(var(--ck-spacing-small)*-1);margin-left:var(--ck-spacing-small)}.ck.ck-button.ck-button_with-keystroke .ck-button__label,a.ck.ck-button.ck-button_with-keystroke .ck-button__label{flex-grow:1}.ck.ck-button.ck-on,a.ck.ck-button.ck-on{background:var(--ck-color-button-on-background)}.ck.ck-button.ck-on:not(.ck-disabled):hover,a.ck.ck-button.ck-on:not(.ck-disabled):hover{background:var(--ck-color-button-on-hover-background)}.ck.ck-button.ck-on:not(.ck-disabled):active,a.ck.ck-button.ck-on:not(.ck-disabled):active{background:var(--ck-color-button-on-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-on-active-shadow)}.ck.ck-button.ck-on.ck-disabled,a.ck.ck-button.ck-on.ck-disabled{background:var(--ck-color-button-on-disabled-background)}.ck.ck-button.ck-button-save,a.ck.ck-button.ck-button-save{color:var(--ck-color-button-save)}.ck.ck-button.ck-button-cancel,a.ck.ck-button.ck-button-cancel{color:var(--ck-color-button-cancel)}.ck.ck-button-action,a.ck.ck-button-action{background:var(--ck-color-button-action-background)}.ck.ck-button-action:not(.ck-disabled):hover,a.ck.ck-button-action:not(.ck-disabled):hover{background:var(--ck-color-button-action-hover-background)}.ck.ck-button-action:not(.ck-disabled):active,a.ck.ck-button-action:not(.ck-disabled):active{background:var(--ck-color-button-action-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-action-active-shadow)}.ck.ck-button-action.ck-disabled,a.ck.ck-button-action.ck-disabled{background:var(--ck-color-button-action-disabled-background)}.ck.ck-button-action,a.ck.ck-button-action{color:var(--ck-color-button-action-text)}.ck.ck-button-bold,a.ck.ck-button-bold{font-weight:700}"},function(e,t,i){var o=i(1),n=i(37);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:calc(var(--ck-switch-button-toggle-width) - var(--ck-switch-button-toggle-inner-size) - var(--ck-switch-button-toggle-spacing)*2)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(var(--ck-spacing-large)*2)}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(var(--ck-spacing-large)*2)}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{transition:background .4s ease;width:var(--ck-switch-button-toggle-width);background:var(--ck-color-switch-button-off-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(var(--ck-border-radius)*0.5)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{margin:var(--ck-switch-button-toggle-spacing);width:var(--ck-switch-button-toggle-inner-size);height:var(--ck-switch-button-toggle-inner-size);background:var(--ck-color-switch-button-inner-background);transition:all .3s ease}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var(--ck-switch-button-translation))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(var(--ck-switch-button-translation)*-1))}"},function(e,t,i){var o=i(1),n=i(39);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{width:var(--ck-color-grid-tile-size);height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;border:0}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{display:none;color:var(--ck-color-color-grid-check-icon)}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(41);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck.ck-splitbutton{font-size:inherit}.ck.ck-splitbutton .ck-splitbutton__action:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button .ck-tooltip{display:none}:root{--ck-color-split-button-hover-background:#ebebeb;--ck-color-split-button-hover-border:#b3b3b3}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__action{border-top-right-radius:unset;border-bottom-right-radius:unset}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__action{border-top-left-radius:unset;border-bottom-left-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow{min-width:unset}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-left-radius:unset;border-bottom-left-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-right-radius:unset;border-bottom-right-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow svg{width:var(--ck-dropdown-arrow-size)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover),.ck.ck-splitbutton:hover>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover){background:var(--ck-color-split-button-hover-background)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{content:"";position:absolute;width:1px;height:100%;background-color:var(--ck-color-split-button-hover-border)}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{left:-1px}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled):after{right:-1px}.ck.ck-splitbutton.ck-splitbutton_open{border-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__action{border-bottom-left-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__arrow{border-bottom-right-radius:0}'},function(e,t,i){var o=i(1),n=i(43);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-dropdown-max-width:75vw}.ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;z-index:var(--ck-z-modal);max-width:var(--ck-dropdown-max-width);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_n,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nmw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{top:100%;bottom:auto}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_n,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_s{left:50%;transform:translateX(-50%)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nmw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_smw{left:75%;transform:translateX(-75%)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nme,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sme{left:25%;transform:translateX(-25%)}.ck.ck-toolbar .ck-dropdown__panel{z-index:calc(var(--ck-z-modal) + 1)}:root{--ck-dropdown-arrow-size:calc(var(--ck-icon-size)*0.5)}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-dropdown__button_label-width_auto .ck-button__label{width:auto}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-off:active,.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on:active{box-shadow:none}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-off:active:focus,.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on:active:focus{box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}"},function(e,t,i){var o=i(1),n=i(45);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row nowrap;align-items:center}.ck.ck-toolbar>.ck-toolbar__items{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar .ck-toolbar__line-break{flex-basis:100%}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);padding:0 var(--ck-spacing-small);border:1px solid var(--ck-color-toolbar-border)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;background:var(--ck-color-toolbar-border);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar .ck-toolbar__line-break{height:0}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break){margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>:not(.ck-toolbar__line-break),.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-right:var(--ck-spacing-small)}"},function(e,t,i){var o=i(1),n=i(47);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-list{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{list-style-type:none;background:var(--ck-color-list-background)}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{min-height:unset;width:100%;text-align:left;border-radius:0;padding:calc(var(--ck-line-height-base)*0.2*var(--ck-font-size-base)) calc(var(--ck-line-height-base)*0.4*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(var(--ck-line-height-base)*1.2*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,t,i){var o=i(1),n=i(49);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-toolbar-dropdown-max-width:60vw}.ck.ck-toolbar-dropdown>.ck-dropdown__panel{width:max-content;max-width:var(--ck-toolbar-dropdown-max-width)}.ck.ck-toolbar-dropdown>.ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}"},function(e,t,i){var o=i(1),n=i(51);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,i){var o=i(1),n=i(53);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-editable-blur-selection:#d9d9d9}.ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0}.ck.ck-editor__editable_inline{overflow:auto;padding:0 var(--ck-spacing-standard);border:1px solid transparent}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-editor__editable_inline.ck-blurred ::selection{background:var(--ck-color-editable-blur-selection)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,t,i){var o=i(1),n=i(55);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,t,i){var o=i(1),n=i(57);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-form__header{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:space-between}:root{--ck-form-header-height:38px}.ck.ck-form__header{padding:var(--ck-spacing-small) var(--ck-spacing-large);height:var(--ck-form-header-height);line-height:var(--ck-form-header-height);border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-form__header .ck-form__header__label{font-weight:700}"},function(e,t,i){var o=i(1),n=i(59);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-input-text-width:18em}.ck.ck-input-text{border-radius:0}.ck-rounded-corners .ck.ck-input-text,.ck.ck-input-text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-text{background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);min-width:var(--ck-input-text-width);min-height:var(--ck-ui-component-min-height);transition:box-shadow .1s ease-in-out,border .1s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),0 0}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,i){var o=i(1),n=i(61);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{display:flex;position:relative}.ck.ck-labeled-field-view .ck.ck-label{display:block;position:absolute}:root{--ck-labeled-field-view-transition:.1s cubic-bezier(0,0,0.24,0.95);--ck-labeled-field-empty-unfocused-max-width:100% - 2 * var(--ck-spacing-medium);--ck-color-labeled-field-label-background:var(--ck-color-base-background)}.ck.ck-labeled-field-view{border-radius:0}.ck-rounded-corners .ck.ck-labeled-field-view,.ck.ck-labeled-field-view.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper{width:100%}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{top:0}[dir=ltr] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{left:0}[dir=rtl] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{right:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{pointer-events:none;transform-origin:0 0;transform:translate(var(--ck-spacing-medium),-6px) scale(.75);background:var(--ck-color-labeled-field-label-background);padding:0 calc(var(--ck-font-size-tiny)*0.5);line-height:normal;font-weight:400;text-overflow:ellipsis;overflow:hidden;max-width:100%;transition:transform var(--ck-labeled-field-view-transition),padding var(--ck-labeled-field-view-transition),background var(--ck-labeled-field-view-transition)}.ck.ck-labeled-field-view.ck-error .ck-input:not([readonly])+.ck.ck-label,.ck.ck-labeled-field-view.ck-error>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view .ck-labeled-field-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-field-view .ck-labeled-field-view__status.ck-labeled-field-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view.ck-disabled>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{color:var(--ck-color-input-disabled-text)}[dir=ltr] .ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=ltr] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(var(--ck-spacing-medium),calc(var(--ck-font-size-base)*0.6)) scale(1)}[dir=rtl] .ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,[dir=rtl] .ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{transform:translate(calc(var(--ck-spacing-medium)*-1),calc(var(--ck-font-size-base)*0.6)) scale(1)}.ck.ck-labeled-field-view.ck-disabled.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label,.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width));background:transparent;padding:0}.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck.ck-button{background:transparent}.ck.ck-labeled-field-view.ck-labeled-field-view_empty>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown>.ck-button>.ck-button__label{opacity:0}.ck.ck-labeled-field-view.ck-labeled-field-view_empty:not(.ck-labeled-field-view_focused):not(.ck-labeled-field-view_placeholder)>.ck.ck-labeled-field-view__input-wrapper>.ck-dropdown+.ck-label{max-width:calc(var(--ck-labeled-field-empty-unfocused-max-width) - var(--ck-dropdown-arrow-size) - var(--ck-spacing-standard))}"},function(e,t,i){var o=i(1),n=i(63);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-balloon-panel-arrow-z-index:calc(var(--ck-z-default) - 3)}.ck.ck-balloon-panel{display:none;position:absolute;z-index:var(--ck-z-modal)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{content:"";position:absolute}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_n]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_n]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_s]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_s]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel.ck-balloon-panel_visible{display:block}:root{--ck-balloon-arrow-offset:2px;--ck-balloon-arrow-height:10px;--ck-balloon-arrow-half-width:8px;--ck-balloon-arrow-drop-shadow:0 2px 2px var(--ck-color-shadow-drop)}.ck.ck-balloon-panel{border-radius:0}.ck-rounded-corners .ck.ck-balloon-panel,.ck.ck-balloon-panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-balloon-panel{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{width:0;height:0;border-style:solid}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:var(--ck-balloon-arrow-height);border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:0}.ck.ck-balloon-panel[class*=arrow_n]:before{border-bottom-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.ck.ck-balloon-panel[class*=arrow_n]:after{border-bottom-color:var(--ck-color-panel-background);margin-top:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:0;border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:var(--ck-balloon-arrow-height)}.ck.ck-balloon-panel[class*=arrow_s]:before{border-top-color:var(--ck-color-panel-border);filter:drop-shadow(var(--ck-balloon-arrow-drop-shadow))}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent}.ck.ck-balloon-panel[class*=arrow_s]:after{border-top-color:var(--ck-color-panel-background);margin-bottom:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:before{left:50%;margin-left:calc(var(--ck-balloon-arrow-half-width)*-1);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:before{left:50%;margin-left:calc(var(--ck-balloon-arrow-half-width)*-1);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{left:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{right:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:before{right:25%;margin-right:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:before{left:25%;margin-left:calc(var(--ck-balloon-arrow-half-width)*2);bottom:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:before{right:25%;margin-right:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:before{left:25%;margin-left:calc(var(--ck-balloon-arrow-half-width)*2);top:calc(var(--ck-balloon-arrow-height)*-1)}'},function(e,t,i){var o=i(1),n=i(65);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-balloon-rotator__navigation{display:flex;align-items:center;justify-content:center}.ck .ck-balloon-rotator__content .ck-toolbar{justify-content:center}.ck .ck-balloon-rotator__navigation{background:var(--ck-color-toolbar-background);border-bottom:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation>*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,t,i){var o=i(1),n=i(67);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);width:100%;height:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}"},function(e,t,i){var o=i(1),n=i(69);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-sticky-panel .ck-sticky-panel__content_sticky{z-index:var(--ck-z-modal);position:fixed;top:0}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky_bottom-limit{top:auto;position:absolute}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky{box-shadow:var(--ck-drop-shadow),0 0;border-width:0 1px 1px;border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,i){var o=i(1),n=i(71);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-block-toolbar-button{position:absolute;z-index:var(--ck-z-default)}:root{--ck-color-block-toolbar-button:var(--ck-color-text);--ck-block-toolbar-button-size:var(--ck-font-size-normal)}.ck.ck-block-toolbar-button{color:var(--ck-color-block-toolbar-button);font-size:var(--ck-block-toolbar-size)}"},function(e,t,i){var o=i(1),n=i(73);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-placeholder,.ck .ck-placeholder{position:relative}.ck.ck-placeholder:before,.ck .ck-placeholder:before{position:absolute;left:0;right:0;content:attr(data-placeholder);pointer-events:none}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-placeholder:before,.ck .ck-placeholder:before{cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(e,t,i){var o=i(1),n=i(75);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-modal)}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-bottom-width:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar{border-bottom-width:1px;border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}"},function(e,t,i){var o=i(1),n=i(77);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck .ck-widget .ck-widget__type-around__button{display:block;position:absolute;overflow:hidden;z-index:var(--ck-z-default)}.ck .ck-widget .ck-widget__type-around__button svg{position:absolute;top:50%;left:50%;z-index:calc(var(--ck-z-default) + 2)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_before{top:calc(var(--ck-widget-outline-thickness)*-0.5);left:min(10%,30px);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(var(--ck-widget-outline-thickness)*-0.5);right:min(10%,30px);transform:translateY(50%)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{content:"";display:block;position:absolute;top:1px;left:1px;z-index:calc(var(--ck-z-default) + 1)}.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:none;position:absolute;left:0;right:0}.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__fake-caret{left:calc(var(--ck-widget-outline-thickness)*-1);right:calc(var(--ck-widget-outline-thickness)*-1)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:calc(var(--ck-widget-outline-thickness)*-1 - 1px);display:block}.ck.ck-editor__editable.ck-read-only .ck-widget__type-around,.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around,.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around{display:none}:root{--ck-widget-type-around-button-size:20px;--ck-color-widget-type-around-button-active:var(--ck-color-focus-border);--ck-color-widget-type-around-button-hover:var(--ck-color-widget-hover-border);--ck-color-widget-type-around-button-blurred-editable:var(--ck-color-widget-blurred-border);--ck-color-widget-type-around-button-radar-start-alpha:0;--ck-color-widget-type-around-button-radar-end-alpha:.3;--ck-color-widget-type-around-button-icon:var(--ck-color-base-background)}.ck .ck-widget .ck-widget__type-around__button{width:var(--ck-widget-type-around-button-size);height:var(--ck-widget-type-around-button-size);background:var(--ck-color-widget-type-around-button);border-radius:100px;transition:opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);opacity:0;pointer-events:none}.ck .ck-widget .ck-widget__type-around__button svg{width:10px;height:8px;transform:translate(-50%,-50%);transition:transform .5s ease;margin-top:1px}.ck .ck-widget .ck-widget__type-around__button svg *{stroke-dasharray:10;stroke-dashoffset:0;fill:none;stroke:var(--ck-color-widget-type-around-button-icon);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}.ck .ck-widget .ck-widget__type-around__button svg line{stroke-dasharray:7}.ck .ck-widget .ck-widget__type-around__button:hover{animation:ck-widget-type-around-button-sonar 1s ease infinite}.ck .ck-widget .ck-widget__type-around__button:hover svg polyline{animation:ck-widget-type-around-arrow-dash 2s linear}.ck .ck-widget .ck-widget__type-around__button:hover svg line{animation:ck-widget-type-around-arrow-tip-dash 2s linear}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:1;pointer-events:auto}.ck .ck-widget:not(.ck-widget_selected)>.ck-widget__type-around>.ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button-hover)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover{background:var(--ck-color-widget-type-around-button-active)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{width:calc(var(--ck-widget-type-around-button-size) - 2px);height:calc(var(--ck-widget-type-around-button-size) - 2px);border-radius:100px;background:linear-gradient(135deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3))}.ck .ck-widget.ck-widget_with-selection-handle>.ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:20px}.ck .ck-widget .ck-widget__type-around__fake-caret{pointer-events:none;height:1px;animation:ck-widget-type-around-fake-caret-pulse 1s linear infinite normal forwards;outline:1px solid hsla(0,0%,100%,.5);background:var(--ck-color-base-text)}.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_after,.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_before{outline-color:transparent}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected:hover,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:0}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer{opacity:0}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:0;margin-right:20px}.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover){background:var(--ck-color-widget-type-around-button-blurred-editable)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover) svg *{stroke:#999}@keyframes ck-widget-type-around-arrow-dash{0%{stroke-dashoffset:10}20%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-arrow-tip-dash{0%,20%{stroke-dashoffset:7}40%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-button-sonar{0%{box-shadow:0 0 0 0 hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}50%{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-end-alpha))}to{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}}@keyframes ck-widget-type-around-fake-caret-pulse{0%{opacity:1}49%{opacity:1}50%{opacity:0}99%{opacity:0}to{opacity:1}}'},function(e,t,i){var o=i(1),n=i(79);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2;--ck-resizer-border-radius:var(--ck-border-radius);--ck-resizer-tooltip-offset:10px;--ck-resizer-tooltip-height:calc(var(--ck-spacing-small)*2 + 10px)}.ck .ck-widget,.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);color:var(--ck-color-resizer-tooltip-text);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);font-size:var(--ck-font-size-tiny);display:block;padding:0 var(--ck-spacing-small);height:var(--ck-resizer-tooltip-height);line-height:var(--ck-resizer-tooltip-height)}.ck .ck-size-view.ck-orientation-above-center,.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{top:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{top:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-above-center{top:calc(var(--ck-resizer-tooltip-height)*-1);left:50%;transform:translate(-50%)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-width:var(--ck-widget-outline-thickness);outline-style:solid;outline-color:transparent;transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;background-color:var(--ck-color-widget-editable-focus-background)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{padding:4px;box-sizing:border-box;background-color:transparent;opacity:0;transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;transform:translateY(-100%);left:calc(0px - var(--ck-widget-outline-thickness));top:0}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{width:var(--ck-widget-handler-icon-size);height:var(--ck-widget-handler-icon-size);color:var(--ck-color-widget-drag-handler-icon-color)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover>.ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck.ck-editor__editable.ck-read-only .ck-widget{transition:none}.ck.ck-editor__editable.ck-read-only .ck-widget:not(.ck-widget_selected){--ck-widget-outline-thickness:0px}.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle>.ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle>.ck-widget__selection-handle:hover,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle>.ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle>.ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}"},function(e,t,i){var o=i(1),n=i(81);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position{display:inline;position:relative;pointer-events:none}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{position:absolute;width:0}.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__selection-handle,.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__type-around{display:none}:root{--ck-clipboard-drop-target-dot-width:12px;--ck-clipboard-drop-target-dot-height:8px;--ck-clipboard-drop-target-color:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{bottom:calc(var(--ck-clipboard-drop-target-dot-height)*-0.5);top:calc(var(--ck-clipboard-drop-target-dot-height)*-0.5);border:1px solid var(--ck-clipboard-drop-target-color);background:var(--ck-clipboard-drop-target-color);margin-left:-1px}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span:after{content:"";width:0;height:0;display:block;position:absolute;left:50%;top:calc(var(--ck-clipboard-drop-target-dot-height)*-0.5);transform:translateX(-50%);border-left:calc(var(--ck-clipboard-drop-target-dot-width)*0.5) solid transparent;border-bottom:0 solid transparent;border-right:calc(var(--ck-clipboard-drop-target-dot-width)*0.5) solid transparent;border-top:calc(var(--ck-clipboard-drop-target-dot-height)) solid var(--ck-clipboard-drop-target-color)}.ck.ck-editor__editable .ck-widget.ck-clipboard-drop-target-range{outline:var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color)!important}.ck.ck-editor__editable .ck-widget:-webkit-drag{zoom:.6;outline:none!important}'},function(e,t,i){var o=i(1),n=i(83);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:5px solid #ccc}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}"},function(e,t){e.exports=".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}"},function(e,t,i){var o=i(1),n=i(86);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-widget_with-resizer{position:relative}.ck .ck-widget__resizer{display:none;position:absolute;pointer-events:none;left:0;top:0}.ck-focused .ck-widget_with-resizer.ck-widget_selected>.ck-widget__resizer{display:block}.ck .ck-widget__resizer__handle{position:absolute;pointer-events:all}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right,.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left,.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{cursor:nesw-resize}:root{--ck-resizer-size:10px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-border-width:1px}.ck .ck-widget__resizer{outline:1px solid var(--ck-color-resizer)}.ck .ck-widget__resizer__handle{width:var(--ck-resizer-size);height:var(--ck-resizer-size);background:var(--ck-color-focus-border);border:var(--ck-resizer-border-width) solid #fff;border-radius:var(--ck-resizer-border-radius)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{top:var(--ck-resizer-offset);left:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{top:var(--ck-resizer-offset);right:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right{bottom:var(--ck-resizer-offset);right:var(--ck-resizer-offset)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left{bottom:var(--ck-resizer-offset);left:var(--ck-resizer-offset)}"},function(e,t,i){var o=i(1),n=i(88);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-field-view{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}"},function(e,t){e.exports='.ck-vertical-form .ck-button:after{content:"";width:0;position:absolute;right:-1px;top:var(--ck-spacing-small);bottom:var(--ck-spacing-small);z-index:1}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{content:"";width:0;position:absolute;right:-1px;top:var(--ck-spacing-small);bottom:var(--ck-spacing-small);z-index:1}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-text-width)*0.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-large);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after,[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}'},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:.9em auto;min-width:50px}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:100%}.ck-content .image-inline{display:inline-flex;max-width:100%;align-items:flex-start}.ck-content .image-inline picture{display:flex}.ck-content .image-inline img,.ck-content .image-inline picture{flex-grow:1;flex-shrink:1;max-width:100%}.ck.ck-editor__editable .image>figcaption.ck-placeholder:before{padding-left:inherit;padding-right:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ck.ck-editor__editable .image-inline.ck-widget_selected,.ck.ck-editor__editable .image.ck-widget_selected{z-index:1}.ck.ck-editor__editable .image-inline.ck-widget_selected ::selection{display:none}.ck.ck-editor__editable td .image-inline img,.ck.ck-editor__editable th .image-inline img{max-width:none}"},function(e,t,i){var o=i(1),n=i(92);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-image-caption-background:#f7f7f7;--ck-color-image-caption-text:#333;--ck-color-image-caption-highligted-background:#fd0}.ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:var(--ck-color-image-caption-text);background-color:var(--ck-color-image-caption-background);padding:.6em;font-size:.75em;outline-offset:-1px}.ck.ck-editor__editable .image>figcaption.image__caption_highlighted{animation:ck-image-caption-highlight .6s ease-out}@keyframes ck-image-caption-highlight{0%{background-color:var(--ck-color-image-caption-highligted-background)}to{background-color:var(--ck-color-image-caption-background)}}"},function(e,t,i){var o=i(1),n=i(94);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em;--ck-inline-image-style-spacing:calc(var(--ck-image-style-spacing)/2)}.ck-content .image-style-block-align-left,.ck-content .image-style-block-align-right{max-width:calc(100% - var(--ck-image-style-spacing))}.ck-content .image-style-align-left,.ck-content .image-style-align-right{clear:none}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing);max-width:50%}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}.ck-content .image-style-block-align-right{margin-right:0;margin-left:auto}.ck-content .image-style-block-align-left{margin-left:0;margin-right:auto}.ck-content p+.image-style-align-left,.ck-content p+.image-style-align-right,.ck-content p+.image-style-side{margin-top:0}.ck-content .image-inline.image-style-align-left,.ck-content .image-inline.image-style-align-right{margin-top:var(--ck-inline-image-style-spacing);margin-bottom:var(--ck-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-left{margin-right:var(--ck-inline-image-style-spacing)}.ck-content .image-inline.image-style-align-right{margin-left:var(--ck-inline-image-style-spacing)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-background)}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__action:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):after,.ck.ck-splitbutton.ck-splitbutton_flatten:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover):after{display:none}.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__action:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled),.ck.ck-splitbutton.ck-splitbutton_flatten.ck-splitbutton_open:hover>.ck-splitbutton__arrow:not(.ck-disabled):not(:hover){background-color:var(--ck-color-button-on-hover-background)}"},function(e,t,i){var o=i(1),n=i(96);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-editor__editable .image,.ck.ck-editor__editable .image-inline{position:relative}.ck.ck-editor__editable .image-inline .ck-progress-bar,.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image-inline.ck-appear,.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image-inline .ck-progress-bar,.ck.ck-editor__editable .image .ck-progress-bar{height:2px;width:0;background:var(--ck-color-upload-bar-background);transition:width .1s}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"},function(e,t,i){var o=i(1),n=i(98);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:min(var(--ck-spacing-medium),6%);right:min(var(--ck-spacing-medium),6%);border-radius:50%;z-index:1}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20;--ck-image-upload-icon-width:2px;--ck-image-upload-icon-is-visible:clamp(0px,100% - 50px,1px)}.ck-image-upload-complete-icon{opacity:0;background:var(--ck-color-image-upload-icon-background);animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;animation-fill-mode:forwards,forwards;animation-duration:.5s,.5s;font-size:calc(1px*var(--ck-image-upload-icon-size));animation-delay:0ms,3s;overflow:hidden;width:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size));height:calc(var(--ck-image-upload-icon-is-visible)*var(--ck-image-upload-icon-size))}.ck-image-upload-complete-icon:after{left:25%;top:50%;opacity:0;height:0;width:0;transform:scaleX(-1) rotate(135deg);transform-origin:left top;border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);animation-name:ck-upload-complete-icon-check;animation-duration:.5s;animation-delay:.5s;animation-fill-mode:forwards;box-sizing:border-box}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{opacity:1;width:0;height:0}33%{width:.3em;height:0}to{opacity:1;width:.3em;height:.45em}}'},function(e,t,i){var o=i(1),n=i(100);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck .ck-upload-placeholder-loader{position:absolute;display:flex;align-items:center;justify-content:center;top:0;left:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px}.ck .ck-image-upload-placeholder{width:100%;margin:0}.ck .ck-upload-placeholder-loader{width:100%;height:100%}.ck .ck-upload-placeholder-loader:before{width:var(--ck-upload-placeholder-loader-size);height:var(--ck-upload-placeholder-loader-size);border-radius:50%;border-top:3px solid var(--ck-color-upload-placeholder-loader);border-right:2px solid transparent;animation:ck-upload-placeholder-loader 1s linear infinite}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}'},function(e,t,i){var o=i(1),n=i(102);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-link_selected span.image-inline{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{height:100%;border-right:1px solid var(--ck-color-base-text);margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}"},function(e,t,i){var o=i(1),n=i(104);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form_layout-vertical .ck-button.ck-button-cancel,.ck.ck-link-form_layout-vertical .ck-button.ck-button-save{margin-top:var(--ck-spacing-medium)}.ck.ck-link-form_layout-vertical{padding:0;min-width:var(--ck-input-text-width)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{padding:var(--ck-spacing-standard);margin:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button,[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin:var(--ck-spacing-standard) var(--ck-spacing-large)}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;padding:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,i){var o=i(1),n=i(106);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{min-width:0;max-width:100%}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview),[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}}"},function(e,t,i){var o=i(1),n=i(108);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-media__wrapper .ck-media__placeholder{display:flex;flex-direction:column;align-items:center}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:block}@media (hover:none){.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:none}}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url{max-width:100%;position:relative}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url:hover .ck-tooltip{visibility:visible;opacity:1}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{overflow:hidden;display:block}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="goo.gl/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="maps.app.goo.gl"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="maps.google.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck-media__placeholder__icon *{display:none}.ck-editor__editable:not(.ck-read-only) .ck-media__wrapper>:not(.ck-media__placeholder),.ck-editor__editable:not(.ck-read-only) .ck-widget:not(.ck-widget_selected) .ck-media__placeholder{pointer-events:none}:root{--ck-media-embed-placeholder-icon-size:3em;--ck-color-media-embed-placeholder-url-text:#757575;--ck-color-media-embed-placeholder-url-text-hover:var(--ck-color-base-text)}.ck-media__wrapper{margin:0 auto}.ck-media__wrapper .ck-media__placeholder{padding:calc(var(--ck-spacing-standard)*3);background:var(--ck-color-base-foreground)}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon{min-width:var(--ck-media-embed-placeholder-icon-size);height:var(--ck-media-embed-placeholder-icon-size);margin-bottom:var(--ck-spacing-large);background-position:50%;background-size:cover}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon .ck-icon{width:100%;height:100%}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url__text{color:var(--ck-color-media-embed-placeholder-url-text);white-space:nowrap;text-align:center;font-style:italic;text-overflow:ellipsis}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:var(--ck-color-media-embed-placeholder-url-text-hover);cursor:pointer;text-decoration:underline}.ck-media__wrapper[data-oembed-url*="open.spotify.com"]{max-width:300px;max-height:380px}.ck-media__wrapper[data-oembed-url*="goo.gl/maps"] .ck-media__placeholder__icon,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon,.ck-media__wrapper[data-oembed-url*="maps.app.goo.gl"] .ck-media__placeholder__icon,.ck-media__wrapper[data-oembed-url*="maps.google.com"] .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAuMzc4IiBoZWlnaHQ9IjI1NC4xNjciIHZpZXdCb3g9IjAgMCA2Ni4yNDYgNjcuMjQ4Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcyLjUzMSAtMjE4LjQ1NSkgc2NhbGUoLjk4MDEyKSI+PHJlY3Qgcnk9IjUuMjM4IiByeD0iNS4yMzgiIHk9IjIzMS4zOTkiIHg9IjE3Ni4wMzEiIGhlaWdodD0iNjAuMDk5IiB3aWR0aD0iNjAuMDk5IiBmaWxsPSIjMzRhNjY4IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0yMDYuNDc3IDI2MC45bC0yOC45ODcgMjguOTg3YTUuMjE4IDUuMjE4IDAgMDAzLjc4IDEuNjFoNDkuNjIxYzEuNjk0IDAgMy4xOS0uNzk4IDQuMTQ2LTIuMDM3eiIgZmlsbD0iIzVjODhjNSIvPjxwYXRoIGQ9Ik0yMjYuNzQyIDIyMi45ODhjLTkuMjY2IDAtMTYuNzc3IDcuMTctMTYuNzc3IDE2LjAxNC4wMDcgMi43NjIuNjYzIDUuNDc0IDIuMDkzIDcuODc1LjQzLjcwMy44MyAxLjQwOCAxLjE5IDIuMTA3LjMzMy41MDIuNjUgMS4wMDUuOTUgMS41MDguMzQzLjQ3Ny42NzMuOTU3Ljk4OCAxLjQ0IDEuMzEgMS43NjkgMi41IDMuNTAyIDMuNjM3IDUuMTY4Ljc5MyAxLjI3NSAxLjY4MyAyLjY0IDIuNDY2IDMuOTkgMi4zNjMgNC4wOTQgNC4wMDcgOC4wOTIgNC42IDEzLjkxNHYuMDEyYy4xODIuNDEyLjUxNi42NjYuODc5LjY2Ny40MDMtLjAwMS43NjgtLjMxNC45My0uNzk5LjYwMy01Ljc1NiAyLjIzOC05LjcyOSA0LjU4NS0xMy43OTQuNzgyLTEuMzUgMS42NzMtMi43MTUgMi40NjUtMy45OSAxLjEzNy0xLjY2NiAyLjMyOC0zLjQgMy42MzgtNS4xNjkuMzE1LS40ODIuNjQ1LS45NjIuOTg4LTEuNDM5LjMtLjUwMy42MTctMS4wMDYuOTUtMS41MDguMzU5LS43Ljc2LTEuNDA0IDEuMTktMi4xMDcgMS40MjYtMi40MDIgMi01LjExNCAyLjAwNC03Ljg3NSAwLTguODQ0LTcuNTExLTE2LjAxNC0xNi43NzYtMTYuMDE0eiIgZmlsbD0iI2RkNGIzZSIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48ZWxsaXBzZSByeT0iNS41NjQiIHJ4PSI1LjgyOCIgY3k9IjIzOS4wMDIiIGN4PSIyMjYuNzQyIiBmaWxsPSIjODAyZDI3IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0xOTAuMzAxIDIzNy4yODNjLTQuNjcgMC04LjQ1NyAzLjg1My04LjQ1NyA4LjYwNnMzLjc4NiA4LjYwNyA4LjQ1NyA4LjYwN2MzLjA0MyAwIDQuODA2LS45NTggNi4zMzctMi41MTYgMS41My0xLjU1NyAyLjA4Ny0zLjkxMyAyLjA4Ny02LjI5IDAtLjM2Mi0uMDIzLS43MjItLjA2NC0xLjA3OWgtOC4yNTd2My4wNDNoNC44NWMtLjE5Ny43NTktLjUzMSAxLjQ1LTEuMDU4IDEuOTg2LS45NDIuOTU4LTIuMDI4IDEuNTQ4LTMuOTAxIDEuNTQ4LTIuODc2IDAtNS4yMDgtMi4zNzItNS4yMDgtNS4yOTkgMC0yLjkyNiAyLjMzMi01LjI5OSA1LjIwOC01LjI5OSAxLjM5OSAwIDIuNjE4LjQwNyAzLjU4NCAxLjI5M2wyLjM4MS0yLjM4YzAtLjAwMi0uMDAzLS4wMDQtLjAwNC0uMDA1LTEuNTg4LTEuNTI0LTMuNjItMi4yMTUtNS45NTUtMi4yMTV6bTQuNDMgNS42NmwuMDAzLjAwNnYtLjAwM3oiIGZpbGw9IiNmZmYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxNS4xODQgMjUxLjkyOWwtNy45OCA3Ljk3OSAyOC40NzcgMjguNDc1YTUuMjMzIDUuMjMzIDAgMDAuNDQ5LTIuMTIzdi0zMS4xNjVjLS40NjkuNjc1LS45MzQgMS4zNDktMS4zODIgMi4wMDUtLjc5MiAxLjI3NS0xLjY4MiAyLjY0LTIuNDY1IDMuOTktMi4zNDcgNC4wNjUtMy45ODIgOC4wMzgtNC41ODUgMTMuNzk0LS4xNjIuNDg1LS41MjcuNzk4LS45My43OTktLjM2My0uMDAxLS42OTctLjI1NS0uODc5LS42Njd2LS4wMTJjLS41OTMtNS44MjItMi4yMzctOS44Mi00LjYtMTMuOTE0LS43ODMtMS4zNS0xLjY3My0yLjcxNS0yLjQ2Ni0zLjk5LTEuMTM3LTEuNjY2LTIuMzI3LTMuNC0zLjYzNy01LjE2OWwtLjAwMi0uMDAzeiIgZmlsbD0iI2MzYzNjMyIvPjxwYXRoIGQ9Ik0yMTIuOTgzIDI0OC40OTVsLTM2Ljk1MiAzNi45NTN2LjgxMmE1LjIyNyA1LjIyNyAwIDAwNS4yMzggNS4yMzhoMS4wMTVsMzUuNjY2LTM1LjY2NmExMzYuMjc1IDEzNi4yNzUgMCAwMC0yLjc2NC0zLjkgMzcuNTc1IDM3LjU3NSAwIDAwLS45ODktMS40NCAzNS4xMjcgMzUuMTI3IDAgMDAtLjk1LTEuNTA4Yy0uMDgzLS4xNjItLjE3Ni0uMzI2LS4yNjQtLjQ4OXoiIGZpbGw9IiNmZGRjNGYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxMS45OTggMjYxLjA4M2wtNi4xNTIgNi4xNTEgMjQuMjY0IDI0LjI2NGguNzgxYTUuMjI3IDUuMjI3IDAgMDA1LjIzOS01LjIzOHYtMS4wNDV6IiBmaWxsPSIjZmZmIiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjwvZz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder{background:#4268b3}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05NjcuNDg0IDBINTYuNTE3QzI1LjMwNCAwIDAgMjUuMzA0IDAgNTYuNTE3djkxMC45NjZDMCA5OTguNjk0IDI1LjI5NyAxMDI0IDU2LjUyMiAxMDI0SDU0N1Y2MjhINDE0VjQ3M2gxMzNWMzU5LjAyOWMwLTEzMi4yNjIgODAuNzczLTIwNC4yODIgMTk4Ljc1Ni0yMDQuMjgyIDU2LjUxMyAwIDEwNS4wODYgNC4yMDggMTE5LjI0NCA2LjA4OVYyOTlsLTgxLjYxNi4wMzdjLTYzLjk5MyAwLTc2LjM4NCAzMC40OTItNzYuMzg0IDc1LjIzNlY0NzNoMTUzLjQ4N2wtMTkuOTg2IDE1NUg3MDd2Mzk2aDI2MC40ODRjMzEuMjEzIDAgNTYuNTE2LTI1LjMwMyA1Ni41MTYtNTYuNTE2VjU2LjUxNUMxMDI0IDI1LjMwMyA5OTguNjk3IDAgOTY3LjQ4NCAwIiBmaWxsPSIjRkZGRkZFIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#cdf}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder{background:linear-gradient(-135deg,#1400c7,#b800b1,#f50000)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTA0IiBoZWlnaHQ9IjUwNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PHBhdGggaWQ9ImEiIGQ9Ik0wIC4xNTloNTAzLjg0MVY1MDMuOTRIMHoiLz48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjYSIvPjwvbWFzaz48cGF0aCBkPSJNMjUxLjkyMS4xNTljLTY4LjQxOCAwLTc2Ljk5Ny4yOS0xMDMuODY3IDEuNTE2LTI2LjgxNCAxLjIyMy00NS4xMjcgNS40ODItNjEuMTUxIDExLjcxLTE2LjU2NiA2LjQzNy0zMC42MTUgMTUuMDUxLTQ0LjYyMSAyOS4wNTYtMTQuMDA1IDE0LjAwNi0yMi42MTkgMjguMDU1LTI5LjA1NiA0NC42MjEtNi4yMjggMTYuMDI0LTEwLjQ4NyAzNC4zMzctMTEuNzEgNjEuMTUxQy4yOSAxNzUuMDgzIDAgMTgzLjY2MiAwIDI1Mi4wOGMwIDY4LjQxNy4yOSA3Ni45OTYgMS41MTYgMTAzLjg2NiAxLjIyMyAyNi44MTQgNS40ODIgNDUuMTI3IDExLjcxIDYxLjE1MSA2LjQzNyAxNi41NjYgMTUuMDUxIDMwLjYxNSAyOS4wNTYgNDQuNjIxIDE0LjAwNiAxNC4wMDUgMjguMDU1IDIyLjYxOSA0NC42MjEgMjkuMDU3IDE2LjAyNCA2LjIyNyAzNC4zMzcgMTAuNDg2IDYxLjE1MSAxMS43MDkgMjYuODcgMS4yMjYgMzUuNDQ5IDEuNTE2IDEwMy44NjcgMS41MTYgNjguNDE3IDAgNzYuOTk2LS4yOSAxMDMuODY2LTEuNTE2IDI2LjgxNC0xLjIyMyA0NS4xMjctNS40ODIgNjEuMTUxLTExLjcwOSAxNi41NjYtNi40MzggMzAuNjE1LTE1LjA1MiA0NC42MjEtMjkuMDU3IDE0LjAwNS0xNC4wMDYgMjIuNjE5LTI4LjA1NSAyOS4wNTctNDQuNjIxIDYuMjI3LTE2LjAyNCAxMC40ODYtMzQuMzM3IDExLjcwOS02MS4xNTEgMS4yMjYtMjYuODcgMS41MTYtMzUuNDQ5IDEuNTE2LTEwMy44NjYgMC02OC40MTgtLjI5LTc2Ljk5Ny0xLjUxNi0xMDMuODY3LTEuMjIzLTI2LjgxNC01LjQ4Mi00NS4xMjctMTEuNzA5LTYxLjE1MS02LjQzOC0xNi41NjYtMTUuMDUyLTMwLjYxNS0yOS4wNTctNDQuNjIxLTE0LjAwNi0xNC4wMDUtMjguMDU1LTIyLjYxOS00NC42MjEtMjkuMDU2LTE2LjAyNC02LjIyOC0zNC4zMzctMTAuNDg3LTYxLjE1MS0xMS43MUMzMjguOTE3LjQ0OSAzMjAuMzM4LjE1OSAyNTEuOTIxLjE1OXptMCA0NS4zOTFjNjcuMjY1IDAgNzUuMjMzLjI1NyAxMDEuNzk3IDEuNDY5IDI0LjU2MiAxLjEyIDM3LjkwMSA1LjIyNCA0Ni43NzggOC42NzQgMTEuNzU5IDQuNTcgMjAuMTUxIDEwLjAyOSAyOC45NjYgMTguODQ1IDguODE2IDguODE1IDE0LjI3NSAxNy4yMDcgMTguODQ1IDI4Ljk2NiAzLjQ1IDguODc3IDcuNTU0IDIyLjIxNiA4LjY3NCA0Ni43NzggMS4yMTIgMjYuNTY0IDEuNDY5IDM0LjUzMiAxLjQ2OSAxMDEuNzk4IDAgNjcuMjY1LS4yNTcgNzUuMjMzLTEuNDY5IDEwMS43OTctMS4xMiAyNC41NjItNS4yMjQgMzcuOTAxLTguNjc0IDQ2Ljc3OC00LjU3IDExLjc1OS0xMC4wMjkgMjAuMTUxLTE4Ljg0NSAyOC45NjYtOC44MTUgOC44MTYtMTcuMjA3IDE0LjI3NS0yOC45NjYgMTguODQ1LTguODc3IDMuNDUtMjIuMjE2IDcuNTU0LTQ2Ljc3OCA4LjY3NC0yNi41NiAxLjIxMi0zNC41MjcgMS40NjktMTAxLjc5NyAxLjQ2OS02Ny4yNzEgMC03NS4yMzctLjI1Ny0xMDEuNzk4LTEuNDY5LTI0LjU2Mi0xLjEyLTM3LjkwMS01LjIyNC00Ni43NzgtOC42NzQtMTEuNzU5LTQuNTctMjAuMTUxLTEwLjAyOS0yOC45NjYtMTguODQ1LTguODE1LTguODE1LTE0LjI3NS0xNy4yMDctMTguODQ1LTI4Ljk2Ni0zLjQ1LTguODc3LTcuNTU0LTIyLjIxNi04LjY3NC00Ni43NzgtMS4yMTItMjYuNTY0LTEuNDY5LTM0LjUzMi0xLjQ2OS0xMDEuNzk3IDAtNjcuMjY2LjI1Ny03NS4yMzQgMS40NjktMTAxLjc5OCAxLjEyLTI0LjU2MiA1LjIyNC0zNy45MDEgOC42NzQtNDYuNzc4IDQuNTctMTEuNzU5IDEwLjAyOS0yMC4xNTEgMTguODQ1LTI4Ljk2NiA4LjgxNS04LjgxNiAxNy4yMDctMTQuMjc1IDI4Ljk2Ni0xOC44NDUgOC44NzctMy40NSAyMi4yMTYtNy41NTQgNDYuNzc4LTguNjc0IDI2LjU2NC0xLjIxMiAzNC41MzItMS40NjkgMTAxLjc5OC0xLjQ2OXoiIGZpbGw9IiNGRkYiIG1hc2s9InVybCgjYikiLz48cGF0aCBkPSJNMjUxLjkyMSAzMzYuMDUzYy00Ni4zNzggMC04My45NzQtMzcuNTk2LTgzLjk3NC04My45NzMgMC00Ni4zNzggMzcuNTk2LTgzLjk3NCA4My45NzQtODMuOTc0IDQ2LjM3NyAwIDgzLjk3MyAzNy41OTYgODMuOTczIDgzLjk3NCAwIDQ2LjM3Ny0zNy41OTYgODMuOTczLTgzLjk3MyA4My45NzN6bTAtMjEzLjMzOGMtNzEuNDQ3IDAtMTI5LjM2NSA1Ny45MTgtMTI5LjM2NSAxMjkuMzY1IDAgNzEuNDQ2IDU3LjkxOCAxMjkuMzY0IDEyOS4zNjUgMTI5LjM2NCA3MS40NDYgMCAxMjkuMzY0LTU3LjkxOCAxMjkuMzY0LTEyOS4zNjQgMC03MS40NDctNTcuOTE4LTEyOS4zNjUtMTI5LjM2NC0xMjkuMzY1ek00MTYuNjI3IDExNy42MDRjMCAxNi42OTYtMTMuNTM1IDMwLjIzLTMwLjIzMSAzMC4yMy0xNi42OTUgMC0zMC4yMy0xMy41MzQtMzAuMjMtMzAuMjMgMC0xNi42OTYgMTMuNTM1LTMwLjIzMSAzMC4yMy0zMC4yMzEgMTYuNjk2IDAgMzAuMjMxIDEzLjUzNSAzMC4yMzEgMzAuMjMxIiBmaWxsPSIjRkZGIi8+PC9nPjwvc3ZnPg==)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#ffe0fe}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder{background:linear-gradient(90deg,#71c6f4,#0d70a5)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgNDAwIj48cGF0aCBkPSJNNDAwIDIwMGMwIDExMC41LTg5LjUgMjAwLTIwMCAyMDBTMCAzMTAuNSAwIDIwMCA4OS41IDAgMjAwIDBzMjAwIDg5LjUgMjAwIDIwMHpNMTYzLjQgMzA1LjVjODguNyAwIDEzNy4yLTczLjUgMTM3LjItMTM3LjIgMC0yLjEgMC00LjItLjEtNi4yIDkuNC02LjggMTcuNi0xNS4zIDI0LjEtMjUtOC42IDMuOC0xNy45IDYuNC0yNy43IDcuNiAxMC02IDE3LjYtMTUuNCAyMS4yLTI2LjctOS4zIDUuNS0xOS42IDkuNS0zMC42IDExLjctOC44LTkuNC0yMS4zLTE1LjItMzUuMi0xNS4yLTI2LjYgMC00OC4yIDIxLjYtNDguMiA0OC4yIDAgMy44LjQgNy41IDEuMyAxMS00MC4xLTItNzUuNi0yMS4yLTk5LjQtNTAuNC00LjEgNy4xLTYuNSAxNS40LTYuNSAyNC4yIDAgMTYuNyA4LjUgMzEuNSAyMS41IDQwLjEtNy45LS4yLTE1LjMtMi40LTIxLjgtNnYuNmMwIDIzLjQgMTYuNiA0Mi44IDM4LjcgNDcuMy00IDEuMS04LjMgMS43LTEyLjcgMS43LTMuMSAwLTYuMS0uMy05LjEtLjkgNi4xIDE5LjIgMjMuOSAzMy4xIDQ1IDMzLjUtMTYuNSAxMi45LTM3LjMgMjAuNi01OS45IDIwLjYtMy45IDAtNy43LS4yLTExLjUtLjcgMjEuMSAxMy44IDQ2LjUgMjEuOCA3My43IDIxLjgiIGZpbGw9IiNmZmYiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text{color:#b8e6ff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}'},function(e,t,i){var o=i(1),n=i(110);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-media-form{display:flex;align-items:flex-start;flex-direction:row;flex-wrap:nowrap}.ck.ck-media-form .ck-labeled-field-view{display:inline-block}.ck.ck-media-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-media-form{flex-wrap:wrap}.ck.ck-media-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-media-form .ck-button{flex-basis:50%}}"},function(e,t,i){var o=i(1),n=i(112);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .media{clear:both;margin:.9em 0;display:block;min-width:15em}"},function(e,t,i){var o=i(1),n=i(114);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-color-table-focused-cell-background:rgba(158,207,250,0.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(e,t,i){var o=i(1),n=i(116);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-color-base-border);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-color-focus-border);background:var(--ck-color-focus-outer-shadow)}"},function(e,t,i){var o=i(1),n=i(118);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=':root{--ck-table-selected-cell-background:rgba(158,207,250,0.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{position:relative;caret-color:transparent;outline:unset;box-shadow:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{content:"";pointer-events:none;background-color:var(--ck-table-selected-cell-background);position:absolute;top:0;left:0;right:0;bottom:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget_selected{outline:unset}'},function(e,t,i){var o=i(1),n=i(120);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .table{margin:.9em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border:1px solid #bfbfbf}.ck-content .table table th{font-weight:700;background:hsla(0,0%,0%,5%)}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}.ck-editor__editable .ck-table-bogus-paragraph{display:inline-block;width:100%}"},function(e,t,i){"use strict";var o=i(4),n=i(17),r=i(122),s=i(23);function a(e){var t=new r(e),i=n(r.prototype.request,t);return o.extend(i,r.prototype,t),o.extend(i,t),i}var l=a(i(13));l.Axios=r,l.create=function(e){return a(s(l.defaults,e))},l.Cancel=i(24),l.CancelToken=i(137),l.isCancel=i(22),l.all=function(e){return Promise.all(e)},l.spread=i(138),l.isAxiosError=i(139),e.exports=l,e.exports.default=l},function(e,t,i){"use strict";var o=i(4),n=i(18),r=i(123),s=i(124),a=i(23),l=i(135),c=l.validators;function d(e){this.defaults=e,this.interceptors={request:new r,response:new r}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&l.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var i=[],o=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(o=o&&t.synchronous,i.unshift(t.fulfilled,t.rejected))}));var n,r=[];if(this.interceptors.response.forEach((function(e){r.push(e.fulfilled,e.rejected)})),!o){var d=[s,void 0];for(Array.prototype.unshift.apply(d,i),d=d.concat(r),n=Promise.resolve(e);d.length;)n=n.then(d.shift(),d.shift());return n}for(var u=e;i.length;){var h=i.shift(),m=i.shift();try{u=h(u)}catch(e){m(e);break}}try{n=s(u)}catch(e){return Promise.reject(e)}for(;r.length;)n=n.then(r.shift(),r.shift());return n},d.prototype.getUri=function(e){return e=a(this.defaults,e),n(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,i){return this.request(a(i||{},{method:e,url:t,data:(i||{}).data}))}})),o.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,i,o){return this.request(a(o||{},{method:e,url:t,data:i}))}})),e.exports=d},function(e,t,i){"use strict";var o=i(4);function n(){this.handlers=[]}n.prototype.use=function(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},function(e,t,i){"use strict";var o=i(4),n=i(125),r=i(22),s=i(13);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=n.call(e,e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=n.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return r(t)||(a(e),t&&t.response&&(t.response.data=n.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,i){"use strict";var o=i(4),n=i(13);e.exports=function(e,t,i){var r=this||n;return o.forEach(i,(function(i){e=i.call(r,e,t)})),e}},function(e,t){var i,o,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(e){i=r}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(e){o=s}}();var l,c=[],d=!1,u=-1;function h(){d&&l&&(d=!1,l.length?c=l.concat(c):u=-1,c.length&&m())}function m(){if(!d){var e=a(h);d=!0;for(var t=c.length;t;){for(l=c,c=[];++u<t;)l&&l[u].run();u=-1,t=c.length}l=null,d=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function f(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];c.push(new g(e,t)),1!==c.length||d||a(m)},g.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=f,n.addListener=f,n.once=f,n.off=f,n.removeListener=f,n.removeAllListeners=f,n.emit=f,n.prependListener=f,n.prependOnceListener=f,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,i){"use strict";var o=i(4);e.exports=function(e,t){o.forEach(e,(function(i,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[o])}))}},function(e,t,i){"use strict";var o=i(21);e.exports=function(e,t,i){var n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(o("Request failed with status code "+i.status,i.config,null,i.request,i)):e(i)}},function(e,t,i){"use strict";var o=i(4);e.exports=o.isStandardBrowserEnv()?{write:function(e,t,i,n,r,s){var a=[];a.push(e+"="+encodeURIComponent(t)),o.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),o.isString(n)&&a.push("path="+n),o.isString(r)&&a.push("domain="+r),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,i){"use strict";var o=i(131),n=i(132);e.exports=function(e,t){return e&&!o(t)?n(e,t):t}},function(e,t,i){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,i){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,i){"use strict";var o=i(4),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,i,r,s={};return e?(o.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=o.trim(e.substr(0,r)).toLowerCase(),i=o.trim(e.substr(r+1)),t){if(s[t]&&n.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([i]):s[t]?s[t]+", "+i:i}})),s):s}},function(e,t,i){"use strict";var o=i(4);e.exports=o.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");function n(e){var o=e;return t&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}return e=n(window.location.href),function(t){var i=o.isString(t)?n(t):t;return i.protocol===e.protocol&&i.host===e.host}}():function(){return!0}},function(e,t,i){"use strict";var o=i(136),n={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){n[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));var r={},s=o.version.split(".");function a(e,t){for(var i=t?t.split("."):s,o=e.split("."),n=0;n<3;n++){if(i[n]>o[n])return!0;if(i[n]<o[n])return!1}return!1}n.transitional=function(e,t,i){var n=t&&a(t);function s(e,t){return"[Axios v"+o.version+"] Transitional option '"+e+"'"+t+(i?". "+i:"")}return function(i,o,a){if(!1===e)throw new Error(s(o," has been removed in "+t));return n&&!r[o]&&(r[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,o,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,i){if("object"!=typeof e)throw new TypeError("options must be an object");for(var o=Object.keys(e),n=o.length;n-- >0;){var r=o[n],s=t[r];if(s){var a=e[r],l=void 0===a||s(a,r,e);if(!0!==l)throw new TypeError("option "+r+" must be "+l)}else if(!0!==i)throw Error("Unknown option "+r)}},validators:n}},function(e){e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,i){"use strict";var o=i(24);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var i=this;e((function(e){i.reason||(i.reason=new o(e),t(i.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},function(e,t,i){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,i){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,i){var o=i(1),n=i(141);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=":root{--ck-html-object-embed-unfocused-outline-width:1px}.ck-widget.html-object-embed{font-size:var(--ck-font-size-base);background-color:var(--ck-color-base-foreground);padding:var(--ck-spacing-small);padding-top:calc(var(--ck-font-size-tiny) + var(--ck-spacing-large));min-width:calc(76px + var(--ck-spacing-standard))}.ck-widget.html-object-embed:not(.ck-widget_selected):not(:hover){outline:var(--ck-html-object-embed-unfocused-outline-width) dashed var(--ck-color-widget-blurred-border)}.ck-widget.html-object-embed:before{font-weight:400;font-style:normal;position:absolute;content:attr(data-html-object-embed-label);top:0;left:var(--ck-spacing-standard);background:#999;transition:background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);padding:calc(var(--ck-spacing-tiny) + var(--ck-html-object-embed-unfocused-outline-width)) var(--ck-spacing-small) var(--ck-spacing-tiny);border-radius:0 0 var(--ck-border-radius) var(--ck-border-radius);color:var(--ck-color-base-background);font-size:var(--ck-font-size-tiny);font-family:var(--ck-font-face)}.ck-widget.html-object-embed .ck-widget__type-around .ck-widget__type-around__button.ck-widget__type-around__button_before{margin-left:50px}.ck-widget.html-object-embed .html-object-embed__content{pointer-events:none}div.ck-widget.html-object-embed{margin:1em auto}span.ck-widget.html-object-embed{display:inline-block}"},function(e,t,i){var o=i(1),n=i(143);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck .ck-button.ck-color-table__remove-color{display:flex;align-items:center;width:100%}label.ck.ck-color-grid__label{font-weight:unset}.ck .ck-button.ck-color-table__remove-color{padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck .ck-button.ck-color-table__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-base-border)}[dir=ltr] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(145);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}"},function(e,t,i){var o=i(1),n=i(147);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck-content .image.image_resized{max-width:100%;display:block;box-sizing:border-box}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}.ck.ck-editor__editable td .image-inline.image_resized img,.ck.ck-editor__editable th .image-inline.image_resized img{max-width:100%}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}"},function(e,t,i){var o=i(1),n=i(149);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-input-color{width:100%;display:flex;flex-direction:row-reverse}.ck.ck-input-color>input.ck.ck-input-text{min-width:auto;flex-grow:1}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{position:relative;overflow:hidden}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{position:absolute;display:block}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-left-width:0;border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button{border-right-width:0;border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview{border-radius:0}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview{width:20px;height:20px;border:1px solid var(--ck-color-input-border)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-button.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{top:-30%;left:50%;height:150%;width:8%;background:red;border-radius:2px;transform:rotate(45deg);transform-origin:50%}.ck.ck-input-color .ck.ck-input-color__remove-color{width:100%;border-bottom:1px solid var(--ck-color-input-border);padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:0;margin-left:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(151);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}[dir=ltr] .ck.ck-form__row>:not(.ck-label)+*{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-form__row>:not(.ck-label)+*{margin-right:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{width:100%;min-width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t){e.exports=".ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}"},function(e,t){e.exports='.ck.ck-table-form .ck-form__row.ck-table-form__background-row,.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{flex-wrap:wrap;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{position:absolute;left:50%;bottom:calc(var(--ck-table-properties-error-arrow-size)*-1);transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";position:absolute;top:calc(var(--ck-table-properties-error-arrow-size)*-1);left:50%;transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{width:80px;min-width:80px;max-width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:flex-end;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-field-view{padding-top:var(--ck-spacing-standard)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{border-radius:0}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{background:var(--ck-color-base-error);color:var(--ck-color-base-background);padding:var(--ck-spacing-small) var(--ck-spacing-medium);min-width:var(--ck-table-properties-min-error-width);text-align:center}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-left:var(--ck-table-properties-error-arrow-size) solid transparent;border-bottom:var(--ck-table-properties-error-arrow-size) solid var(--ck-color-base-error);border-right:var(--ck-table-properties-error-arrow-size) solid transparent;border-top:0 solid transparent}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both}.ck.ck-table-form .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}'},function(e,t,i){var o=i(1),n=i(155);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{flex-wrap:wrap;flex-basis:0;align-content:baseline}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{align-self:flex-end;padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}"},function(e,t,i){var o=i(1),n=i(157);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports=".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:first-of-type{flex-grow:0.57}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar:last-of-type{flex-grow:0.43}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar .ck-button{flex-grow:1}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{align-self:flex-end;padding:0;width:25%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none;margin-top:var(--ck-spacing-standard)}"},function(e,t,i){var o=i(1),n=i(159);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o(n,r);e.exports=n.locals||{}},function(e,t){e.exports='.ck-content .page-break{position:relative;clear:both;padding:5px 0;display:flex;align-items:center;justify-content:center}.ck-content .page-break:after{content:"";position:absolute;border-bottom:2px dashed #c4c4c4;width:100%}.ck-content .page-break__label{position:relative;z-index:1;padding:.3em .6em;display:block;text-transform:uppercase;border:1px solid #c4c4c4;border-radius:2px;font-family:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;font-size:.75em;font-weight:700;color:#333;background:#fff;box-shadow:2px 2px 1px rgba(0,0,0,.15);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media print{.ck-content .page-break{padding:0}.ck-content .page-break:after{display:none}}'},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return ey}));var o=function(){return function e(){e.called=!0}};class n{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=o(),this.off=o()}}const r=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function s(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,i=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0;return"e"+r[e>>0&255]+r[e>>8&255]+r[e>>16&255]+r[e>>24&255]+r[t>>0&255]+r[t>>8&255]+r[t>>16&255]+r[t>>24&255]+r[i>>0&255]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]+r[o>>0&255]+r[o>>8&255]+r[o>>16&255]+r[o>>24&255]}var a={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},l=(i(7),i(0));const c=Symbol("listeningTo"),d=Symbol("emitterId");var u={on(e,t,i={}){this.listenTo(this,e,t,i)},once(e,t,i){let o=!1;this.listenTo(this,e,(function(e,...i){o||(o=!0,e.off(),t.call(this,e,...i))}),i)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,i,o={}){let n,r;this[c]||(this[c]={});const s=this[c];m(e)||h(e);const a=m(e);(n=s[a])||(n=s[a]={emitter:e,callbacks:{}}),(r=n.callbacks[t])||(r=n.callbacks[t]=[]),r.push(i),function(e,t,i,o,n){t._addEventListener?t._addEventListener(i,o,n):e._addEventListener.call(t,i,o,n)}(this,e,t,i,o)},stopListening(e,t,i){const o=this[c];let n=e&&m(e);const r=o&&n&&o[n],s=r&&t&&r.callbacks[t];if(!(!o||e&&!r||t&&!s))if(i){b(this,e,t,i);-1!==s.indexOf(i)&&(1===s.length?delete r.callbacks[t]:b(this,e,t,i))}else if(s){for(;i=s.pop();)b(this,e,t,i);delete r.callbacks[t]}else if(r){for(t in r.callbacks)this.stopListening(e,t);delete o[n]}else{for(n in o)this.stopListening(o[n].emitter);delete this[c]}},fire(e,...t){try{const i=e instanceof n?e:new n(this,e),o=i.name;let r=function e(t,i){let o;if(!t._events||!(o=t._events[i])||!o.callbacks.length)return i.indexOf(":")>-1?e(t,i.substr(0,i.lastIndexOf(":"))):null;return o.callbacks}(this,o);if(i.path.push(this),r){const e=[i,...t];r=Array.from(r);for(let t=0;t<r.length&&(r[t].callback.apply(this,e),i.off.called&&(delete i.off.called,this._removeEventListener(o,r[t].callback)),!i.stop.called);t++);}if(this._delegations){const e=this._delegations.get(o),n=this._delegations.get("*");e&&p(e,i,t),n&&p(n,i,t)}return i.return}catch(e){l.a.rethrowUnexpectedError(e,this)}},delegate(...e){return{to:(t,i)=>{this._delegations||(this._delegations=new Map),e.forEach(e=>{const o=this._delegations.get(e);o?o.set(t,i):this._delegations.set(e,new Map([[t,i]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const i=this._delegations.get(e);i&&i.delete(t)}else this._delegations.delete(e);else this._delegations.clear()},_addEventListener(e,t,i){!function(e,t){const i=g(e);if(i[t])return;let o=t,n=null;const r=[];for(;""!==o&&!i[o];)i[o]={callbacks:[],childEvents:[]},r.push(i[o]),n&&i[o].childEvents.push(n),n=o,o=o.substr(0,o.lastIndexOf(":"));if(""!==o){for(const e of r)e.callbacks=i[o].callbacks.slice();i[o].childEvents.push(n)}}(this,e);const o=f(this,e),n=a.get(i.priority),r={callback:t,priority:n};for(const e of o){let t=!1;for(let i=0;i<e.length;i++)if(e[i].priority<n){e.splice(i,0,r),t=!0;break}t||e.push(r)}},_removeEventListener(e,t){const i=f(this,e);for(const e of i)for(let i=0;i<e.length;i++)e[i].callback==t&&(e.splice(i,1),i--)}};function h(e,t){e[d]||(e[d]=t||s())}function m(e){return e[d]}function g(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function f(e,t){const i=g(e)[t];if(!i)return[];let o=[i.callbacks];for(let t=0;t<i.childEvents.length;t++){const n=f(e,i.childEvents[t]);o=o.concat(n)}return o}function p(e,t,i){for(let[o,r]of e){r?"function"==typeof r&&(r=r(t.name)):r=t.name;const e=new n(t.source,r);e.path=[...t.path],o.fire(e,...i)}}function b(e,t,i,o){t._removeEventListener?t._removeEventListener(i,o):e._removeEventListener.call(t,i,o)}var w=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},k=i(3),_=k.a.Symbol,v=Object.prototype,y=v.hasOwnProperty,x=v.toString,A=_?_.toStringTag:void 0;var C=function(e){var t=y.call(e,A),i=e[A];try{e[A]=void 0;var o=!0}catch(e){}var n=x.call(e);return o&&(t?e[A]=i:delete e[A]),n},T=Object.prototype.toString;var E=function(e){return T.call(e)},S=_?_.toStringTag:void 0;var P=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":S&&S in Object(e)?C(e):E(e)};var I,M=function(e){if(!w(e))return!1;var t=P(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},N=k.a["__core-js_shared__"],R=(I=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var O=function(e){return!!R&&R in e},z=Function.prototype.toString;var V=function(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""},D=/^\[object .+?Constructor\]$/,L=Function.prototype,B=Object.prototype,j=L.toString,F=B.hasOwnProperty,H=RegExp("^"+j.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var U=function(e){return!(!w(e)||O(e))&&(M(e)?H:D).test(V(e))};var W=function(e,t){return null==e?void 0:e[t]};var $=function(e,t){var i=W(e,t);return U(i)?i:void 0},q=function(){try{var e=$(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Y=function(e,t,i){"__proto__"==t&&q?q(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i};var G=function(e,t){return e===t||e!=e&&t!=t},K=Object.prototype.hasOwnProperty;var Q=function(e,t,i){var o=e[t];K.call(e,t)&&G(o,i)&&(void 0!==i||t in e)||Y(e,t,i)};var J=function(e,t,i,o){var n=!i;i||(i={});for(var r=-1,s=t.length;++r<s;){var a=t[r],l=o?o(i[a],e[a],a,i,e):void 0;void 0===l&&(l=e[a]),n?Y(i,a,l):Q(i,a,l)}return i};var Z=function(e){return e};var X=function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)},ee=Math.max;var te=function(e,t,i){return t=ee(void 0===t?e.length-1:t,0),function(){for(var o=arguments,n=-1,r=ee(o.length-t,0),s=Array(r);++n<r;)s[n]=o[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=o[n];return a[t]=i(s),X(e,this,a)}};var ie=function(e){return function(){return e}},oe=q?function(e,t){return q(e,"toString",{configurable:!0,enumerable:!1,value:ie(t),writable:!0})}:Z,ne=Date.now;var re=function(e){var t=0,i=0;return function(){var o=ne(),n=16-(o-i);if(i=o,n>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(oe);var se=function(e,t){return re(te(e,t,Z),e+"")};var ae=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var le=function(e){return null!=e&&ae(e.length)&&!M(e)},ce=/^(?:0|[1-9]\d*)$/;var de=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&ce.test(e))&&e>-1&&e%1==0&&e<t};var ue=function(e,t,i){if(!w(i))return!1;var o=typeof t;return!!("number"==o?le(i)&&de(t,i.length):"string"==o&&t in i)&&G(i[t],e)};var he=function(e){return se((function(t,i){var o=-1,n=i.length,r=n>1?i[n-1]:void 0,s=n>2?i[2]:void 0;for(r=e.length>3&&"function"==typeof r?(n--,r):void 0,s&&ue(i[0],i[1],s)&&(r=n<3?void 0:r,n=1),t=Object(t);++o<n;){var a=i[o];a&&e(t,a,o,r)}return t}))};var me=function(e,t){for(var i=-1,o=Array(e);++i<e;)o[i]=t(i);return o};var ge=function(e){return null!=e&&"object"==typeof e};var fe=function(e){return ge(e)&&"[object Arguments]"==P(e)},pe=Object.prototype,be=pe.hasOwnProperty,we=pe.propertyIsEnumerable,ke=fe(function(){return arguments}())?fe:function(e){return ge(e)&&be.call(e,"callee")&&!we.call(e,"callee")},_e=Array.isArray,ve=i(5),ye={};ye["[object Float32Array]"]=ye["[object Float64Array]"]=ye["[object Int8Array]"]=ye["[object Int16Array]"]=ye["[object Int32Array]"]=ye["[object Uint8Array]"]=ye["[object Uint8ClampedArray]"]=ye["[object Uint16Array]"]=ye["[object Uint32Array]"]=!0,ye["[object Arguments]"]=ye["[object Array]"]=ye["[object ArrayBuffer]"]=ye["[object Boolean]"]=ye["[object DataView]"]=ye["[object Date]"]=ye["[object Error]"]=ye["[object Function]"]=ye["[object Map]"]=ye["[object Number]"]=ye["[object Object]"]=ye["[object RegExp]"]=ye["[object Set]"]=ye["[object String]"]=ye["[object WeakMap]"]=!1;var xe=function(e){return ge(e)&&ae(e.length)&&!!ye[P(e)]};var Ae=function(e){return function(t){return e(t)}},Ce=i(6),Te=Ce.a&&Ce.a.isTypedArray,Ee=Te?Ae(Te):xe,Se=Object.prototype.hasOwnProperty;var Pe=function(e,t){var i=_e(e),o=!i&&ke(e),n=!i&&!o&&Object(ve.a)(e),r=!i&&!o&&!n&&Ee(e),s=i||o||n||r,a=s?me(e.length,String):[],l=a.length;for(var c in e)!t&&!Se.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||de(c,l))||a.push(c);return a},Ie=Object.prototype;var Me=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)};var Ne=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t},Re=Object.prototype.hasOwnProperty;var Oe=function(e){if(!w(e))return Ne(e);var t=Me(e),i=[];for(var o in e)("constructor"!=o||!t&&Re.call(e,o))&&i.push(o);return i};var ze=function(e){return le(e)?Pe(e,!0):Oe(e)},Ve=he((function(e,t){J(t,ze(t),e)}));const De=Symbol("observableProperties"),Le=Symbol("boundObservables"),Be=Symbol("boundProperties"),je=Symbol("decoratedMethods"),Fe=Symbol("decoratedOriginal"),He={set(e,t){if(w(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);We(this);const i=this[De];if(e in this&&!i.has(e))throw new l.a("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>i.get(e),set(t){const o=i.get(e);let n=this.fire("set:"+e,e,t,o);void 0===n&&(n=t),o===n&&i.has(e)||(i.set(e,n),this.fire("change:"+e,e,n,o))}}),this[e]=t},bind(...e){if(!e.length||!Ye(e))throw new l.a("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new l.a("observable-bind-duplicate-properties",this);We(this);const t=this[Be];e.forEach(e=>{if(t.has(e))throw new l.a("observable-bind-rebind",this)});const i=new Map;return e.forEach(e=>{const o={property:e,to:[]};t.set(e,o),i.set(e,o)}),{to:$e,toMany:qe,_observable:this,_bindProperties:e,_to:[],_bindings:i}},unbind(...e){if(!this[De])return;const t=this[Be],i=this[Le];if(e.length){if(!Ye(e))throw new l.a("observable-unbind-wrong-properties",this);e.forEach(e=>{const o=t.get(e);if(!o)return;let n,r,s,a;o.to.forEach(e=>{n=e[0],r=e[1],s=i.get(n),a=s[r],a.delete(o),a.size||delete s[r],Object.keys(s).length||(i.delete(n),this.stopListening(n,"change"))}),t.delete(e)})}else i.forEach((e,t)=>{this.stopListening(t,"change")}),i.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new l.a("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(e,i)=>{e.return=t.apply(this,i)}),this[e]=function(...t){return this.fire(e,t)},this[e][Fe]=t,this[je]||(this[je]=[]),this[je].push(e)}};Ve(He,u),He.stopListening=function(e,t,i){if(!e&&this[je]){for(const e of this[je])this[e]=this[e][Fe];delete this[je]}u.stopListening.call(this,e,t,i)};var Ue=He;function We(e){e[De]||(Object.defineProperty(e,De,{value:new Map}),Object.defineProperty(e,Le,{value:new Map}),Object.defineProperty(e,Be,{value:new Map}))}function $e(...e){const t=function(...e){if(!e.length)throw new l.a("observable-bind-to-parse-error",null);const t={to:[]};let i;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)i.properties.push(e);else{if("object"!=typeof e)throw new l.a("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i)}}),t}(...e),i=Array.from(this._bindings.keys()),o=i.length;if(!t.callback&&t.to.length>1)throw new l.a("observable-bind-to-no-callback",this);if(o>1&&t.callback)throw new l.a("observable-bind-to-extra-callback",this);var n;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==o)throw new l.a("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),n=this._observable,this._to.forEach(e=>{const t=n[Le];let i;t.get(e.observable)||n.listenTo(e.observable,"change",(o,r)=>{i=t.get(e.observable)[r],i&&i.forEach(e=>{Ge(n,e.property)})})}),function(e){let t;e._bindings.forEach((i,o)=>{e._to.forEach(n=>{t=n.properties[i.callback?0:e._bindProperties.indexOf(o)],i.to.push([n.observable,t]),function(e,t,i,o){const n=e[Le],r=n.get(i),s=r||{};s[o]||(s[o]=new Set);s[o].add(t),r||n.set(i,s)}(e._observable,i,n.observable,t)})})}(this),this._bindProperties.forEach(e=>{Ge(this._observable,e)})}function qe(e,t,i){if(this._bindings.size>1)throw new l.a("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map(e=>[e,t]);return Array.prototype.concat.apply([],i)}(e,t),i)}function Ye(e){return e.every(e=>"string"==typeof e)}function Ge(e,t){const i=e[Be].get(t);let o;i.callback?o=i.callback.apply(e,i.to.map(e=>e[0][e[1]])):(o=i.to[0],o=o[0][o[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=o:e.set(t,o)}function Ke(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(i=>{if(i in e.prototype)return;const o=Object.getOwnPropertyDescriptor(t,i);o.enumerable=!1,Object.defineProperty(e.prototype,i,o)})})}class Qe{constructor(e){this.editor=e,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Je,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Je),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Je(e){e.return=!1,e.stop()}Ke(Qe,Ue);class Ze{constructor(e){this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"}),this.listenTo(e,"change:isReadOnly",(e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Xe,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Xe),this.refresh())}execute(){}destroy(){this.stopListening()}}function Xe(e){e.return=!1,e.stop()}Ke(Ze,Ue);class et extends Ze{constructor(e){super(e),this._childCommands=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return null!=t&&t.execute(e)}registerChildCommand(e){this._childCommands.push(e),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){return this._childCommands.find(e=>e.isEnabled)}}var tt=function(e,t){return function(i){return e(t(i))}},it=tt(Object.getPrototypeOf,Object),ot=Function.prototype,nt=Object.prototype,rt=ot.toString,st=nt.hasOwnProperty,at=rt.call(Object);var lt=function(e){if(!ge(e)||"[object Object]"!=P(e))return!1;var t=it(e);if(null===t)return!0;var i=st.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&rt.call(i)==at};var ct=function(){this.__data__=[],this.size=0};var dt=function(e,t){for(var i=e.length;i--;)if(G(e[i][0],t))return i;return-1},ut=Array.prototype.splice;var ht=function(e){var t=this.__data__,i=dt(t,e);return!(i<0)&&(i==t.length-1?t.pop():ut.call(t,i,1),--this.size,!0)};var mt=function(e){var t=this.__data__,i=dt(t,e);return i<0?void 0:t[i][1]};var gt=function(e){return dt(this.__data__,e)>-1};var ft=function(e,t){var i=this.__data__,o=dt(i,e);return o<0?(++this.size,i.push([e,t])):i[o][1]=t,this};function pt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}pt.prototype.clear=ct,pt.prototype.delete=ht,pt.prototype.get=mt,pt.prototype.has=gt,pt.prototype.set=ft;var bt=pt;var wt=function(){this.__data__=new bt,this.size=0};var kt=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i};var _t=function(e){return this.__data__.get(e)};var vt=function(e){return this.__data__.has(e)},yt=$(k.a,"Map"),xt=$(Object,"create");var At=function(){this.__data__=xt?xt(null):{},this.size=0};var Ct=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Tt=Object.prototype.hasOwnProperty;var Et=function(e){var t=this.__data__;if(xt){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return Tt.call(t,e)?t[e]:void 0},St=Object.prototype.hasOwnProperty;var Pt=function(e){var t=this.__data__;return xt?void 0!==t[e]:St.call(t,e)};var It=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=xt&&void 0===t?"__lodash_hash_undefined__":t,this};function Mt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}Mt.prototype.clear=At,Mt.prototype.delete=Ct,Mt.prototype.get=Et,Mt.prototype.has=Pt,Mt.prototype.set=It;var Nt=Mt;var Rt=function(){this.size=0,this.__data__={hash:new Nt,map:new(yt||bt),string:new Nt}};var Ot=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var zt=function(e,t){var i=e.__data__;return Ot(t)?i["string"==typeof t?"string":"hash"]:i.map};var Vt=function(e){var t=zt(this,e).delete(e);return this.size-=t?1:0,t};var Dt=function(e){return zt(this,e).get(e)};var Lt=function(e){return zt(this,e).has(e)};var Bt=function(e,t){var i=zt(this,e),o=i.size;return i.set(e,t),this.size+=i.size==o?0:1,this};function jt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var o=e[t];this.set(o[0],o[1])}}jt.prototype.clear=Rt,jt.prototype.delete=Vt,jt.prototype.get=Dt,jt.prototype.has=Lt,jt.prototype.set=Bt;var Ft=jt;var Ht=function(e,t){var i=this.__data__;if(i instanceof bt){var o=i.__data__;if(!yt||o.length<199)return o.push([e,t]),this.size=++i.size,this;i=this.__data__=new Ft(o)}return i.set(e,t),this.size=i.size,this};function Ut(e){var t=this.__data__=new bt(e);this.size=t.size}Ut.prototype.clear=wt,Ut.prototype.delete=kt,Ut.prototype.get=_t,Ut.prototype.has=vt,Ut.prototype.set=Ht;var Wt=Ut;var $t=function(e,t){for(var i=-1,o=null==e?0:e.length;++i<o&&!1!==t(e[i],i,e););return e},qt=tt(Object.keys,Object),Yt=Object.prototype.hasOwnProperty;var Gt=function(e){if(!Me(e))return qt(e);var t=[];for(var i in Object(e))Yt.call(e,i)&&"constructor"!=i&&t.push(i);return t};var Kt=function(e){return le(e)?Pe(e):Gt(e)};var Qt=function(e,t){return e&&J(t,Kt(t),e)};var Jt=function(e,t){return e&&J(t,ze(t),e)},Zt=i(10);var Xt=function(e,t){var i=-1,o=e.length;for(t||(t=Array(o));++i<o;)t[i]=e[i];return t};var ei=function(e,t){for(var i=-1,o=null==e?0:e.length,n=0,r=[];++i<o;){var s=e[i];t(s,i,e)&&(r[n++]=s)}return r};var ti=function(){return[]},ii=Object.prototype.propertyIsEnumerable,oi=Object.getOwnPropertySymbols,ni=oi?function(e){return null==e?[]:(e=Object(e),ei(oi(e),(function(t){return ii.call(e,t)})))}:ti;var ri=function(e,t){return J(e,ni(e),t)};var si=function(e,t){for(var i=-1,o=t.length,n=e.length;++i<o;)e[n+i]=t[i];return e},ai=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)si(t,ni(e)),e=it(e);return t}:ti;var li=function(e,t){return J(e,ai(e),t)};var ci=function(e,t,i){var o=t(e);return _e(e)?o:si(o,i(e))};var di=function(e){return ci(e,Kt,ni)};var ui=function(e){return ci(e,ze,ai)},hi=$(k.a,"DataView"),mi=$(k.a,"Promise"),gi=$(k.a,"Set"),fi=$(k.a,"WeakMap"),pi=V(hi),bi=V(yt),wi=V(mi),ki=V(gi),_i=V(fi),vi=P;(hi&&"[object DataView]"!=vi(new hi(new ArrayBuffer(1)))||yt&&"[object Map]"!=vi(new yt)||mi&&"[object Promise]"!=vi(mi.resolve())||gi&&"[object Set]"!=vi(new gi)||fi&&"[object WeakMap]"!=vi(new fi))&&(vi=function(e){var t=P(e),i="[object Object]"==t?e.constructor:void 0,o=i?V(i):"";if(o)switch(o){case pi:return"[object DataView]";case bi:return"[object Map]";case wi:return"[object Promise]";case ki:return"[object Set]";case _i:return"[object WeakMap]"}return t});var yi=vi,xi=Object.prototype.hasOwnProperty;var Ai=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&xi.call(e,"index")&&(i.index=e.index,i.input=e.input),i},Ci=k.a.Uint8Array;var Ti=function(e){var t=new e.constructor(e.byteLength);return new Ci(t).set(new Ci(e)),t};var Ei=function(e,t){var i=t?Ti(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)},Si=/\w*$/;var Pi=function(e){var t=new e.constructor(e.source,Si.exec(e));return t.lastIndex=e.lastIndex,t},Ii=_?_.prototype:void 0,Mi=Ii?Ii.valueOf:void 0;var Ni=function(e){return Mi?Object(Mi.call(e)):{}};var Ri=function(e,t){var i=t?Ti(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)};var Oi=function(e,t,i){var o=e.constructor;switch(t){case"[object ArrayBuffer]":return Ti(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return Ei(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Ri(e,i);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return Pi(e);case"[object Set]":return new o;case"[object Symbol]":return Ni(e)}},zi=Object.create,Vi=function(){function e(){}return function(t){if(!w(t))return{};if(zi)return zi(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();var Di=function(e){return"function"!=typeof e.constructor||Me(e)?{}:Vi(it(e))};var Li=function(e){return ge(e)&&"[object Map]"==yi(e)},Bi=Ce.a&&Ce.a.isMap,ji=Bi?Ae(Bi):Li;var Fi=function(e){return ge(e)&&"[object Set]"==yi(e)},Hi=Ce.a&&Ce.a.isSet,Ui=Hi?Ae(Hi):Fi,Wi={};Wi["[object Arguments]"]=Wi["[object Array]"]=Wi["[object ArrayBuffer]"]=Wi["[object DataView]"]=Wi["[object Boolean]"]=Wi["[object Date]"]=Wi["[object Float32Array]"]=Wi["[object Float64Array]"]=Wi["[object Int8Array]"]=Wi["[object Int16Array]"]=Wi["[object Int32Array]"]=Wi["[object Map]"]=Wi["[object Number]"]=Wi["[object Object]"]=Wi["[object RegExp]"]=Wi["[object Set]"]=Wi["[object String]"]=Wi["[object Symbol]"]=Wi["[object Uint8Array]"]=Wi["[object Uint8ClampedArray]"]=Wi["[object Uint16Array]"]=Wi["[object Uint32Array]"]=!0,Wi["[object Error]"]=Wi["[object Function]"]=Wi["[object WeakMap]"]=!1;var $i=function e(t,i,o,n,r,s){var a,l=1&i,c=2&i,d=4&i;if(o&&(a=r?o(t,n,r,s):o(t)),void 0!==a)return a;if(!w(t))return t;var u=_e(t);if(u){if(a=Ai(t),!l)return Xt(t,a)}else{var h=yi(t),m="[object Function]"==h||"[object GeneratorFunction]"==h;if(Object(ve.a)(t))return Object(Zt.a)(t,l);if("[object Object]"==h||"[object Arguments]"==h||m&&!r){if(a=c||m?{}:Di(t),!l)return c?li(t,Jt(a,t)):ri(t,Qt(a,t))}else{if(!Wi[h])return r?t:{};a=Oi(t,h,l)}}s||(s=new Wt);var g=s.get(t);if(g)return g;s.set(t,a),Ui(t)?t.forEach((function(n){a.add(e(n,i,o,n,t,s))})):ji(t)&&t.forEach((function(n,r){a.set(r,e(n,i,o,r,t,s))}));var f=u?void 0:(d?c?ui:di:c?ze:Kt)(t);return $t(f||t,(function(n,r){f&&(n=t[r=n]),Q(a,r,e(n,i,o,r,t,s))})),a};var qi=function(e,t){return $i(e,5,t="function"==typeof t?t:void 0)};var Yi=function(e){return ge(e)&&1===e.nodeType&&!lt(e)};class Gi{constructor(e,t){this._config={},t&&this.define(Ki(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,o=!1){if(lt(t))return void this._setObjectToTarget(e,t,o);const n=t.split(".");t=n.pop();for(const t of n)lt(e[t])||(e[t]={}),e=e[t];if(lt(i))return lt(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,i,o);o&&void 0!==e[t]||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const t of i){if(!lt(e[t])){e=null;break}e=e[t]}return e?Ki(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(o=>{this._setToTarget(e,o,t[o],i)})}}function Ki(e){return qi(e,Qi)}function Qi(e){return Yi(e)?e:void 0}function Ji(e){return!(!e||!e[Symbol.iterator])}class Zi{constructor(e={},t={}){const i=Ji(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new l.a("collection-add-item-invalid-index",this);for(let i=0;i<e.length;i++){const o=e[i],n=this._getItemIdBeforeAdding(o),r=t+i;this._items.splice(r,0,o),this._itemMap.set(n,o),this.fire("add",o,r)}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new l.a("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,this._items.indexOf(t)}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new l.a("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(t=>e(t)):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(i,o,n)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(o);if(r&&s)this._bindToExternalToInternalMap.set(o,s),this._bindToInternalToExternalMap.set(s,o);else{const i=e(o);if(!i)return void this._skippedIndexesFromExternal.push(n);let r=n;for(const e of this._skippedIndexesFromExternal)n>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(o,i),this._bindToInternalToExternalMap.set(i,o),this.add(i,r);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)r<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)i(0,e,t.getIndex(e));this.listenTo(t,"add",i),this.listenTo(t,"remove",(e,t,i)=>{const o=this._bindToExternalToInternalMap.get(t);o&&this.remove(o),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(i<t&&e.push(t-1),i>t&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],"string"!=typeof i)throw new l.a("collection-add-invalid-id",this);if(this.get(i))throw new l.a("collection-add-item-already-exists",this)}else e[t]=i=s();return i}_remove(e){let t,i,o,n=!1;const r=this._idProperty;if("string"==typeof e?(i=e,o=this._itemMap.get(i),n=!o,o&&(t=this._items.indexOf(o))):"number"==typeof e?(t=e,o=this._items[t],n=!o,o&&(i=o[r])):(o=e,i=o[r],t=this._items.indexOf(o),n=-1==t||!this._itemMap.get(i)),n)throw new l.a("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const s=this._bindToInternalToExternalMap.get(o);return this._bindToInternalToExternalMap.delete(o),this._bindToExternalToInternalMap.delete(s),this.fire("remove",o,t),[o,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}Ke(Zi,u);class Xi{constructor(e,t=[],i=[]){this._context=e,this._plugins=new Map,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of i)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new l.a("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const o=this,n=this._context;!function e(t,i=new Set){t.forEach(t=>{a(t)&&(i.has(t)||(i.add(t),t.pluginName&&!o._availablePlugins.has(t.pluginName)&&o._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,i)))})}(e),h(e);const r=[...function e(t,i=new Set){return t.map(e=>a(e)?e:o._availablePlugins.get(e)).reduce((t,o)=>i.has(o)?t:(i.add(o),o.requires&&(h(o.requires,o),e(o.requires,i).forEach(e=>t.add(e))),t.add(o)),new Set)}(e.filter(e=>!d(e,t)))];!function(e,t){for(const i of t){if("function"!=typeof i)throw new l.a("plugincollection-replace-plugin-invalid-type",null,{pluginItem:i});const t=i.pluginName;if(!t)throw new l.a("plugincollection-replace-plugin-missing-name",null,{pluginItem:i});if(i.requires&&i.requires.length)throw new l.a("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const n=o._availablePlugins.get(t);if(!n)throw new l.a("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const r=e.indexOf(n);if(-1===r){if(o._contextPlugins.has(n))return;throw new l.a("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(n.requires&&n.requires.length)throw new l.a("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(r,1,i),o._availablePlugins.set(t,i)}}(r,i);const s=function(e){return e.map(e=>{const t=o._contextPlugins.get(e)||new e(n);return o._add(e,t),t})}(r);return m(s,"init").then(()=>m(s,"afterInit")).then(()=>s);function a(e){return"function"==typeof e}function c(e){return a(e)&&e.isContextPlugin}function d(e,t){return t.some(t=>t===e||(u(e)===t||u(t)===e))}function u(e){return a(e)?e.pluginName||e.name:e}function h(e,i=null){e.map(e=>a(e)?e:o._availablePlugins.get(e)||e).forEach(e=>{!function(e,t){if(a(e))return;if(t)throw new l.a("plugincollection-soft-required",n,{missingPlugin:e,requiredBy:u(t)});throw new l.a("plugincollection-plugin-not-found",n,{plugin:e})}(e,i),function(e,t){if(!c(t))return;if(c(e))return;throw new l.a("plugincollection-context-required",n,{plugin:u(e),requiredBy:u(t)})}(e,i),function(e,i){if(!i)return;if(!d(e,t))return;throw new l.a("plugincollection-required",n,{plugin:u(e),requiredBy:u(i)})}(e,i)})}function m(e,t){return e.reduce((e,i)=>i[t]?o._contextPlugins.has(i)?e:e.then(i[t].bind(i)):e,Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new l.a("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}function eo(e){return Array.isArray(e)?e:[e]}function to(e,t,i=1){if("number"!=typeof i)throw new l.a("translation-service-quantity-not-a-number",null,{quantity:i});const o=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===o&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const n=t.id||t.string;if(0===o||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,n))return 1!==i?t.plural:t.string;const r=window.CKEDITOR_TRANSLATIONS[e].dictionary,s=window.CKEDITOR_TRANSLATIONS[e].getPluralForm||(e=>1===e?0:1);if("string"==typeof r[n])return r[n];const a=Number(s(i));return r[n][a]}Ke(Xi,u),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const io=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function oo(e){return io.includes(e)?"rtl":"ltr"}class no{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=oo(this.uiLanguage),this.contentLanguageDirection=oo(this.contentLanguage),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=eo(t),"string"==typeof e&&(e={string:e});const i=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,i)=>i<t.length?t[i]:e)}(to(this.uiLanguage,e,i),t)}}class ro{constructor(e){this.config=new Gi(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new Xi(this,t);const i=this.config.get("language")||{};this.locale=new no({uiLanguage:"string"==typeof i?i:i.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new Zi,this._contextOwner=null}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if("function"!=typeof i)throw new l.a("context-initplugins-constructor-only",null,{Plugin:i});if(!0!==i.isContextPlugin)throw new l.a("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new l.a("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}class so{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}function ao(e,t){const i=Math.min(e.length,t.length);for(let o=0;o<i;o++)if(e[o]!=t[o])return o;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}Ke(so,Ue);var lo=function(e){return $i(e,4)};class co{constructor(e){this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new l.a("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),o=e.getAncestors(t);let n=0;for(;i[n]==o[n]&&i[n];)n++;return 0===n?null:i[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=ao(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire("change:"+e,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=lo(this);return delete e.parent,e}is(e){return"node"===e||"view:node"===e}}Ke(co,u);class uo extends co{constructor(e,t){super(e),this._textData=t}is(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof uo&&(this===e||this.data===e.data)}_clone(){return new uo(this.document,this.data)}}class ho{constructor(e,t,i){if(this.textNode=e,t<0||t>e.data.length)throw new l.a("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new l.a("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;null!==i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}}function mo(e){return Ji(e)?new Map(e):function(e){const t=new Map;for(const i in e)t.set(i,e[i]);return t}(e)}class go{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const i=fo(t,e);if(i)return{element:t,pattern:e,match:i}}return null}matchAll(...e){const t=[];for(const i of e)for(const e of this._patterns){const o=fo(i,e);o&&t.push({element:i,pattern:e,match:o})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function fo(e,t){if("function"==typeof t)return t(e);const i={};return t.name&&(i.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!i.name)||t.attributes&&(i.attributes=function(e,t){const i=new Set(t.getAttributeKeys());lt(e)?(void 0!==e.style&&Object(l.b)("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&Object(l.b)("matcher-pattern-deprecated-attributes-class-key",e)):(i.delete("style"),i.delete("class"));return po(e,i,e=>t.getAttribute(e))}(t.attributes,e),!i.attributes)?null:!(t.classes&&(i.classes=function(e,t){return po(e,t.getClassNames())}(t.classes,e),!i.classes))&&(!(t.styles&&(i.styles=function(e,t){return po(e,t.getStyleNames(!0),e=>t.getStyle(e))}(t.styles,e),!i.styles))&&i)}function po(e,t,i){const o=function(e){if(Array.isArray(e))return e.map(e=>lt(e)?(void 0!==e.key&&void 0!==e.value||Object(l.b)("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]);if(lt(e))return Object.entries(e);return[[e,!0]]}(e),n=Array.from(t),r=[];return o.forEach(([e,t])=>{n.forEach(o=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&e.test(t)})(e,o)&&function(e,t,i){if(!0===e)return!0;const o=i(t);return e===o||e instanceof RegExp&&e.test(o)}(t,o,i)&&r.push(o)})}),!o.length||r.length<o.length?null:r}var bo=function(e){return"symbol"==typeof e||ge(e)&&"[object Symbol]"==P(e)},wo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ko=/^\w*$/;var _o=function(e,t){if(_e(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!bo(e))||(ko.test(e)||!wo.test(e)||null!=t&&e in Object(t))};function vo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var o=arguments,n=t?t.apply(this,o):o[0],r=i.cache;if(r.has(n))return r.get(n);var s=e.apply(this,o);return i.cache=r.set(n,s)||r,s};return i.cache=new(vo.Cache||Ft),i}vo.Cache=Ft;var yo=vo;var xo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ao=/\\(\\)?/g,Co=function(e){var t=yo(e,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(xo,(function(e,i,o,n){t.push(o?n.replace(Ao,"$1"):i||e)})),t}));var To=function(e,t){for(var i=-1,o=null==e?0:e.length,n=Array(o);++i<o;)n[i]=t(e[i],i,e);return n},Eo=_?_.prototype:void 0,So=Eo?Eo.toString:void 0;var Po=function e(t){if("string"==typeof t)return t;if(_e(t))return To(t,e)+"";if(bo(t))return So?So.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i};var Io=function(e){return null==e?"":Po(e)};var Mo=function(e,t){return _e(e)?e:_o(e,t)?[e]:Co(Io(e))};var No=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var Ro=function(e){if("string"==typeof e||bo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Oo=function(e,t){for(var i=0,o=(t=Mo(t,e)).length;null!=e&&i<o;)e=e[Ro(t[i++])];return i&&i==o?e:void 0};var zo=function(e,t,i){var o=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(i=i>n?n:i)<0&&(i+=n),n=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(n);++o<n;)r[o]=e[o+t];return r};var Vo=function(e,t){return t.length<2?e:Oo(e,zo(t,0,-1))};var Do=function(e,t){return t=Mo(t,e),null==(e=Vo(e,t))||delete e[Ro(No(t))]};var Lo=function(e,t){return null==e||Do(e,t)};var Bo=function(e,t,i){var o=null==e?void 0:Oo(e,t);return void 0===o?i:o};var jo=function(e,t,i){(void 0!==i&&!G(e[t],i)||void 0===i&&!(t in e))&&Y(e,t,i)};var Fo=function(e){return function(t,i,o){for(var n=-1,r=Object(t),s=o(t),a=s.length;a--;){var l=s[e?a:++n];if(!1===i(r[l],l,r))break}return t}}();var Ho=function(e){return ge(e)&&le(e)};var Uo=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var Wo=function(e){return J(e,ze(e))};var $o=function(e,t,i,o,n,r,s){var a=Uo(e,i),l=Uo(t,i),c=s.get(l);if(c)jo(e,i,c);else{var d=r?r(a,l,i+"",e,t,s):void 0,u=void 0===d;if(u){var h=_e(l),m=!h&&Object(ve.a)(l),g=!h&&!m&&Ee(l);d=l,h||m||g?_e(a)?d=a:Ho(a)?d=Xt(a):m?(u=!1,d=Object(Zt.a)(l,!0)):g?(u=!1,d=Ri(l,!0)):d=[]:lt(l)||ke(l)?(d=a,ke(a)?d=Wo(a):w(a)&&!M(a)||(d=Di(l))):u=!1}u&&(s.set(l,d),n(d,l,o,r,s),s.delete(l)),jo(e,i,d)}};var qo=function e(t,i,o,n,r){t!==i&&Fo(i,(function(s,a){if(r||(r=new Wt),w(s))$o(t,i,a,o,e,n,r);else{var l=n?n(Uo(t,a),s,a+"",t,i,r):void 0;void 0===l&&(l=s),jo(t,a,l)}}),ze)},Yo=he((function(e,t,i){qo(e,t,i)}));var Go=function(e,t,i,o){if(!w(e))return e;for(var n=-1,r=(t=Mo(t,e)).length,s=r-1,a=e;null!=a&&++n<r;){var l=Ro(t[n]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(n!=s){var d=a[l];void 0===(c=o?o(d,l,a):void 0)&&(c=w(d)?d:de(t[n+1])?[]:{})}Q(a,l,c),a=a[l]}return e};var Ko=function(e,t,i){return null==e?e:Go(e,t,i)};class Qo{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){const e=Object.entries(this._styles);return!Array.from(e).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=Array.from(function(e){let t=null,i=0,o=0,n=null;const r=new Map;if(""===e)return r;";"!=e.charAt(e.length-1)&&(e+=";");for(let s=0;s<e.length;s++){const a=e.charAt(s);if(null===t)switch(a){case":":n||(n=e.substr(i,s-i),o=s+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(o,s-o);n&&r.set(n.trim(),t.trim()),n=null,i=s+1;break}}else a===t&&(t=null)}return r}(e).entries());for(const[e,i]of t)this._styleProcessor.toNormalizedForm(e,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)}set(e,t){if(w(e))for(const[t,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=Zo(e);Lo(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this._getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!w(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){if(this.isEmpty)return[];if(e)return this._styleProcessor.getStyleNames(this._styles);return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const i=t.splice(0,t.length-1).join("."),o=Bo(this._styles,i);if(!o)return;!Array.from(Object.keys(o)).length&&this.remove(i)}}class Jo{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(w(t))Xo(i,Zo(e),t);else if(this._normalizers.has(e)){const o=this._normalizers.get(e),{path:n,value:r}=o(t);Xo(i,n,r)}else Xo(i,e,t)}getNormalized(e,t){if(!e)return Yo({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if("string"==typeof i)return Bo(t,i);const o=i(e,t);if(o)return o}return Bo(t,Zo(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);if(void 0===i)return[];if(this._reducers.has(e)){return this._reducers.get(e)(i)}return[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(t=>{const i=this.getNormalized(t,e);return i&&"object"==typeof i?Object.keys(i).length:i}),i=new Set([...t,...Object.keys(e)]);return Array.from(i.values())}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function Zo(e){return e.replace("-",".")}function Xo(e,t,i){let o=i;w(i)&&(o=Yo({},Bo(e,t),i)),Ko(e,t,o)}class en extends co{constructor(e,t,i,o){if(super(e),this.name=t,this._attrs=function(e){e=mo(e);for(const[t,i]of e)null===i?e.delete(t):"string"!=typeof i&&e.set(t,String(i));return e}(i),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");tn(this._classes,e),this._attrs.delete("class")}this._styles=new Qo(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map,this._isAllowedInsideAttributeElement=!1}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}get isAllowedInsideAttributeElement(){return this._isAllowedInsideAttributeElement}is(e,t=null){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof en))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this.isAllowedInsideAttributeElement!=e.isAllowedInsideAttributeElement)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e=!1){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new go(...e);let i=this.parent;for(;i;){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==i?"":" "+i)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._isAllowedInsideAttributeElement=this.isAllowedInsideAttributeElement,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){if("string"==typeof t)return[new uo(e,t)];Ji(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new uo(e,t):t instanceof ho?new uo(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){t=String(t),this._fireChange("attributes",this),"class"==e?tn(this._classes,t):"style"==e?this._styles.setTo(t):this._attrs.set(e,t)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of eo(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of eo(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of eo(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function tn(e,t){const i=t.split(/\s+/);e.clear(),i.forEach(t=>e.add(t))}class on extends en{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=nn}is(e,t=null){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}}function nn(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}class rn extends on{constructor(e,t,i,o){super(e,t,i,o),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}is(e,t=null){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}destroy(){this.stopListening()}}Ke(rn,Ue);const sn=Symbol("rootName");class an extends rn{constructor(e,t){super(e,t),this.rootName="main"}is(e,t=null){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}get rootName(){return this.getCustomProperty(sn)}set rootName(e){this._setCustomProperty(sn,e)}set _name(e){this.name=e}}class ln{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new l.a("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new l.a("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=cn._createAt(e.startPosition):this.position=cn._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(e){let t,i,o;do{o=this.position,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this.position=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&e.offset===i.childCount)return{done:!0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let o;if(i instanceof uo){if(e.isAtEnd)return this.position=cn._createAfter(i),this._next();o=i.data[e.offset]}else o=i.getChild(e.offset);if(o instanceof en)return this.shallow?e.offset++:e=new cn(o,0),this.position=e,this._formatReturnValue("elementStart",o,t,e,1);if(o instanceof uo){if(this.singleCharacters)return e=new cn(o,0),this.position=e,this._next();{let i,n=o.data.length;return o==this._boundaryEndParent?(n=this.boundaries.end.offset,i=new ho(o,0,n),e=cn._createAfter(i)):(i=new ho(o,0,o.data.length),e.offset++),this.position=e,this._formatReturnValue("text",i,t,e,n)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{o=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset}const n=new ho(i,e.offset,o);return e.offset+=o,this.position=e,this._formatReturnValue("text",n,t,e,o)}return e=cn._createAfter(i),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&0===e.offset)return{done:!0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let o;if(i instanceof uo){if(e.isAtStart)return this.position=cn._createBefore(i),this._previous();o=i.data[e.offset-1]}else o=i.getChild(e.offset-1);if(o instanceof en)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",o,t,e,1)):(e=new cn(o,o.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",o,t,e));if(o instanceof uo){if(this.singleCharacters)return e=new cn(o,o.data.length),this.position=e,this._previous();{let i,n=o.data.length;if(o==this._boundaryStartParent){const t=this.boundaries.start.offset;i=new ho(o,t,o.data.length-t),n=i.data.length,e=cn._createBefore(i)}else i=new ho(o,0,o.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",i,t,e,n)}}if("string"==typeof o){let o;if(this.singleCharacters)o=1;else{const t=i===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-t}e.offset-=o;const n=new ho(i,e.offset,o);return this.position=e,this._formatReturnValue("text",n,t,e,o)}return e=cn._createBefore(i),this.position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,o,n){return t instanceof ho&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?i=cn._createAfter(t.textNode):(o=cn._createAfter(t.textNode),this.position=o)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?i=cn._createBefore(t.textNode):(o=cn._createBefore(t.textNode),this.position=o))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:o,length:n}}}}class cn{constructor(e,t){this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof rn);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=cn._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new ln(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let o=0;for(;t[o]==i[o]&&t[o];)o++;return 0===o?null:t[o-1]}is(e){return"position"===e||"view:position"===e}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const o=ao(t,i);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]<i[o]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new ln(e)}clone(){return new cn(this.parent,this.offset)}static _createAt(e,t){if(e instanceof cn)return new this(e.parent,e.offset);{const i=e;if("end"==t)t=i.is("$text")?i.data.length:i.childCount;else{if("before"==t)return this._createBefore(i);if("after"==t)return this._createAfter(i);if(0!==t&&!t)throw new l.a("view-createpositionat-offset-required",i)}return new cn(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new cn(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new l.a("view-position-after-root",e,{root:e});return new cn(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new cn(e.textNode,e.offsetInText);if(!e.parent)throw new l.a("view-position-before-root",e,{root:e});return new cn(e.parent,e.index)}}class dn{constructor(e,t=null){this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new ln({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(un,{direction:"backward"}),t=this.end.getLastMatchingPosition(un);return e.parent.is("$text")&&e.isAtStart&&(e=cn._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=cn._createAfter(t.parent)),new dn(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(un);if(e.isAfter(this.end)||e.isEqual(this.end))return new dn(e,e);let t=this.end.getLastMatchingPosition(un,{direction:"backward"});const i=e.nodeAfter,o=t.nodeBefore;return i&&i.is("$text")&&(e=new cn(i,0)),o&&o.is("$text")&&(t=new cn(o,o.data.length)),new dn(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),o=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&o}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new dn(this.start,e.start)),this.containsPosition(e.end)&&t.push(new dn(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new dn(t,i)}return null}getWalker(e={}){return e.boundaries=this,new ln(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new dn(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ln(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new ln(e);yield t.position;for(const e of t)yield e.nextPosition}is(e){return"range"===e||"view:range"===e}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,o){return new this(new cn(e,t),new cn(i,o))}static _createFromPositionAndShift(e,t){const i=e,o=e.getShiftedBy(t);return t>0?new this(i,o):new this(o,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(cn._createBefore(e),t)}}function un(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function hn(e){let t=0;for(const i of e)t++;return t}class mn{constructor(e=null,t,i){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,i)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const o of e._ranges)if(t.isEqual(o)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=hn(this.getRanges());if(t!=hn(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let i=!1;for(let o of e.getRanges())if(o=o.getTrimmed(),t.start.isEqual(o.start)&&t.end.isEqual(o.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,i){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof mn||e instanceof gn)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof dn)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof cn)this._setRanges([new dn(e)]),this._setFakeOptions(t);else if(e instanceof co){const o=!!i&&!!i.backward;let n;if(void 0===t)throw new l.a("view-selection-setto-required-second-parameter",this);n="in"==t?dn._createIn(e):"on"==t?dn._createOn(e):new dn(cn._createAt(e,t)),this._setRanges([n],o),this._setFakeOptions(i)}else{if(!Ji(e))throw new l.a("view-selection-setto-not-selectable",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new l.a("view-selection-setfocus-no-ranges",this);const i=cn._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==i.compareWith(o)?this._addRange(new dn(i,o),!0):this._addRange(new dn(o,i)),this.fire("change")}is(e){return"selection"===e||"view:selection"===e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof dn))throw new l.a("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new l.a("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new dn(e.start,e.end))}}Ke(mn,u);class gn{constructor(e=null,t,i){this._selection=new mn,this._selection.delegate("change").to(this),this._selection.setTo(e,t,i)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}is(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e}_setTo(e,t,i){this._selection.setTo(e,t,i)}_setFocus(e,t){this._selection.setFocus(e,t)}}Ke(gn,u);class fn extends n{constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const pn=Symbol("bubbling contexts");var bn={fire(e,...t){try{const i=e instanceof n?e:new n(this,e),o=vn(this);if(!o.size)return;if(wn(i,"capturing",this),kn(o,"$capture",i,...t))return i.return;const r=i.startRange||this.selection.getFirstRange(),s=r?r.getContainedElement():null,a=!!s&&Boolean(_n(o,s));let l=s||function(e){if(!e)return null;const t=e.start.parent,i=e.end.parent,o=t.getPath(),n=i.getPath();return o.length>n.length?t:i}(r);if(wn(i,"atTarget",l),!a){if(kn(o,"$text",i,...t))return i.return;wn(i,"bubbling",l)}for(;l;){if(l.is("rootElement")){if(kn(o,"$root",i,...t))return i.return}else if(l.is("element")&&kn(o,l.name,i,...t))return i.return;if(kn(o,l,i,...t))return i.return;l=l.parent,wn(i,"bubbling",l)}return wn(i,"bubbling",this),kn(o,"$document",i,...t),i.return}catch(e){l.a.rethrowUnexpectedError(e,this)}},_addEventListener(e,t,i){const o=eo(i.context||"$document"),n=vn(this);for(const r of o){let o=n.get(r);o||(o=Object.create(u),n.set(r,o)),this.listenTo(o,e,t,i)}},_removeEventListener(e,t){const i=vn(this);for(const o of i.values())this.stopListening(o,e,t)}};function wn(e,t,i){e instanceof fn&&(e._eventPhase=t,e._currentTarget=i)}function kn(e,t,i,...o){const n="string"==typeof t?e.get(t):_n(e,t);return!!n&&(n.fire(i,...o),i.stop.called)}function _n(e,t){for(const[i,o]of e)if("function"==typeof i&&i(t))return o;return null}function vn(e){return e[pn]||(e[pn]=new Map),e[pn]}class yn{constructor(e){this.selection=new gn,this.roots=new Zi({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(t=i(e),t)break}while(t)}}Ke(yn,bn),Ke(yn,Ue);class xn extends en{constructor(e,t,i,o){super(e,t,i,o),this.getFillerOffset=An,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new l.a("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}is(e,t=null){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function An(){if(Cn(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(Cn(e)>1)return null;e=e.parent}return!e||Cn(e)>1?null:this.childCount}function Cn(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}xn.DEFAULT_PRIORITY=10;class Tn extends en{constructor(e,t,i,o){super(e,t,i,o),this._isAllowedInsideAttributeElement=!0,this.getFillerOffset=En}is(e,t=null){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof co||Array.from(t).length>0))throw new l.a("view-emptyelement-cannot-add",[this,t])}}function En(){return null}const Sn=navigator.userAgent.toLowerCase();var Pn={isMac:function(e){return e.indexOf("macintosh")>-1}(Sn),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(Sn),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(Sn),isAndroid:function(e){return e.indexOf("android")>-1}(Sn),isBlink:function(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}(Sn),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const In={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},Mn={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},Nn=function(){const e={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let t=65;t<=90;t++){const i=String.fromCharCode(t);e[i.toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return e}(),Rn=Object.fromEntries(Object.entries(Nn).map(([e,t])=>[t,e.charAt(0).toUpperCase()+e.slice(1)]));function On(e){let t;if("string"==typeof e){if(t=Nn[e.toLowerCase()],!t)throw new l.a("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?Nn.alt:0)+(e.ctrlKey?Nn.ctrl:0)+(e.shiftKey?Nn.shift:0)+(e.metaKey?Nn.cmd:0);return t}function zn(e){return"string"==typeof e&&(e=function(e){return e.split("+").map(e=>e.trim())}(e)),e.map(e=>"string"==typeof e?function(e){if(e.endsWith("!"))return On(e.slice(0,-1));const t=On(e);return Pn.isMac&&t==Nn.ctrl?Nn.cmd:t}(e):e).reduce((e,t)=>t+e,0)}function Vn(e){let t=zn(e);return Object.entries(Pn.isMac?In:Mn).reduce((e,[i,o])=>(0!=(t&Nn[i])&&(t&=~Nn[i],e+=o),e),"")+(t?Rn[t]:"")}function Dn(e,t){const i="ltr"===t;switch(e){case Nn.arrowleft:return i?"left":"right";case Nn.arrowright:return i?"right":"left";case Nn.arrowup:return"up";case Nn.arrowdown:return"down"}}function Ln(e,t){const i=Dn(e,t);return"down"===i||"right"===i}class Bn extends en{constructor(e,t,i,o){super(e,t,i,o),this._isAllowedInsideAttributeElement=!0,this.getFillerOffset=Fn}is(e,t=null){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof co||Array.from(t).length>0))throw new l.a("view-uielement-cannot-add",this)}render(e){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function jn(e){e.document.on("arrowKey",(t,i)=>function(e,t,i){if(t.keyCode==Nn.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),o=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(o||t.shiftKey){const t=e.focusNode,n=e.focusOffset,r=i.domPositionToView(t,n);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(s){const t=i.viewPositionToDom(a);o?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,i,e.domConverter),{priority:"low"})}function Fn(){return null}class Hn extends en{constructor(e,t,i,o){super(e,t,i,o),this._isAllowedInsideAttributeElement=!0,this.getFillerOffset=Un}is(e,t=null){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof co||Array.from(t).length>0))throw new l.a("view-rawelement-cannot-add",[this,t])}}function Un(){return null}class Wn{constructor(e,t){this.document=e,this._children=[],t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"view:documentFragment"===e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){if("string"==typeof t)return[new uo(e,t)];Ji(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new uo(e,t):t instanceof ho?new uo(e,t.data):t)}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}}Ke(Wn,u);class $n{constructor(e){this.document=e,this._cloneGroups=new Map}setSelection(e,t,i){this.document.selection._setTo(e,t,i)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new Wn(this.document,e)}createText(e){return new uo(this.document,e)}createAttributeElement(e,t,i={}){const o=new xn(this.document,e,t);return"number"==typeof i.priority&&(o._priority=i.priority),i.id&&(o._id=i.id),o}createContainerElement(e,t,i={}){const o=new on(this.document,e,t);return void 0!==i.isAllowedInsideAttributeElement&&(o._isAllowedInsideAttributeElement=i.isAllowedInsideAttributeElement),o}createEditableElement(e,t){const i=new rn(this.document,e,t);return i._document=this.document,i}createEmptyElement(e,t,i={}){const o=new Tn(this.document,e,t);return void 0!==i.isAllowedInsideAttributeElement&&(o._isAllowedInsideAttributeElement=i.isAllowedInsideAttributeElement),o}createUIElement(e,t,i,o={}){const n=new Bn(this.document,e,t);return i&&(n.render=i),void 0!==o.isAllowedInsideAttributeElement&&(n._isAllowedInsideAttributeElement=o.isAllowedInsideAttributeElement),n}createRawElement(e,t,i,o={}){const n=new Hn(this.document,e,t);return n.render=i||(()=>{}),void 0!==o.isAllowedInsideAttributeElement&&(n._isAllowedInsideAttributeElement=o.isAllowedInsideAttributeElement),n}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){lt(e)&&void 0===i&&(i=t),i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof cn?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new l.a("view-writer-break-non-container-element",this.document);if(!t.parent)throw new l.a("view-writer-break-root",this.document);if(e.isAtStart)return cn._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(cn._createAfter(t),i);const o=new dn(e,cn._createAt(t,"end")),n=new cn(i,0);this.move(o,n)}return cn._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&0===i.childCount){const e=i.parent,t=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new cn(e,t))}const o=i.getChild(t-1),n=i.getChild(t);if(!o||!n)return e;if(o.is("$text")&&n.is("$text"))return Qn(o,n);if(o.is("attributeElement")&&n.is("attributeElement")&&o.isSimilar(n)){const e=o.childCount;return o._appendChild(n.getChildren()),n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new cn(o,e))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!(t&&i&&t.is("containerElement")&&i.is("containerElement")))throw new l.a("view-writer-merge-containers-invalid-position",this.document);const o=t.getChild(t.childCount-1),n=o instanceof uo?cn._createAt(o,"end"):cn._createAt(t,"end");return this.move(dn._createIn(i),cn._createAt(t,"end")),this.remove(dn._createOn(i)),n}insert(e,t){(function e(t,i){for(const o of t){if(!Jn.some(e=>o instanceof e))throw new l.a("view-writer-insert-invalid-node-type",i);o.is("$text")||e(o.getChildren(),i)}})(t=Ji(t)?[...t]:[t],this.document);const i=t.reduce((e,t)=>{const i=e[e.length-1],o=!(t.is("uiElement")&&t.isAllowedInsideAttributeElement);return i&&i.breakAttributes==o?i.nodes.push(t):e.push({breakAttributes:o,nodes:[t]}),e},[]);let o=null,n=e;for(const{nodes:e,breakAttributes:t}of i){const i=this._insertNodes(n,e,t);o||(o=i.start),n=i.end}return o?new dn(o,n):new dn(e)}remove(e){const t=e instanceof dn?e:dn._createOn(e);if(Xn(t,this.document),t.isCollapsed)return new Wn(this.document);const{start:i,end:o}=this._breakAttributesRange(t,!0),n=i.parent,r=o.offset-i.offset,s=n._removeChildren(i.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new Wn(this.document,s)}clear(e,t){Xn(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const o of i){const i=o.item;let n;if(i.is("element")&&t.isSimilar(i))n=dn._createOn(i);else if(!o.nextPosition.isAfter(e.start)&&i.is("$textProxy")){const e=i.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(n=dn._createIn(e))}n&&(n.end.isAfter(e.end)&&(n.end=e.end),n.start.isBefore(e.start)&&(n.start=e.start),this.remove(n))}}move(e,t){let i;if(t.isAfter(e.end)){const o=(t=this._breakAttributes(t,!0)).parent,n=o.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=o.childCount-n}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof xn))throw new l.a("view-writer-wrap-invalid-attribute",this.document);if(Xn(e,this.document),e.isCollapsed){let o=e.start;o.parent.is("element")&&(i=o.parent,!Array.from(i.getChildren()).some(e=>!e.is("uiElement")))&&(o=o.getLastMatchingPosition(e=>e.item.is("uiElement"))),o=this._wrapPosition(o,t);const n=this.document.selection;return n.isCollapsed&&n.getFirstPosition().isEqual(e.start)&&this.setSelection(o),new dn(o)}return this._wrapRange(e,t);var i}unwrap(e,t){if(!(t instanceof xn))throw new l.a("view-writer-unwrap-invalid-attribute",this.document);if(Xn(e,this.document),e.isCollapsed)return e;const{start:i,end:o}=this._breakAttributesRange(e,!0),n=i.parent,r=this._unwrapChildren(n,i.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new dn(s,a)}rename(e,t){const i=new on(this.document,e,t.getAttributes());return this.insert(cn._createAfter(t),i),this.move(dn._createIn(t),cn._createAt(i,0)),this.remove(dn._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return cn._createAt(e,t)}createPositionAfter(e){return cn._createAfter(e)}createPositionBefore(e){return cn._createBefore(e)}createRange(e,t){return new dn(e,t)}createRangeOn(e){return dn._createOn(e)}createRangeIn(e){return dn._createIn(e)}createSelection(e,t,i){return new mn(e,t,i)}_insertNodes(e,t,i){let o,n;if(o=i?qn(e):e.parent.is("$text")?e.parent.parent:e.parent,!o)throw new l.a("view-writer-invalid-position-container",this.document);n=i?this._breakAttributes(e,!0):e.parent.is("$text")?Kn(e):e;const r=o._insertChild(n.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const s=n.getShiftedBy(r),a=this.mergeAttributes(n);a.isEqual(n)||s.offset--;const c=this.mergeAttributes(s);return new dn(a,c)}_wrapChildren(e,t,i,o){let n=t;const r=[];for(;n<i;){const t=e.getChild(n),i=t.is("$text"),s=t.is("attributeElement"),a=t.isAllowedInsideAttributeElement;if(s&&this._wrapAttributeElement(o,t))r.push(new cn(e,n));else if(i||a||s&&Yn(o,t)){const i=o._clone();t._remove(),i._appendChild(t),e._insertChild(n,i),this._addToClonedElementsGroup(i),r.push(new cn(e,n))}else s&&this._wrapChildren(t,0,t.childCount,o);n++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t)continue;this.mergeAttributes(e).isEqual(e)||(s++,i--)}return dn._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,o){let n=t;const r=[];for(;n<i;){const t=e.getChild(n);if(t.is("attributeElement"))if(t.isSimilar(o)){const o=t.getChildren(),s=t.childCount;t._remove(),e._insertChild(n,o),this._removeFromClonedElementsGroup(t),r.push(new cn(e,n),new cn(e,n+s)),n+=s,i+=s-1}else this._unwrapAttributeElement(o,t)?(r.push(new cn(e,n),new cn(e,n+1)),n++):(this._unwrapChildren(t,0,t.childCount,o),n++);else n++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t||e.offset==i)continue;this.mergeAttributes(e).isEqual(e)||(s++,i--)}return dn._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:o}=this._breakAttributesRange(e,!0),n=i.parent,r=this._wrapChildren(n,i.offset,o.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new dn(s,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Gn(e.clone());e.parent.is("$text")&&(e=Kn(e));const i=this.createAttributeElement();i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const o=new dn(e,e.getShiftedBy(1));this.wrap(o,t);const n=new cn(i.parent,i.index);i._remove();const r=n.nodeBefore,s=n.nodeAfter;return r instanceof uo&&s instanceof uo?Qn(r,s):Gn(n)}_wrapAttributeElement(e,t){if(!er(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&(t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t));for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!er(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,o=e.end;if(Xn(e,this.document),e.isCollapsed){const i=this._breakAttributes(e.start,t);return new dn(i,i)}const n=this._breakAttributes(o,t),r=n.parent.childCount,s=this._breakAttributes(i,t);return n.offset+=n.parent.childCount-r,new dn(s,n)}_breakAttributes(e,t=!1){const i=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new l.a("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new l.a("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new l.a("view-writer-cannot-break-raw-element",this.document);if(!t&&o.is("$text")&&Zn(o.parent))return e.clone();if(Zn(o))return e.clone();if(o.is("$text"))return this._breakAttributes(Kn(e),t);if(i==o.childCount){const e=new cn(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===i){const e=new cn(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,n=o._clone();o.parent._insertChild(e,n),this._addToClonedElementsGroup(n);const r=o.childCount-i,s=o._removeChildren(i,r);n._appendChild(s);const a=new cn(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function qn(e){let t=e.parent;for(;!Zn(t);){if(!t)return;t=t.parent}return t}function Yn(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function Gn(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new cn(t,t.data.length);const i=e.nodeAfter;return i&&i.is("$text")?new cn(i,0):e}function Kn(e){if(e.offset==e.parent.data.length)return new cn(e.parent.parent,e.parent.index+1);if(0===e.offset)return new cn(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new uo(e.root.document,t)),new cn(e.parent.parent,e.parent.index+1)}function Qn(e,t){const i=e.data.length;return e._data+=t.data,t._remove(),new cn(e,i)}const Jn=[uo,xn,on,Tn,Hn,Bn];function Zn(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Xn(e,t){const i=qn(e.start),o=qn(e.end);if(!i||!o||i!==o)throw new l.a("view-writer-invalid-range-container",t)}function er(e,t){return null===e.id&&null===t.id}function tr(e){return"[object Text]"==Object.prototype.toString.call(e)}const ir=e=>e.createTextNode(" "),or=e=>{const t=e.createElement("span");return t.dataset.ckeFiller=!0,t.innerHTML=" ",t},nr=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},rr="⁠".repeat(7);function sr(e){return tr(e)&&e.data.substr(0,7)===rr}function ar(e){return 7==e.data.length&&sr(e)}function lr(e){return sr(e)?e.data.slice(7):e.data}function cr(e,t){if(t.keyCode==Nn.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,i=e.getRangeAt(0).startOffset;sr(t)&&i<=7&&e.collapse(t,0)}}}function dr(e,t,i,o=!1){i=i||function(e,t){return e===t},Array.isArray(e)||(e=Array.prototype.slice.call(e)),Array.isArray(t)||(t=Array.prototype.slice.call(t));const n=function(e,t,i){const o=ur(e,t,i);if(-1===o)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const n=hr(e,o),r=hr(t,o),s=ur(n,r,i),a=e.length-s,l=t.length-s;return{firstIndex:o,lastIndexOld:a,lastIndexNew:l}}(e,t,i);return o?function(e,t){const{firstIndex:i,lastIndexOld:o,lastIndexNew:n}=e;if(-1===i)return Array(t).fill("equal");let r=[];i>0&&(r=r.concat(Array(i).fill("equal")));n-i>0&&(r=r.concat(Array(n-i).fill("insert")));o-i>0&&(r=r.concat(Array(o-i).fill("delete")));n<t&&(r=r.concat(Array(t-n).fill("equal")));return r}(n,t.length):function(e,t){const i=[],{firstIndex:o,lastIndexOld:n,lastIndexNew:r}=t;r-o>0&&i.push({index:o,type:"insert",values:e.slice(o,r)});n-o>0&&i.push({index:o+(r-o),type:"delete",howMany:n-o});return i}(t,n)}function ur(e,t,i){for(let o=0;o<Math.max(e.length,t.length);o++)if(void 0===e[o]||void 0===t[o]||!i(e[o],t[o]))return o;return-1}function hr(e,t){return e.slice(t).reverse()}function mr(e,t,i){i=i||function(e,t){return e===t};const o=e.length,n=t.length;if(o>200||n>200||o+n>300)return mr.fastDiff(e,t,i,!0);let r,s;if(n<o){const i=e;e=t,t=i,r="delete",s="insert"}else r="insert",s="delete";const a=e.length,l=t.length,c=l-a,d={},u={};function h(o){const n=(void 0!==u[o-1]?u[o-1]:-1)+1,c=void 0!==u[o+1]?u[o+1]:-1,h=n>c?-1:1;d[o+h]&&(d[o]=d[o+h].slice(0)),d[o]||(d[o]=[]),d[o].push(n>c?r:s);let m=Math.max(n,c),g=m-o;for(;g<a&&m<l&&i(e[g],t[m]);)g++,m++,d[o].push("equal");return m}let m,g=0;do{for(m=-g;m<c;m++)u[m]=h(m);for(m=c+g;m>c;m--)u[m]=h(m);u[c]=h(c),g++}while(u[c]!==l);return d[c].slice(1)}function gr(e,t,i){e.insertBefore(i,e.childNodes[t]||null)}function fr(e){const t=e.parentNode;t&&t.removeChild(e)}function pr(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}mr.fastDiff=dr;class br{constructor(e,t){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=t,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new l.a("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){let e;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(e){const t=this.domConverter.viewPositionToDom(e),i=t.parent.ownerDocument;sr(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=wr(i,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(this.domConverter.mapViewToDom(e).childNodes),o=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),n=this._diffNodeLists(i,o),r=this._findReplaceActions(n,i,o);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const n of r)if("replace"===n){const n=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(n);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,i[r]),fr(o[n]),t.equal++}else t[n]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?cn._createBefore(this.selection.getFirstPosition().parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&tr(t.parent)&&sr(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!sr(e))throw new l.a("view-renderer-filler-was-lost",this);ar(e)?e.parentNode.removeChild(e):e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;if(i===t.getFillerOffset())return!1;const o=e.nodeBefore,n=e.nodeAfter;return!(o instanceof uo||n instanceof uo)}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e),o=this.domConverter.viewToDom(e,i.ownerDocument),n=i.data;let r=o.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=rr+r),n!=r){const e=dr(n,r);for(const t of e)"insert"===t.type?i.insertData(t.index,t.values.join("")):i.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map(e=>e.name),o=e.getAttributeKeys();for(const i of o)t.setAttribute(i,e.getAttribute(i));for(const o of i)e.hasAttribute(o)||t.removeAttribute(o)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;const o=t.inlineFillerPosition,n=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,i.ownerDocument,{bind:!0,inlineFillerPosition:o}));o&&o.parent===e&&wr(i.ownerDocument,r,o.offset);const s=this._diffNodeLists(n,r);let a=0;const l=new Set;for(const e of s)"delete"===e?(l.add(n[a]),fr(n[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(gr(i,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of l)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return mr(e=function(e,t){const i=Array.from(e);if(0==i.length||!t)return i;i[i.length-1]==t&&i.pop();return i}(e,this._fakeSelectionContainer),t,_r.bind(null,this.domConverter))}_findReplaceActions(e,t,i){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let o=[],n=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(i[s.equal+s.insert]):"delete"===a?n.push(t[s.equal+s.delete]):(o=o.concat(mr(n,r,kr).map(e=>"equal"===e?"replace":e)),o.push("equal"),n=[],r=[]),s[a]++;return o.concat(mr(n,r,kr).map(e=>"equal"===e?"replace":e))}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):(this._removeFakeSelection(),this._updateDomSelection(e)))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;i.parentElement&&i.parentElement==e||e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const o=t.getSelection(),n=t.createRange();o.removeAllRanges(),n.selectNodeContents(i),o.addRange(n)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);t.collapse(i.parent,i.offset),t.extend(o.parent,o.offset),Pn.isGecko&&function(e,t){const i=e.parent;if(i.nodeType!=Node.ELEMENT_NODE||e.offset!=i.childNodes.length-1)return;const o=i.childNodes[e.offset];o&&"BR"==o.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(i.anchorNode!==t&&!t.contains(i.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,i=this.domConverter.mapDomToView(t);t&&i&&e.getSelection().removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function wr(e,t,i){const o=t instanceof Array?t:t.childNodes,n=o[i];if(tr(n))return n.data=rr+n.data,n;{const n=e.createTextNode(rr);return Array.isArray(t)?o.splice(i,0,n):gr(t,i,n),n}}function kr(e,t){return pr(e)&&pr(t)&&!tr(e)&&!tr(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function _r(e,t,i){return t===i||(tr(t)&&tr(i)?t.data===i.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(i)))}Ke(br,Ue);var vr={window:window,document:document};function yr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function xr(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const Ar=nr(document),Cr=ir(document),Tr=or(document);class Er{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new go,this._encounteredRawContentDomNodes=new WeakSet}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new mn(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of e.childNodes)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}viewToDom(e,t,i={}){if(e.is("$text")){const i=this._processDataFromViewText(e);return t.createTextNode(i)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let o;if(e.is("documentFragment"))o=t.createDocumentFragment(),i.bind&&this.bindDocumentFragments(o,e);else{if(e.is("uiElement"))return o="$comment"===e.name?t.createComment(e.getCustomProperty("$rawContent")):e.render(t),i.bind&&this.bindElements(o,e),o;o=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(o),i.bind&&this.bindElements(o,e);for(const t of e.getAttributeKeys())o.setAttribute(t,e.getAttribute(t))}if(!1!==i.withChildren)for(const n of this.viewChildrenToDom(e,t,i))o.appendChild(n);return o}}*viewChildrenToDom(e,t,i={}){const o=e.getFillerOffset&&e.getFillerOffset();let n=0;for(const r of e.getChildren())o===n&&(yield this._getBlockFiller(t)),yield this.viewToDom(r,t,i),n++;o===n&&(yield this._getBlockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),o=document.createRange();return o.setStart(t.parent,t.offset),o.setEnd(i.parent,i.offset),o}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let o=e.offset;return sr(i)&&(o+=7),{parent:i,offset:o}}{let i,o,n;if(0===e.offset){if(i=this.mapViewToDom(t),!i)return null;n=i.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!o)return null;i=o.parentNode,n=o.nextSibling}if(tr(n)&&sr(n))return{parent:n,offset:7};return{parent:i,offset:o?yr(o)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e))return null;const i=this.getHostViewElement(e);if(i)return i;if(this.isComment(e)&&t.skipComments)return null;if(tr(e)){if(ar(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new uo(this.document,t)}}{if(this.mapDomToView(e))return this.mapDomToView(e);let i;if(this.isDocumentFragment(e))i=new Wn(this.document),t.bind&&this.bindDocumentFragments(e,i);else{i=this._createViewElement(e,t),t.bind&&this.bindElements(e,i);const o=e.attributes;if(o)for(let e=o.length-1;e>=0;e--)i._setAttribute(o[e].name,o[e].value);if(this._isViewElementWithRawContent(i,t)||this.isComment(e)){const t=this.isComment(e)?e.data:e.innerHTML;return i._setCustomProperty("$rawContent",t),this._encounteredRawContentDomNodes.add(e),i}}if(!1!==t.withChildren)for(const o of this.domChildrenToView(e,t))i._appendChild(o);return i}}*domChildrenToView(e,t={}){for(let i=0;i<e.childNodes.length;i++){const o=e.childNodes[i],n=this.domToView(o,t);null!==n&&(yield n)}}domSelectionToView(e){if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;tr(t)&&(t=t.parentNode);const i=this.fakeSelectionToView(t);if(i)return i}const t=this.isDomSelectionBackward(e),i=[];for(let t=0;t<e.rangeCount;t++){const o=e.getRangeAt(t),n=this.domRangeToView(o);n&&i.push(n)}return new mn(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new dn(t,i):null}domPositionToView(e,t){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,yr(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return cn._createBefore(i);if(tr(e)){if(ar(e))return this.domPositionToView(e.parentNode,yr(e));const i=this.findCorrespondingViewText(e);let o=t;return i?(sr(e)&&(o-=7,o=o<0?0:o),new cn(i,o)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new cn(t,0)}else{const i=e.childNodes[t-1],o=tr(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(o&&o.parent)return new cn(o.parent,o.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(ar(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const e=this.mapDomToView(i);if(e){return e.nextSibling instanceof uo?e.nextSibling:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof uo?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:i}=vr.window,o=[];Sr(t,e=>{const{scrollLeft:t,scrollTop:i}=e;o.push([t,i])}),t.focus(),Sr(t,e=>{const[t,i]=o.shift();e.scrollLeft=t,e.scrollTop=i}),vr.window.scrollTo(e,i)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(e){return e&&e.nodeType==Node.COMMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(Ar):!("BR"!==e.tagName||!Pr(e,this.blockElements)||1!==e.parentNode.childNodes.length)||(e.isEqualNode(Tr)||function(e,t){return e.isEqualNode(Cr)&&Pr(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements))}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=xr(e);for(t.pop();t.length;){const e=t.pop(),i=this._domToViewMapping.get(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return i}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}_getBlockFiller(e){switch(this.blockFillerMode){case"nbsp":return ir(e);case"markedNbsp":return or(e);case"br":return nr(e)}}_isDomSelectionPositionCorrect(e,t){if(tr(e)&&sr(e)&&t<7)return!1;if(this.isElement(e)&&sr(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!i||!i.is("uiElement")&&!i.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return t;if(" "==t.charAt(0)){const i=this._getTouchingInlineViewNode(e,!1);!(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i))&&i||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const i=this._getTouchingInlineViewNode(e,!0),o=i&&i.is("$textProxy")&&" "==i.data.charAt(0);" "!=t.charAt(t.length-2)&&i&&!o||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(function(e,t){return xr(e).some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}(e,this.preElements))return lr(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const i=this._getTouchingInlineDomNode(e,!1),o=this._getTouchingInlineDomNode(e,!0),n=this._checkShouldLeftTrimDomText(e,i),r=this._checkShouldRightTrimDomText(e,o);n&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=lr(new Text(t)),t=t.replace(/ \u00A0/g,"  ");const s=o&&this.isElement(o)&&"BR"!=o.tagName,a=o&&tr(o)&&" "==o.data.charAt(0);return(/( |\u00A0)\u00A0$/.test(t)||!o||s||a)&&(t=t.replace(/\u00A0$/," ")),(n||i&&this.isElement(i)&&"BR"!=i.tagName)&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(this.isElement(t)?"BR"===t.tagName:!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!sr(e)}_getTouchingInlineViewNode(e,t){const i=new ln({startPosition:t?cn._createAfter(e):cn._createBefore(e),direction:t?"forward":"backward"});for(const e of i){if(e.item.is("element")&&this.inlineObjectElements.includes(e.item.name))return e.item;if(e.item.is("containerElement"))return null;if(e.item.is("element","br"))return null;if(e.item.is("$textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const i=t?"firstChild":"lastChild",o=t?"nextSibling":"previousSibling";let n=!0;do{if(!n&&e[i]?e=e[i]:e[o]?(e=e[o],n=!1):(e=e.parentNode,n=!0),!e||this._isBlockElement(e))return null}while(!tr(e)&&"BR"!=e.tagName&&!this._isInlineObjectElement(e));return e}_isBlockElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isInlineObjectElement(e){return this.isElement(e)&&this.inlineObjectElements.includes(e.tagName.toLowerCase())}_createViewElement(e,t){if(this.isComment(e))return new Bn(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new en(this.document,i)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&this._rawContentElementMatcher.match(e)}}function Sr(e,t){for(;e&&e!=vr.document;)t(e),e=e.parentNode}function Pr(e,t){const i=e.parentNode;return i&&i.tagName&&t.includes(i.tagName.toLowerCase())}function Ir(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var Mr=Ve({},u,{listenTo(e,...t){if(pr(e)||Ir(e)){const i=this._getProxyEmitter(e)||new Nr(e);i.attach(...t),e=i}u.listenTo.call(this,e,...t)},stopListening(e,t,i){if(pr(e)||Ir(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}u.stopListening.call(this,e,t,i),e instanceof Nr&&e.detach(t)},_getProxyEmitter(e){return t=this,i=Rr(e),t[c]&&t[c][i]?t[c][i].emitter:null;var t,i}});class Nr{constructor(e){h(this,Rr(e)),this._domNode=e}}function Rr(e){return e["data-ck-expando"]||(e["data-ck-expando"]=s())}Ve(Nr.prototype,u,{attach(e,t,i={}){if(this._domListeners&&this._domListeners[e])return;const o={capture:!!i.useCapture,passive:!!i.usePassive},n=this._createDomListener(e,o);this._domNode.addEventListener(e,n,o),this._domListeners||(this._domListeners={}),this._domListeners[e]=n},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const i=t=>{this.fire(e,t)};return i.removeListener=()=>{this._domNode.removeEventListener(e,i,t),delete this._domListeners[e]},i}});class Or{constructor(e){this.view=e,this.document=e.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}Ke(Or,Mr);var zr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Vr=function(e){return this.__data__.has(e)};function Dr(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new Ft;++t<i;)this.add(e[t])}Dr.prototype.add=Dr.prototype.push=zr,Dr.prototype.has=Vr;var Lr=Dr;var Br=function(e,t){for(var i=-1,o=null==e?0:e.length;++i<o;)if(t(e[i],i,e))return!0;return!1};var jr=function(e,t){return e.has(t)};var Fr=function(e,t,i,o,n,r){var s=1&i,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(e),d=r.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,m=2&i?new Lr:void 0;for(r.set(e,t),r.set(t,e);++u<a;){var g=e[u],f=t[u];if(o)var p=s?o(f,g,u,t,e,r):o(g,f,u,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(m){if(!Br(t,(function(e,t){if(!jr(m,t)&&(g===e||n(g,e,i,o,r)))return m.push(t)}))){h=!1;break}}else if(g!==f&&!n(g,f,i,o,r)){h=!1;break}}return r.delete(e),r.delete(t),h};var Hr=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,o){i[++t]=[o,e]})),i};var Ur=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i},Wr=_?_.prototype:void 0,$r=Wr?Wr.valueOf:void 0;var qr=function(e,t,i,o,n,r,s){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new Ci(e),new Ci(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return G(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Hr;case"[object Set]":var l=1&o;if(a||(a=Ur),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;o|=2,s.set(e,t);var d=Fr(a(e),a(t),o,n,r,s);return s.delete(e),d;case"[object Symbol]":if($r)return $r.call(e)==$r.call(t)}return!1},Yr=Object.prototype.hasOwnProperty;var Gr=function(e,t,i,o,n,r){var s=1&i,a=di(e),l=a.length;if(l!=di(t).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in t:Yr.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var m=!0;r.set(e,t),r.set(t,e);for(var g=s;++c<l;){var f=e[d=a[c]],p=t[d];if(o)var b=s?o(p,f,d,t,e,r):o(f,p,d,e,t,r);if(!(void 0===b?f===p||n(f,p,i,o,r):b)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var w=e.constructor,k=t.constructor;w==k||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(m=!1)}return r.delete(e),r.delete(t),m},Kr=Object.prototype.hasOwnProperty;var Qr=function(e,t,i,o,n,r){var s=_e(e),a=_e(t),l=s?"[object Array]":yi(e),c=a?"[object Array]":yi(t),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),u="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),h=l==c;if(h&&Object(ve.a)(e)){if(!Object(ve.a)(t))return!1;s=!0,d=!1}if(h&&!d)return r||(r=new Wt),s||Ee(e)?Fr(e,t,i,o,n,r):qr(e,t,l,i,o,n,r);if(!(1&i)){var m=d&&Kr.call(e,"__wrapped__"),g=u&&Kr.call(t,"__wrapped__");if(m||g){var f=m?e.value():e,p=g?t.value():t;return r||(r=new Wt),n(f,p,i,o,r)}}return!!h&&(r||(r=new Wt),Gr(e,t,i,o,n,r))};var Jr=function e(t,i,o,n,r){return t===i||(null==t||null==i||!ge(t)&&!ge(i)?t!=t&&i!=i:Qr(t,i,o,n,e,r))};var Zr=function(e,t,i){var o=(i="function"==typeof i?i:void 0)?i(e,t):void 0;return void 0===o?Jr(e,t,void 0,i):!!o};class Xr extends Or{constructor(e){super(e),this._config={childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=[],this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.push(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(0===e.length)return;const t=this.domConverter,i=new Map,o=new Set;for(const i of e)if("childList"===i.type){const e=t.mapDomToView(i.target);if(e&&(e.is("uiElement")||e.is("rawElement")))continue;e&&!this._isBogusBrMutation(i)&&o.add(e)}for(const n of e){const e=t.mapDomToView(n.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===n.type){const e=t.findCorrespondingViewText(n.target);e&&!o.has(e.parent)?i.set(e,{type:"text",oldText:e.data,newText:lr(n.target),node:e}):!e&&sr(n.target)&&o.add(t.mapDomToView(n.target.parentNode))}}const n=[];for(const e of i.values())this.renderer.markToSync("text",e.node),n.push(e);for(const e of o){const i=t.mapViewToDom(e),o=Array.from(e.getChildren()),r=Array.from(t.domChildrenToView(i,{withChildren:!1}));Zr(o,r,a)||(this.renderer.markToSync("children",e),n.push({type:"children",oldChildren:o,newChildren:r,node:e}))}const r=e[0].target.ownerDocument.getSelection();let s=null;if(r&&r.anchorNode){const e=t.domPositionToView(r.anchorNode,r.anchorOffset),i=t.domPositionToView(r.focusNode,r.focusOffset);e&&i&&(s=new mn(e),s.setFocus(i))}function a(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}n.length&&(this.document.fire("mutations",n,s),this.view.forceRender())}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}class es{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Ve(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class ts extends Or{constructor(e){super(e),this.useCapture=!1}observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,i){this.isEnabled&&this.document.fire(e,new es(this.view,t,i))}}class is extends ts{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return On(this)}})}}var os=function(){return k.a.Date.now()},ns=/\s/;var rs=function(e){for(var t=e.length;t--&&ns.test(e.charAt(t)););return t},ss=/^\s+/;var as=function(e){return e?e.slice(0,rs(e)+1).replace(ss,""):e},ls=/^[-+]0x[0-9a-f]+$/i,cs=/^0b[01]+$/i,ds=/^0o[0-7]+$/i,us=parseInt;var hs=function(e){if("number"==typeof e)return e;if(bo(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=as(e);var i=cs.test(e);return i||ds.test(e)?us(e.slice(2),i?2:8):ls.test(e)?NaN:+e},ms=Math.max,gs=Math.min;var fs=function(e,t,i){var o,n,r,s,a,l,c=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var i=o,r=n;return o=n=void 0,c=t,s=e.apply(r,i)}function g(e){return c=e,a=setTimeout(p,t),d?m(e):s}function f(e){var i=e-l;return void 0===l||i>=t||i<0||u&&e-c>=r}function p(){var e=os();if(f(e))return b(e);a=setTimeout(p,function(e){var i=t-(e-l);return u?gs(i,r-(e-c)):i}(e))}function b(e){return a=void 0,h&&o?m(e):(o=n=void 0,s)}function k(){var e=os(),i=f(e);if(o=arguments,n=this,l=e,i){if(void 0===a)return g(l);if(u)return clearTimeout(a),a=setTimeout(p,t),m(l)}return void 0===a&&(a=setTimeout(p,t)),s}return t=hs(t)||0,w(i)&&(d=!!i.leading,r=(u="maxWait"in i)?ms(hs(i.maxWait)||0,t):r,h="trailing"in i?!!i.trailing:h),k.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=n=a=void 0},k.flush=function(){return void 0===a?s:b(os())},k};class ps extends Or{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=fs(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new mn(t.getRanges(),{backward:t.isBackward,fake:!1});e!=Nn.arrowleft&&e!=Nn.arrowup||i.setTo(i.getFirstPosition()),e!=Nn.arrowright&&e!=Nn.arrowdown||i.setTo(i.getLastPosition());const o={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}class bs extends Or{constructor(e){super(e),this.mutationObserver=e.getObserver(Xr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=fs(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument;this._documents.has(t)||(this.listenTo(t,"selectionchange",(e,i)=>{this._handleSelectionChange(i,t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e,t){if(!this.isEnabled)return;const i=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(i.anchorNode))return;this.mutationObserver.flush();const o=this.domConverter.domSelectionToView(i);if(0!=o.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(o)&&this.domConverter.isDomSelectionCorrect(i)||++this._loopbackCounter>60))if(this.selection.isSimilar(o))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:o,domSelection:i};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class ws extends ts{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{t.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.change(()=>{}),50)}),t.on("blur",(i,o)=>{const n=t.selection.editableElement;null!==n&&n!==o.target||(t.isFocused=!1,e.change(()=>{}))})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class ks extends ts{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}class _s extends ts{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}class vs{constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach(({element:e,newElement:t})=>{e.style.display="",t&&t.remove()}),this._replacedElements=[]}}var ys=function(e){return"string"==typeof e||!_e(e)&&ge(e)&&"[object String]"==P(e)};function xs(e){return"[object Range]"==Object.prototype.toString.apply(e)}function As(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}const Cs=["top","right","bottom","left","width","height"];class Ts{constructor(e){const t=xs(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),Yi(e)||t)if(t){const t=Ts.getDomRangeRects(e);Es(this,Ts.getBoundingRect(t))}else Es(this,e.getBoundingClientRect());else if(Ir(e)){const{innerWidth:t,innerHeight:i}=e;Es(this,{top:0,right:t,bottom:i,left:0,width:t,height:i})}else Es(this,e)}clone(){return new Ts(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left)};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new Ts(t)}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(!Ss(e)){let i=e.parentNode||e.commonAncestorContainer;for(;i&&!Ss(i);){const e=new Ts(i),o=t.getIntersection(e);if(!o)return null;o.getArea()<t.getArea()&&(t=o),i=i.parentNode}}return t}isEqual(e){for(const t of Cs)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}excludeScrollbarsAndBorders(){const e=this._source;let t,i,o;if(Ir(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,o=e.getComputedStyle(e.document.documentElement).direction;else{const n=As(this._source);t=e.offsetWidth-e.clientWidth-n.left-n.right,i=e.offsetHeight-e.clientHeight-n.top-n.bottom,o=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=n.left,this.top+=n.top,this.right-=n.right,this.bottom-=n.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===o?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const e of i)t.push(new Ts(e));else{let i=e.startContainer;tr(i)&&(i=i.parentNode);const o=new Ts(i.getBoundingClientRect());o.right=o.left,o.width=0,t.push(o)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY};let i=0;for(const o of e)i++,t.left=Math.min(t.left,o.left),t.top=Math.min(t.top,o.top),t.right=Math.max(t.right,o.right),t.bottom=Math.max(t.bottom,o.bottom);return 0==i?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new Ts(t))}}function Es(e,t){for(const i of Cs)e[i]=t[i]}function Ss(e){return!!Yi(e)&&e===e.ownerDocument.body}class Ps{constructor(e,t){Ps._observerInstance||Ps._createObserver(),this._element=e,this._callback=t,Ps._addElementCallback(e,t),Ps._observerInstance.observe(e)}destroy(){Ps._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Ps._elementCallbacks||(Ps._elementCallbacks=new Map);let i=Ps._elementCallbacks.get(e);i||(i=new Set,Ps._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=Ps._getElementCallbacks(e);i&&(i.delete(t),i.size||(Ps._elementCallbacks.delete(e),Ps._observerInstance.unobserve(e))),Ps._elementCallbacks&&!Ps._elementCallbacks.size&&(Ps._observerInstance=null,Ps._elementCallbacks=null)}static _getElementCallbacks(e){return Ps._elementCallbacks?Ps._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof vr.window.ResizeObserver?vr.window.ResizeObserver:Is,Ps._observerInstance=new e(e=>{for(const t of e){const e=Ps._getElementCallbacks(t.target);if(e)for(const i of e)i(t)}})}}Ps._observerInstance=null,Ps._elementCallbacks=null;class Is{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(vr.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),this._periodicCheckTimeout=setTimeout(e,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const t of this._elements)this._hasRectChanged(t)&&e.push({target:t,contentRect:this._previousRects.get(t)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const t=new Ts(e),i=this._previousRects.get(e),o=!i||!i.isEqual(t);return this._previousRects.set(e,t),o}}function Ms(e){return t=>t+e}function Ns(e){const t=e.next();return t.done?null:t.value}Ke(Is,Mr);class Rs{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(e){if(this._elements.has(e))throw new l.a("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(e),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}Ke(Rs,Mr),Ke(Rs,Ue);class Os{constructor(){this._listener=Object.create(Mr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+On(t),t)})}set(e,t,i={}){const o=zn(e),n=i.priority;this._listener.listenTo(this._listener,"_keydown:"+o,(e,i)=>{t(i,()=>{i.preventDefault(),i.stopPropagation(),e.stop()}),e.return=!0},{priority:n})}press(e){return!!this._listener.fire("_keydown:"+On(e),e)}destroy(){this._listener.stopListening()}}class zs extends Or{constructor(e){super(e),this.document.on("keydown",(e,t)=>{if(this.isEnabled&&((i=t.keyCode)==Nn.arrowright||i==Nn.arrowleft||i==Nn.arrowup||i==Nn.arrowdown)){const i=new fn(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(i,t),i.stop.called&&e.stop()}var i})}observe(){}}function Vs({target:e,viewportOffset:t=0}){const i=Us(e);let o=i,n=null;for(;o;){let r;r=Ws(o==i?e:n),Ls(r,()=>$s(e,o));const s=$s(e,o);if(Ds(o,s,t),o.parent!=o){if(n=o.frameElement,o=o.parent,!n)return}else o=null}}function Ds(e,t,i){const o=t.clone().moveBy(0,i),n=t.clone().moveBy(0,-i),r=new Ts(e).excludeScrollbarsAndBorders();if(![n,o].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;js(n,r)?a-=r.top-t.top+i:Bs(o,r)&&(a+=t.bottom-r.bottom+i),Fs(t,r)?s-=r.left-t.left+i:Hs(t,r)&&(s+=t.right-r.right+i),e.scrollTo(s,a)}}function Ls(e,t){const i=Us(e);let o,n;for(;e!=i.document.body;)n=t(),o=new Ts(e).excludeScrollbarsAndBorders(),o.contains(n)||(js(n,o)?e.scrollTop-=o.top-n.top:Bs(n,o)&&(e.scrollTop+=n.bottom-o.bottom),Fs(n,o)?e.scrollLeft-=o.left-n.left:Hs(n,o)&&(e.scrollLeft+=n.right-o.right)),e=e.parentNode}function Bs(e,t){return e.bottom>t.bottom}function js(e,t){return e.top<t.top}function Fs(e,t){return e.left<t.left}function Hs(e,t){return e.right>t.right}function Us(e){return xs(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function Ws(e){if(xs(e)){let t=e.commonAncestorContainer;return tr(t)&&(t=t.parentNode),t}return e.parentNode}function $s(e,t){const i=Us(e),o=new Ts(e);if(i===t)return o;{let e=i;for(;e!=t;){const t=e.frameElement,i=new Ts(t).excludeScrollbarsAndBorders();o.moveBy(i.left,i.top),e=e.parent}}return o}Object.assign({},{scrollViewportToShowTarget:Vs,scrollAncestorsToShowTarget:function(e){Ls(Ws(e),()=>new Ts(e))}});class qs{constructor(e){this.document=new yn(e),this.domConverter=new Er(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new br(this.domConverter,this.document.selection),this._renderer.bind("isFocused").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new $n(this.document),this.addObserver(Xr),this.addObserver(bs),this.addObserver(ws),this.addObserver(is),this.addObserver(ps),this.addObserver(ks),this.addObserver(zs),Pn.isAndroid&&this.addObserver(_s),this.document.on("arrowKey",cr,{priority:"low"}),jn(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0}),this.listenTo(this.document,"change:isFocused",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const o={};for(const{name:t,value:n}of Array.from(e.attributes))o[t]=n,"class"===t?this._writer.addClass(n.split(" "),i):this._writer.setAttribute(t,n,i);this._initialDomRootAttributes.set(e,o);const n=()=>{this._writer.setAttribute("contenteditable",!i.isReadOnly,i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};n(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),i.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),i.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),i.on("change:isReadOnly",()=>this.change(n)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const i of this._observers.values())i.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const i=this._initialDomRootAttributes.get(t);for(const e in i)t.setAttribute(e,i[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,i]of this.domRoots)t.observe(i,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection(){const e=this.document.selection.getFirstRange();e&&Vs({target:this.domConverter.viewRangeToDom(e),viewportOffset:20})}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new l.a("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){l.a.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return cn._createAt(e,t)}createPositionAfter(e){return cn._createAfter(e)}createPositionBefore(e){return cn._createBefore(e)}createRange(e,t){return new dn(e,t)}createRangeOn(e){return dn._createOn(e)}createRangeIn(e){return dn._createIn(e)}createSelection(e,t,i){return new mn(e,t,i)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}Ke(qs,Ue);class Ys{constructor(e){this.parent=null,this._attrs=mo(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new l.a("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new l.a("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),o=e.getAncestors(t);let n=0;for(;i[n]==o[n]&&i[n];)n++;return 0===n?null:i[n-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=ao(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((e,t)=>(e[t[0]]=t[1],e),{})),e}is(e){return"node"===e||"model:node"===e}_clone(){return new Ys(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=mo(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class Gs extends Ys{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new Gs(this.data,this.getAttributes())}static fromJSON(e){return new Gs(e.data,e.attributes)}}class Ks{constructor(e,t,i){if(this.textNode=e,t<0||t>e.offsetSize)throw new l.a("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new l.a("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}is(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}class Qs{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce((e,t)=>e+t.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new l.a("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new l.a("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const e of t)if(!(e instanceof Ys))throw new l.a("model-nodelist-insertnodes-not-node",this);this._nodes.splice(e,0,...t)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}class Js extends Ys{constructor(e,t,i){super(t),this.name=e,this._children=new Qs,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,t=null){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={includeSelf:!1}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(e=>e._clone(!0)):null;return new Js(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){if("string"==typeof e)return[new Gs(e)];Ji(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new Gs(e):e instanceof Ks?new Gs(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}static fromJSON(e){let t=null;if(e.children){t=[];for(const i of e.children)i.name?t.push(Js.fromJSON(i)):t.push(Gs.fromJSON(i))}return new Js(e.name,e.attributes,t)}}class Zs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new l.a("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new l.a("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this.position=e.startPosition.clone():this.position=ea._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}skip(e){let t,i,o,n;do{o=this.position,n=this._visitedParent,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this.position=o,this._visitedParent=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&t.offset===i.maxOffset)return{done:!0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const o=t.parent,n=ta(t,o),r=n||ia(t,o,n);if(r instanceof Js)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,Xs("elementStart",r,e,t,1);if(r instanceof Gs){let o;if(this.singleCharacters)o=1;else{let e=r.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),o=e-t.offset}const n=t.offset-r.startOffset,s=new Ks(r,n,o);return t.offset+=o,this.position=t,Xs("text",s,e,t,o)}return t.path.pop(),t.offset++,this.position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():Xs("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&0===t.offset)return{done:!0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};const o=t.parent,n=ta(t,o),r=n||oa(t,o,n);if(r instanceof Js)return t.offset--,this.shallow?(this.position=t,Xs("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this.position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():Xs("elementEnd",r,e,t));if(r instanceof Gs){let o;if(this.singleCharacters)o=1;else{let e=r.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),o=t.offset-e}const n=t.offset-r.startOffset,s=new Ks(r,n-o,o);return t.offset-=o,this.position=t,Xs("text",s,e,t,o)}return t.path.pop(),this.position=t,this._visitedParent=i.parent,Xs("elementStart",i,e,t,1)}}function Xs(e,t,i,o,n){return{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:o,length:n}}}class ea{constructor(e,t,i="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new l.a("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new l.a("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new l.a("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new l.a("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return ta(this,this.parent)}get nodeAfter(){const e=this.parent;return ia(this,e,ta(this,e))}get nodeBefore(){const e=this.parent;return oa(this,e,ta(this,e))}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=ao(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new Zs(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=ao(this.path,e.path),i="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let o=0;for(;t[o]==i[o]&&t[o];)o++;return 0===o?null:t[o-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){let t=null,i=null;switch(this.compareWith(e)){case"same":return!0;case"before":t=ea._createAt(this),i=ea._createAt(e);break;case"after":t=ea._createAt(e),i=ea._createAt(this);break;default:return!1}let o=t.parent;for(;t.path.length+i.path.length;){if(t.isEqual(i))return!0;if(t.path.length>i.path.length){if(t.offset!==o.maxOffset)return!1;t.path=t.path.slice(0,-1),o=o.parent,t.offset++}else{if(0!==i.offset)return!1;i.path=i.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==ao(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=ea._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let i;return t.containsPosition(this)||t.start.isEqual(this)?(i=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(i=i._getTransformedByDeletion(e.deletionPosition,1))):i=this.isEqual(e.deletionPosition)?ea._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),i}_getTransformedByDeletion(e,t){const i=ea._createAt(this);if(this.root!=e.root)return i;if("same"==ao(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if("prefix"==ao(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;if(e.offset<=this.path[o]){if(e.offset+t>this.path[o])return null;i.path[o]-=t}}return i}_getTransformedByInsertion(e,t){const i=ea._createAt(this);if(this.root!=e.root)return i;if("same"==ao(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(i.offset+=t);else if("prefix"==ao(e.getParentPath(),this.getParentPath())){const o=e.path.length-1;e.offset<=this.path[o]&&(i.path[o]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return ea._createAt(this);const o=this._getTransformedByDeletion(e,i);return null===o||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(i).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):o._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,o=ea._createAt(t);return o.stickiness=this.stickiness,o.offset=o.offset+this.path[i]-e.offset,o.path=[...o.path,...this.path.slice(i+1)],o}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof ea)return new ea(e.root,e.path,e.stickiness);{const o=e;if("end"==t)t=o.maxOffset;else{if("before"==t)return this._createBefore(o,i);if("after"==t)return this._createAfter(o,i);if(0!==t&&!t)throw new l.a("model-createpositionat-offset-required",[this,e])}if(!o.is("element")&&!o.is("documentFragment"))throw new l.a("model-position-parent-incorrect",[this,e]);const n=o.getPath();return n.push(t),new this(o.root,n,i)}}static _createAfter(e,t){if(!e.parent)throw new l.a("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new l.a("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const i=new ea(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new l.a("model-position-fromjson-no-root",t,{rootName:e.root});return new ea(t.getRoot(e.root),e.path,e.stickiness)}}function ta(e,t){const i=t.getChild(t.offsetToIndex(e.offset));return i&&i.is("$text")&&i.startOffset<e.offset?i:null}function ia(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset))}function oa(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset)-1)}class na{constructor(e,t=null){this.start=ea._createAt(e),this.end=t?ea._createAt(t):ea._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new Zs({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==ao(this.start.getParentPath(),this.end.getParentPath())}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),o=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&o}containsItem(e){const t=ea._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}is(e){return"range"===e||"model:range"===e}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new na(this.start,e.start)),this.containsPosition(e.end)&&t.push(new na(e.end,this.end))):t.push(new na(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new na(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(i=this.start.isBefore(e.start)?t?this.end.isTouching(e.start):this.end.isEqual(e.start):t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let o=this.start,n=this.end;return e.start.isBefore(o)&&(o=e.start),e.end.isAfter(n)&&(n=e.end),new na(o,n)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=ea._createAt(this.start);let o=i.parent;for(;i.path.length>t+1;){const t=o.maxOffset-i.offset;0!==t&&e.push(new na(i,i.getShiftedBy(t))),i.path=i.path.slice(0,-1),i.offset++,o=o.parent}for(;i.path.length<=this.end.path.length;){const t=this.end.path[i.path.length-1],o=t-i.offset;0!==o&&e.push(new na(i,i.getShiftedBy(o))),i.offset=t,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Zs(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Zs(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Zs(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new na(this.start,this.end)]}getTransformedByOperations(e){const t=[new na(this.start,this.end)];for(const i of e)for(let e=0;e<t.length;e++){const o=t[e].getTransformedByOperation(i);t.splice(e,1,...o),e+=o.length-1}for(let e=0;e<t.length;e++){const i=t[e];for(let o=e+1;o<t.length;o++){const e=t[o];(i.containsRange(e)||e.containsRange(i)||i.isEqual(e))&&t.splice(o,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,o=e.howMany,n=e.targetPosition;return this._getTransformedByMove(i,n,o,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new na(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new na(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=ea._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new na(t,i)):new na(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new na(this.start,e),new na(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new na(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,i,o=!1){if(this.isCollapsed){const o=this.start._getTransformedByMove(e,t,i);return[new na(o)]}const n=na._createFromPositionAndShift(e,i),r=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!o&&(n.containsPosition(this.start)||n.containsPosition(this.end))){const o=this.start._getTransformedByMove(e,t,i),n=this.end._getTransformedByMove(e,t,i);return[new na(o,n)]}let s;const a=this.getDifference(n);let l=null;const c=this.getIntersection(n);if(1==a.length?l=new na(a[0].start._getTransformedByDeletion(e,i),a[0].end._getTransformedByDeletion(e,i)):2==a.length&&(l=new na(this.start,this.end._getTransformedByDeletion(e,i))),s=l?l._getTransformedByInsertion(r,i,null!==c||o):[],c){const e=new na(c.start._getCombined(n.start,r),c.end._getCombined(n.start,r));2==s.length?s.splice(1,0,e):s.push(e)}return s}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),o=this.end._getTransformedByDeletion(e,t);return null==i&&null==o?null:(null==i&&(i=e),null==o&&(o=e),new na(i,o))}static _createFromPositionAndShift(e,t){const i=e,o=e.getShiftedBy(t);return t>0?new this(i,o):new this(o,i)}static _createIn(e){return new this(ea._createAt(e,0),ea._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(ea._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new l.a("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);const i=e.indexOf(t),o=new this(t.start,t.end);if(i>0)for(let t=i-1;e[t].end.isEqual(o.start);t++)o.start=ea._createAt(e[t].start);for(let t=i+1;t<e.length&&e[t].start.isEqual(o.end);t++)o.end=ea._createAt(e[t].end);return o}static fromJSON(e,t){return new this(ea.fromJSON(e.start,t),ea.fromJSON(e.end,t))}}class ra{constructor(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),o=this._viewToModelMapping.get(i),n=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=ea._createAt(o,n)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e){const t=this.toModelElement(e);if(this._viewToModelMapping.delete(e),this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);this._modelToViewMapping.get(t)==e&&this._modelToViewMapping.delete(t)}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const o=this._elementToMarkerNames.get(e)||new Set;o.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,o)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),0==i.size&&this._markerNameToElements.delete(t));const o=this._elementToMarkerNames.get(e);o&&(o.delete(t),0==o.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new na(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new dn(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={isPhantom:!1}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())i.add(t);else i.add(e);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e){return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let o=0;for(let i=0;i<t;i++)o+=this.getModelLength(e.getChild(i));return o}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name)){return this._viewToModelLengthCallbacks.get(e.name)(e)}if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,o=0,n=0,r=0;if(e.is("$text"))return new cn(e,t);for(;n<t;)i=e.getChild(r),o=this.getModelLength(i),n+=o,r++;return n==t?this._moveViewPositionToTextNode(new cn(e,r)):this.findPositionIn(i,t-(n-o))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof uo?new cn(t,t.data.length):i instanceof uo?new cn(i,0):e}}Ke(ra,u);class sa{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=aa(t),e instanceof Ks&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=aa(t),e instanceof Ks&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=aa(t),e instanceof Ks&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(void 0===i)return null;const o=i.get(t);return void 0===o?null:o}revert(e,t){t=aa(t),e instanceof Ks&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return!1===i?(this._consumable.get(e).set(t,!0),!0):!0!==i&&null}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const o=i.get(e.endOffset);o&&(t=o.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e.startOffset,e.endOffset,e.parent)),t}_addSymbolForTextProxy(e,t,i){const o=Symbol("textProxySymbol");let n,r;return n=this._textProxyRegistry.get(e),n||(n=new Map,this._textProxyRegistry.set(e,n)),r=n.get(t),r||(r=new Map,n.set(t,r)),r.set(i,o),o}}function aa(e){const t=e.split(":");return"addMarker"==t[0]||"removeMarker"==t[0]?e:t.length>1?t[0]+":"+t[1]:t[0]}class la{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e),this._reconversionEventsMapping=new Map}convertChanges(e,t,i){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,i);const o=this._mapChangesWithAutomaticReconversion(e);for(const e of o)"insert"===e.type?this.convertInsert(na._createFromPositionAndShift(e.position,e.length),i):"remove"===e.type?this.convertRemove(e.position,e.length,e.name,i):"reconvert"===e.type?this.reconvertElement(e.element,i):this.convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,i);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const o=t.get(e).getRange();this.convertMarkerRemove(e,o,i),this.convertMarkerAdd(e,o,i)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,i)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of Array.from(e).map(da))this._convertInsertWithAttributes(t);this._clearConversionApi()}convertRemove(e,t,i,o){this.conversionApi.writer=o,this.fire("remove:"+i,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,i,o,n){this.conversionApi.writer=n,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const n of e){const e={item:n.item,range:na._createFromPositionAndShift(n.previousPosition,n.length),attributeKey:t,attributeOldValue:i,attributeNewValue:o};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}reconvertElement(e,t){const i=na._createOn(e);this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(i);const o=this.conversionApi.mapper,n=o.toViewElement(e);t.remove(n),this._convertInsertWithAttributes({item:e,range:i});const r=o.toViewElement(e);for(const i of na._createIn(e)){const{item:e}=i,n=ua(e,o);n?n.root!==r.root&&t.move(t.createRangeOn(n),o.toViewPosition(ea._createBefore(e))):this._convertInsertWithAttributes(da(i))}o.unbindViewElement(n),this._clearConversionApi()}convertSelection(e,t,i){const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=i,this.conversionApi.consumable=this._createSelectionConsumable(e,o),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of o){const i=t.getRange();if(!ca(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const o={item:e,markerName:t.name,markerRange:i};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,o,this.conversionApi)}for(const t of e.getAttributeKeys()){const i={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+i.attributeKey)&&this.fire("attribute:"+i.attributeKey+":$text",i,this.conversionApi)}this._clearConversionApi()}else this._clearConversionApi()}convertMarkerAdd(e,t,i){if("$graveyard"==t.root.rootName)return;this.conversionApi.writer=i;const o="addMarker:"+e,n=new sa;if(n.add(t,o),this.conversionApi.consumable=n,this.fire(o,{markerName:e,markerRange:t},this.conversionApi),n.test(t,o)){this.conversionApi.consumable=this._createConsumableForRange(t,o);for(const i of t.getItems()){if(!this.conversionApi.consumable.test(i,o))continue;const n={item:i,range:na._createOn(i),markerName:e,markerRange:t};this.fire(o,n,this.conversionApi)}this._clearConversionApi()}else this._clearConversionApi()}convertMarkerRemove(e,t,i){"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=i,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_mapReconversionTriggerEvent(e,t){this._reconversionEventsMapping.set(t,e)}_createInsertConsumable(e){const t=new sa;for(const i of e){const e=i.item;t.add(e,"insert");for(const i of e.getAttributeKeys())t.add(e,"attribute:"+i)}return t}_createConsumableForRange(e,t){const i=new sa;for(const o of e.getItems())i.add(o,t);return i}_createSelectionConsumable(e,t){const i=new sa;i.add(e,"selection");for(const o of t)i.add(e,"addMarker:"+o.name);for(const t of e.getAttributeKeys())i.add(e,"attribute:"+t);return i}_testAndFire(e,t){this.conversionApi.consumable.test(t.item,e)&&this.fire(function(e,t){const i=t.item.name||"$text";return`${e}:${i}`}(e,t),t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}_convertInsertWithAttributes(e){this._testAndFire("insert",e);for(const t of e.item.getAttributeKeys())e.attributeKey=t,e.attributeOldValue=null,e.attributeNewValue=e.item.getAttribute(t),this._testAndFire("attribute:"+t,e)}_mapChangesWithAutomaticReconversion(e){const t=new Set,i=[];for(const o of e.getChanges()){const e=o.position||o.range.start,n=e.parent;if(ta(e,n)){i.push(o);continue}const r="attribute"===o.type?ia(e,n,null):n;if(r.is("$text")){i.push(o);continue}let s;if(s="attribute"===o.type?`attribute:${o.attributeKey}:${r.name}`:`${o.type}:${o.name}`,this._isReconvertTriggerEvent(s,r.name)){if(t.has(r))continue;t.add(r),i.push({type:"reconvert",element:r})}else i.push(o)}return i}_isReconvertTriggerEvent(e,t){return this._reconversionEventsMapping.get(e)===t}}function ca(e,t,i){const o=t.getRange(),n=Array.from(e.getAncestors());n.shift(),n.reverse();return!n.some(e=>{if(o.containsItem(e)){return!!i.toViewElement(e).getCustomProperty("addHighlight")}})}function da(e){return{item:e.item,range:na._createFromPositionAndShift(e.previousPosition,e.length)}}function ua(e,t){if(e.is("textProxy")){const i=t.toViewPosition(ea._createBefore(e)).parent;return i.is("$text")?i:null}return t.toViewElement(e)}Ke(la,u);class ha{constructor(e,t,i){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,i)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const o of e._ranges)if(t.isEqual(o)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new na(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new na(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new na(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(e,t,i){if(null===e)this._setRanges([]);else if(e instanceof ha)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof na)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof ea)this._setRanges([new na(e)]);else if(e instanceof Ys){const o=!!i&&!!i.backward;let n;if("in"==t)n=na._createIn(e);else if("on"==t)n=na._createOn(e);else{if(void 0===t)throw new l.a("model-selection-setto-required-second-parameter",[this,e]);n=new na(ea._createAt(e,t))}this._setRanges([n],o)}else{if(!Ji(e))throw new l.a("model-selection-setto-not-selectable",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const i=(e=Array.from(e)).some(t=>{if(!(t instanceof na))throw new l.a("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||i){this._removeAllRanges();for(const t of e)this._pushRange(t);this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0})}}setFocus(e,t){if(null===this.anchor)throw new l.a("model-selection-setfocus-no-ranges",[this,e]);const i=ea._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==i.compareWith(o)?(this._pushRange(new na(i,o)),this._lastRangeBackward=!0):(this._pushRange(new na(o,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}is(e){return"selection"===e||"model:selection"===e}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=fa(t.start,e);i&&pa(i,t)&&(yield i);for(const i of t.getWalker()){const o=i.item;"elementEnd"==i.type&&ga(o,e,t)&&(yield o)}const o=fa(t.end,e);o&&!t.end.isTouching(ea._createAt(o,0))&&pa(o,t)&&(yield o)}}containsEntireContent(e=this.anchor.root){const t=ea._createAt(e,0),i=ea._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new na(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new l.a("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function ma(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function ga(e,t,i){return ma(e,t)&&pa(e,i)}function fa(e,t){const i=e.parent.root.document.model.schema,o=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let n=!1;const r=o.find(e=>!n&&(n=i.isLimit(e),!n&&ma(e,t)));return o.forEach(e=>t.add(e)),r}function pa(e,t){const i=function(e){const t=e.root.document.model.schema;let i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent}}(e);if(!i)return!0;return!t.containsRange(na._createOn(i),!0)}Ke(ha,u);class ba extends na{constructor(e,t){super(e,t),wa.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new na(this.start,this.end)}static fromRange(e){return new ba(e.start,e.end)}}function wa(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&ka.call(this,i)},{priority:"low"})}function ka(e){const t=this.getTransformedByOperation(e),i=na._createFromRanges(t),o=!i.isEqual(this),n=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let r=null;if(o){"$graveyard"==i.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",t,{deletionPosition:r})}else n&&this.fire("change:content",this.toRange(),{deletionPosition:r})}Ke(ba,u);class _a{constructor(e){this._selection=new va(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}is(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,i){this._selection.setTo(e,t,i)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return"selection:"+e}static _isStoreAttributeKey(e){return e.startsWith("selection:")}}Ke(_a,u);class va extends ha{constructor(e){super(),this.markers=new Zi({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&"marker"!=i.type&&"rename"!=i.type&&"noop"!=i.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{for(const e of this.getRanges())if(!this._document._validateSelectionRange(e))throw new l.a("document-selection-wrong-position",this,{range:e})}),this.listenTo(this._model.markers,"update",(e,t,i,o)=>{this._updateMarker(t,o)}),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const i=e.document.differ;for(const o of i.getChanges()){if("insert"!=o.type)continue;const i=o.position.parent;o.length===i.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(i.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const o of t)e.removeAttribute(o,i)})}}(this._model,t)})}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(e,t,i){super.setTo(e,t,i),this._updateAttributes(!0),this._updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this._updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=s();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new l.a("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this._updateMarkers()}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=ba.fromRange(e);return t.on("change:range",(e,i,o)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}_updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const t of this._model.markers){const i=t.name.split(":",1)[0];if(!this._observedMarkers.has(i))continue;const o=t.getRange();for(const i of this.getRanges())o.containsRange(i,!i.isCollapsed)&&e.push(t)}const i=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=!0);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let o=!1;const n=Array.from(this.markers),r=this.markers.has(e);if(t){let i=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){i=!0;break}i&&!r?(this.markers.add(e),o=!0):!i&&r&&(this.markers.remove(e),o=!0)}else r&&(this.markers.remove(e),o=!0);o&&this.fire("change:marker",{oldMarkers:n,directChange:!1})}_updateAttributes(e){const t=mo(this._getSurroundingAttributes()),i=mo(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())i.has(e)&&i.get(e)===t||o.push(e);for(const[e]of i)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,i=!0){const o=i?"normal":"low";if("low"==o&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,o),!0)}_removeAttribute(e,t=!0){const i=t?"normal":"low";return("low"!=i||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,i),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,i]of this.getAttributes())e.get(t)!==i&&this._removeAttribute(t,!1);for(const[i,o]of e){this._setAttribute(i,o,!1)&&t.add(i)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const i=t.substr("selection:".length);yield[i,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let i=null;if(this.isCollapsed){const o=e.textNode?e.textNode:e.nodeBefore,n=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=ya(o)),i||(i=ya(n)),!this.isGravityOverridden&&!i){let e=o;for(;e&&!t.isInline(e)&&!i;)e=e.previousSibling,i=ya(e)}if(!i){let e=n;for(;e&&!t.isInline(e)&&!i;)e=e.nextSibling,i=ya(e)}i||(i=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const o of e){if(o.item.is("element")&&t.isObject(o.item))break;if("text"==o.type){i=o.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function ya(e){return e instanceof Ks||e instanceof Gs?e.getAttributes():null}class xa{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Aa=function(e){return $i(e,5)};class Ca extends xa{elementToElement(e){return this.add(function(e){return(e=Aa(e)).view=Sa(e.view,"container"),t=>{var i;if(t.on("insert:"+e.model,(i=e.view,(e,t,o)=>{const n=i(t.item,o);if(!n)return;if(!o.consumable.consume(t.item,"insert"))return;const r=o.mapper.toViewPosition(t.range.start);o.mapper.bindElements(t.item,n),o.writer.insert(r,n)}),{priority:e.converterPriority||"normal"}),e.triggerBy){if(e.triggerBy.attributes)for(const i of e.triggerBy.attributes)t._mapReconversionTriggerEvent(e.model,`attribute:${i}:${e.model}`);if(e.triggerBy.children)for(const i of e.triggerBy.children)t._mapReconversionTriggerEvent(e.model,"insert:"+i),t._mapReconversionTriggerEvent(e.model,"remove:"+i)}}}(e))}attributeToElement(e){return this.add(function(e){e=Aa(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Sa(e.view[t],"attribute");else e.view=Sa(e.view,"attribute");const i=Pa(e);return o=>{o.on(t,function(e){return(t,i,o)=>{const n=e(i.attributeOldValue,o),r=e(i.attributeNewValue,o);if(!n&&!r)return;if(!o.consumable.consume(i.item,t.name))return;const s=o.writer,a=s.document.selection;if(i.item instanceof ha||i.item instanceof _a)s.wrap(a.getFirstRange(),r);else{let e=o.mapper.toViewRange(i.range);null!==i.attributeOldValue&&n&&(e=s.unwrap(e,n)),null!==i.attributeNewValue&&r&&s.wrap(e,r)}}}(i),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Aa(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Ia(e.view[t]);else e.view=Ia(e.view);const i=Pa(e);return o=>{var n;o.on(t,(n=i,(e,t,i)=>{const o=n(t.attributeOldValue,i),r=n(t.attributeNewValue,i);if(!o&&!r)return;if(!i.consumable.consume(t.item,e.name))return;const s=i.mapper.toViewElement(t.item),a=i.writer;if(!s)throw new l.a("conversion-attribute-to-attribute-on-text",[t,i]);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e=eo(o.value);for(const t of e)a.removeClass(t,s)}else if("style"==o.key){const e=Object.keys(o.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(o.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=eo(r.value);for(const t of e)a.addClass(t,s)}else if("style"==r.key){const e=Object.keys(r.value);for(const t of e)a.setStyle(t,r.value[t],s)}else a.setAttribute(r.key,r.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Aa(e)).view=Sa(e.view,"ui"),t=>{var i;t.on("addMarker:"+e.model,(i=e.view,(e,t,o)=>{t.isOpening=!0;const n=i(t,o);t.isOpening=!1;const r=i(t,o);if(!n||!r)return;const s=t.markerRange;if(s.isCollapsed&&!o.consumable.consume(s,e.name))return;for(const t of s)if(!o.consumable.consume(t.item,e.name))return;const a=o.mapper,l=o.writer;l.insert(a.toViewPosition(s.start),n),o.mapper.bindElementToMarker(n,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),r),o.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,i)=>{const o=i.mapper.markerNameToElements(t.markerName);if(o){for(const e of o)i.mapper.unbindElementFromMarkerName(e,t.markerName),i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var i;t.on("addMarker:"+e.model,(i=e.view,(e,t,o)=>{if(!t.item)return;if(!(t.item instanceof ha||t.item instanceof _a||t.item.is("$textProxy")))return;const n=Ma(i,t,o);if(!n)return;if(!o.consumable.consume(t.item,e.name))return;const r=o.writer,s=Ta(r,n),a=r.document.selection;if(t.item instanceof ha||t.item instanceof _a)r.wrap(a.getFirstRange(),s,a);else{const e=o.mapper.toViewRange(t.range),i=r.wrap(e,s);for(const e of i.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){o.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,i,o)=>{if(!i.item)return;if(!(i.item instanceof Js))return;const n=Ma(e,i,o);if(!n)return;if(!o.consumable.test(i.item,t.name))return;const r=o.mapper.toViewElement(i.item);if(r&&r.getCustomProperty("addHighlight")){o.consumable.consume(i.item,t.name);for(const e of na._createIn(i.item))o.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,n,o.writer),o.mapper.bindElementToMarker(r,i.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,i,o)=>{if(i.markerRange.isCollapsed)return;const n=Ma(e,i,o);if(!n)return;const r=Ta(o.writer,n),s=o.mapper.markerNameToElements(i.markerName);if(s){for(const e of s)o.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("attributeElement")?o.writer.unwrap(o.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,n.id,o.writer);o.writer.clearClonedElementsGroup(i.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=Aa(e)).model;e.view||(e.view=i=>({group:t,name:i.substr(e.model.length+1)}));return i=>{var o;i.on("addMarker:"+t,(o=e.view,(e,t,i)=>{const n=o(t.markerName,i);if(!n)return;const r=t.markerRange;i.consumable.consume(r,e.name)&&(Ea(r,!1,i,t,n),Ea(r,!0,i,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),i.on("removeMarker:"+t,function(e){return(t,i,o)=>{const n=e(i.markerName,o);if(!n)return;const r=o.mapper.markerNameToElements(i.markerName);if(r){for(const e of r)o.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("containerElement")?(s(`data-${n.group}-start-before`,e),s(`data-${n.group}-start-after`,e),s(`data-${n.group}-end-before`,e),s(`data-${n.group}-end-after`,e)):o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(i.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const i=new Set(t.getAttribute(e).split(","));i.delete(n.name),0==i.size?o.writer.removeAttribute(e,t):o.writer.setAttribute(e,Array.from(i).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Ta(e,t){const i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),"number"==typeof t.priority&&(i._priority=t.priority),i._id=t.id,i}function Ea(e,t,i,o,n){const r=t?e.start:e.end,s=r.nodeAfter&&r.nodeAfter.is("element")?r.nodeAfter:null,a=r.nodeBefore&&r.nodeBefore.is("element")?r.nodeBefore:null;if(s||a){let e,r;t&&s||!t&&!a?(e=s,r=!0):(e=a,r=!1);const l=i.mapper.toViewElement(e);if(l)return void function(e,t,i,o,n,r){const s=`data-${r.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),o.writer.setAttribute(s,a.join(","),e),o.mapper.bindElementToMarker(e,n.markerName)}(l,t,r,i,o,n)}!function(e,t,i,o,n){const r=`${n.group}-${t?"start":"end"}`,s=n.name?{name:n.name}:null,a=i.writer.createUIElement(r,s);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,o.markerName)}(i.mapper.toViewPosition(r),t,i,o,n)}function Sa(e,t){return"function"==typeof e?e:(i,o)=>function(e,t,i){"string"==typeof e&&(e={name:e});let o;const n=t.writer,r=Object.assign({},e.attributes);if("container"==i)o=n.createContainerElement(e.name,r);else if("attribute"==i){const t={priority:e.priority||xn.DEFAULT_PRIORITY};o=n.createAttributeElement(e.name,r,t)}else o=n.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const i of t)n.setStyle(i,e.styles[i],o)}if(e.classes){const t=e.classes;if("string"==typeof t)n.addClass(t,o);else for(const e of t)n.addClass(e,o)}return o}(e,o,t)}function Pa(e){return e.model.values?(t,i)=>{const o=e.view[t];return o?o(t,i):null}:e.view}function Ia(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function Ma(e,t,i){const o="function"==typeof e?e(t,i):e;return o?(o.priority||(o.priority=10),o.id||(o.id=t.markerName),o):null}function Na(e){const{schema:t,document:i}=e.model;for(const o of i.getRootNames()){const n=i.getRoot(o);if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),!0}return!1}function Ra(e,t,i){const o=i.createContext(e);return!!i.checkChild(o,"paragraph")&&!!i.checkChild(o.push("paragraph"),t)}function Oa(e,t){const i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}class za extends xa{elementToElement(e){return this.add(Va(e))}elementToAttribute(e){return this.add(function(e){Ba(e=Aa(e));const t=ja(e,!1),i=Da(e.view),o=i?"element:"+i:"element";return i=>{i.on(o,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Aa(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let i;if("class"==t||"style"==t){i={["class"==t?"classes":"styles"]:e.view.value}}else{const o=void 0===e.view.value?/[\s\S]*/:e.view.value;i={attributes:{[t]:o}}}e.view.name&&(i.name=e.view.name);return e.view=i,t}(e));Ba(e,t);const i=ja(e,!0);return t=>{t.on("element",i,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){return function(e){const t=e.model;e.model=(e,i)=>{const o="string"==typeof t?t:t(e,i);return i.writer.createElement("$marker",{"data-name":o})}}(e=Aa(e)),Va(e)}(e))}dataToMarker(e){return this.add(function(e){(e=Aa(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=La(Fa(e,"start")),i=La(Fa(e,"end"));return o=>{o.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),o.on("element:"+e.view+"-end",i,{priority:e.converterPriority||"normal"});const n=a.get("low"),r=a.get("highest"),s=a.get(e.converterPriority)/r;o.on("element",function(e){return(t,i,o)=>{const n="data-"+e.view;function r(t,n){for(const r of n){const n=e.model(r,o),s=o.writer.createElement("$marker",{"data-name":n});o.writer.insert(s,t),i.modelCursor.isEqual(t)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(t,1),i.modelRange=i.modelRange._getTransformedByInsertion(t,1)[0]}}(o.consumable.test(i.viewItem,{attributes:n+"-end-after"})||o.consumable.test(i.viewItem,{attributes:n+"-start-after"})||o.consumable.test(i.viewItem,{attributes:n+"-end-before"})||o.consumable.test(i.viewItem,{attributes:n+"-start-before"}))&&(i.modelRange||Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor)),o.consumable.consume(i.viewItem,{attributes:n+"-end-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-end-after").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-start-after"})&&r(i.modelRange.end,i.viewItem.getAttribute(n+"-start-after").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-end-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-end-before").split(",")),o.consumable.consume(i.viewItem,{attributes:n+"-start-before"})&&r(i.modelRange.start,i.viewItem.getAttribute(n+"-start-before").split(",")))}}(e),{priority:n+s})}}(e))}}function Va(e){const t=La(e=Aa(e)),i=Da(e.view),o=i?"element:"+i:"element";return i=>{i.on(o,t,{priority:e.converterPriority||"normal"})}}function Da(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function La(e){const t=new go(e.view);return(i,o,n)=>{const r=t.match(o.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!n.consumable.test(o.viewItem,s))return;const a=function(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}(e.model,o.viewItem,n);a&&n.safeInsert(a,o.modelCursor)&&(n.consumable.consume(o.viewItem,s),n.convertChildren(o.viewItem,a),n.updateConversionResult(a,o))}}function Ba(e,t=null){const i=null===t||(e=>e.getAttribute(t)),o="object"!=typeof e.model?e.model:e.model.key,n="object"!=typeof e.model||void 0===e.model.value?i:e.model.value;e.model={key:o,value:n}}function ja(e,t){const i=new go(e.view);return(o,n,r)=>{const s=i.match(n.viewItem);if(!s)return;if(!function(e,t){const i="function"==typeof e?e(t):e;if("object"==typeof i&&!Da(i))return!1;return!i.classes&&!i.attributes&&!i.styles}(e.view,n.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(n.viewItem,s.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(n.viewItem,r):e.model.value;if(null===l)return;n.modelRange||Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor));(function(e,t,i,o){let n=!1;for(const r of Array.from(e.getItems({shallow:i})))o.schema.checkAttribute(r,t.key)&&(n=!0,r.hasAttribute(t.key)||o.writer.setAttribute(t.key,t.value,r));return n})(n.modelRange,{key:a,value:l},t,r)&&r.consumable.consume(n.viewItem,s.match)}}function Fa(e,t){const i={};return i.view=e.view+"-"+t,i.model=(t,i)=>{const o=t.getAttribute("name"),n=e.model(o,i);return i.writer.createElement("$marker",{"data-name":n})},i}class Ha{constructor(e,t){this.model=e,this.view=new qs(t),this.mapper=new ra,this.downcastDispatcher=new la({mapper:this.mapper,schema:e.schema});const i=this.model.document,o=i.selection,n=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(i.differ,n,e),this.downcastDispatcher.convertSelection(o,n,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(i,o)=>{const n=o.newSelection,r=[];for(const e of n.getRanges())r.push(t.toModelRange(e));const s=e.createSelection(r,{backward:n.isBackward});s.isEqual(e.document.selection)||e.change(e=>{e.setSelection(s)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,"insert"))return;const o=i.writer,n=i.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(n,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,i)=>{const o=i.mapper.toViewPosition(t.position),n=t.position.getShiftedBy(t.length),r=i.mapper.toViewPosition(n,{isPhantom:!0}),s=i.writer.createRange(o,r),a=i.writer.remove(s.getTrimmed());for(const e of i.writer.createRangeIn(a).getItems())i.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=i.writer,n=o.document.selection;for(const e of n.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);o.setSelection(null)},{priority:"high"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=t.selection;if(o.isCollapsed)return;if(!i.consumable.consume(o,"selection"))return;const n=[];for(const e of o.getRanges()){const t=i.mapper.toViewRange(e);n.push(t)}i.writer.setSelection(n,{backward:o.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const o=t.selection;if(!o.isCollapsed)return;if(!i.consumable.consume(o,"selection"))return;const n=i.writer,r=o.getFirstPosition(),s=i.mapper.toViewPosition(r),a=n.breakAttributes(s);n.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new an(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}Ke(Ha,Ue);class Ua{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new l.a("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class Wa{constructor(){this._consumables=new Map}add(e,t){let i;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?i=this._consumables.get(e):(i=new $a(e),this._consumables.set(e,i)),i.add(t))}test(e,t){const i=this._consumables.get(e);return void 0===i?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const i=this._consumables.get(e);void 0!==i&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const e of i)"style"!=e&&"class"!=e&&t.attributes.push(e);const o=e.getClassNames();for(const e of o)t.classes.push(e);const n=e.getStyleNames();for(const e of n)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new Wa(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,Wa.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=Wa.createFrom(i,t);return t}}class $a{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t in this._consumables)if(t in e){const i=this._test(t,e[t]);if(!0!==i)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t in this._consumables)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._revert(t,e[t])}_add(e,t){const i=_e(t)?t:[t],o=this._consumables[e];for(const t of i){if("attributes"===e&&("class"===t||"style"===t))throw new l.a("viewconsumable-invalid-attribute",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const i=_e(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",i=this._test(e,[...this._consumables[e].keys()]);if(!0!==i)return i}return!0}_consume(e,t){const i=_e(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const i=_e(t)?t:[t],o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){!1===o.get(t)&&o.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class qa{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new Ya(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Ya(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new l.a("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new l.a("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:e.is&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!!t&&!(!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!!t&&!(!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!!t&&!(!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(t,e)}checkAttribute(e,t){const i=this.getDefinition(e.last);return!!i&&i.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof ea){const t=e.nodeBefore,i=e.nodeAfter;if(!(t instanceof Js))throw new l.a("schema-check-merge-no-element-before",this);if(!(i instanceof Js))throw new l.a("schema-check-merge-no-element-after",this);return this.checkMerge(t,i)}for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[i,o])=>{if(!o)return;const n=e(i,o);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[i,o])=>{const n=e(i,o);"boolean"==typeof n&&(t.stop(),t.return=n)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof ea)t=e.parent;else{t=(e instanceof na?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const i=t.getCommonAncestor();return e?e.getCommonAncestor(i,{includeSelf:!0}):i},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new Gs("",e.getAttributes())];return this.checkAttribute(i,t)}{const i=e.getRanges();for(const e of i)for(const i of e)if(this.checkAttribute(i.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new na(e);let i,o;const n=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(i=new Zs({boundaries:na._createIn(n),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(o=new Zs({boundaries:na._createIn(n),startPosition:e}));for(const e of function*(e,t){let i=!1;for(;!i;){if(i=!0,e){const t=e.next();t.done||(i=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(i=!1,yield{walker:t,value:e.value})}}}(i,o)){const t=e.walker==i?"elementEnd":"elementStart",o=e.value;if(o.type==t&&this.isObject(o.item))return na._createOn(o.item);if(this.checkChild(o.nextPosition,"$text"))return new na(o.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))sl(this,i,t);else{const e=na._createIn(i).getPositions();for(const i of e){sl(this,i.nodeBefore||i.parent,t)}}}createContext(e){return new Ya(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const o of i)e[o]=Ga(t[o],o);for(const t of i)Ka(e,t);for(const t of i)Qa(e,t);for(const t of i)Ja(e,t);for(const t of i)Za(e,t),Xa(e,t);for(const t of i)el(e,t),tl(e,t),il(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,i=t.length-1){const o=t.getItem(i);if(e.allowIn.includes(o.name)){if(0==i)return!0;{const e=this.getDefinition(o);return this._checkContextMatch(e,t,i-1)}}return!1}*_getValidRangesForRange(e,t){let i=e.start,o=e.start;for(const n of e.getItems({shallow:!0}))n.is("element")&&(yield*this._getValidRangesForRange(na._createIn(n),t)),this.checkAttribute(n,t)||(i.isEqual(o)||(yield new na(i,o)),i=ea._createAfter(n)),o=ea._createAfter(n);i.isEqual(o)||(yield new na(i,o))}}Ke(qa,Ue);class Ya{constructor(e){if(e instanceof Ya)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),this._items=e.map(rl)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new Ya([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function Ga(e,t){const i={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return function(e,t){for(const i of e){const e=Object.keys(i).filter(e=>e.startsWith("is"));for(const o of e)t[o]=i[o]}}(e,i),ol(e,i,"allowIn"),ol(e,i,"allowContentOf"),ol(e,i,"allowWhere"),ol(e,i,"allowAttributes"),ol(e,i,"allowAttributesOf"),ol(e,i,"allowChildren"),ol(e,i,"inheritTypesFrom"),function(e,t){for(const i of e){const e=i.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,i),i}function Ka(e,t){const i=e[t];for(const o of i.allowChildren){const i=e[o];i&&i.allowIn.push(t)}i.allowChildren.length=0}function Qa(e,t){for(const i of e[t].allowContentOf)if(e[i]){nl(e,i).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function Ja(e,t){for(const i of e[t].allowWhere){const o=e[i];if(o){const i=o.allowIn;e[t].allowIn.push(...i)}}delete e[t].allowWhere}function Za(e,t){for(const i of e[t].allowAttributesOf){const o=e[i];if(o){const i=o.allowAttributes;e[t].allowAttributes.push(...i)}}delete e[t].allowAttributesOf}function Xa(e,t){const i=e[t];for(const t of i.inheritTypesFrom){const o=e[t];if(o){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const t of e)t in i||(i[t]=o[t])}}delete i.inheritTypesFrom}function el(e,t){const i=e[t],o=i.allowIn.filter(t=>e[t]);i.allowIn=Array.from(new Set(o))}function tl(e,t){const i=e[t];for(const o of i.allowIn){e[o].allowChildren.push(t)}}function il(e,t){const i=e[t];i.allowAttributes=Array.from(new Set(i.allowAttributes))}function ol(e,t,i){for(const o of e)"string"==typeof o[i]?t[i].push(o[i]):Array.isArray(o[i])&&t[i].push(...o[i])}function nl(e,t){const i=e[t];return(o=e,Object.keys(o).map(e=>o[e])).filter(e=>e.allowIn.includes(i.name));var o}function rl(e){return"string"==typeof e||e.is("documentFragment")?{name:"string"==typeof e?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function sl(e,t,i){for(const o of t.getAttributeKeys())e.checkAttribute(t,o)||i.removeAttribute(o,t)}class al{constructor(e={}){this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},e),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.safeInsert=this._safeInsert.bind(this),this.conversionApi.updateConversionResult=this._updateConversionResult.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let i;for(const o of new Ya(e)){const e={};for(const t of o.getAttributeKeys())e[t]=o.getAttribute(t);const n=t.createElement(o.name,e);i&&t.append(n,i),i=ea._createAt(n,0)}return i}(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=Wa.createFrom(e),this.conversionApi.store={};const{modelRange:o}=this._convertItem(e,this._modelCursor),n=t.createDocumentFragment();if(o){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,n);n.markers=function(e,t){const i=new Set,o=new Map,n=na._createIn(e).getItems();for(const e of n)"$marker"==e.name&&i.add(e);for(const e of i){const i=e.getAttribute("data-name"),n=t.createPositionBefore(e);o.has(i)?o.get(i).end=n.clone():o.set(i,new na(n.clone())),t.remove(e)}return o}(n,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,n}_convertItem(e,t){const i=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof na))throw new l.a("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:ea._createAt(t,0);const o=new na(i);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,i);e.modelRange instanceof na&&(o.end=e.modelRange.end,i=e.modelCursor)}return{modelRange:o,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return!!i&&(this.conversionApi.writer.insert(e,i.position),!0)}_updateConversionResult(e,t){const i=this._getSplitParts(e),o=this.conversionApi.writer;t.modelRange||(t.modelRange=o.createRange(o.createPositionBefore(e),o.createPositionAfter(i[i.length-1])));const n=this._cursorParents.get(e);t.modelCursor=n?o.createPositionAt(n,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:o}=this.conversionApi;let n=i.findAllowedParent(t,e);if(n){if(n===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(n)&&(n=null)}if(!n)return Ra(t,e,i)?{position:Oa(t,o)}:null;const r=this.conversionApi.writer.split(t,n),s=[];for(const e of r.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),i=e.item;this._registerSplitPair(t,i)}const a=r.range.end.parent;return this._cursorParents.set(e,a),{position:r.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}Ke(al,u);class ll{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class cl{constructor(e){this._domParser=new DOMParser,this._domConverter=new Er(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new ll}toData(e){const t=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this._domConverter.domToView(t)}registerRawContentMatcher(e){this._domConverter.registerRawContentMatcher(e)}useFillerType(e){this._domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment();let o=t.firstChild;for(;!o.isSameNode(t.documentElement);){const e=o;o=o.nextSibling,e.nodeType==Node.COMMENT_NODE&&i.appendChild(e)}const n=t.body.childNodes;for(;n.length>0;)i.appendChild(n[0]);return i}}class dl{constructor(e,t){this.model=e,this.mapper=new ra,this.downcastDispatcher=new la({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,"insert"))return;const o=i.writer,n=i.mapper.toViewPosition(t.range.start),r=o.createText(t.item.data);o.insert(n,r)},{priority:"lowest"}),this.upcastDispatcher=new al({schema:e.schema}),this.viewDocument=new yn(t),this.stylesProcessor=t,this.htmlProcessor=new cl(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new $n(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:i,consumable:o,writer:n})=>{let r=t.modelCursor;if(!o.test(t.viewItem))return;if(!i.checkChild(r,"$text")){if(!Ra(r,"$text",i))return;r=Oa(r,n)}o.consume(t.viewItem);const s=n.createText(t.viewItem.data);n.insert(s,r),t.modelRange=n.createRange(r,r.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:o}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=o}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",Na)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new l.a("datacontroller-get-non-existent-root",this);const o=this.model.document.getRoot(t);return"empty"!==i||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,e):""}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,o=this._viewWriter;this.mapper.clearBindings();const n=na._createIn(e),r=new Wn(i);this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(n,o);const s=e.is("documentFragment")?Array.from(e.markers):function(e){const t=[],i=e.root.document;if(!i)return[];const o=na._createIn(e);for(const e of i.model.markers){const i=e.getRange(),n=i.isCollapsed,r=i.start.isEqual(o.start)||i.end.isEqual(o.end);if(n&&r)t.push([e.name,i]);else{const n=o.getIntersection(i);n&&t.push([e.name,n])}}return t}(e);for(const[e,t]of s)this.downcastDispatcher.convertMarkerAdd(e,t,o);return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new l.a("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new l.a("datacontroller-init-non-existent-root",this);return this.model.enqueueChange("transparent",e=>{for(const i of Object.keys(t)){const o=this.model.document.getRoot(i);e.insert(this.parse(t[i],o),o,0)}}),Promise.resolve()}set(e,t={}){let i={};if("string"==typeof e?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new l.a("datacontroller-set-non-existent-root",this);const o=t.batchType||"default";this.model.enqueueChange(o,e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const t of Object.keys(i)){const o=this.model.document.getRoot(t);e.remove(e.createRangeIn(o)),e.insert(this.parse(i[t],o),o,0)}})}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}Ke(dl,Ue);class ul{constructor(e,t){this._helpers=new Map,this._downcast=eo(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=eo(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new l.a("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new l.a("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of hl(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of hl(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of hl(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new l.a("conversion-group-exists",this);const o=i?new Ca(t):new za(t);this._helpers.set(e,o)}}function*hl(e){if(e.model.values)for(const t of e.model.values){const i={key:e.model.key,value:t},o=e.view[t],n=e.upcastAlso?e.upcastAlso[t]:void 0;yield*ml(i,o,n)}else yield*ml(e.model,e.view,e.upcastAlso)}function*ml(e,t,i){if(yield{model:e,view:t},i)for(const t of eo(i))yield{model:e,view:t}}class gl{constructor(e="default"){this.operations=[],this.type=e}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class fl{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e){return new this(e.baseVersion)}}class pl{constructor(e){this.markers=new Map,this._children=new Qs,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"model:documentFragment"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(Js.fromJSON(i)):t.push(Gs.fromJSON(i));return new pl(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){if("string"==typeof e)return[new Gs(e)];Ji(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new Gs(e):e instanceof Ks?new Gs(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}}function bl(e,t){const i=(t=_l(t)).reduce((e,t)=>e+t.offsetSize,0),o=e.parent;yl(e);const n=e.index;return o._insertChild(n,t),vl(o,n+t.length),vl(o,n),new na(e,e.getShiftedBy(i))}function wl(e){if(!e.isFlat)throw new l.a("operation-utils-remove-range-not-flat",this);const t=e.start.parent;yl(e.start),yl(e.end);const i=t._removeChildren(e.start.index,e.end.index-e.start.index);return vl(t,e.start.index),i}function kl(e,t){if(!e.isFlat)throw new l.a("operation-utils-move-range-not-flat",this);const i=wl(e);return bl(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),i)}function _l(e){const t=[];e instanceof Array||(e=[e]);for(let i=0;i<e.length;i++)if("string"==typeof e[i])t.push(new Gs(e[i]));else if(e[i]instanceof Ks)t.push(new Gs(e[i].data,e[i].getAttributes()));else if(e[i]instanceof pl||e[i]instanceof Qs)for(const o of e[i])t.push(o);else e[i]instanceof Ys&&t.push(e[i]);for(let e=1;e<t.length;e++){const i=t[e],o=t[e-1];i instanceof Gs&&o instanceof Gs&&xl(i,o)&&(t.splice(e-1,2,new Gs(o.data+i.data,o.getAttributes())),e--)}return t}function vl(e,t){const i=e.getChild(t-1),o=e.getChild(t);if(i&&o&&i.is("$text")&&o.is("$text")&&xl(i,o)){const n=new Gs(i.data+o.data,i.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,n)}}function yl(e){const t=e.textNode,i=e.parent;if(t){const o=e.offset-t.startOffset,n=t.index;i._removeChildren(n,1);const r=new Gs(t.data.substr(0,o),t.getAttributes()),s=new Gs(t.data.substr(o),t.getAttributes());i._insertChild(n,[r,s])}}function xl(e,t){const i=e.getAttributes(),o=t.getAttributes();for(const e of i){if(e[1]!==t.getAttribute(e[0]))return!1;o.next()}return o.next().done}var Al=function(e,t){return Jr(e,t)};class Cl extends fl{constructor(e,t,i,o,n){super(n),this.range=e.clone(),this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===o?null:o}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}clone(){return new Cl(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Cl(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new l.a("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!Al(e.getAttribute(this.key),this.oldValue))throw new l.a("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new l.a("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){Al(this.oldValue,this.newValue)||function(e,t,i){yl(e.start),yl(e.end);for(const o of e.getItems({shallow:!0})){const e=o.is("$textProxy")?o.textNode:o;null!==i?e._setAttribute(t,i):e._removeAttribute(t),vl(e.parent,e.index)}vl(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new Cl(na.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Tl extends fl{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new l.a("detach-operation-on-document-node",this)}_execute(){wl(na._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class El extends fl{constructor(e,t,i,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new this.constructor(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,o=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new l.a("move-operation-nodes-do-not-exist",this);if(e===t&&i<o&&o<i+this.howMany)throw new l.a("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==ao(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=i&&this.targetPosition.path[e]<i+this.howMany)throw new l.a("move-operation-node-into-itself",this)}}_execute(){kl(na._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=ea.fromJSON(e.sourcePosition,t),o=ea.fromJSON(e.targetPosition,t);return new this(i,e.howMany,o,e.baseVersion)}}class Sl extends fl{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Qs(_l(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}clone(){const e=new Qs([...this.nodes].map(e=>e._clone(!0))),t=new Sl(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new ea(e,[0]);return new El(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new l.a("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Qs([...e].map(e=>e._clone(!0))),bl(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const t of e.nodes)t.name?i.push(Js.fromJSON(t)):i.push(Gs.fromJSON(t));const o=new Sl(ea.fromJSON(e.position,t),i,e.baseVersion);return o.shouldReceiveAttributes=e.shouldReceiveAttributes,o}}class Pl extends fl{constructor(e,t,i,o,n,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=n,this._markers=o}get type(){return"marker"}clone(){return new Pl(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Pl(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const e=this.newRange?"_set":"_remove";this._markers[e](this.name,this.newRange,!0,this.affectsData)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Pl(e.name,e.oldRange?na.fromJSON(e.oldRange,t):null,e.newRange?na.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Il extends fl{constructor(e,t,i,o){super(o),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}clone(){return new Il(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Il(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof Js))throw new l.a("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new l.a("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Il(ea.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Ml extends fl{constructor(e,t,i,o,n){super(n),this.root=e,this.key=t,this.oldValue=i,this.newValue=o}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Ml(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Ml(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new l.a("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new l.a("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new l.a("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new l.a("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Ml(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Nl extends fl{constructor(e,t,i,o,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=o.clone()}get type(){return"merge"}get deletionPosition(){return new ea(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new na(this.sourcePosition,e)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new ea(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new Rl(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new l.a("merge-operation-source-position-invalid",this);if(!t.parent)throw new l.a("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new l.a("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;kl(na._createIn(e),this.targetPosition),kl(na._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=ea.fromJSON(e.sourcePosition,t),o=ea.fromJSON(e.targetPosition,t),n=ea.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,o,n,e.baseVersion)}}class Rl extends fl{constructor(e,t,i,o,n){super(n),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=o?o.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new ea(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new na(this.splitPosition,e)}clone(){return new this.constructor(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new ea(e,[0]);return new Nl(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new l.a("split-operation-position-invalid",this);if(!e.parent)throw new l.a("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new l.a("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new l.a("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)kl(na._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();bl(this.insertionPosition,t)}kl(new na(ea._createAt(e,this.splitPosition.offset),ea._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new ea(e.root,t,"toPrevious")}static fromJSON(e,t){const i=ea.fromJSON(e.splitPosition,t),o=ea.fromJSON(e.insertionPosition,t),n=e.graveyardPosition?ea.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,o,n,e.baseVersion)}}class Ol extends Js{constructor(e,t,i="main"){super(t),this._document=e,this.rootName=i}get document(){return this._document}is(e,t){return t?t===this.name&&("rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e):"rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e||"node"===e||"model:node"===e}toJSON(){return this.rootName}}class zl{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new Gs(e,t)}createElement(e,t){return new Js(e,t)}createDocumentFragment(){return new pl}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof Gs&&""==e.data)return;const o=ea._createAt(t,i);if(e.parent){if(jl(e.root,o.root))return void this.move(na._createOn(e),o);if(e.root.document)throw new l.a("model-writer-insert-forbidden-move",this);this.remove(e)}const n=o.root.document?o.root.document.version:null,r=new Sl(o,e,n);if(e instanceof Gs&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof pl)for(const[t,i]of e.markers){const e=ea._createAt(i.root,0),n={range:new na(i.start._getCombined(e,o),i.end._getCombined(e,o)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,n):this.addMarker(t,n)}}insertText(e,t,i,o){t instanceof pl||t instanceof Js||t instanceof ea?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,o)}insertElement(e,t,i,o){t instanceof pl||t instanceof Js||t instanceof ea?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,o)}append(e,t){this.insert(e,t,"end")}appendText(e,t,i){t instanceof pl||t instanceof Js?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof pl||t instanceof Js?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof na){const o=i.getMinimalFlatRanges();for(const i of o)Vl(this,e,t,i)}else Dl(this,e,t,i)}setAttributes(e,t){for(const[i,o]of mo(e))this.setAttribute(i,o,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof na){const i=t.getMinimalFlatRanges();for(const t of i)Vl(this,e,null,t)}else Dl(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof na)for(const i of e.getItems())t(i);else t(e)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof na))throw new l.a("writer-move-invalid-range",this);if(!e.isFlat)throw new l.a("writer-move-range-not-flat",this);const o=ea._createAt(t,i);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!jl(e.root,o.root))throw new l.a("writer-move-different-document",this);const n=e.root.document?e.root.document.version:null,r=new El(e.start,e.end.offset-e.start.offset,o,n);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof na?e:na._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),Bl(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof Js))throw new l.a("writer-merge-no-element-before",this);if(!(i instanceof Js))throw new l.a("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(e,t,i){return this.model.createSelection(e,t,i)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(na._createIn(i),ea._createAt(t,"end")),this.remove(i)}_merge(e){const t=ea._createAt(e.nodeBefore,"end"),i=ea._createAt(e.nodeAfter,0),o=e.root.document.graveyard,n=new ea(o,[0]),r=e.root.document.version,s=new Nl(i,e.nodeAfter.maxOffset,t,n,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof Js))throw new l.a("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,o=new Il(ea._createBefore(e),e.name,t,i);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let i,o,n=e.parent;if(!n.parent)throw new l.a("writer-split-element-no-parent",this);if(t||(t=n.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new l.a("writer-split-invalid-limit-element",this);do{const t=n.root.document?n.root.document.version:null,r=n.maxOffset-e.offset,s=Rl.getInsertionPosition(e),a=new Rl(e,r,s,null,t);this.batch.addOperation(a),this.model.applyOperation(a),i||o||(i=n,o=e.parent.nextSibling),n=(e=this.createPositionAfter(e.parent)).parent}while(n!==t);return{position:e,range:new na(ea._createAt(i,"end"),ea._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new l.a("writer-wrap-range-not-flat",this);const i=t instanceof Js?t:new Js(t);if(i.childCount>0)throw new l.a("writer-wrap-element-not-empty",this);if(null!==i.parent)throw new l.a("writer-wrap-element-attached",this);this.insert(i,e.start);const o=new na(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,ea._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new l.a("writer-unwrap-element-no-parent",this);this.move(na._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new l.a("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,o=t.range,n=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new l.a("writer-addmarker-marker-exists",this);if(!o)throw new l.a("writer-addmarker-no-range",this);return i?(Ll(this,e,null,o,n),this.model.markers.get(e)):this.model.markers._set(e,o,i,n)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i="string"==typeof e?e:e.name,o=this.model.markers.get(i);if(!o)throw new l.a("writer-updatemarker-marker-not-exists",this);if(!t)return void this.model.markers._refresh(o);const n="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:o.affectsData;if(!n&&!t.range&&!r)throw new l.a("writer-updatemarker-wrong-options",this);const a=o.getRange(),c=t.range?t.range:a;n&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?Ll(this,i,null,c,s):(Ll(this,i,a,null,s),this.model.markers._set(i,c,void 0,s)):o.managedUsingOperations?Ll(this,i,a,c,s):this.model.markers._set(i,c,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new l.a("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations)return void this.model.markers._remove(t);Ll(this,t,i.getRange(),null,i.affectsData)}setSelection(e,t,i){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,i)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,i]of mo(e))this._setSelectionAttribute(t,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const o=_a._getStoreAttributeKey(e);this.setAttribute(o,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=_a._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new l.a("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const o=i.getRange();let n=!1;if("move"===e)n=t.containsPosition(o.start)||t.start.isEqual(o.start)||t.containsPosition(o.end)||t.end.isEqual(o.end);else{const e=t.nodeBefore,i=t.nodeAfter,r=o.start.parent==e&&o.start.isAtEnd,s=o.end.parent==i&&0==o.end.offset,a=o.end.nodeAfter==i,l=o.start.nodeAfter==i;n=r||s||a||l}n&&this.updateMarker(i.name,{range:o})}}}function Vl(e,t,i,o){const n=e.model,r=n.document;let s,a,l,c=o.start;for(const e of o.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=i&&d(),c=s),s=e.nextPosition,a=l;function d(){const o=new na(c,s),l=o.root.document?r.version:null,d=new Cl(o,t,a,i,l);e.batch.addOperation(d),n.applyOperation(d)}s instanceof ea&&s!=c&&a!=i&&d()}function Dl(e,t,i,o){const n=e.model,r=n.document,s=o.getAttribute(t);let a,l;if(s!=i){if(o.root===o){const e=o.document?r.version:null;l=new Ml(o,t,s,i,e)}else{a=new na(ea._createBefore(o),e.createPositionAfter(o));const n=a.root.document?r.version:null;l=new Cl(a,t,s,i,n)}e.batch.addOperation(l),n.applyOperation(l)}}function Ll(e,t,i,o,n){const r=e.model,s=r.document,a=new Pl(t,i,o,r.markers,n,s.version);e.batch.addOperation(a),r.applyOperation(a)}function Bl(e,t,i,o){let n;if(e.root.document){const i=o.document,r=new ea(i.graveyard,[0]);n=new El(e,t,r,i.version)}else n=new Tl(e,t);i.addOperation(n),o.applyOperation(n)}function jl(e,t){return e===t||e instanceof Ol&&t instanceof Ol}class Fl{constructor(e){this._markerCollection=e,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize);const t=na._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}this._cachedChanges=null}bufferOperation(e){switch(e.type){case"insert":if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),i=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),i||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=na._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}break}case"split":{const t=e.splitPosition.parent;this._isInInsertedElement(t)||this._markRemove(t,e.splitPosition.offset,e.howMany),this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1);break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const i=e.graveyardPosition.parent;this._markInsert(i,e.graveyardPosition.offset,1);const o=e.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i,o){const n=this._changedMarkers.get(e);n?(n.newRange=i,n.affectsData=o,null==n.oldRange&&null==n.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:i,affectsData:o})}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.oldRange&&e.push({name:t,range:i.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.newRange&&e.push({name:t,range:i.newRange});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(e=>({name:e[0],data:{oldRange:e[1].oldRange,newRange:e[1].newRange}}))}hasDataChanges(){for(const[,e]of this._changedMarkers)if(e.affectsData)return!0;return this._changesInElement.size>0}getChanges(e={includeChangesInGraveyard:!1}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const e of this._changesInElement.keys()){const i=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1),o=this._elementSnapshots.get(e),n=Hl(e.getChildren()),r=Ul(o.length,i);let s=0,a=0;for(const i of r)if("i"===i)t.push(this._getInsertDiff(e,s,n[s].name)),s++;else if("r"===i)t.push(this._getRemoveDiff(e,s,o[a].name)),a++;else if("a"===i){const i=n[s].attributes,r=o[a].attributes;let l;if("$text"==n[s].name)l=new na(ea._createAt(e,s),ea._createAt(e,s+1));else{const t=e.offsetToIndex(s);l=new na(ea._createAt(e,s),ea._createAt(e.getChild(t),0))}t.push(...this._getAttributesDiff(l,r,i)),s++,a++}else s++,a++}t.sort((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1);for(let e=1,i=0;e<t.length;e++){const o=t[i],n=t[e],r="remove"==o.type&&"remove"==n.type&&"$text"==o.name&&"$text"==n.name&&o.position.isEqual(n.position),s="insert"==o.type&&"insert"==n.type&&"$text"==o.name&&"$text"==n.name&&o.position.parent==n.position.parent&&o.position.offset+o.length==n.position.offset,a="attribute"==o.type&&"attribute"==n.type&&o.position.parent==n.position.parent&&o.range.isFlat&&n.range.isFlat&&o.position.offset+o.length==n.position.offset&&o.attributeKey==n.attributeKey&&o.attributeOldValue==n.attributeOldValue&&o.attributeNewValue==n.attributeNewValue;r||s||a?(o.length++,a&&(o.range.end=o.range.end.getShiftedBy(1)),t[e]=null):i=e}t=t.filter(e=>e);for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t.slice(),this._cachedChanges=t.filter(Wl),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard:this._cachedChanges}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._cachedChanges=null}_markInsert(e,t,i){const o={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,o)}_markRemove(e,t,i){const o={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,o),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let e=0;e<i.length;e++)i[e].howMany<1&&(i.splice(e,1),e--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,Hl(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const o=e.offset+e.howMany,n=i.offset+i.howMany;if("insert"==e.type&&("insert"==i.type&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<n&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==i.type&&e.offset<i.offset&&(i.offset+=e.howMany),"attribute"==i.type))if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<n){const n=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:o,howMany:n-i.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==i.type)if(o<=i.offset)i.offset-=e.howMany;else if(o<=n)if(e.offset<i.offset){const t=o-i.offset;i.offset=e.offset,i.howMany-=t,e.nodesToHandle-=t}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<n){const t=n-e.offset;i.howMany-=t,e.nodesToHandle-=t}if("remove"==i.type&&(o<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),"attribute"==i.type)if(o<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const t=o-i.offset;i.offset=e.offset,i.howMany-=t}else if(e.offset<n)if(o<=n){const o=i.howMany;i.howMany=e.offset-i.offset;const n=o-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:n,count:this._changeCount++})}else i.howMany-=n-e.offset}if("attribute"==e.type){if("insert"==i.type)if(e.offset<i.offset&&o>i.offset){if(o>n){const e={type:"attribute",offset:n,howMany:o-n,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<n&&(o>n?(e.nodesToHandle=o-n,e.offset=n):e.nodesToHandle=0);if("remove"==i.type&&e.offset<i.offset&&o>i.offset){const n={type:"attribute",offset:i.offset,howMany:o-i.offset,count:this._changeCount++};this._handleChange(n,t),t.push(n),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==i.type&&(e.offset>=i.offset&&o<=n?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&o>=n&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i){return{type:"insert",position:ea._createAt(e,t),name:i,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,i){return{type:"remove",position:ea._createAt(e,t),name:i,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const o=[];i=new Map(i);for(const[n,r]of t){const t=i.has(n)?i.get(n):null;t!==r&&o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:n,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),i.delete(n)}for(const[t,n]of i)o.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:n,changeCount:this._changeCount++});return o}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),o=e.startOffset;if(i)for(const e of i)if("insert"==e.type&&o>=e.offset&&o<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const o=new na(ea._createAt(e,t),ea._createAt(e,t+i));for(const e of o.getItems({shallow:!0}))e.is("element")&&(this._elementSnapshots.delete(e),this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}function Hl(e){const t=[];for(const i of e)if(i.is("$text"))for(let e=0;e<i.data.length;e++)t.push({name:"$text",attributes:new Map(i.getAttributes())});else t.push({name:i.name,attributes:new Map(i.getAttributes())});return t}function Ul(e,t){const i=[];let o=0,n=0;for(const e of t){if(e.offset>o){for(let t=0;t<e.offset-o;t++)i.push("e");n+=e.offset-o}if("insert"==e.type){for(let t=0;t<e.howMany;t++)i.push("i");o=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)i.push("r");o=e.offset,n+=e.howMany}else i.push(..."a".repeat(e.howMany).split("")),o=e.offset+e.howMany,n+=e.howMany}if(n<e)for(let t=0;t<e-n-o;t++)i.push("e");return i}function Wl(e){const t=e.position&&"$graveyard"==e.position.root.rootName,i=e.range&&"$graveyard"==e.range.root.rootName;return!t&&!i}class $l{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set}addOperation(e){this._operations.includes(e)||this._operations.push(e)}getOperations(e=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY){const i=[];for(const o of this._operations)o.baseVersion>=e&&o.baseVersion<t&&i.push(o);return i}getOperation(e){for(const t of this._operations)if(t.baseVersion==e)return t}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}}function ql(e,t){return!!(i=e.charAt(t-1))&&1==i.length&&/[\ud800-\udbff]/.test(i)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var i}function Yl(e,t){return!!(i=e.charAt(t))&&1==i.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(i);var i}class Gl{constructor(e){this.model=e,this.version=0,this.history=new $l(this),this.selection=new _a(this),this.roots=new Zi({idProperty:"rootName"}),this.differ=new Fl(e.markers),this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root","$graveyard"),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];if(i.isDocumentOperation&&i.baseVersion!==this.version)throw new l.a("model-document-applyoperation-wrong-version",this,{operation:i})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&this.differ.bufferOperation(i)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&(this.version++,this.history.addOperation(i))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,i,o)=>{this.differ.bufferMarkerChange(t.name,i,o,t.affectsData),null===i&&t.on("change",(e,i)=>{this.differ.bufferMarkerChange(t.name,i,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new l.a("model-document-createroot-name-exists",this,{name:t});const i=new Ol(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(){return Array.from(this.roots,e=>e.rootName).filter(e=>"$graveyard"!=e)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=lo(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,o=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(o)||t.createRange(o)}_validateSelectionRange(e){return Kl(e.start)&&Kl(e.end)}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break}while(t)}}function Kl(e){const t=e.textNode;if(t){const i=t.data,o=e.offset-t.startOffset;return!ql(i,o)&&!Yl(i,o)}return!0}Ke(Gl,u);class Ql{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){return this._markers.has(e)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,o=!1){const n=e instanceof Jl?e.name:e;if(n.includes(","))throw new l.a("markercollection-incorrect-marker-name",this);const r=this._markers.get(n);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(ba.fromRange(t)),s=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,s=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,s=!0),s&&this.fire("update:"+n,r,e,t),r}const s=ba.fromRange(t),a=new Jl(n,s,i,o);return this._markers.set(n,a),this.fire("update:"+n,a,null,t),a}_remove(e){const t=e instanceof Jl?e.name:e,i=this._markers.get(t);return!!i&&(this._markers.delete(t),this.fire("update:"+t,i,i.getRange(),null),this._destroyMarker(i),!0)}_refresh(e){const t=e instanceof Jl?e.name:e,i=this._markers.get(t);if(!i)throw new l.a("markercollection-refresh-marker-not-exists",this);const o=i.getRange();this.fire("update:"+t,i,o,o,i.managedUsingOperations,i.affectsData)}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}Ke(Ql,u);class Jl{constructor(e,t,i,o){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=o}get managedUsingOperations(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._affectsData}getStart(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new l.a("marker-destroyed",this);return this._liveRange.toRange()}is(e){return"marker"===e||"model:marker"===e}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Ke(Jl,u);class Zl extends fl{get type(){return"noop"}clone(){return new Zl(this.baseVersion)}getReversed(){return new Zl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const Xl={};Xl[Cl.className]=Cl,Xl[Sl.className]=Sl,Xl[Pl.className]=Pl,Xl[El.className]=El,Xl[Zl.className]=Zl,Xl[fl.className]=fl,Xl[Il.className]=Il,Xl[Ml.className]=Ml,Xl[Rl.className]=Rl,Xl[Nl.className]=Nl;class ec extends ea{constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new l.a("model-liveposition-root-not-rootelement",e);tc.call(this)}detach(){this.stopListening()}is(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e}toPosition(){return new ea(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function tc(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&ic.call(this,i)},{priority:"low"})}function ic(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}Ke(ec,u);class oc{constructor(e,t,i){this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0),this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new l.a("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this.nodeToSelect?na._createOn(this.nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new na(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(this.schema.isObject(e))return void this._handleObject(e);let t=this._checkAndAutoParagraphToAllowedPosition(e);t||(t=this._checkAndSplitToAllowedPosition(e),t)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=ec.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new l.a("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this.nodeToSelect=e:this.nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=ec.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=ec.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof Js))return;if(!this._canMergeLeft(e))return;const t=ec._createBefore(e);t.stickiness="toNext";const i=ec.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=ec._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=ec._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof Js))return;if(!this._canMergeRight(e))return;const t=ec._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new l.a("insertcontent-invalid-insertion-position",this);this.position=ea._createAt(t.nodeBefore,"end");const i=ec.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=ec._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=ec._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof Js&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof Js&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!0}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}function nc(e,t,i={}){if(t.isCollapsed)return;const o=t.getFirstRange();if("$graveyard"==o.root.rootName)return;const n=e.schema;e.change(e=>{if(!i.doNotResetEntireContent&&function(e,t){const i=e.getLimitElement(t);if(!t.containsEntireContent(i))return!1;const o=t.getFirstRange();if(o.start.parent==o.end.parent)return!1;return e.checkChild(i,"paragraph")}(n,t))return void function(e,t){const i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),sc(e,e.createPositionAt(i,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,i=e.start;let o=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const i=function(e){const t=e.parent,i=t.root.document.model.schema,o=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of o){if(i.isLimit(e))return null;if(i.isBlock(e))return e}}(o);if(i&&o.isTouching(t.createPositionAt(i,0))){const i=t.createSelection(e);t.modifySelection(i,{direction:"backward"});const n=i.getLastPosition(),r=t.createRange(n,o);t.hasContent(r,{ignoreMarkers:!0})||(o=n)}}return[ec.fromPosition(i,"toPrevious"),ec.fromPosition(o,"toNext")]}(o);r.isTouching(s)||e.remove(e.createRange(r,s)),i.leaveUnmerged||(!function(e,t,i){const o=e.model;if(!rc(e.model.schema,t,i))return;const[n,r]=function(e,t){const i=e.getAncestors(),o=t.getAncestors();let n=0;for(;i[n]&&i[n]==o[n];)n++;return[i[n],o[n]]}(t,i);if(!n||!r)return;!o.hasContent(n,{ignoreMarkers:!0})&&o.hasContent(r,{ignoreMarkers:!0})?function e(t,i,o,n){const r=i.parent,s=o.parent;if(r==n||s==n)return;i=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(i)||t.insert(r,o);for(;i.parent.isEmpty;){const e=i.parent;i=t.createPositionBefore(e),t.remove(e)}if(o=t.createPositionBefore(s),function(e,t){const i=t.nodeBefore,o=t.nodeAfter;i.name!=o.name&&e.rename(i,o.name);e.clearAttributes(i),e.setAttributes(Object.fromEntries(o.getAttributes()),i),e.merge(t)}(t,o),!rc(t.model.schema,i,o))return;e(t,i,o,n)}(e,t,i,n.parent):function e(t,i,o,n){const r=i.parent,s=o.parent;if(r==n||s==n)return;i=t.createPositionAfter(r),(o=t.createPositionBefore(s)).isEqual(i)||t.insert(s,i);t.merge(i);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(!rc(t.model.schema,i,o))return;e(t,i,o,n)}(e,t,i,n.parent)}(e,r,s),n.removeDisallowedAttributes(r.parent.getChildren(),e)),ac(e,t,r),!i.doNotAutoparagraph&&function(e,t){const i=e.checkChild(t,"$text"),o=e.checkChild(t,"paragraph");return!i&&o}(n,r)&&sc(e,r,t),r.detach(),s.detach()})}function rc(e,t,i){const o=t.parent,n=i.parent;return o!=n&&(!e.isLimit(o)&&!e.isLimit(n)&&function(e,t,i){const o=new na(e,t);for(const e of o.getWalker())if(i.isLimit(e.item))return!1;return!0}(t,i,e))}function sc(e,t,i){const o=e.createElement("paragraph");e.insert(o,t),ac(e,i,e.createPositionAt(o,0))}function ac(e,t,i){t instanceof _a?e.setSelection(i):t.setTo(i)}function lc(e,t){const{isForward:i,walker:o,unit:n,schema:r}=e,{type:s,item:a,nextPosition:l}=t;if("text"==s)return"word"===e.unit?function(e,t){let i=e.position.textNode;if(i){let o=e.position.offset-i.startOffset;for(;!dc(i.data,o,t)&&!uc(i,o,t);){e.next();const n=t?e.position.nodeAfter:e.position.nodeBefore;if(n&&n.is("$text")){const o=n.data.charAt(t?0:n.data.length-1);' ,.?!:;"-()'.includes(o)||(e.next(),i=e.position.textNode)}o=e.position.offset-i.startOffset}}return e.position}(o,i):function(e,t){const i=e.position.textNode;if(i){const o=i.data;let n=e.position.offset-i.startOffset;for(;ql(o,n)||"character"==t&&Yl(o,n);)e.next(),n=e.position.offset-i.startOffset}return e.position}(o,n);if(s==(i?"elementStart":"elementEnd")){if(r.isSelectable(a))return ea._createAt(a,i?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(a))return void o.skip(()=>!0);if(r.checkChild(l,"$text"))return l}}function cc(e,t){const i=e.root,o=ea._createAt(i,t?"end":0);return t?new na(e,o):new na(o,e)}function dc(e,t,i){const o=t+(i?0:-1);return' ,.?!:;"-()'.includes(e.charAt(o))}function uc(e,t,i){return t===(i?e.endOffset:0)}function hc(e,t){const i=[];Array.from(e.getItems({direction:"backward"})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEach(e=>{i.push(e.start.parent),t.remove(e)}),i.forEach(e=>{let i=e;for(;i.parent&&i.isEmpty;){const e=t.createRangeOn(i);i=i.parent,t.remove(e)}})}function mc(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.selection,o=t.schema,n=[];let r=!1;for(const e of i.getRanges()){const t=gc(e,o);t&&!t.isEqual(e)?(n.push(t),r=!0):n.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const i of e){const e=t.pop();if(i.isEqual(e))t.push(e);else if(i.isIntersecting(e)){const o=e.start.isAfter(i.start)?i.start:e.start,n=e.end.isAfter(i.end)?e.end:i.end,r=new na(o,n);t.push(r)}else t.push(e),t.push(i)}return t}(n),{backward:i.isBackward})}(t,e))}function gc(e,t){return e.isCollapsed?function(e,t){const i=e.start,o=t.getNearestSelectionRange(i);if(!o)return null;if(!o.isCollapsed)return o;const n=o.start;if(i.isEqual(n))return null;return new na(n)}(e,t):function(e,t){const{start:i,end:o}=e,n=t.checkChild(i,"$text"),r=t.checkChild(o,"$text"),s=t.getLimitElement(i),a=t.getLimitElement(o);if(s===a){if(n&&r)return null;if(function(e,t,i){const o=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),n=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return o||n}(i,o,t)){const e=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),n=o.nodeBefore&&t.isSelectable(o.nodeBefore)?null:t.getNearestSelectionRange(o,"backward"),r=e?e.start:i,s=n?n.end:o;return new na(r,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=i.nodeAfter&&o.nodeBefore&&i.nodeAfter.parent===o.nodeBefore.parent,n=l&&(!e||!pc(i.nodeAfter,t)),r=c&&(!e||!pc(o.nodeBefore,t));let d=i,u=o;return n&&(d=ea._createBefore(fc(s,t))),r&&(u=ea._createAfter(fc(a,t))),new na(d,u)}return null}(e,t)}function fc(e,t){let i=e,o=i;for(;t.isLimit(o)&&o.parent;)i=o,o=o.parent;return i}function pc(e,t){return e&&t.isSelectable(e)}class bc{constructor(){this.markers=new Ql,this.document=new Gl(this),this.schema=new qa,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),mc(this),this.document.registerPostFixer(Na)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new gl,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){l.a.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new gl(e):"function"==typeof e&&(t=e,e=new gl),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){l.a.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,i){return function(e,t,i,o){return e.change(n=>{let r;r=i?i instanceof ha||i instanceof _a?i:n.createSelection(i,o):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new oc(e,n,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a);const l=s.getSelectionRange();l&&(r instanceof _a?n.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c})}(this,e,t,i)}deleteContent(e,t){nc(this,e,t)}modifySelection(e,t){!function(e,t,i={}){const o=e.schema,n="backward"!=i.direction,r=i.unit?i.unit:"character",s=t.focus,a=new Zs({boundaries:cc(s,n),singleCharacters:!0,direction:n?"forward":"backward"}),l={walker:a,schema:o,isForward:n,unit:r};let c;for(;c=a.next();){if(c.done)return;const i=lc(l,c.value);if(i)return void(t instanceof _a?e.change(e=>{e.setSelectionFocus(i)}):t.setFocus(i))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const i=e.createDocumentFragment(),o=t.getFirstRange();if(!o||o.isCollapsed)return i;const n=o.start.root,r=o.start.getCommonPath(o.end),s=n.getNodeByPath(r);let a;a=o.start.parent==o.end.parent?o:e.createRange(e.createPositionAt(s,o.start.path[r.length]),e.createPositionAt(s,o.end.path[r.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),i):e.append(e.cloneElement(t,!0),i);if(a!=o){const t=o._getTransformedByMove(a.start,e.createPositionAt(i,0),l)[0],n=e.createRange(e.createPositionAt(i,0),t.start);hc(e.createRange(t.end,e.createPositionAt(i,"end")),e),hc(n,e)}return i})}(this,e)}hasContent(e,t={}){const i=e instanceof Js?na._createIn(e):e;if(i.isCollapsed)return!1;const{ignoreWhitespaces:o=!1,ignoreMarkers:n=!1}=t;if(!n)for(const e of this.markers.getMarkersIntersectingRange(i))if(e.affectsData)return!0;for(const e of i.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!o)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}createPositionFromPath(e,t,i){return new ea(e,t,i)}createPositionAt(e,t){return ea._createAt(e,t)}createPositionAfter(e){return ea._createAfter(e)}createPositionBefore(e){return ea._createBefore(e)}createRange(e,t){return new na(e,t)}createRangeIn(e){return na._createIn(e)}createRangeOn(e){return na._createOn(e)}createSelection(e,t,i){return new ha(e,t,i)}createBatch(e){return new gl(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return Xl[e.__className].fromJSON(e,t)}}.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new zl(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}Ke(bc,Ue);class wc extends Os{constructor(e){super(),this.editor=e}set(e,t,i={}){if("string"==typeof t){const e=t;t=(t,i)=>{this.editor.execute(e),i()}}super.set(e,t,i)}}class kc{constructor(e={}){this._context=e.context||new ro({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new Gi(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new Xi(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new Ua,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new bc;const i=new Jo;this.data=new dl(this.model,i),this.editing=new Ha(this.model,i),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new ul([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new wc(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],o=e.get("extraPlugins")||[],n=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(o),i,n)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(...e){try{return this.commands.execute(...e)}catch(e){l.a.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}}Ke(kc,Ue);class _c{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(vc(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new l.a("componentfactory-item-missing",this,{name:e});return this._components.get(vc(e)).callback(this.editor.locale)}has(e){return this._components.has(vc(e))}}function vc(e){return String(e).toLowerCase()}class yc{constructor(e){this.editor=e,this.componentFactory=new _c(e),this.focusTracker=new Rs,this._editableElementsMap=new Map,this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}}Ke(yc,u);var xc={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};var Ac={updateSourceElement(){if(!this.sourceElement)throw new l.a("editor-missing-sourceelement",this);var e,t;e=this.sourceElement,t=this.data.get(),e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}};class Cc extends so{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Zi({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new l.a("pendingactions-add-invalid-message",this);const t=Object.create(Ue);return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const Tc={cancel:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',caption:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',check:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',cog:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',eraser:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',lowVision:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',image:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.91 10.54c.26-.23.64-.21.88.03l3.36 3.14 2.23-2.06a.64.64 0 0 1 .87 0l2.52 2.97V4.5H3.2v10.12l3.71-4.08zm10.27-7.51c.6 0 1.09.47 1.09 1.05v11.84c0 .59-.49 1.06-1.09 1.06H2.79c-.6 0-1.09-.47-1.09-1.06V4.08c0-.58.49-1.05 1.1-1.05h14.38zm-5.22 5.56a1.96 1.96 0 1 1 3.4-1.96 1.96 1.96 0 0 1-3.4 1.96z"/></svg>',alignBottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',alignMiddle:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',alignTop:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',alignLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',alignCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',alignRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',alignJustify:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',objectLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',objectRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectFullWidth:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',objectInline:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectSizeFull:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',objectSizeLarge:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M13 6H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5h11z"/></svg>',objectSizeSmall:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M7 10H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5h5z"/></svg>',objectSizeMedium:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M10 8H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6a.5.5 0 0 1 .5-.5h8z"/></svg>',pencil:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',pilcrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',quote:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',threeVerticalDots:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>'};function Ec({emitter:e,activator:t,callback:i,contextElements:o}){e.listenTo(document,"mousedown",(e,n)=>{if(!t())return;const r="function"==typeof n.composedPath?n.composedPath():[];for(const e of o)if(e.contains(n.target)||r.includes(e))return;i()})}function Sc(e){e.set("_isCssTransitionsDisabled",!1),e.disableCssTransitions=()=>{e._isCssTransitionsDisabled=!0},e.enableCssTransitions=()=>{e._isCssTransitionsDisabled=!1},e.extendTemplate({attributes:{class:[e.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}function Pc({view:e}){e.listenTo(e.element,"submit",(t,i)=>{i.preventDefault(),e.fire("submit")},{useCapture:!0})}class Ic extends Zi{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,i)=>{this._renderViewIntoCollectionParent(t,i)}),this.on("remove",(e,t)=>{t.element&&this._parentElement&&t.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every(e=>"string"==typeof e))throw new l.a("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const o of e)i.delegate(o).to(t);this.on("add",(i,o)=>{for(const i of e)o.delegate(i).to(t)}),this.on("remove",(i,o)=>{for(const i of e)o.stopDelegating(i,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}i(28);class Mc{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Zi,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,i)=>{i.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Nc.bind(this,this)}createCollection(e){const t=new Ic(e);return this._viewCollections.add(t),t}registerChild(e){Ji(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Ji(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new Nc(e)}extendTemplate(e){Nc.extend(this.template,e)}render(){if(this.isRendered)throw new l.a("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}Ke(Mc,Mr),Ke(Mc,Ue);class Nc{constructor(e){Object.assign(this,Hc(Fc(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new l.a("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const i of t.children)Yc(i)?yield i:Gc(i)&&(yield*e(i))}(this)}static bind(e,t){return{to:(i,o)=>new Oc({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:o}),if:(i,o,n)=>new zc({observable:e,emitter:t,attribute:i,valueIfTrue:o,callback:n})}}static extend(e,t){if(e._isRendered)throw new l.a("template-extend-render",[this,e]);!function e(t,i){i.attributes&&(t.attributes||(t.attributes={}),$c(t.attributes,i.attributes));i.eventListeners&&(t.eventListeners||(t.eventListeners={}),$c(t.eventListeners,i.eventListeners));i.text&&t.text.push(...i.text);if(i.children&&i.children.length){if(t.children.length!=i.children.length)throw new l.a("ui-template-extend-children-mismatch",t);let o=0;for(const n of i.children)e(t.children[o++],n)}}(e,Hc(Fc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new l.a("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),Vc(this.text)?this._bindToObservable({schema:this.text,updater:Lc(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,i,o,n;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(o=r.getAttribute(t),i=this.attributes[t],s&&(s.attributes[t]=o),n=w(i[0])&&i[0].ns?i[0].ns:null,Vc(i)){const a=n?i[0].value:i;s&&Qc(t)&&a.unshift(o),this._bindToObservable({schema:a,updater:Bc(r,t,n),data:e})}else"style"==t&&"string"!=typeof i[0]?this._renderStyleAttribute(i[0],e):(s&&o&&Qc(t)&&i.unshift(o),i=i.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(Wc,""),qc(i)||r.setAttributeNS(n,t,i))}_renderStyleAttribute(e,t){const i=t.node;for(const o in e){const n=e[o];Vc(n)?this._bindToObservable({schema:[n],updater:jc(i,o),data:t}):i.style[o]=n}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let n=0;for(const r of this.children)if(Kc(r)){if(!o){r.setParent(t);for(const e of r)i.appendChild(e.element)}}else if(Yc(r))o||(r.isRendered||r.render(),i.appendChild(r.element));else if(pr(r))i.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:i.childNodes[n++],isApplying:!0,revertData:t})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(i=>{const[o,n]=t.split("@");return i.activateDomEventListener(o,n,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const o=i.revertData;Dc(e,t,i);const n=e.filter(e=>!qc(e)).filter(e=>e.observable).map(o=>o.activateAttributeListener(e,t,i));o&&o.bindings.push(n)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)e.textContent=t.text;else{for(const i in t.attributes){const o=t.attributes[i];null===o?e.removeAttribute(i):e.setAttribute(i,o)}for(let i=0;i<t.children.length;++i)this._revertTemplateFromNode(e.childNodes[i],t.children[i])}}}Ke(Nc,u);class Rc{constructor(e){Object.assign(this,e)}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const o=()=>Dc(e,t,i);return this.emitter.listenTo(this.observable,"change:"+this.attribute,o),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,o)}}}class Oc extends Rc{activateDomEventListener(e,t,i){const o=(e,i)=>{t&&!i.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(i):this.observable.fire(this.eventNameOrFunction,i))};return this.emitter.listenTo(i.node,e,o),()=>{this.emitter.stopListening(i.node,e,o)}}}class zc extends Rc{getValue(e){return!qc(super.getValue(e))&&(this.valueIfTrue||!0)}}function Vc(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Vc):e instanceof Rc)}function Dc(e,t,{node:i}){let o=function(e,t){return e.map(e=>e instanceof Rc?e.getValue(t):e)}(e,i);o=1==e.length&&e[0]instanceof zc?o[0]:o.reduce(Wc,""),qc(o)?t.remove():t.set(o)}function Lc(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function Bc(e,t,i){return{set(o){e.setAttributeNS(i,t,o)},remove(){e.removeAttributeNS(i,t)}}}function jc(e,t){return{set(i){e.style[t]=i},remove(){e.style[t]=null}}}function Fc(e){return qi(e,e=>{if(e&&(e instanceof Rc||Gc(e)||Yc(e)||Kc(e)))return e})}function Hc(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=eo(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)Uc(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=eo(e[t].value)),Uc(e,t)}(e.attributes);const t=[];if(e.children)if(Kc(e.children))t.push(e.children);else for(const i of e.children)Gc(i)||Yc(i)||pr(i)?t.push(i):t.push(new Nc(i));e.children=t}return e}function Uc(e,t){e[t]=eo(e[t])}function Wc(e,t){return qc(t)?e:qc(e)?t:`${e} ${t}`}function $c(e,t){for(const i in t)e[i]?e[i].push(...t[i]):e[i]=t[i]}function qc(e){return!e&&0!==e}function Yc(e){return e instanceof Mc}function Gc(e){return e instanceof Nc}function Kc(e){return e instanceof Ic}function Qc(e){return"class"==e||"style"==e}class Jc extends Ic{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new Nc({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=function(e,t,i={},o=[]){const n=i&&i.xmlns,r=n?e.createElementNS(n,t):e.createElement(t);for(const e in i)r.setAttribute(e,i[e]);!ys(o)&&Ji(o)||(o=[o]);for(let t of o)ys(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}i(30);class Zc extends Mc{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");for(t&&(this.viewBox=t),this.element.innerHTML="";e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}i(32);class Xc extends Mc{constructor(e){super(e),this.set("text",""),this.set("position","s");const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",t.to("position",e=>"ck-tooltip_"+e),t.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:t.to("text")}]}]})}}i(34);class ed extends Mc{constructor(e){super(e);const t=this.bindTemplate,i=s();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(i),this.iconView=new Zc,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",e=>!e),t.if("isVisible","ck-hidden",e=>!e),t.to("isOn",e=>e?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],type:t.to("type",e=>e||"button"),tabindex:t.to("tabindex"),"aria-labelledby":"ck-editor__aria-label_"+i,"aria-disabled":t.if("isEnabled",!0,e=>!e),"aria-pressed":t.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new Xc;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new Mc,i=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:i.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new Mc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>Vn(e))}]}),e}_getTooltipString(e,t,i){return e?"string"==typeof e?e:(i&&(i=Vn(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}i(36);class td extends ed{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new Mc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function id(e,t){const i=e.t,o={Black:i("Black"),"Dim grey":i("Dim grey"),Grey:i("Grey"),"Light grey":i("Light grey"),White:i("White"),Red:i("Red"),Orange:i("Orange"),Yellow:i("Yellow"),"Light green":i("Light green"),Green:i("Green"),Aquamarine:i("Aquamarine"),Turquoise:i("Turquoise"),"Light blue":i("Light blue"),Blue:i("Blue"),Purple:i("Purple")};return t.map(e=>{const t=o[e.label];return t&&t!=e.label&&(e.label=t),e})}function od(e){return e.map(nd).filter(e=>!!e)}function nd(e){return"string"==typeof e?{model:e,label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:""+e.color}}}}class rd extends ed{constructor(e){super(e);const t=this.bindTemplate;this.set("color"),this.set("hasBorder"),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color")},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-table__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class sd{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];"string"==typeof i&&(i=[i]);for(const o of i)e.keystrokeHandler.set(o,(e,i)=>{this[t](),i()})}}get first(){return this.focusables.find(ad)||null}get last(){return this.focusables.filter(ad).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,i)=>{const o=t.element===this.focusTracker.focusedElement;return o&&(e=i),o}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,i=this.focusables.length;if(!i)return null;if(null===t)return this[1===e?"first":"last"];let o=(t+i+e)%i;do{const t=this.focusables.get(o);if(ad(t))return t;o=(o+i+e)%i}while(o!==t);return null}}function ad(e){return!(!e.focus||"none"==vr.window.getComputedStyle(e.element).display)}i(38);class ld extends Mc{constructor(e,t){super(e);const i=t&&t.colorDefinitions||[],o={};t&&t.columns&&(o.gridTemplateColumns=`repeat( ${t.columns}, 1fr)`),this.set("selectedColor"),this.items=this.createCollection(),this.focusTracker=new Rs,this.keystrokes=new Os,this._focusCycler=new sd({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.items.on("add",(e,t)=>{t.isOn=t.color===this.selectedColor}),i.forEach(e=>{const t=new rd;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})}),this.items.add(t)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:o}}),this.on("change:selectedColor",(e,t,i)=>{for(const e of this.items)e.isOn=e.color===i})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}}var cd='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';class dd extends ed{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new Zc;return e.content=cd,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}i(40);class ud extends Mc{constructor(e){super(e);const t=this.bindTemplate;this.set("class"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new Os,this.focusTracker=new Rs,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.to("class"),t.if("isVisible","ck-hidden",e=>!e),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}focus(){this.actionView.focus()}_createActionView(){const e=new ed;return e.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),e.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),e.delegate("execute").to(this),e}_createArrowView(){const e=new ed,t=e.bindTemplate;return e.icon=cd,e.extendTemplate({attributes:{class:"ck-splitbutton__arrow","aria-haspopup":!0,"aria-expanded":t.to("isOn",e=>String(e))}}),e.bind("isEnabled").to(this),e.delegate("execute").to(this,"open"),e}}class hd extends Mc{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",e=>"ck-dropdown__panel_"+e),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(e=>e.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}i(42);function md({element:e,target:t,positions:i,limiter:o,fitInViewport:n}){M(t)&&(t=t()),M(o)&&(o=o());const r=function(e){return e&&e.parentNode?e.offsetParent===vr.document.body?null:e.offsetParent:null}(e),s=new Ts(e),a=new Ts(t);let l,c;if(o||n){const e=function(e,t){const{elementRect:i,viewportRect:o}=t,n=i.getArea(),r=function(e,{targetRect:t,elementRect:i,limiterRect:o,viewportRect:n}){const r=[],s=i.getArea();for(const a of e){const e=gd(a,t,i);if(!e)continue;const[l,c]=e;let d=0,u=0;if(o)if(n){const e=o.getIntersection(n);e&&(d=e.getIntersectionArea(c))}else d=o.getIntersectionArea(c);n&&(u=n.getIntersectionArea(c));const h={positionName:l,positionRect:c,limiterIntersectArea:d,viewportIntersectArea:u};if(d===s)return[h];r.push(h)}return r}(e,t);if(o){const e=fd(r.filter(({viewportIntersectArea:e})=>e===n),n);if(e)return e}return fd(r,n)}(i,{targetRect:a,elementRect:s,limiterRect:o&&new Ts(o).getVisible(),viewportRect:n&&new Ts(vr.window)});[c,l]=e||gd(i[0],a,s)}else[c,l]=gd(i[0],a,s);let d=pd(l);return r&&(d=function({left:e,top:t},i){const o=pd(new Ts(i)),n=As(i);return e-=o.left,t-=o.top,e+=i.scrollLeft,t+=i.scrollTop,e-=n.left,t-=n.top,{left:e,top:t}}(d,r)),{left:d.left,top:d.top,name:c}}function gd(e,t,i){const o=e(t,i);if(!o)return null;const{left:n,top:r,name:s}=o;return[s,i.clone().moveTo(n,r)]}function fd(e,t){let i,o,n=0;for(const{positionName:r,positionRect:s,limiterIntersectArea:a,viewportIntersectArea:l}of e){if(a===t)return[r,s];const e=l**2+a**2;e>n&&(n=e,i=s,o=r)}return i?[o,i]:null}function pd({left:e,top:t}){const{scrollX:i,scrollY:o}=vr.window;return{left:e+i,top:t+o}}class bd extends Mc{constructor(e,t,i){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Os,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",e=>!e)],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=bd._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)}),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,t())};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set("arrowright",(e,t)=>{this.isOpen&&t()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:o,northEast:n,northWest:r,southMiddleEast:s,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=bd.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[i,o,s,a,e,n,r,l,c,t]:[o,i,a,s,e,r,n,c,l,t]}}bd.defaultPanelPositions={south:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/2,name:"s"}),southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),southMiddleEast:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/4,name:"sme"}),southMiddleWest:(e,t)=>({top:e.bottom,left:e.left-3*(t.width-e.width)/4,name:"smw"}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:"n"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:"nme"}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-3*(t.width-e.width)/4,name:"nmw"})},bd._getOptimalPosition=md;class wd extends Mc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class kd extends Mc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function _d(e){return Array.isArray(e)?{items:e,removeItems:[]}:e?Object.assign({items:[],removeItems:[]},e):{items:[],removeItems:[]}}i(44);class vd extends Mc{constructor(e,t){super(e);const i=this.bindTemplate,o=this.t;this.options=t||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Rs,this.keystrokes=new Os,this.set("class"),this.set("isCompact",!1),this.itemsView=new yd(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const n="rtl"===e.uiLanguageDirection;this._focusCycler=new sd({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[n?"arrowright":"arrowleft","arrowup"],focusNext:[n?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];var s;this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")}},children:this.children,on:{mousedown:(s=this,s.bindTemplate.to(e=>{e.target===s.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Ad(this):new xd(this)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t){const i=_d(e),o=i.items.filter((e,o,n)=>"|"===e||-1===i.removeItems.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||(Object(l.b)("toolbarview-line-break-ignored-when-grouping-items",n),!1):!!t.has(e)||(Object(l.b)("toolbarview-item-unavailable",{name:e}),!1))),n=this._cleanSeparators(o).map(e=>"|"===e?new wd:"-"===e?new kd:t.create(e));this.items.addMany(n)}_cleanSeparators(e){const t=e=>"-"!==e&&"|"!==e,i=e.length,o=e.findIndex(t),n=i-e.slice().reverse().findIndex(t);return e.slice(o,n).filter((e,i,o)=>{if(t(e))return!0;return!(i>0&&o[i-1]===e)})}}class yd extends Mc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class xd{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>e),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Ad{constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),e.children.on("add",this._updateFocusCycleableItems.bind(this)),e.children.on("remove",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(e,t)=>{const i=t.index;for(const e of t.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=i;e<i+t.added.length;e++){const o=t.added[e-i];e>this.ungroupedItems.length?this.groupedItems.add(o,e-this.ungroupedItems.length):this.ungroupedItems.add(o,e)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!this.viewElement.offsetParent)return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new Ts(e.lastChild),o=new Ts(e);if(!this.cachedPadding){const i=vr.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(i[o])}return"ltr"===t?i.right>o.right-this.cachedPadding:i.left<o.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Ps(this.viewElement,t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new wd),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=Sd(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Pd(i,[]),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:Tc.threeVerticalDots}),i.toolbarView.items.bindTo(this.groupedItems).using(e=>e),i}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}i(46);class Cd extends Mc{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Rs,this.keystrokes=new Os,this._focusCycler=new sd({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class Td extends Mc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class Ed extends Mc{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}i(48),i(50);function Sd(e,t=dd){const i=new t(e),o=new hd(e),n=new bd(e,i,o);return i.bind("isEnabled").to(n),i instanceof dd?i.bind("isOn").to(n,"isOpen"):i.arrowView.bind("isOn").to(n,"isOpen"),function(e){(function(e){e.on("render",()=>{Ec({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof td||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isOpen&&(e.panelView.focus(),i())}),e.keystrokes.set("arrowup",(t,i)=>{e.isOpen&&(e.panelView.focusLast(),i())})}(e)}(n),n}function Pd(e,t){const i=e.locale,o=i.t,n=e.toolbarView=new vd(i);n.set("ariaLabel",o("Dropdown toolbar")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>n.items.add(e)),e.panelView.children.add(n),n.items.delegate("execute").to(e)}function Id(e,t){const i=e.locale,o=e.listView=new Cd(i);o.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Ed(i);if("button"===e||"switchbutton"===e){const o=new Td(i);let n;return n="button"===e?new ed(i):new td(i),n.bind(...Object.keys(t)).to(t),n.delegate("execute").to(o),o.children.add(n),o}}),e.panelView.children.add(o),o.items.delegate("execute").to(e)}i(52);class Md extends Mc{constructor(e){super(e),this.body=new Jc(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}i(54);class Nd extends Mc{constructor(e){super(e),this.set("text"),this.set("for"),this.id="ck-editor__label_"+s();const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}class Rd extends Md{constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new Nd;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class Od extends Mc{constructor(e,t,i){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(i=>{const o=e.document.getRoot(t.name);i.addClass(t.isFocused?"ck-focused":"ck-blurred",o),i.removeClass(t.isFocused?"ck-blurred":"ck-focused",o)})}e.isRenderingInProgress?function i(o){e.once("change:isRenderingInProgress",(e,n,r)=>{r?i(o):t(o)})}(this):t(this)}}class zd extends Od{constructor(e,t,i){super(e,t,i),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(i=>{const o=e.document.getRoot(this.name);i.setAttribute("aria-label",t("Rich Text Editor, %0",this.name),o)})}}i(56);class Vd extends Mc{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",i.to("class")]},children:this.children});const o=new Mc(e);o.setTemplate({tag:"span",attributes:{class:["ck","ck-form__header__label"]},children:[{text:i.to("label")}]}),this.children.add(o)}}i(58);class Dd extends Mc{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById"),this.focusTracker=new Rs,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to("input"),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()})}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}i(60);class Ld extends Mc{constructor(e,t){super(e);const i="ck-labeled-field-view-"+s(),o="ck-labeled-field-view-status-"+s();this.fieldView=t(this,i,o),this.set("label"),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.set("placeholder"),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(o),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const n=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e),n.if("isEmpty","ck-labeled-field-view_empty"),n.if("isFocused","ck-labeled-field-view_focused"),n.if("placeholder","ck-labeled-field-view_placeholder"),n.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:[this.fieldView,this.labelView]},this.statusView]})}_createLabelView(e){const t=new Nd(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new Mc(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",e=>!e)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}function Bd(e,t,i){const o=new Dd(e.locale);return o.set({id:t,ariaDescribedById:i}),o.bind("isReadOnly").to(e,"isEnabled",e=>!e),o.bind("hasError").to(e,"errorText",e=>!!e),o.on("input",()=>{e.errorText=null}),e.bind("isEmpty","isFocused","placeholder").to(o),o}function jd(e,t,i){const o=Sd(e.locale);return o.set({id:t,ariaDescribedById:i}),o.bind("isEnabled").to(e),o}class Fd extends so{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t="show:"+e.type+(e.namespace?":"+e.namespace:"");this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class Hd{constructor(e,t){t&&Ve(this,t),e&&this.set(e)}}Ke(Hd,Ue);i(62);const Ud=Ms("px"),Wd=vr.document.body;class $d extends Mc{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class"),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",e=>"ck-balloon-panel_"+e),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",Ud),left:t.to("left",Ud)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=$d.defaultPositions,i=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast],limiter:Wd,fitInViewport:!0},e),o=$d._getOptimalPosition(i),n=parseInt(o.left),r=parseInt(o.top),s=o.name;Object.assign(this,{top:r,left:n,position:s})}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=qd(e.target),i=e.limiter?qd(e.limiter):Wd;this.listenTo(vr.document,"scroll",(o,n)=>{const r=n.target,s=t&&r.contains(t),a=i&&r.contains(i);!s&&!a&&t&&i||this.attachTo(e)},{useCapture:!0}),this.listenTo(vr.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(vr.document,"scroll"),this.stopListening(vr.window,"resize")}}function qd(e){return Yi(e)?e:xs(e)?e.commonAncestorContainer:"function"==typeof e?qd(e()):null}function Yd(e,t){return e.top-t.height-$d.arrowVerticalOffset}function Gd(e){return e.bottom+$d.arrowVerticalOffset}$d.arrowHorizontalOffset=25,$d.arrowVerticalOffset=10,$d._getOptimalPosition=md,$d.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:Yd(e,t),left:e.left-$d.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:Yd(e,t),left:e.left-.25*t.width-$d.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:Yd(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:Yd(e,t),left:e.left-.75*t.width+$d.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:Yd(e,t),left:e.left-t.width+$d.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-$d.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-.25*t.width-$d.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-.75*t.width+$d.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:Yd(e,t),left:e.left+e.width/2-t.width+$d.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:Yd(e,t),left:e.right-$d.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:Yd(e,t),left:e.right-.25*t.width-$d.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:Yd(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:Yd(e,t),left:e.right-.75*t.width+$d.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:Yd(e,t),left:e.right-t.width+$d.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:Gd(e),left:e.left-$d.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:Gd(e),left:e.left-.25*t.width-$d.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:Gd(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:Gd(e),left:e.left-.75*t.width+$d.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:Gd(e),left:e.left-t.width+$d.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:Gd(e),left:e.left+e.width/2-$d.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:Gd(e),left:e.left+e.width/2-.25*t.width-$d.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:Gd(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:Gd(e),left:e.left+e.width/2-.75*t.width+$d.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:Gd(e),left:e.left+e.width/2-t.width+$d.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:Gd(e),left:e.right-$d.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:Gd(e),left:e.right-.25*t.width-$d.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:Gd(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:Gd(e),left:e.right-.75*t.width+$d.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:Gd(e),left:e.right-t.width+$d.arrowHorizontalOffset,name:"arrow_ne"})};i(64),i(66);const Kd=Ms("px");class Qd extends Qe{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.view=new $d(e.locale),e.ui.view.body.add(this.view),e.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this.hasView(e.view))throw new l.a("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new l.a("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new l.a("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(t=>t[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new Jd(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,i)=>{if(i<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,i])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new Zd(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:o=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),o&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&!e.limiter&&(e=Object.assign({},e,{limiter:this.positionLimiter})),e}}class Jd extends Mc{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Rs,this.buttonPrevView=this._createButtonView(t("Previous"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>'),this.buttonNextView=this._createButtonView(t("Next"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>'),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new ed(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class Zd extends Mc{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:i.to("top",Kd),left:i.to("left",Kd),width:i.to("width",Kd),height:i.to("height",Kd)}},children:this.content}),this.on("change:numberOfPanels",(e,t,i,o)=>{i>o?this._addPanels(i-o):this._removePanels(o-i),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new Mc;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:o}=new Ts(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:o})}}}i(68);const Xd=Ms("px");class eu extends Mc{constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheLimiter",!1),this.set("_hasViewportTopOffset",!1),this.content=this.createCollection(),this._contentPanelPlaceholder=new Nc({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",e=>e?"block":"none"),height:t.to("isSticky",e=>e?Xd(this._panelRect.height):null)}}}).render(),this._contentPanel=new Nc({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",e=>e?Xd(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_hasViewportTopOffset",e=>e?Xd(this.viewportTopOffset):null),bottom:t.to("_isStickyToTheLimiter",e=>e?Xd(this.limiterBottomOffset):null),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this._contentPanel]})}render(){super.render(),this._checkIfShouldBeSticky(),this.listenTo(vr.window,"scroll",()=>{this._checkIfShouldBeSticky()}),this.listenTo(this,"change:isActive",()=>{this._checkIfShouldBeSticky()})}_checkIfShouldBeSticky(){const e=this._panelRect=this._contentPanel.getBoundingClientRect();let t;this.limiterElement?(t=this._limiterRect=this.limiterElement.getBoundingClientRect(),this.isSticky=this.isActive&&t.top<this.viewportTopOffset&&this._panelRect.height+this.limiterBottomOffset<t.height):this.isSticky=!1,this.isSticky?(this._isStickyToTheLimiter=t.bottom<e.height+this.limiterBottomOffset+this.viewportTopOffset,this._hasViewportTopOffset=!this._isStickyToTheLimiter&&!!this.viewportTopOffset,this._marginLeft=this._isStickyToTheLimiter?null:Xd(-vr.window.scrollX)):(this._isStickyToTheLimiter=!1,this._hasViewportTopOffset=!1,this._marginLeft=null)}}Ms("px");i(70);Ms("px");Ms("px");i(72);const tu=new WeakMap;function iu(e){const{view:t,element:i,text:o,isDirectHost:n=!0,keepOnFocus:r=!1}=e,s=t.document;tu.has(s)||(tu.set(s,new Map),s.registerPostFixer(e=>nu(s,e))),tu.get(s).set(i,{text:o,isDirectHost:n,keepOnFocus:r,hostElement:n?i:null}),t.change(e=>nu(s,e))}function ou(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function nu(e,t){const i=tu.get(e),o=[];let n=!1;for(const[e,r]of i)r.isDirectHost&&(o.push(e),ru(t,e,r)&&(n=!0));for(const[e,r]of i){if(r.isDirectHost)continue;const i=su(e);i&&(o.includes(i)||(r.hostElement=i,ru(t,e,r)&&(n=!0)))}return n}function ru(e,t,i){const{text:o,isDirectHost:n,hostElement:r}=i;let s=!1;r.getAttribute("data-placeholder")!==o&&(e.setAttribute("data-placeholder",o,r),s=!0);return(n||1==t.childCount)&&function(e,t){if(!e.isAttached())return!1;if(Array.from(e.getChildren()).some(e=>!e.is("uiElement")))return!1;if(t)return!0;const i=e.document;if(!i.isFocused)return!0;const o=i.selection.anchor;return o&&o.parent!==e}(r,i.keepOnFocus)?function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0):ou(e,r)&&(s=!0),s}function su(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}const au=new Map;function lu(e,t,i){let o=au.get(e);o||(o=new Map,au.set(e,o)),o.set(t,i)}function cu(e){return[e]}function du(e,t,i={}){const o=function(e,t){const i=au.get(e);return i&&i.has(t)?i.get(t):cu}(e.constructor,t.constructor);try{return o(e=e.clone(),t,i)}catch(e){throw e}}function uu(e,t,i){e=e.slice(),t=t.slice();const o=new hu(i.document,i.useRelations,i.forceWeakRemove);o.setOriginalOperations(e),o.setOriginalOperations(t);const n=o.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:n};const r=new WeakMap;for(const t of e)r.set(t,0);const s={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const i=e[a],n=r.get(i);if(n==t.length){a++;continue}const s=t[n],l=du(i,s,o.getContext(i,s,!0)),c=du(s,i,o.getContext(s,i,!1));o.updateRelation(i,s),o.setOriginalOperations(l,i),o.setOriginalOperations(c,s);for(const e of l)r.set(e,n+c.length);e.splice(a,1,...l),t.splice(n,1,...c)}if(i.padWithNoOps){const i=e.length-s.originalOperationsACount,o=t.length-s.originalOperationsBCount;gu(e,o-i),gu(t,i-o)}return mu(e,s.nextBaseVersionB),mu(t,s.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:n}}class hu{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,i||t)}updateRelation(e,t){switch(e.constructor){case El:switch(t.constructor){case Nl:e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter");break;case El:e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter")}break;case Rl:switch(t.constructor){case Nl:e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");break;case El:if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const i=na._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const o=i.end.offset-e.splitPosition.offset,n=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:o,offset:n})}}}break;case Nl:switch(t.constructor){case Nl:e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement");break;case Rl:e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource")}break;case Pl:{const i=e.newRange;if(!i)return;switch(t.constructor){case El:{const o=na._createFromPositionAndShift(t.sourcePosition,t.howMany),n=o.containsPosition(i.start)||o.start.isEqual(i.start),r=o.containsPosition(i.end)||o.end.isEqual(i.end);!n&&!r||o.containsRange(i)||this._setRelation(e,t,{side:n?"left":"right",path:n?i.start.path.slice():i.end.path.slice()});break}case Nl:{const o=i.start.isEqual(t.targetPosition),n=i.start.isEqual(t.deletionPosition),r=i.end.isEqual(t.deletionPosition),s=i.end.isEqual(t.sourcePosition);(o||n||r||s)&&this._setRelation(e,t,{wasInLeftElement:o,wasStartBeforeMergedElement:n,wasEndBeforeMergedElement:r,wasInRightElement:s});break}}break}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),o=this._history.getUndoneOperation(i);if(!o)return null;const n=this.originalOperations.get(e),r=this._relations.get(n);return r&&r.get(o)||null}_setRelation(e,t,i){const o=this.originalOperations.get(e),n=this.originalOperations.get(t);let r=this._relations.get(o);r||(r=new Map,this._relations.set(o,r)),r.set(n,i)}}function mu(e,t){for(const i of e)i.baseVersion=t++}function gu(e,t){for(let i=0;i<t;i++)e.push(new Zl(0))}function fu(e,t,i){const o=e.nodes.getNode(0).getAttribute(t);if(o==i)return null;const n=new na(e.position,e.position.getShiftedBy(e.howMany));return new Cl(n,t,o,i,0)}function pu(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function bu(e,t){const i=[];for(let o=0;o<e.length;o++){const n=e[o],r=new El(n.start,n.end.offset-n.start.offset,t,0);i.push(r);for(let t=o+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];t=t._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return i}lu(Cl,Cl,(e,t,i)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const o=e.range.getDifference(t.range).map(t=>new Cl(t,e.key,e.oldValue,e.newValue,0)),n=e.range.getIntersection(t.range);return n&&i.aIsStrong&&o.push(new Cl(n,t.key,t.newValue,e.newValue,0)),0==o.length?[new Zl(0)]:o}return[e]}),lu(Cl,Sl,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const i=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new Cl(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const o=fu(t,e.key,e.oldValue);o&&i.unshift(o)}return i}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),lu(Cl,Nl,(e,t)=>{const i=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&i.push(na._createFromPositionAndShift(t.graveyardPosition,1));const o=e.range._getTransformedByMergeOperation(t);return o.isCollapsed||i.push(o),i.map(t=>new Cl(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),lu(Cl,El,(e,t)=>function(e,t){const i=na._createFromPositionAndShift(t.sourcePosition,t.howMany);let o=null,n=[];i.containsRange(e,!0)?o=e:e.start.hasSameParentAs(i.start)?(n=e.getDifference(i),o=e.getIntersection(i)):n=[e];const r=[];for(let e of n){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const i=t.getMovedRangeStart(),o=e.start.hasSameParentAs(i);e=e._getTransformedByInsertion(i,t.howMany,o),r.push(...e)}o&&r.push(o._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return r}(e.range,t).map(t=>new Cl(t,e.key,e.oldValue,e.newValue,e.baseVersion))),lu(Cl,Rl,(e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const i=e.clone();return i.range=new na(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,i]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),lu(Sl,Cl,(e,t)=>{const i=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const o=fu(e,t.key,t.newValue);o&&i.push(o)}return i}),lu(Sl,Sl,(e,t,i)=>(e.position.isEqual(t.position)&&i.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),lu(Sl,El,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),lu(Sl,Rl,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),lu(Sl,Nl,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),lu(Pl,Sl,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),lu(Pl,Pl,(e,t,i)=>{if(e.name==t.name){if(!i.aIsStrong)return[new Zl(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),lu(Pl,Nl,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),lu(Pl,El,(e,t,i)=>{if(e.oldRange&&(e.oldRange=na._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(i.abRelation){const o=na._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=i.abRelation.path,e.newRange.end=o.end,[e];if("right"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=o.start,e.newRange.end.path=i.abRelation.path,[e]}e.newRange=na._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]}),lu(Pl,Rl,(e,t,i)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(i.abRelation){const o=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&i.abRelation.wasStartBeforeMergedElement?e.newRange.start=ea._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!i.abRelation.wasInLeftElement&&(e.newRange.start=ea._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasInRightElement?e.newRange.end=ea._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasEndBeforeMergedElement?e.newRange.end=ea._createAt(t.insertionPosition):e.newRange.end=o.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),lu(Nl,Sl,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),lu(Nl,Nl,(e,t,i)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(i.bWasUndone){const i=t.graveyardPosition.path.slice();return i.push(0),e.sourcePosition=new ea(t.graveyardPosition.root,i),e.howMany=0,[e]}return[new Zl(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!i.bWasUndone&&"splitAtSource"!=i.abRelation){const o="$graveyard"==e.targetPosition.root.rootName,n="$graveyard"==t.targetPosition.root.rootName,r=o&&!n;if(n&&!o||!r&&i.aIsStrong){const i=t.targetPosition._getTransformedByMergeOperation(t),o=e.targetPosition._getTransformedByMergeOperation(t);return[new El(i,e.howMany,o,0)]}return[new Zl(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&i.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),lu(Nl,El,(e,t,i)=>{const o=na._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!i.bWasUndone&&!i.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.sourcePosition)?[new Zl(0)]:(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])}),lu(Nl,Rl,(e,t,i)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){const o=0!=t.howMany,n=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(o||n||"mergeTargetNotMoved"==i.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==i.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==i.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}),lu(El,Sl,(e,t)=>{const i=na._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),lu(El,El,(e,t,i)=>{const o=na._createFromPositionAndShift(e.sourcePosition,e.howMany),n=na._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,s=i.aIsStrong,a=!i.aIsStrong;if("insertBefore"==i.abRelation||"insertAfter"==i.baRelation?a=!0:"insertAfter"!=i.abRelation&&"insertBefore"!=i.baRelation||(a=!1),r=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),pu(e,t)&&pu(t,e))return[t.getReversed()];if(o.containsPosition(t.targetPosition)&&o.containsRange(n,!0))return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),bu([o],r);if(n.containsPosition(e.targetPosition)&&n.containsRange(o,!0))return o.start=o.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),o.end=o.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),bu([o],r);const l=ao(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),bu([o],r);"remove"!=e.type||"remove"==t.type||i.aWasUndone||i.forceWeakRemove?"remove"==e.type||"remove"!=t.type||i.bWasUndone||i.forceWeakRemove||(s=!1):s=!0;const c=[],d=o.getDifference(n);for(const e of d){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const i="same"==ao(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),o=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,i);c.push(...o)}const u=o.getIntersection(n);return null!==u&&s&&(u.start=u.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),u.end=u.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(u):1==c.length?n.start.isBefore(o.start)||n.start.isEqual(o.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),0===c.length?[new Zl(e.baseVersion)]:bu(c,r)}),lu(El,Rl,(e,t,i)=>{let o=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=i.abRelation||(o=e.targetPosition._getTransformedBySplitOperation(t));const n=na._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=o,[e];if(n.start.hasSameParentAs(t.splitPosition)&&n.containsPosition(t.splitPosition)){let e=new na(t.splitPosition,n.end);e=e._getTransformedBySplitOperation(t);return bu([new na(n.start,t.splitPosition),e],o)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==i.abRelation&&(o=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==i.abRelation&&(o=e.targetPosition);const r=[n._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const o=n.start.isEqual(t.graveyardPosition)||n.containsPosition(t.graveyardPosition);e.howMany>1&&o&&!i.aWasUndone&&r.push(na._createFromPositionAndShift(t.insertionPosition,1))}return bu(r,o)}),lu(El,Nl,(e,t,i)=>{const o=na._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&o.containsPosition(t.sourcePosition))if("remove"!=e.type||i.forceWeakRemove){if(1==e.howMany)return i.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new Zl(0)]}else if(!i.aWasUndone){const i=[];let o=t.graveyardPosition.clone(),n=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(i.push(new El(e.sourcePosition,e.howMany-1,e.targetPosition,0)),o=o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),n=n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const r=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),s=new El(o,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const l=new ea(s.targetPosition.root,a);n=n._getTransformedByMove(o,r,1);const c=new El(n,t.howMany,l,0);return i.push(s),i.push(c),i}const n=na._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),lu(Il,Sl,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),lu(Il,Nl,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),lu(Il,El,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),lu(Il,Il,(e,t,i)=>{if(e.position.isEqual(t.position)){if(!i.aIsStrong)return[new Zl(0)];e.oldName=t.newName}return[e]}),lu(Il,Rl,(e,t)=>{if("same"==ao(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new Il(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),lu(Ml,Ml,(e,t,i)=>{if(e.root===t.root&&e.key===t.key){if(!i.aIsStrong||e.newValue===t.newValue)return[new Zl(0)];e.oldValue=t.newValue}return[e]}),lu(Rl,Sl,(e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e])),lu(Rl,Nl,(e,t,i)=>{if(!e.graveyardPosition&&!i.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const i=t.graveyardPosition.path.slice();i.push(0);const o=new ea(t.graveyardPosition.root,i),n=Rl.getInsertionPosition(new ea(t.graveyardPosition.root,i)),r=new Rl(o,0,n,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Rl.getInsertionPosition(e.splitPosition),e.graveyardPosition=r.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[r,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Rl.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),lu(Rl,El,(e,t,i)=>{const o=na._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const n=o.start.isEqual(e.graveyardPosition)||o.containsPosition(e.graveyardPosition);if(!i.bWasUndone&&n){const i=e.splitPosition._getTransformedByMoveOperation(t),o=e.graveyardPosition._getTransformedByMoveOperation(t),n=o.path.slice();n.push(0);const r=new ea(o.root,n);return[new El(i,e.howMany,r,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const n=e.splitPosition.isEqual(t.targetPosition);if(n&&("insertAtSource"==i.baRelation||"splitBefore"==i.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=Rl.getInsertionPosition(e.splitPosition),[e];if(n&&i.abRelation&&i.abRelation.howMany){const{howMany:t,offset:o}=i.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(o),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&o.containsPosition(e.splitPosition)){const i=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=i,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=Rl.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=Rl.getInsertionPosition(e.splitPosition),[e]}),lu(Rl,Rl,(e,t,i)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new Zl(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new Zl(0)];if("splitBefore"==i.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const o="$graveyard"==e.splitPosition.root.rootName,n="$graveyard"==t.splitPosition.root.rootName,r=o&&!n;if(n&&!o||!r&&i.aIsStrong){const i=[];return t.howMany&&i.push(new El(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&i.push(new El(e.splitPosition,e.howMany,e.moveTargetPosition,0)),i}return[new Zl(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==i.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==i.baRelation){const i=t.insertionPosition.path.slice();i.push(0);const o=new ea(t.insertionPosition.root,i);return[e,new El(e.insertionPosition,1,o,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=Rl.getInsertionPosition(e.splitPosition),[e]});class wu extends ts{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class ku extends ts{constructor(e){super(e),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class _u{constructor(e){this.document=e}createDocumentFragment(e){return new Wn(this.document,e)}createElement(e,t,i){return new en(this.document,e,t,i)}createText(e){return new uo(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const o=i.getChildIndex(e);return this.removeChildren(o,1,i),this.insertChild(o,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new en(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){lt(e)&&void 0===i&&(i=t),i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return cn._createAt(e,t)}createPositionAfter(e){return cn._createAfter(e)}createPositionBefore(e){return cn._createBefore(e)}createRange(e,t){return new dn(e,t)}createRangeOn(e){return dn._createOn(e)}createRangeIn(e){return dn._createIn(e)}createSelection(e,t,i){return new mn(e,t,i)}}const vu=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,yu=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,xu=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Au=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,Cu=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Tu=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rebeccapurple","currentcolor","transparent"]);function Eu(e){return e.startsWith("#")?vu.test(e):e.startsWith("rgb")?yu.test(e)||xu.test(e):e.startsWith("hsl")?Au.test(e)||Cu.test(e):Tu.has(e.toLowerCase())}const Su=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Pu(e){return Su.includes(e)}const Iu=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Mu(e){return Iu.test(e)}const Nu=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Ru(e){return Nu.test(e)}const Ou=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const zu=["center","top","bottom","left","right"];function Vu(e){return zu.includes(e)}const Du=["fixed","scroll","local"];function Lu(e){return Du.includes(e)}const Bu=/^url\(/;function ju(e){return Bu.test(e)}function Fu(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=$u(e),i=t[0],o=t[2]||i,n=t[1]||i;return{top:i,bottom:o,right:n,left:t[3]||n}}function Hu(e){return t=>{const{top:i,right:o,bottom:n,left:r}=t,s=[];return[i,o,r,n].every(e=>!!e)?s.push([e,Uu(t)]):(i&&s.push([e+"-top",i]),o&&s.push([e+"-right",o]),n&&s.push([e+"-bottom",n]),r&&s.push([e+"-left",r])),s}}function Uu({top:e,right:t,bottom:i,left:o}){const n=[];return o!==t?n.push(e,t,i,o):i!==e?n.push(e,t,i):t!==e?n.push(e,t):n.push(e),n.join(" ")}function Wu(e){return t=>({path:e,value:Fu(t)})}function $u(e){return e.replace(/, /g,",").split(" ").map(e=>e.replace(/,/g,", "))}function qu(e){e.setNormalizer("background",Yu),e.setNormalizer("background-color",e=>({path:"background.color",value:e})),e.setReducer("background",e=>{const t=[];return t.push(["background-color",e.color]),t}),e.setStyleRelation("background",["background-color"])}function Yu(e){const t={},i=$u(e);for(const e of i)o=e,Ou.includes(o)?(t.repeat=t.repeat||[],t.repeat.push(e)):Vu(e)?(t.position=t.position||[],t.position.push(e)):Lu(e)?t.attachment=e:Eu(e)?t.color=e:ju(e)&&(t.image=e);var o;return{path:"background",value:t}}function Gu(e){e.setNormalizer("border",Ku),e.setNormalizer("border-top",Qu("top")),e.setNormalizer("border-right",Qu("right")),e.setNormalizer("border-bottom",Qu("bottom")),e.setNormalizer("border-left",Qu("left")),e.setNormalizer("border-color",Ju("color")),e.setNormalizer("border-width",Ju("width")),e.setNormalizer("border-style",Ju("style")),e.setNormalizer("border-top-color",Xu("color","top")),e.setNormalizer("border-top-style",Xu("style","top")),e.setNormalizer("border-top-width",Xu("width","top")),e.setNormalizer("border-right-color",Xu("color","right")),e.setNormalizer("border-right-style",Xu("style","right")),e.setNormalizer("border-right-width",Xu("width","right")),e.setNormalizer("border-bottom-color",Xu("color","bottom")),e.setNormalizer("border-bottom-style",Xu("style","bottom")),e.setNormalizer("border-bottom-width",Xu("width","bottom")),e.setNormalizer("border-left-color",Xu("color","left")),e.setNormalizer("border-left-style",Xu("style","left")),e.setNormalizer("border-left-width",Xu("width","left")),e.setExtractor("border-top",eh("top")),e.setExtractor("border-right",eh("right")),e.setExtractor("border-bottom",eh("bottom")),e.setExtractor("border-left",eh("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",Hu("border-color")),e.setReducer("border-style",Hu("border-style")),e.setReducer("border-width",Hu("border-width")),e.setReducer("border-top",oh("top")),e.setReducer("border-right",oh("right")),e.setReducer("border-bottom",oh("bottom")),e.setReducer("border-left",oh("left")),e.setReducer("border",function(){return t=>{const i=th(t,"top"),o=th(t,"right"),n=th(t,"bottom"),r=th(t,"left"),s=[i,o,n,r],a={width:e(s,"width"),style:e(s,"style"),color:e(s,"color")},l=nh(a,"all");if(l.length)return l;return[...Object.entries(a).reduce((e,[t,i])=>(i&&(e.push(["border-"+t,i]),s.forEach(e=>e[t]=null)),e),[]),...nh(i,"top"),...nh(o,"right"),...nh(n,"bottom"),...nh(r,"left")]};function e(e,t){return e.map(e=>e[t]).reduce((e,t)=>e==t?e:null)}}()),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function Ku(e){const{color:t,style:i,width:o}=ih(e);return{path:"border",value:{color:Fu(t),style:Fu(i),width:Fu(o)}}}function Qu(e){return t=>{const{color:i,style:o,width:n}=ih(t),r={};return void 0!==i&&(r.color={[e]:i}),void 0!==o&&(r.style={[e]:o}),void 0!==n&&(r.width={[e]:n}),{path:"border",value:r}}}function Ju(e){return t=>({path:"border",value:Zu(t,e)})}function Zu(e,t){return{[t]:Fu(e)}}function Xu(e,t){return i=>({path:"border",value:{[e]:{[t]:i}}})}function eh(e){return(t,i)=>{if(i.border)return th(i.border,e)}}function th(e,t){const i={};return e.width&&e.width[t]&&(i.width=e.width[t]),e.style&&e.style[t]&&(i.style=e.style[t]),e.color&&e.color[t]&&(i.color=e.color[t]),i}function ih(e){const t={},i=$u(e);for(const e of i)Mu(e)||/thin|medium|thick/.test(e)?t.width=e:Pu(e)?t.style=e:t.color=e;return t}function oh(e){return t=>nh(t,e)}function nh(e,t){const i=[];if(e&&e.width&&i.push("width"),e&&e.style&&i.push("style"),e&&e.color&&i.push("color"),3==i.length){const o=i.map(t=>e[t]).join(" ");return["all"==t?["border",o]:["border-"+t,o]]}return"all"==t?[]:i.map(i=>[`border-${t}-${i}`,e[i]])}function rh(e){e.setNormalizer("padding",Wu("padding")),e.setNormalizer("padding-top",e=>({path:"padding.top",value:e})),e.setNormalizer("padding-right",e=>({path:"padding.right",value:e})),e.setNormalizer("padding-bottom",e=>({path:"padding.bottom",value:e})),e.setNormalizer("padding-left",e=>({path:"padding.left",value:e})),e.setReducer("padding",Hu("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}class sh extends yc{constructor(e,t){super(e),this.view=t,this._toolbarConfig=_d(e.config.get("toolbar")),this._elementReplacer=new vs}get element(){return this.view.element}init(e){const t=this.editor,i=this.view,o=t.editing.view,n=i.editable,r=o.document.getRoot();n.name=r.rootName,i.render();const s=n.element;this.setEditableElement(n.name,s),this.focusTracker.add(s),i.editable.bind("isFocused").to(this.focusTracker),o.attachDomRoot(s),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initToolbar(){const e=this.editor,t=this.view,i=e.editing.view;t.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),t.stickyPanel.limiterElement=t.element,this._toolbarConfig.viewportTopOffset&&(t.stickyPanel.viewportTopOffset=this._toolbarConfig.viewportTopOffset),t.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),function({origin:e,originKeystrokeHandler:t,originFocusTracker:i,toolbar:o,beforeFocus:n,afterBlur:r}){i.add(o.element),t.set("Alt+F10",(e,t)=>{i.isFocused&&!o.focusTracker.isFocused&&(n&&n(),o.focus(),t())}),o.keystrokes.set("Esc",(t,i)=>{o.focusTracker.isFocused&&(e.focus(),r&&r(),i())})}({origin:i,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:t.toolbar})}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),o=e.sourceElement,n=e.config.get("placeholder")||o&&"textarea"===o.tagName.toLowerCase()&&o.getAttribute("placeholder");n&&iu({view:t,element:i,text:n,isDirectHost:!1,keepOnFocus:!0})}}i(74);class ah extends Rd{constructor(e,t,i={}){super(e),this.stickyPanel=new eu(e),this.toolbar=new vd(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),this.editable=new zd(e,t)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class lh extends kc{constructor(e,t){super(t),Yi(e)&&(this.sourceElement=e),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),o=new ah(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i});this.ui=new sh(this,o),function(e){if(!M(e.updateSourceElement))throw new l.a("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(t&&"textarea"===t.tagName.toLowerCase()&&t.form){let i;const o=t.form,n=()=>e.updateSourceElement();M(o.submit)&&(i=o.submit,o.submit=()=>{n(),i.apply(o)}),o.addEventListener("submit",n),e.on("destroy",()=>{o.removeEventListener("submit",n),i&&(o.submit=i)})}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(i=>{const o=new this(e,t);i(o.initPlugins().then(()=>o.ui.init(Yi(e)?e:null)).then(()=>{if(!Yi(e)&&t.initialData)throw new l.a("editor-create-initial-data",null);const i=void 0!==t.initialData?t.initialData:function(e){return Yi(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}(e);return o.data.init(i)}).then(()=>o.fire("ready")).then(()=>o))})}}Ke(lh,xc),Ke(lh,Ac);class ch{constructor(e){this.files=function(e){const t=Array.from(e.files||[]),i=Array.from(e.items||[]);if(t.length)return t;return i.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}(e),this._native=e}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}class dh extends ts{constructor(e){super(e);const t=this.document;function i(e){return(i,o)=>{o.preventDefault();const r=o.dropRange?[o.dropRange]:null,s=new n(t,e);t.fire(s,{dataTransfer:o.dataTransfer,method:i.name,targetRanges:r,target:o.target}),s.stop.called&&o.stopPropagation()}}this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"],this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"})}onDomEvent(e){const t={dataTransfer:new ch(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"!=e.type&&"dragover"!=e.type||(t.dropRange=function(e,t){const i=t.target.ownerDocument,o=t.clientX,n=t.clientY;let r;i.caretRangeFromPoint&&i.caretRangeFromPoint(o,n)?r=i.caretRangeFromPoint(o,n):t.rangeParent&&(r=i.createRange(),r.setStart(t.rangeParent,t.rangeOffset),r.collapse(!0));if(r)return e.domConverter.domRangeToView(r);return null}(this.view,e)),this.fire(e.type,e,t)}}const uh=["figcaption","li"];class hh extends Qe{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(dh),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,o=i.document;this.listenTo(o,"clipboardInput",t=>{e.isReadOnly&&t.stop()},{priority:"highest"}),this.listenTo(o,"clipboardInput",(e,t)=>{const o=t.dataTransfer;let r=t.content||"";var s;r||(o.getData("text/html")?r=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t).replace(/<!--[\s\S]*?-->/g,"")}(o.getData("text/html")):o.getData("text/plain")&&(((s=(s=o.getData("text/plain")).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;")).includes("</p><p>")||s.includes("<br>"))&&(s=`<p>${s}</p>`),r=s),r=this.editor.data.htmlProcessor.toView(r));const a=new n(this,"inputTransformation");this.fire(a,{content:r,dataTransfer:o,targetRanges:t.targetRanges,method:t.method}),a.stop.called&&e.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,i)=>{if(i.content.isEmpty)return;const o=this.editor.data.toModel(i.content,"$clipboardHolder");0!=o.childCount&&(e.stop(),t.change(()=>{this.fire("contentInsertion",{content:o,method:i.method,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(e,i)=>{i.resultRange=t.insertContent(i.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document;function o(o,n){const r=n.dataTransfer;n.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));i.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this.listenTo(i,"copy",o,{priority:"low"}),this.listenTo(i,"cut",(t,i)=>{e.isReadOnly?i.preventDefault():o(t,i)},{priority:"low"}),this.listenTo(i,"clipboardOutput",(i,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",function e(t){let i="";if(t.is("$text")||t.is("$textProxy"))i=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))i=t.getAttribute("alt");else if(t.is("element","br"))i="\n";else{let o=null;for(const n of t.getChildren()){const t=e(n);o&&(o.is("containerElement")||n.is("containerElement"))&&(uh.includes(o.name)||uh.includes(n.name)?i+="\n":i+="\n\n"),i+=t,o=n}}return i}(o.content))),"cut"==o.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}function*mh(e,t){for(const i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i)}class gh extends Ze{execute(){const e=this.editor.model,t=e.document;e.change(i=>{!function(e,t,i,o){const n=i.isCollapsed,r=i.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return void(n||s!=a||e.deleteContent(i));if(n){const e=mh(t.model.schema,i.getAttributes());fh(t,r.start),t.setSelectionAttribute(e)}else{const o=!(r.start.isAtStart&&r.end.isAtEnd),n=s==a;e.deleteContent(i,{leaveUnmerged:o}),o&&(n?fh(t,i.focus):t.setSelection(a,0))}}(this.editor.model,i,t.selection,e.schema),this.fire("afterExecute",{writer:i})})}}function fh(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}class ph extends Or{constructor(e){super(e);const t=this.document;t.on("keydown",(e,i)=>{if(this.isEnabled&&i.keyCode==Nn.enter){const o=new fn(t,"enter",t.selection.getFirstRange());t.fire(o,new es(t,i.domEvent,{isSoft:i.shiftKey})),o.stop.called&&e.stop()}})}observe(){}}class bh extends Qe{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(ph),e.commands.add("enter",new gh(e)),this.listenTo(i,"enter",(i,o)=>{o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class wh{constructor(e,t=20){this.model=e,this.size=0,this.limit=t,this.isLocked=!1,this._changeCallback=(e,t)=>{"transparent"!=t.type&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(e){this.size+=e,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e){this.isLocked&&!e||(this._batch=null,this.size=0)}}class kh extends Ze{constructor(e,t){super(e),this.direction=t,this._buffer=new wh(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,o=>{this._buffer.lock();const n=o.createSelection(e.selection||i.selection),r=e.sequence||1,s=n.isCollapsed;if(n.isCollapsed&&t.modifySelection(n,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(n,r))return void this.editor.execute("paragraph",{selection:n});if(n.isCollapsed)return;let a=0;n.getFirstRange().getMinimalFlatRanges().forEach(e=>{a+=hn(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(n,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(n),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,o=t.schema.getLimitElement(i);if(!(i.isCollapsed&&i.containsEntireContent(o)))return!1;if(!t.schema.checkChild(o,"paragraph"))return!1;const n=o.getChild(0);return!n||"paragraph"!==n.name}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,o=t.schema.getLimitElement(i),n=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(n,o),e.setSelection(n,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const o=e.getFirstPosition(),n=i.schema.getLimitElement(o),r=n.getChild(0);return o.parent==r&&(!!e.containsEntireContent(r)&&(!!i.schema.checkChild(n,"paragraph")&&"paragraph"!=r.name))}}class _h extends Or{constructor(e){super(e);const t=e.document;let i=0;function o(e,i,o){const n=new fn(t,"delete",t.selection.getFirstRange());t.fire(n,new es(t,i,o)),n.stop.called&&e.stop()}t.on("keyup",(e,t)=>{t.keyCode!=Nn.delete&&t.keyCode!=Nn.backspace||(i=0)}),t.on("keydown",(e,t)=>{const n={};if(t.keyCode==Nn.delete)n.direction="forward",n.unit="character";else{if(t.keyCode!=Nn.backspace)return;n.direction="backward",n.unit="codePoint"}const r=Pn.isMac?t.altKey:t.ctrlKey;n.unit=r?"word":n.unit,n.sequence=++i,o(e,t.domEvent,n)}),Pn.isAndroid&&t.on("beforeinput",(t,i)=>{if("deleteContentBackward"!=i.domEvent.inputType)return;const n={unit:"codepoint",direction:"backward",sequence:1},r=i.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(n.selectionToRemove=e.domConverter.domSelectionToView(r)),o(t,i.domEvent,n)})}observe(){}}class vh extends Qe{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(_h);const o=new kh(e,"forward");if(e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new kh(e,"backward")),this.listenTo(i,"delete",(i,o)=>{const n={unit:o.unit,sequence:o.sequence};if(o.selectionToRemove){const t=e.model.createSelection(),i=[];for(const t of o.selectionToRemove.getRanges())i.push(e.editing.mapper.toModelRange(t));t.setTo(i),n.selection=t}e.execute("forward"==o.direction?"deleteForward":"delete",n),o.preventDefault(),t.scrollToTheSelection()},{priority:"low"}),Pn.isAndroid){let e=null;this.listenTo(i,"delete",(t,i)=>{const o=i.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}},{priority:"lowest"}),this.listenTo(i,"keyup",(t,i)=>{if(e){const t=i.domTarget.ownerDocument.defaultView.getSelection();t.collapse(e.anchorNode,e.anchorOffset),t.extend(e.focusNode,e.focusOffset),e=null}})}}}class yh{constructor(){this._stack=[]}add(e,t){const i=this._stack,o=i[0];this._insertDescriptor(e);const n=i[0];o===n||xh(o,n)||this.fire("change:top",{oldDescriptor:o,newDescriptor:n,writer:t})}remove(e,t){const i=this._stack,o=i[0];this._removeDescriptor(e);const n=i[0];o===n||xh(o,n)||this.fire("change:top",{oldDescriptor:o,newDescriptor:n,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e.id);if(xh(e,t[i]))return;i>-1&&t.splice(i,1);let o=0;for(;t[o]&&Ah(t[o],e);)o++;t.splice(o,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e);i>-1&&t.splice(i,1)}}function xh(e,t){return e&&t&&e.priority==t.priority&&Ch(e.classes)==Ch(t.classes)}function Ah(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&Ch(e.classes)>Ch(t.classes)}function Ch(e){return Array.isArray(e)?e.sort().join(","):e}Ke(yh,u);function Th(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function Eh(e,t,i={}){if(!e.is("containerElement"))throw new l.a("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=zh,i.label&&function(e,t,i){i.setCustomProperty("widgetLabel",t,e)}(e,i.label,t),i.hasSelectionHandle&&function(e,t){const i=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),i=new Zc;return i.set("content",'<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>'),i.render(),t.appendChild(i.element),t}));t.insert(t.createPositionAt(e,0),i),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),Ih(e,t,Sh,Ph),e}function Sh(e,t,i){if(t.classes&&i.addClass(eo(t.classes),e),t.attributes)for(const o in t.attributes)i.setAttribute(o,t.attributes[o],e)}function Ph(e,t,i){if(t.classes&&i.removeClass(eo(t.classes),e),t.attributes)for(const o in t.attributes)i.removeAttribute(o,e)}function Ih(e,t,i,o){const n=new yh;n.on("change:top",(t,n)=>{n.oldDescriptor&&o(e,n.oldDescriptor,n.writer),n.newDescriptor&&i(e,n.newDescriptor,n.writer)}),t.setCustomProperty("addHighlight",(e,t,i)=>n.add(t,i),e),t.setCustomProperty("removeHighlight",(e,t,i)=>n.remove(t,i),e)}function Mh(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function Nh(e,t){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(i,o,n)=>{t.setAttribute("contenteditable",n?"false":"true",e)}),e.on("change:isFocused",(i,o,n)=>{n?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),e}function Rh(e,t){const i=e.getSelectedElement();if(i){const o=Dh(e);if(o)return t.createRange(t.createPositionAt(i,o));if(t.schema.isObject(i)&&!t.schema.isInline(i))return t.createRangeOn(i)}const o=e.getSelectedBlocks().next().value;if(o){if(o.isEmpty)return t.createRange(t.createPositionAt(o,0));const i=t.createPositionAfter(o);return e.focus.isTouching(i)?t.createRange(i):t.createRange(t.createPositionBefore(o))}return t.createRange(e.focus)}function Oh(e,t){const i=new Ts(vr.window),o=i.getIntersection(e),n=t.height+$d.arrowVerticalOffset;if(e.top-n>i.top||e.bottom+n<i.bottom)return null;const r=o||e,s=r.left+r.width/2-t.width/2;return{top:Math.max(e.top,0)+$d.arrowVerticalOffset,left:s,name:"arrow_n"}}function zh(){return null}function Vh(e,t,i){return e&&Th(e)&&!i.isInline(t)}function Dh(e){return e.getAttribute("widget-type-around")}const Lh=[On("arrowUp"),On("arrowRight"),On("arrowDown"),On("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let e=112;e<=135;e++)Lh.push(e);function Bh(e){return!(!e.ctrlKey&&!e.metaKey)||Lh.includes(e.keyCode)}i(76);const jh=["before","after"],Fh=(new DOMParser).parseFromString('<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>',"image/svg+xml").firstChild;class Hh extends Qe{static get pluginName(){return"WidgetTypeAround"}static get requires(){return[bh,vh]}constructor(e){super(e),this._currentFakeCaretModelElement=null}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,o,n)=>{t.change(e=>{for(const i of t.document.roots)n?e.removeClass("ck-widget__type-around_disabled",i):e.addClass("ck-widget__type-around_disabled",i)}),n||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableDeleteContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,o=i.editing.view;i.execute("insertParagraph",{position:i.model.createPositionAt(e,t)}),o.focus(),o.scrollToTheSelection()}_listenToIfEnabled(e,t,i,o){this.listenTo(e,t,(...e)=>{this.isEnabled&&i(...e)},o)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Dh(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,o={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,i,n)=>{const r=n.mapper.toViewElement(i.item);Vh(r,i.item,t)&&function(e,t,i){const o=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const i=this.toDomElement(e);return function(e,t){for(const i of jh){const o=new Nc({tag:"div",attributes:{class:["ck","ck-widget__type-around__button","ck-widget__type-around__button_"+i],title:t[i]},children:[e.ownerDocument.importNode(Fh,!0)]});e.appendChild(o.render())}}(i,t),function(e){const t=new Nc({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(i),i}));e.insert(e.createPositionAt(i,"end"),o)}(n.writer,o,r)},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,o=t.schema,n=e.editing.view;function r(e){return"ck-widget_type-around_show-fake-caret_"+e}this._listenToIfEnabled(n.document,"arrowKey",(e,t)=>{this._handleArrowKeyPress(e,t)},{context:[Th,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(t,i)=>{i.directChange&&e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=i.getSelectedElement();if(t){if(Vh(e.editing.mapper.toViewElement(t),t,o))return}e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,i)=>{const n=i.writer;if(this._currentFakeCaretModelElement){const e=i.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(n.removeClass(jh.map(r),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=i.mapper.toViewElement(s);if(!Vh(a,s,o))return;const l=Dh(t.selection);l&&(n.addClass(r(l),a),this._currentFakeCaretModelElement=s)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,i,o)=>{o||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})})}_handleArrowKeyPress(e,t){const i=this.editor,o=i.model,n=o.document.selection,r=o.schema,s=i.editing.view,a=Ln(t.keyCode,i.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;Vh(l,i.editing.mapper.toModelElement(l),r)?c=this._handleArrowKeyPressOnSelectedWidget(a):n.isCollapsed&&(c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=Dh(t.document.selection);return t.change(t=>{if(!i)return t.setSelectionAttribute("widget-type-around",e?"after":"before"),!0;if(!(i===(e?"after":"before")))return t.removeSelectionAttribute("widget-type-around"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,o=i.schema,n=t.plugins.get("Widget"),r=n._getObjectElementNextToSelection(e);return!!Vh(t.editing.mapper.toViewElement(r),r,o)&&(i.change(t=>{n._setSelectionOverElement(r),t.setSelectionAttribute("widget-type-around",e?"before":"after")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,o)=>{const n=o.domTarget.closest(".ck-widget__type-around__button");if(!n)return;const r=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(n),s=function(e,t){const i=e.closest(".ck-widget");return t.mapDomToView(i)}(n,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,r),o.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(i,o)=>{if("atTarget"!=i.eventPhase)return;const n=t.getSelectedElement(),r=e.editing.mapper.toViewElement(n),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Vh(r,n,s)&&(this._insertParagraph(n,o.isSoft?"before":"after"),a=!0),a&&(o.preventDefault(),i.stop())},{context:Th})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view,t=[Nn.enter,Nn.delete,Nn.backspace];this._listenToIfEnabled(e.document,"keydown",(e,i)=>{t.includes(i.keyCode)||Bh(i)||this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,o=i.schema;this._listenToIfEnabled(t.document,"delete",(t,n)=>{if("atTarget"!=t.eventPhase)return;const r=Dh(i.document.selection);if(!r)return;const s=n.direction,a=i.document.selection.getSelectedElement(),l="forward"==s;if("before"===r===l)e.execute("delete",{selection:i.createSelection(a,"on")});else{const t=o.getNearestSelectionRange(i.createPositionAt(a,r),s);if(t)if(t.isCollapsed){const n=i.createSelection(t.start);if(i.modifySelection(n,{direction:s}),n.focus.isEqual(t.start)){const e=function(e,t){let i=t;for(const o of t.getAncestors({parentFirst:!0})){if(o.childCount>1||e.isLimit(o))break;i=o}return i}(o,t.start.parent);i.deleteContent(i.createSelection(e,"on"),{doNotAutoparagraph:!0})}else i.change(i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")})}else i.change(i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")})}n.preventDefault(),t.stop()},{context:Th})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[o,n])=>{if(n&&!n.is("documentSelection"))return;const r=Dh(i);return r?(e.stop(),t.change(e=>{const n=i.getSelectedElement(),s=t.createPositionAt(n,r),a=e.createSelection(s),l=t.insertContent(o,a);return e.setSelection(a),l})):void 0},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(e,[i])=>{if(i&&!i.is("documentSelection"))return;Dh(t)&&e.stop()},{priority:"high"})}}i(78);function Uh(e){const t=e.model;return(i,o)=>{const n=o.keyCode==Nn.arrowup,r=o.keyCode==Nn.arrowdown,s=o.shiftKey,a=t.document.selection;if(!n&&!r)return;const l=r;if(s&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,i){const o=e.model;if(i){const e=t.isCollapsed?t.focus:t.getLastPosition(),i=Wh(o,e,"forward");if(!i)return null;const n=o.createRange(e,i),r=$h(o.schema,n,"backward");return r&&e.isBefore(r)?o.createRange(e,r):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),i=Wh(o,e,"backward");if(!i)return null;const n=o.createRange(i,e),r=$h(o.schema,n,"forward");return r&&e.isAfter(r)?o.createRange(r,e):null}}(e,a,l);c&&!c.isCollapsed&&function(e,t,i){const o=e.model,n=e.view.domConverter;if(i){const e=o.createSelection(t.start);o.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=o.createRange(e.focus,t.end))}const r=e.mapper.toViewRange(t),s=n.viewRangeToDom(r),a=Ts.getDomRangeRects(s);let l;for(const e of a)if(void 0!==l){if(Math.round(e.top)>=l)return!1;l=Math.max(l,Math.round(e.bottom))}else l=Math.round(e.bottom);return!0}(e,c,l)&&(t.change(e=>{const i=l?c.end:c.start;if(s){const o=t.createSelection(a.anchor);o.setFocus(i),e.setSelection(o)}else e.setSelection(i)}),i.stop(),o.preventDefault(),o.stopPropagation())}}function Wh(e,t,i){const o=e.schema,n=e.createRangeIn(t.root),r="forward"==i?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of n.getWalker({startPosition:t,direction:i})){if(o.isLimit(s)&&!o.isInline(s))return e;if(a==r&&o.isBlock(s))return null}return null}function $h(e,t,i){const o="backward"==i?t.end:t.start;if(e.checkChild(o,"$text"))return o;for(const{nextPosition:o}of t.getWalker({direction:i}))if(e.checkChild(o,"$text"))return o}class qh extends Qe{static get pluginName(){return"Widget"}static get requires(){return[Hh,vh]}init(){const e=this.editor,t=e.editing.view,i=t.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(t,i,o)=>{const n=o.writer,r=i.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=e.editing.mapper.toViewElement(s);Th(a)&&o.consumable.consume(r,"selection")&&n.setSelection(n.createRangeOn(a),{fake:!0,label:Mh(a)})}),this.editor.editing.downcastDispatcher.on("selection",(e,t,i)=>{this._clearPreviouslySelectedWidgets(i.writer);const o=i.writer,n=o.document.selection;let r=null;for(const e of n.getRanges())for(const t of e){const e=t.item;Th(e)&&!Yh(e,r)&&(o.addClass("ck-widget_selected",e),this._previouslySelected.add(e),r=e)}},{priority:"low"}),t.addObserver(ku),this.listenTo(i,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(i,"arrowKey",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{context:[Th,"$text"]}),this.listenTo(i,"arrowKey",(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{context:"$root"}),this.listenTo(i,"arrowKey",Uh(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{context:"$root"})}_onMousedown(e,t){const i=this.editor,o=i.editing.view,n=o.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(Th(e))return!1;e=e.parent}return!1}(r)){if((Pn.isSafari||Pn.isGecko)&&t.domEvent.detail>=3){const e=i.editing.mapper,o=r.is("attributeElement")?r.findAncestor(e=>!e.is("attributeElement")):r,n=e.toModelElement(o);t.preventDefault(),this.editor.model.change(e=>{e.setSelection(n,"in")})}return}if(!Th(r)&&(r=r.findAncestor(Th),!r))return;Pn.isAndroid&&t.preventDefault(),n.isFocused||o.focus();const s=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,o=this.editor.model,n=o.schema,r=o.document.selection,s=r.getSelectedElement(),a=Ln(i,this.editor.locale.contentLanguageDirection);if(s&&n.isObject(s)){const i=a?r.getLastPosition():r.getFirstPosition(),s=n.getNearestSelectionRange(i,a?"forward":"backward");return void(s&&(o.change(e=>{e.setSelection(s)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed)return;const l=this._getObjectElementNextToSelection(a);l&&n.isObject(l)&&(this._setSelectionOverElement(l),t.preventDefault(),e.stop())}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,o=i.schema,n=i.document.selection.getSelectedElement();n&&o.isObject(n)&&(t.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change(e=>{let o=t.anchor.parent;for(;o.isEmpty;){const t=o;o=t.parent,e.remove(t)}this._setSelectionOverElement(i)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,o=t.document.selection,n=t.createSelection(o);t.modifySelection(n,{direction:e?"forward":"backward"});const r=e?n.focus.nodeBefore:n.focus.nodeAfter;return r&&i.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function Yh(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}var Gh=function(e,t,i){var o=!0,n=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return w(i)&&(o="leading"in i?!!i.leading:o,n="trailing"in i?!!i.trailing:n),fs(e,t,{leading:o,maxWait:t,trailing:n})};i(80);class Kh extends Qe{static get pluginName(){return"DragDrop"}static get requires(){return[hh,qh]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=Gh(e=>this._updateDropMarker(e),40),this._removeDropMarkerDelayed=Zh(()=>this._removeDropMarker(),40),this._clearDraggableAttributesDelayed=Zh(()=>this._clearDraggableAttributes(),40),t.addObserver(dh),t.addObserver(ku),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(e,t,i)=>{i||this._finalizeDragging(!1)}),Pn.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=t.document,o=e.editing.view,n=o.document;this.listenTo(n,"dragstart",(o,r)=>{const a=i.selection;if(r.target&&r.target.is("editableElement"))return void r.preventDefault();const l=r.target?Xh(r.target):null;if(l){const i=e.editing.mapper.toModelElement(l);this._draggedRange=ba.fromRange(t.createRangeOn(i)),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!n.selection.isCollapsed){const e=n.selection.getSelectedElement();e&&Th(e)||(this._draggedRange=ba.fromRange(a.getFirstRange()))}if(!this._draggedRange)return void r.preventDefault();this._draggingUid=s(),r.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",r.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const c=t.createSelection(this._draggedRange.toRange()),d=e.data.toView(t.getSelectedContent(c));n.fire("clipboardOutput",{dataTransfer:r.dataTransfer,content:d,method:o.name}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(n,"dragend",(e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)},{priority:"low"}),this.listenTo(n,"dragenter",()=>{this.isEnabled&&o.focus()}),this.listenTo(n,"dragleave",()=>{this._removeDropMarkerDelayed()}),this.listenTo(n,"dragging",(t,i)=>{if(!this.isEnabled)return void(i.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const o=Qh(e,i.targetRanges,i.target);this._draggedRange||(i.dataTransfer.dropEffect="copy"),Pn.isGecko||("copy"==i.dataTransfer.effectAllowed?i.dataTransfer.dropEffect="copy":["all","copyMove"].includes(i.dataTransfer.effectAllowed)&&(i.dataTransfer.dropEffect="move")),o&&this._updateDropMarkerThrottled(o)},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"clipboardInput",(t,i)=>{if("drop"!=i.method)return;const o=Qh(e,i.targetRanges,i.target);if(this._removeDropMarker(),!o)return this._finalizeDragging(!1),void t.stop();this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==Jh(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(o,!0))return this._finalizeDragging(!1),void t.stop();i.targetRanges=[e.editing.mapper.toViewRange(o)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(hh);e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i=t.targetRanges.map(e=>this.editor.editing.mapper.toModelRange(e));this.editor.model.change(e=>e.setSelection(i))},{priority:"high"}),e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i="move"==Jh(t.dataTransfer),o=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(o&&i)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(o,n)=>{if(Pn.isAndroid||!n)return;this._clearDraggableAttributesDelayed.cancel();let r=Xh(n.target);if(Pn.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const e=i.selection.getSelectedElement();e&&Th(e)||(r=i.selection.editableElement)}r&&(t.change(e=>{e.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(i,"mouseup",()=>{Pn.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_setupDropMarker(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return i.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.innerHTML="&NoBreak;<span></span>&NoBreak;",t}))}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(t=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_removeDropMarker(){const e=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),e.markers.has("drop-target")&&e.change(e=>{e.removeMarker("drop-target")})}_finalizeDragging(e){const t=this.editor,i=t.model;this._removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(e&&this.isEnabled&&i.deleteContent(i.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Qh(e,t,i){const o=e.model,n=e.editing.mapper;let r=null;const s=t?t[0].start:null;if(i.is("uiElement")&&(i=i.parent),r=function(e,t){const i=e.model,o=e.editing.mapper;if(Th(t))return i.createRangeOn(o.toModelElement(t));if(!t.is("editableElement")){const e=t.findAncestor(e=>Th(e)||e.is("editableElement"));if(Th(e))return i.createRangeOn(o.toModelElement(e))}return null}(e,i),r)return r;const a=function(e,t){const i=e.editing.mapper,o=e.editing.view,n=i.toModelElement(t);if(n)return n;const r=o.createPositionBefore(t),s=i.findMappedViewAncestor(r);return i.toModelElement(s)}(e,i),l=s?n.toModelPosition(s):null;return l?(r=function(e,t,i){const o=e.model;if(!o.schema.checkChild(i,"$block"))return null;const n=o.createPositionAt(i,0),r=t.path.slice(0,n.path.length),s=o.createPositionFromPath(t.root,r).nodeAfter;if(s&&o.schema.isObject(s))return o.createRangeOn(s);return null}(e,l,a),r||(r=o.schema.getNearestSelectionRange(l,Pn.isGecko?"forward":"backward"),r||function(e,t){const i=e.model;for(;t;){if(i.schema.isObject(t))return i.createRangeOn(t);t=t.parent}}(e,l.parent))):function(e,t){const i=e.model,o=i.schema,n=i.createPositionAt(t,0);return o.getNearestSelectionRange(n,"forward")}(e,a)}function Jh(e){return Pn.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function Zh(e,t){let i;function o(...n){o.cancel(),i=setTimeout(()=>e(...n),t)}return o.cancel=()=>{clearTimeout(i)},o}function Xh(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(Th);if(Th(e))return e;const t=e.findAncestor(e=>Th(e)||e.is("editableElement"));return Th(t)?t:null}class em extends Qe{static get pluginName(){return"PastePlainText"}static get requires(){return[hh]}init(){const e=this.editor,t=e.model,i=e.editing.view,o=i.document,n=t.document.selection;let r=!1;i.addObserver(dh),this.listenTo(o,"keydown",(e,t)=>{r=t.shiftKey}),e.plugins.get(hh).on("contentInsertion",(e,i)=>{(r||function(e,t){if(e.childCount>1)return!1;const i=e.getChild(0);if(t.isObject(i))return!1;return 0==[...i.getAttributeKeys()].length}(i.content,t.schema))&&t.change(e=>{const o=Array.from(n.getAttributes()).filter(([e])=>t.schema.getAttributeProperties(e).isFormatting);n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:!0}),o.push(...n.getAttributes());const r=e.createRangeIn(i.content);for(const t of r.getItems())t.is("$textProxy")&&e.setAttributes(o,t)})})}}class tm extends Qe{static get pluginName(){return"Clipboard"}static get requires(){return[hh,Kh,em]}}class im extends Ze{execute(){const e=this.editor.model,t=e.document;e.change(i=>{!function(e,t,i){const o=i.isCollapsed,n=i.getFirstRange(),r=n.start.parent,s=n.end.parent,a=r==s;if(o){const o=mh(e.schema,i.getAttributes());om(e,t,n.end),t.removeSelectionAttribute(i.getAttributeKeys()),t.setSelectionAttribute(o)}else{const o=!(n.start.isAtStart&&n.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:o}),a?om(e,t,i.focus):o&&t.setSelection(s,0)}}(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return!1;const o=t.getFirstRange(),n=o.start.parent,r=o.end.parent;if((nm(n,e)||nm(r,e))&&n!==r)return!1;return!0}(e.schema,t.selection)}}function om(e,t,i){const o=t.createElement("softBreak");e.insertContent(o,i),t.setSelection(o,"after")}function nm(e,t){return!e.is("rootElement")&&(t.isLimit(e)||nm(e.parent,t))}class rm extends Qe{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,o=e.editing.view,n=o.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),o.addObserver(ph),e.commands.add("shiftEnter",new im(e)),this.listenTo(n,"enter",(t,i)=>{i.preventDefault(),i.isSoft&&(e.execute("shiftEnter"),o.scrollToTheSelection())},{priority:"low"})}}class sm extends Ze{execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!am(e.schema,i))do{if(i=i.parent,!i)return}while(!am(e.schema,i));e.change(e=>{e.setSelection(i,"in")})}}function am(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const lm=zn("Ctrl+A");class cm extends Qe{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new sm(e)),this.listenTo(t,"keydown",(t,i)=>{On(i)===lm&&(e.execute("selectAll"),i.preventDefault())})}}class dm extends Qe{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const i=e.commands.get("selectAll"),o=new ed(t),n=t.t;return o.set({label:n("Select all"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>',keystroke:"Ctrl+A",tooltip:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),o})}}class um extends Qe{static get requires(){return[cm,dm]}static get pluginName(){return"SelectAll"}}class hm extends Ze{constructor(e,t){super(e),this._buffer=new wh(e.model,t),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,o=e.text||"",n=o.length,r=e.range?t.createSelection(e.range):i.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),this._batches.add(this._buffer.batch),t.deleteContent(r),o&&t.insertContent(e.createText(o,i.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(n)})}}function mm(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const i=[];let o,n=0;return e.forEach(e=>{"equal"==e?(r(),n++):"insert"==e?(s("insert")?o.values.push(t[n]):(r(),o={type:"insert",index:n,values:[t[n]]}),n++):s("delete")?o.howMany++:(r(),o={type:"delete",index:n,howMany:1})}),r(),i;function r(){o&&(i.push(o),o=null)}function s(e){return o&&o.type==e}}(mr(e.oldChildren,e.newChildren,gm),e.newChildren);if(t.length>1)return;const i=t[0];return i.values[0]&&i.values[0].is("$text")?i:void 0}function gm(e,t){return e&&e.is("$text")&&t&&t.is("$text")?e.data===t.data:e===t}class fm{constructor(e){this.editor=e,this.editing=this.editor.editing}handle(e,t){if(function(e){if(0==e.length)return!1;for(const t of e)if("children"===t.type&&!mm(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const i of e)this._handleTextMutation(i,t),this._handleTextNodeInsertion(i)}_handleContainerChildrenMutations(e,t){const i=function(e){const t=e.map(e=>e.node).reduce((e,t)=>e.getCommonAncestor(t,{includeSelf:!0}));if(!t)return;return t.getAncestors({includeSelf:!0,parentFirst:!0}).find(e=>e.is("containerElement")||e.is("rootElement"))}(e);if(!i)return;const o=this.editor.editing.view.domConverter.mapViewToDom(i),n=new Er(this.editor.editing.view.document),r=this.editor.data.toModel(n.domToView(o)).getChild(0),s=this.editor.editing.mapper.toModelElement(i);if(!s)return;const a=Array.from(r.getChildren()),l=Array.from(s.getChildren()),c=a[a.length-1],d=l[l.length-1],u=c&&c.is("element","softBreak"),h=d&&!d.is("element","softBreak");u&&h&&a.pop();const m=this.editor.model.schema;if(!pm(a,m)||!pm(l,m))return;const g=a.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," "),f=l.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," ");if(f===g)return;const p=mr(f,g),{firstChangeAt:b,insertions:w,deletions:k}=bm(p);let _=null;t&&(_=this.editing.mapper.toModelRange(t.getFirstRange()));const v=g.substr(b,w),y=this.editor.model.createRange(this.editor.model.createPositionAt(s,b),this.editor.model.createPositionAt(s,b+k));this.editor.execute("input",{text:v,range:y,resultRange:_})}_handleTextMutation(e,t){if("text"!=e.type)return;const i=e.newText.replace(/\u00A0/g," "),o=e.oldText.replace(/\u00A0/g," ");if(o===i)return;const n=mr(o,i),{firstChangeAt:r,insertions:s,deletions:a}=bm(n);let l=null;t&&(l=this.editing.mapper.toModelRange(t.getFirstRange()));const c=this.editing.view.createPositionAt(e.node,r),d=this.editing.mapper.toModelPosition(c),u=this.editor.model.createRange(d,d.getShiftedBy(a)),h=i.substr(r,s);this.editor.execute("input",{text:h,range:u,resultRange:l})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=mm(e),i=this.editing.view.createPositionAt(e.node,t.index),o=this.editing.mapper.toModelPosition(i),n=t.values[0].data;this.editor.execute("input",{text:n.replace(/\u00A0/g," "),range:this.editor.model.createRange(o)})}}function pm(e,t){return e.every(e=>t.isInline(e))}function bm(e){let t=null,i=null;for(let o=0;o<e.length;o++){"equal"!=e[o]&&(t=null===t?o:t,i=o)}let o=0,n=0;for(let r=t;r<=i;r++)"insert"!=e[r]&&o++,"delete"!=e[r]&&n++;return{insertions:n,deletions:o,firstChangeAt:t}}class wm extends Qe{static get pluginName(){return"Input"}init(){const e=this.editor,t=new hm(e,e.config.get("typing.undoStep")||20);e.commands.add("input",t),function(e){let t=null;const i=e.model,o=e.editing.view,n=e.commands.get("input");function r(e){const r=i.document,a=o.document.isComposing,l=t&&t.isEqual(r.selection);t=null,n.isEnabled&&(Bh(e)||r.selection.isCollapsed||a&&229===e.keyCode||!a&&229===e.keyCode&&l||s())}function s(){const e=n.buffer;e.lock();const t=e.batch;n._batches.add(t),i.enqueueChange(t,()=>{i.deleteContent(i.document.selection)}),e.unlock()}Pn.isAndroid?o.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):o.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),o.document.on("compositionstart",(function(){const e=i.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),o.document.on("compositionend",()=>{t=i.createSelection(i.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(t,i,o)=>{new fm(e).handle(i,o)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class km extends Qe{static get requires(){return[wm,vh]}static get pluginName(){return"Typing"}}function _m(e,t){let i=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>o.is("$text")||o.is("$textProxy")?e+o.data:(i=t.createPositionAfter(o),""),""),range:t.createRange(i,e.end)}}class vm{constructor(e,t){this.model=e,this.testCallback=t,this.hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))}),this.listenTo(e,"change:data",(e,t)=>{"transparent"!=t.type&&this._evaluateTextBeforeSelection("data",{batch:t})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,o=i.document.selection,n=i.createRange(i.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=_m(n,i),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const i=Object.assign(t,{text:r,range:s});"object"==typeof a&&Object.assign(i,a),this.fire("matched:"+e,i)}}}Ke(vm,Ue);class ym extends Qe{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,o=e.locale,n=t.document.selection;this.listenTo(i.document,"arrowKey",(e,t)=>{if(!n.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==Nn.arrowright,r=t.keyCode==Nn.arrowleft;if(!i&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&i||"rtl"===s&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(n,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&Tm(n.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model.document.selection,o=i.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!xm(i,t))&&(Tm(o,t)?(Cm(e),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,o=i.document.selection,n=o.getFirstPosition();return this._isGravityOverridden?(Cm(e),this._restoreGravity(),Am(i,t,n),!0):n.isAtStart?!!xm(o,t)&&(Cm(e),Am(i,t,n),!0):function(e,t){return Tm(e.getShiftedBy(-1),t)}(n,t)?n.isAtEnd&&!xm(o,t)&&Tm(n,t)?(Cm(e),Am(i,t,n),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function xm(e,t){for(const i of t)if(e.hasAttribute(i))return!0;return!1}function Am(e,t,i){const o=i.nodeBefore;e.change(e=>{o?e.setSelectionAttribute(o.getAttributes()):e.removeSelectionAttribute(t)})}function Cm(e){e.preventDefault()}function Tm(e,t){const{nodeBefore:i,nodeAfter:o}=e;for(const e of t){const t=i?i.getAttribute(e):void 0;if((o?o.getAttribute(e):void 0)!==t)return!0}return!1}var Em=/[\\^$.*+?()[\]{}|]/g,Sm=RegExp(Em.source);var Pm=function(e){return(e=Io(e))&&Sm.test(e)?e.replace(Em,"\\$&"):e};const Im={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:"1/2",to:"½"},oneThird:{from:"1/3",to:"⅓"},twoThirds:{from:"2/3",to:"⅔"},oneForth:{from:"1/4",to:"¼"},threeQuarters:{from:"3/4",to:"¾"},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:Vm('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Vm("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Vm("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Vm('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Vm('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Vm("'"),to:[null,"‚",null,"’"]}},Mm={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Nm=["symbols","mathematical","typography","quotes"];function Rm(e){return"string"==typeof e?new RegExp(`(${Pm(e)})$`):e}function Om(e){return"string"==typeof e?()=>[e]:e instanceof Array?()=>e:e}function zm(e){return(e.textNode?e.textNode:e.nodeAfter).getAttributes()}function Vm(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function Dm(e,t,i,o){return o.createRange(Lm(e,t,i,!0,o),Lm(e,t,i,!1,o))}function Lm(e,t,i,o,n){let r=e.textNode||(o?e.nodeBefore:e.nodeAfter),s=null;for(;r&&r.getAttribute(t)==i;)s=r,r=o?r.previousSibling:r.nextSibling;return s?n.createPositionAt(s,o?"before":"after"):e}class Bm extends Ze{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(e.data,"set",(e,t)=>{t[1]={...t[1]};const i=t[1];i.batchType||(i.batchType="transparent")},{priority:"high"}),this.listenTo(e.data,"set",(e,t)=>{"transparent"===t[1].batchType&&this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const o=this.editor.model,n=o.document,r=[],s=e.map(e=>e.getTransformedByOperations(i)),a=s.flat();for(const e of s){const t=e.filter(e=>e.root!=n.graveyard).filter(e=>!Fm(e,a));t.length&&(jm(t),r.push(t[0]))}r.length&&o.change(e=>{e.setSelection(r,{backward:t})})}_undo(e,t){const i=this.editor.model,o=i.document;this._createdBatches.add(t);const n=e.operations.slice().filter(e=>e.isDocumentOperation);n.reverse();for(const e of n){const n=e.baseVersion+1,r=Array.from(o.history.getOperations(n)),s=uu([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const n of s)t.addOperation(n),i.applyOperation(n),o.history.setOperationAsUndone(e,n)}}}function jm(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){const i=e[t-1].getJoined(e[t],!0);i&&(t--,e.splice(t,2,i))}}function Fm(e,t){return t.some(t=>t!==e&&t.containsRange(e,!0))}class Hm extends Bm{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],o=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(o,()=>{this._undo(i.batch,o);const e=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,e),this.fire("revert",i.batch,o)}),this.refresh()}}class Um extends Bm{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(t,()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}class Wm extends Qe{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new Hm(e),this._redoCommand=new Um(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const i=t[0];if(!i.isDocumentOperation)return;const o=i.batch,n=this._redoCommand._createdBatches.has(o),r=this._undoCommand._createdBatches.has(o);this._batchRegistry.has(o)||"transparent"==o.type&&!n&&!r||(n?this._undoCommand.addBatch(o):r||(this._undoCommand.addBatch(o),this._redoCommand.clearStack()),this._batchRegistry.add(o))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,i)=>{this._redoCommand.addBatch(i)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var $m='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',qm='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>';class Ym extends Qe{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?$m:qm,n="ltr"==t.uiLanguageDirection?qm:$m;this._addButton("undo",i("Undo"),"CTRL+Z",o),this._addButton("redo",i("Redo"),"CTRL+Y",n)}_addButton(e,t,i,o){const n=this.editor;n.ui.componentFactory.add(e,r=>{const s=n.commands.get(e),a=new ed(r);return a.set({label:t,icon:o,keystroke:i,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{n.execute(e),n.editing.view.focus()}),a})}}class Gm extends Qe{static get requires(){return[Wm,Ym]}static get pluginName(){return"Undo"}}class Km{constructor(){const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,o)=>{t.onload=()=>{const e=t.result;this._data=e,i(e)},t.onerror=()=>{o("error")},t.onabort=()=>{o("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}Ke(Km,Ue);class Qm extends Qe{static get pluginName(){return"FileRepository"}static get requires(){return[Cc]}init(){this.loaders=new Zi,this.loaders.on("add",()=>this._updatePendingAction()),this.loaders.on("remove",()=>this._updatePendingAction()),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return Object(l.b)("filerepository-no-upload-adapter"),null;const t=new Jm(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(e=>{this._loadersMap.set(e,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e}),t.on("change:uploadTotal",()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e}),t}destroyLoader(e){const t=e instanceof Jm?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,i)=>{e===t&&this._loadersMap.delete(i)})}_updatePendingAction(){const e=this.editor.plugins.get(Cc);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}Ke(Qm,Ue);class Jm{constructor(e,t){this.id=s(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new Km,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new l.a("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e}).catch(e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e})}upload(){if("idle"!=this.status)throw new l.a("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,o)=>{t.rejecter=o,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,i(e)}).catch(e=>{t.isFulfilled=!0,o(e)})}),t}}Ke(Jm,Ue);class Zm extends Mc{constructor(e){super(e),this.buttonView=new ed(e),this._fileInputView=new Xm(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class Xm extends Mc{constructor(e){super(e),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}class eg{constructor(e){this.loader=e}upload(){return new Promise((e,t)=>{const i=this.reader=new window.FileReader;i.addEventListener("load",()=>{e({default:i.result})}),i.addEventListener("error",e=>{t(e)}),i.addEventListener("abort",()=>{t()}),this.loader.file.then(e=>{i.readAsDataURL(e)})})}abort(){this.reader.abort()}}function tg(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const i of t){const t=i.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,i;return e&&40==e.length||(e=function(e){let t="";const i=new Uint8Array(e);window.crypto.getRandomValues(i);for(let e=0;e<i.length;e++){const o="abcdefghijklmnopqrstuvwxyz0123456789".charAt(i[e]%"abcdefghijklmnopqrstuvwxyz0123456789".length);t+=Math.random()>.5?o.toUpperCase():o}return t}(40),t="ckCsrfToken",i=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(i)+";path=/"),e}class ig{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const o=this.xhr,n=this.loader,r=(0,this.t)("Cannot upload file:")+` ${i.name}.`;o.addEventListener("error",()=>t(r)),o.addEventListener("abort",()=>t()),o.addEventListener("load",()=>{const i=o.response;if(!i||!i.uploaded)return t(i&&i.error&&i.error.message?i.error.message:r);e({default:i.url})}),o.upload&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&(n.uploadTotal=e.total,n.uploaded=e.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",tg()),this.xhr.send(t)}}function og(e,t,i,o){let n,r=null;"function"==typeof o?n=o:(r=e.commands.get(o),n=()=>{e.execute(o)}),e.model.document.on("change:data",(s,a)=>{if(r&&!r.isEnabled||!t.isEnabled)return;const l=Ns(e.model.document.selection.getRanges());if(!l.isCollapsed)return;if("transparent"==a.type)return;const c=Array.from(e.model.document.differ.getChanges()),d=c[0];if(1!=c.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const u=d.position.parent;if(u.is("element","codeBlock"))return;if(u.is("element","listItem")&&"function"!=typeof o&&!["numberedList","bulletedList","todoList"].includes(o))return;if(r&&!0===r.value)return;const h=u.getChild(0),m=e.model.createRangeOn(h);if(!m.containsRange(l)&&!l.end.isEqual(m.end))return;const g=i.exec(h.data.substr(0,l.end.offset));g&&e.model.enqueueChange(t=>{const i=t.createPositionAt(u,0),o=t.createPositionAt(u,g[0].length),r=new ba(i,o);if(!1!==n({match:g})){t.remove(r);const i=e.model.document.selection.getFirstRange(),o=t.createRangeIn(u);!u.isEmpty||o.isEqual(i)||o.containsRange(i,!0)||t.remove(u)}r.detach()})})}function ng(e,t,i,o){let n,r;i instanceof RegExp?n=i:r=i,r=r||(e=>{let t;const i=[],o=[];for(;null!==(t=n.exec(e))&&!(t&&t.length<4);){let{index:e,1:n,2:r,3:s}=t;const a=n+r+s;e+=t[0].length-a.length;const l=[e,e+n.length],c=[e+n.length+r.length,e+n.length+r.length+s.length];i.push(l),i.push(c),o.push([e+n.length,e+n.length+r.length])}return{remove:i,format:o}}),e.model.document.on("change:data",(i,n)=>{if("transparent"==n.type||!t.isEnabled)return;const s=e.model,a=s.document.selection;if(!a.isCollapsed)return;const l=Array.from(s.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=a.focus,u=d.parent,{text:h,range:m}=function(e,t){let i=e.start;return{text:Array.from(e.getItems()).reduce((e,o)=>!o.is("$text")&&!o.is("$textProxy")||o.getAttribute("code")?(i=t.createPositionAfter(o),""):e+o.data,""),range:t.createRange(i,e.end)}}(s.createRange(s.createPositionAt(u,0),d),s),g=r(h),f=rg(m.start,g.format,s),p=rg(m.start,g.remove,s);f.length&&p.length&&s.enqueueChange(e=>{if(!1!==o(e,f))for(const t of p.reverse())e.remove(t)})})}function rg(e,t,i){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>i.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}function sg(e,t){return(i,o)=>{if(!e.commands.get(t).isEnabled)return!1;const n=e.model.schema.getValidRanges(o,t);for(const e of n)i.setAttribute(t,!0,e);i.removeSelectionAttribute(t)}}class ag extends Ze{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(i.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of n)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}class lg extends Qe{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"bold"}),e.model.schema.setAttributeProperties("bold",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"bold",view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t?"bold"==t||Number(t)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),e.commands.add("bold",new ag(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class cg extends Qe{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",i=>{const o=e.commands.get("bold"),n=new ed(i);return n.set({label:t("Bold"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),n})}}class dg extends Qe{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"italic"}),e.model.schema.setAttributeProperties("italic",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"italic",view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add("italic",new ag(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class ug extends Qe{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",i=>{const o=e.commands.get("italic"),n=new ed(i);return n.set({label:t("Italic"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),n})}}class hg extends Ze{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,o=t.document.selection,n=Array.from(o.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=n.filter(e=>mg(e)||fg(i,e));this._applyQuote(e,t)}else this._removeQuote(e,n.filter(mg))})}_getValue(){const e=Ns(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!mg(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Ns(e.getSelectedBlocks());return!!i&&fg(t,i)}_removeQuote(e,t){gg(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i)})}_applyQuote(e,t){const i=[];gg(e,t).reverse().forEach(t=>{let o=mg(t.start);o||(o=e.createElement("blockQuote"),e.wrap(t,o)),i.push(o)}),i.reverse().reduce((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i)}}function mg(e){return"blockQuote"==e.parent.name?e.parent:null}function gg(e,t){let i,o=0;const n=[];for(;o<t.length;){const r=t[o],s=t[o+1];i||(i=e.createPositionBefore(r)),s&&r.nextSibling==s||(n.push(e.createRange(i,e.createPositionAfter(r))),i=null),o++}return n}function fg(e,t){const i=e.checkChild(t.parent,"blockQuote"),o=e.checkChild(["$root","blockQuote"],t);return i&&o}class pg extends Qe{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[bh,vh]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new hg(e)),t.register("blockQuote",{allowWhere:"$block",allowContentOf:"$root"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(i=>{const o=e.model.document.differ.getChanges();for(const e of o)if("insert"==e.type){const o=e.position.nodeAfter;if(!o)continue;if(o.is("element","blockQuote")&&o.isEmpty)return i.remove(o),!0;if(o.is("element","blockQuote")&&!t.checkChild(e.position,o))return i.unwrap(o),!0;if(o.is("element")){const e=i.createRangeIn(o);for(const o of e.getItems())if(o.is("element","blockQuote")&&!t.checkChild(i.createPositionBefore(o),o))return i.unwrap(o),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return i.remove(t),!0}return!1});const i=this.editor.editing.view.document,o=e.model.document.selection,n=e.commands.get("blockQuote");this.listenTo(i,"enter",(t,i)=>{if(!o.isCollapsed||!n.value)return;o.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(t,i)=>{if("backward"!=i.direction||!o.isCollapsed||!n.value)return;const r=o.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())},{context:"blockquote"})}}i(82);class bg extends Qe{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const o=e.commands.get("blockQuote"),n=new ed(i);return n.set({label:t("Block quote"),icon:Tc.quote,tooltip:!0,isToggleable:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),n})}}class wg extends Qe{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,t=e.ui.componentFactory,i=e.t;t.add("ckfinder",t=>{const o=e.commands.get("ckfinder"),n=new ed(t);return n.set({label:i("Insert image or file"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',tooltip:!0}),n.bind("isEnabled").to(o),n.on("execute",()=>{e.execute("ckfinder"),e.editing.view.focus()}),n})}}class kg extends Ze{constructor(e){super(e),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=t&&"modal"!=t)throw new l.a("ckfinder-unknown-openermethod",e);const i=this.editor.config.get("ckfinder.options")||{};i.chooseFiles=!0;const o=i.onInit;i.language||(i.language=e.locale.uiLanguage),i.onInit=t=>{o&&o(t),t.on("files:choose",i=>{const o=i.data.files.toArray(),n=o.filter(e=>!e.isImage()),r=o.filter(e=>e.isImage());for(const t of n)e.execute("link",t.getUrl());const s=[];for(const e of r){const i=e.getUrl();s.push(i||t.request("file:getProxyUrl",{file:e}))}s.length&&_g(e,s)}),t.on("file:choose:resizedImage",t=>{const i=t.data.resizedUrl;if(i)_g(e,[i]);else{const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("Could not obtain resized image URL."),{title:i("Selecting resized image failed"),namespace:"ckfinder"})}})},window.CKFinder[t](i)}}function _g(e,t){if(e.commands.get("insertImage").isEnabled)e.execute("insertImage",{source:t});else{const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("Could not insert image at the current position."),{title:i("Inserting image failed"),namespace:"ckfinder"})}}class vg extends Qe{static get pluginName(){return"CKFinderEditing"}static get requires(){return[Fd,"LinkEditing"]}init(){const e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new l.a("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new kg(e))}}class yg extends Qe{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",Qm]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),i=t.token,o=t.uploadUrl;i&&(this._uploadGateway=e.plugins.get("CloudServicesCore").createUploadGateway(i,o),e.plugins.get(Qm).createUploadAdapter=e=>new xg(this._uploadGateway,e))}}class xg{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(e,t)=>{this.loader.uploadTotal=t.total,this.loader.uploaded=t.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}class Ag extends Ze{refresh(){const e=this.editor.model,t=Ns(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&Cg(t,e.schema)}execute(e={}){const t=this.editor.model,i=t.document;t.change(o=>{const n=(e.selection||i.selection).getSelectedBlocks();for(const e of n)!e.is("element","paragraph")&&Cg(e,t.schema)&&o.rename(e,"paragraph")})}}function Cg(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class Tg extends Ze{execute(e){const t=this.editor.model;let i=e.position;t.change(e=>{const o=e.createElement("paragraph");if(!t.schema.checkChild(i.parent,o)){const n=t.schema.findAllowedParent(i,o);if(!n)return;i=e.split(i,n).position}t.insertContent(o,i),e.setSelection(o,"in")})}}class Eg extends Qe{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new Ag(e)),e.commands.add("insertParagraph",new Tg(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>Eg.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}Eg.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class Sg extends Ze{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=Ns(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>Pg(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,o=e.value;t.change(e=>{const n=Array.from(i.selection.getSelectedBlocks()).filter(e=>Pg(e,o,t.schema));for(const t of n)t.is("element",o)||e.rename(t,o)})}}function Pg(e,t,i){return i.checkChild(e.parent,t)&&!i.isObject(e)}class Ig extends Qe{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[Eg]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const o of t)"paragraph"!==o.model&&(e.model.schema.register(o.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(o),i.push(o.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new Sg(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,o)=>{const n=e.model.document.selection.getFirstPosition().parent;i.some(e=>n.is("element",e.model))&&!n.is("element","paragraph")&&0===n.childCount&&o.writer.rename(n,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:a.get("low")+1})}}i(16);class Mg extends Qe{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=function(e){const t=e.t,i={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map(e=>{const t=i[e.title];return t&&t!=e.title&&(e.title=t),e})}(e),o=t("Choose heading"),n=t("Heading");e.ui.componentFactory.add("heading",t=>{const r={},s=new Zi,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of i){const t={type:"button",model:new Hd({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(l,"value"),t.model.set("commandName","paragraph"),c.push(l)):(t.model.bind("isOn").to(a,"value",t=>t===e.model),t.model.set({commandName:"heading",commandValue:e.model})),s.add(t),r[e.model]=e.title}const d=Sd(t);return Id(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:n}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(c,"isEnabled",(...e)=>e.some(e=>e)),d.buttonView.bind("label").to(a,"value",l,"value",(e,t)=>{const i=e||t&&"paragraph";return r[i]?r[i]:o}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}class Ng extends Qe{static get requires(){return[Qd]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",t=>{(function(e){const t=e.getSelectedElement();return!(!t||!Th(t))})(e.editing.view.document.selection)&&t.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:o,balloonClassName:n="ck-toolbar-container"}){if(!i.length)return void Object(l.b)("widget-toolbar-no-items",{toolbarId:e});const r=this.editor,s=r.t,a=new vd(r.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new l.a("widget-toolbar-duplicated",this,{toolbarId:e});a.fillFromConfig(i,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:o,balloonClassName:n})}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const o of this._toolbarDefinitions.values()){const n=o.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&n)if(this.editor.ui.focusTracker.isFocused){const r=n.getAncestors().length;r>e&&(e=r,t=n,i=o)}else this._isToolbarVisible(o)&&this._hideToolbar(o);else this._isToolbarInBalloon(o)&&this._hideToolbar(o)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Rg(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:Og(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);Rg(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Rg(e,t){const i=e.plugins.get("ContextualBalloon"),o=Og(e,t);i.updatePosition(o)}function Og(e,t){const i=e.editing.view,o=$d.defaultPositions;return{target:i.domConverter.mapViewToDom(t),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast,Oh]}}class zg{constructor(e){this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}begin(e,t,i){const o=new Ts(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)if(e.classList.contains("ck-widget__resizer__handle-"+i))return i}(e),this._referenceCoordinates=function(e,t){const i=new Ts(e),o=t.split("-"),n={x:"right"==o[1]?i.right:i.left,y:"bottom"==o[0]?i.bottom:i.top};return n.x+=e.ownerDocument.defaultView.scrollX,n.y+=e.ownerDocument.defaultView.scrollY,n}(t,function(e){const t=e.split("-"),i={top:"bottom",bottom:"top",left:"right",right:"left"};return`${i[t[0]]}-${i[t[1]]}`}(this.activeHandlePosition)),this.originalWidth=o.width,this.originalHeight=o.height,this.aspectRatio=o.width/o.height;const n=i.style.width;n&&n.match(/^\d+(\.\d*)?%$/)?this.originalWidthPercents=parseFloat(n):this.originalWidthPercents=function(e,t){const i=e.parentElement,o=parseFloat(i.ownerDocument.defaultView.getComputedStyle(i).width);return t.width/o*100}(i,o)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}Ke(zg,Ue);class Vg extends Mc{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",e=>e?"ck-orientation-"+e:"")],style:{display:e.if("_isVisible","none",e=>!e)}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",(e,t)=>null!==e&&null!==t),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(t,i,o)=>"px"===e.unit?`${t}×${i}`:o+"%"),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",(e,t,i)=>t<50||i<50?"above-center":e)}_dismiss(){this.unbind(),this._isVisible=!1}}class Dg{constructor(e){this._options=e,this._viewResizerWrapper=null,this.set("isEnabled",!0),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop())},{priority:"high"}),this.on("change:isEnabled",()=>{this.isEnabled&&this.redraw()})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(i=>{const o=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const i=this.toDomElement(t);return e._appendHandles(i),e._appendSizeUI(i),e.on("change:isEnabled",(e,t,o)=>{i.style.display=o?"":"none"}),i.style.display=e.isEnabled?"":"none",i}));i.insert(i.createPositionAt(t,"end"),o),i.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=o})}begin(e){this.state=new zg(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(e=>{const i=this._options.unit||"%",o=("%"===i?t.widthPercents:t.width)+i;e.setStyle("width",o,this._options.viewElement)});const i=this._getHandleHost(),o=new Ts(i);t.handleHostWidth=Math.round(o.width),t.handleHostHeight=Math.round(o.height);const n=new Ts(i);t.width=Math.round(n.width),t.height=Math.round(n.height),this.redraw(o),this.state.update(t)}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!((i=t)&&i.ownerDocument&&i.ownerDocument.contains(i)))return;var i;const o=t.parentElement,n=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(o.isSameNode(n)){const t=e||new Ts(n);a=[t.width+"px",t.height+"px",void 0,void 0]}else a=[n.offsetWidth+"px",n.offsetHeight+"px",n.offsetLeft+"px",n.offsetTop+"px"];"same"!==ao(s,a)&&this._options.editor.editing.view.change(e=>{e.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change(e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,i={x:(o=e).pageX,y:o.pageY};var o;const n=!this._options.isCentered||this._options.isCentered(this),r={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};n&&t.activeHandlePosition.endsWith("-right")&&(r.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),n&&(r.x*=2);const s={width:Math.abs(t.originalWidth+r.x),height:Math.abs(t.originalHeight+r.y)};s.dominant=s.width/t.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/t.aspectRatio:a.width=a.height*t.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a.width*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const o of t)e.appendChild(new Nc({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(i=o,"ck-widget__resizer__handle-"+i)}}).render());var i}_appendSizeUI(e){this._sizeView=new Vg,this._sizeView.render(),e.appendChild(this._sizeView.element)}}Ke(Dg,Ue);i(85);class Lg extends Qe{static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=vr.window.document;this.set("visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map,e.view.addObserver(ku),this._observer=Object.create(Mr),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this));const i=()=>{this.visibleResizer&&this.visibleResizer.redraw()};this._redrawFocusedResizerThrottled=Gh(i,200),this.on("change:visibleResizer",i),this.editor.ui.on("update",this._redrawFocusedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy())},{priority:"lowest"}),this._observer.listenTo(vr.window,"resize",this._redrawFocusedResizerThrottled);const o=this.editor.editing.view.document.selection;o.on("change",()=>{const e=o.getSelectedElement();this.visibleResizer=this.getResizerByViewElement(e)||null})}destroy(){this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawFocusedResizerThrottled.cancel()}attachTo(e){const t=new Dg(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const e=i.get("WidgetToolbarRepository");t.on("begin",()=>{e.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{e.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{e.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==t&&(this.visibleResizer=t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;Dg.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i),this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}Ke(Lg,Ue);class Bg extends Ze{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),o=t.model,n=i.getClosestSelectedImageElement(o.document.selection);o.change(t=>{t.setAttribute("alt",e.newValue,n)})}}function jg(e,t){const i=e.createEmptyElement("img"),o="imageBlock"===t?e.createContainerElement("figure",{class:"image"}):e.createContainerElement("span",{class:"image-inline"},{isAllowedInsideAttributeElement:!0});return e.insert(e.createPositionAt(o,0),i),o}function Fg(e,t){if(e.plugins.has("ImageInlineEditing")!==e.plugins.has("ImageBlockEditing"))return{name:"img",attributes:{src:!0}};const i=e.plugins.get("ImageUtils");return e=>{if(!i.isInlineImageView(e)||!e.hasAttribute("src"))return null;return(e.findAncestor(i.isBlockImageView)?"imageBlock":"imageInline")!==t?null:{name:!0,attributes:["src"]}}}function Hg(e,t){const i=Ns(t.getSelectedBlocks());return!i||e.isObject(i)||i.isEmpty&&"listItem"!=i.name?"imageBlock":"imageInline"}class Ug extends Qe{static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null){const o=this.editor,n=o.model,r=n.document.selection;i=Wg(o,t||r,i),e={...Object.fromEntries(r.getAttributes()),...e};for(const t in e)n.schema.checkAttribute(i,t)||delete e[t];return n.change(o=>{const s=o.createElement(i,e);return t||"imageInline"==i||(t=Rh(r,n)),n.insertContent(s,t),s.parent?(o.setSelection(s,"on"),s):null})}getClosestSelectedImageWidget(e){const t=e.getSelectedElement();if(t&&this.isImageWidget(t))return t;let i=e.getFirstPosition().parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}isImageAllowed(){const e=this.editor.model.document.selection;return function(e,t){if("imageBlock"==Wg(e,t)){const i=function(e,t){const i=Rh(e,t).start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(t,e.model);if(e.model.schema.checkChild(i,"imageBlock"))return!0}else if(e.model.schema.checkChild(t.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}(e)}toImageWidget(e,t,i){t.setCustomProperty("image",!0,e);return Eh(e,t,{label:()=>{const t=this.findViewImgElement(e).getAttribute("alt");return t?`${t} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&Th(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}}function Wg(e,t,i){const o=e.model.schema,n=e.config.get("image.insert.type");return e.plugins.has("ImageBlockEditing")?e.plugins.has("ImageInlineEditing")?i||("inline"===n?"imageInline":"block"===n?"imageBlock":t.is("selection")?Hg(o,t):o.checkChild(t,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class $g extends Qe{static get requires(){return[Ug]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Bg(this.editor))}}i(87),i(8);class qg extends Mc{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new Rs,this.keystrokes=new Os,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),Tc.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),Tc.cancel,"ck-button-cancel","cancel"),this._focusables=new Ic,this._focusCycler=new sd({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]}),Sc(this)}render(){super.render(),this.keystrokes.listenTo(this.element),Pc({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,i,o){const n=new ed(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createLabeledInputView(){const e=this.locale.t,t=new Ld(this.locale,Bd);return t.label=e("Text alternative"),t}}function Yg(e){const t=e.editing.view,i=$d.defaultPositions,o=e.plugins.get("ImageUtils");return{target:t.domConverter.viewToDom(o.getClosestSelectedImageWidget(t.document.selection)),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast]}}class Gg extends Qe{static get requires(){return[Qd]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const o=e.commands.get("imageTextAlternative"),n=new ed(i);return n.set({label:t("Change image text alternative"),icon:Tc.lowVision,tooltip:!0}),n.bind("isEnabled").to(o,"isEnabled"),this.listenTo(n,"execute",()=>{this._showForm()}),n})}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new qg(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(e,t)=>{this._hideForm(!0),t()}),this.listenTo(e.ui,"update",()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(e.plugins.get("ImageUtils").getClosestSelectedImageWidget(e.editing.view.document.selection)){const i=Yg(e);t.updatePosition(i)}}(e):this._hideForm(!0)}),Ec({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Yg(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Kg extends Qe{static get requires(){return[$g,Gg]}static get pluginName(){return"ImageTextAlternative"}}function Qg(e,t){return e=>{e.on("attribute:srcset:"+t,i)};function i(t,i,o){if(!o.consumable.consume(i.item,t.name))return;const n=o.writer,r=o.mapper.toViewElement(i.item),s=e.findViewImgElement(r);if(null===i.attributeNewValue){const e=i.attributeOldValue;e.data&&(n.removeAttribute("srcset",s),n.removeAttribute("sizes",s),e.width&&n.removeAttribute("width",s))}else{const e=i.attributeNewValue;e.data&&(n.setAttribute("srcset",e.data,s),n.setAttribute("sizes","100vw",s),e.width&&n.setAttribute("width",e.width,s))}}}function Jg(e,t,i){return e=>{e.on(`attribute:${i}:${t}`,o)};function o(t,i,o){if(!o.consumable.consume(i.item,t.name))return;const n=o.writer,r=o.mapper.toViewElement(i.item),s=e.findViewImgElement(r);n.setAttribute(i.attributeKey,i.attributeNewValue||"",s)}}class Zg extends Or{observe(e){this.listenTo(e,"load",(e,t)=>{const i=t.target;this.checkShouldIgnoreEventFromTarget(i)||"IMG"==i.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class Xg extends Ze{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||"block"===t&&Object(l.b)("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||"inline"===t&&Object(l.b)("image-inline-plugin-required")}refresh(){this.isEnabled=this.editor.plugins.get("ImageUtils").isImageAllowed()}execute(e){const t=eo(e.source),i=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),n=Object.fromEntries(i.getAttributes());t.forEach((e,t)=>{const r=i.getSelectedElement();if("string"==typeof e&&(e={src:e}),t&&r&&o.isImage(r)){const t=this.editor.model.createPositionAfter(r);o.insertImage({...e,...n},t)}else o.insertImage({...e,...n})})}}class ef extends Qe{static get requires(){return[Ug]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(Zg),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:e=>{const t={data:e.getAttribute("srcset")};return e.hasAttribute("width")&&(t.width=e.getAttribute("width")),t}}});const i=new Xg(e);e.commands.add("insertImage",i),e.commands.add("imageInsert",i)}}class tf extends Ze{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(){const e=this.editor,t=this.editor.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(t.document.selection),n=Object.fromEntries(o.getAttributes());return n.src||n.uploadId?t.change(e=>{const r=Array.from(t.markers).filter(e=>e.getRange().containsItem(o)),s=i.insertImage(n,t.createSelection(o,"on"),this._modelElementName);if(!s)return null;const a=e.createRangeOn(s);for(const t of r){const i=t.getRange(),o="$graveyard"!=i.root.rootName?i.getJoined(a,!0):a;e.updateMarker(t,{range:o})}return{oldElement:o,newElement:s}}):null}}class of extends Qe{static get requires(){return[ef,Ug,hh]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new tf(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,o=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageBlock",view:(e,{writer:t})=>jg(t,"imageBlock")}),i.for("editingDowncast").elementToElement({model:"imageBlock",view:(e,{writer:i})=>o.toImageWidget(jg(i,"imageBlock"),i,t("image widget"))}),i.for("downcast").add(Jg(o,"imageBlock","src")).add(Jg(o,"imageBlock","alt")).add(Qg(o,"imageBlock")),i.for("upcast").elementToElement({view:Fg(e,"imageBlock"),model:(e,{writer:t})=>t.createElement("imageBlock",{src:e.getAttribute("src")})}).add(function(e){return e=>{e.on("element:figure",t)};function t(t,i,o){if(!o.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const n=e.findViewImgElement(i.viewItem);if(!n||!n.hasAttribute("src")||!o.consumable.test(n,{name:!0}))return;const r=Ns(o.convertItem(n,i.modelCursor).modelRange.getItems());r&&(o.convertChildren(i.viewItem,r),o.updateConversionResult(r,i))}}(o))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,o=e.plugins.get("ImageUtils");this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",(n,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isInlineImageView))return;a=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageBlock"===Hg(t.schema,l)){const e=new _u(i.document),t=s.map(t=>e.createElement("figure",{class:"image"},t));r.content=e.createDocumentFragment(t)}})}}i(12);class nf extends Qe{static get requires(){return[of,qh,Kg]}static get pluginName(){return"ImageBlock"}}class rf extends Qe{static get requires(){return[ef,Ug,hh]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{isObject:!0,isInline:!0,allowWhere:"$text",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((e,t)=>{if(e.endsWith("caption")&&"imageInline"===t.name)return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new tf(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,o=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(e,{writer:t})=>t.createEmptyElement("img")}),i.for("editingDowncast").elementToElement({model:"imageInline",view:(e,{writer:i})=>o.toImageWidget(jg(i,"imageInline"),i,t("image widget"))}),i.for("downcast").add(Jg(o,"imageInline","src")).add(Jg(o,"imageInline","alt")).add(Qg(o,"imageInline")),i.for("upcast").elementToElement({view:Fg(e,"imageInline"),model:(e,{writer:t})=>t.createElement("imageInline",{src:e.getAttribute("src")})})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,o=e.plugins.get("ImageUtils");this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",(n,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(o.isBlockImageView))return;a=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageInline"===Hg(t.schema,l)){const e=new _u(i.document),t=s.map(t=>1===t.childCount?(Array.from(t.getAttributes()).forEach(i=>e.setAttribute(...i,o.findViewImgElement(t))),t.getChild(0)):t);r.content=e.createDocumentFragment(t)}})}}class sf extends Qe{static get requires(){return[rf,qh,Kg]}static get pluginName(){return"ImageInline"}}function af(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}function lf(e,t){const i=t.getFirstPosition().findAncestor("caption");return i&&e.isBlockImage(i.parent)?i:null}class cf extends Ze{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils");if(!e.plugins.has(of))return this.isEnabled=!1,void(this.value=!1);const i=e.model.document.selection,o=i.getSelectedElement();if(!o){const e=lf(t,i);return this.isEnabled=!!e,void(this.value=!!e)}this.isEnabled=this.editor.plugins.get("ImageUtils").isImage(o),this.isEnabled?this.value=!!af(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t)})}_showImageCaption(e,t){const i=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing");let n=i.getSelectedElement();const r=o._getSavedCaption(n);this.editor.plugins.get("ImageUtils").isInlineImage(n)&&(this.editor.execute("imageTypeBlock"),n=i.getSelectedElement());const s=r||e.createElement("caption");e.append(s,n),t&&e.setSelection(s,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,o=t.plugins.get("ImageCaptionEditing"),n=t.plugins.get("ImageUtils");let r,s=i.getSelectedElement();s?r=af(s):(r=lf(n,i),s=r.parent),o._saveCaption(s,r),e.setSelection(s,"on"),e.remove(r)}}class df extends Qe{static get requires(){return[Ug]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new cf(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:e=>function(e,t){return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}(i,e),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>i.isBlockImage(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:n})=>{if(!i.isBlockImage(e.parent))return null;const r=n.createEditableElement("figcaption");n.setCustomProperty("imageCaption",!0,r),iu({view:t,element:r,text:o("Enter image caption"),keepOnFocus:!0});const s=Nh(r,n);return Ih(s,n,(e,t,i)=>i.addClass(eo(t.classes),e),(e,t,i)=>i.removeClass(eo(t.classes),e)),s}}),e.editing.mapper.on("modelToViewPosition",uf(t)),e.data.mapper.on("modelToViewPosition",uf(t))}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),n=e=>{if(!e.return)return;const{oldElement:i,newElement:o}=e.return;if(!i)return;if(t.isBlockImage(i)){const e=af(i);if(e)return void this._saveCaption(o,e)}const n=this._getSavedCaption(i);n&&this._saveCaption(o,n)};i&&this.listenTo(i,"execute",n,{priority:"low"}),o&&this.listenTo(o,"execute",n,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Js.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}function uf(e){return(t,i)=>{const o=i.modelPosition,n=o.parent;if(!n.is("element","imageBlock"))return;const r=i.mapper.toViewElement(n);i.viewPosition=e.createPositionAt(r,o.offset+1)}}class hf extends Qe{static get requires(){return[Ug]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),o=e.t;e.ui.componentFactory.add("toggleImageCaption",n=>{const r=e.commands.get("toggleImageCaption"),s=new ed(n);return s.set({icon:Tc.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",e=>o(e?"Toggle caption off":"Toggle caption on")),this.listenTo(s,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const o=lf(i,e.model.document.selection);if(o){const i=e.editing.mapper.toViewElement(o);t.scrollToTheSelection(),t.change(e=>{e.addClass("image__caption_highlighted",i)})}}),s})}}i(91);class mf extends Ze{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(e=>{if(e.isDefault)for(const t of e.modelElements)this._defaultStyles[t]=e.name;return[e.name,e]}))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,o=t.plugins.get("ImageUtils");i.change(t=>{const n=e.value;let r=o.getClosestSelectedImageElement(i.document.selection);n&&this.shouldConvertImageType(n,r)&&(this.editor.execute(o.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=o.getClosestSelectedImageElement(i.document.selection)),!n||this._styles.get(n).isDefault?t.removeAttribute("imageStyle",r):t.setAttribute("imageStyle",n,r)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}const{objectFullWidth:gf,objectInline:ff,objectLeft:pf,objectRight:bf,objectCenter:wf,objectBlockLeft:kf,objectBlockRight:_f}=Tc,vf={inline:{name:"inline",title:"In line",icon:ff,modelElements:["imageInline"],isDefault:!0},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:pf,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"},alignBlockLeft:{name:"alignBlockLeft",title:"Left aligned image",icon:kf,modelElements:["imageBlock"],className:"image-style-block-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:wf,modelElements:["imageBlock"],className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:bf,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"},alignBlockRight:{name:"alignBlockRight",title:"Right aligned image",icon:_f,modelElements:["imageBlock"],className:"image-style-block-align-right"},block:{name:"block",title:"Centered image",icon:wf,modelElements:["imageBlock"],isDefault:!0},side:{name:"side",title:"Side image",icon:bf,modelElements:["imageBlock"],className:"image-style-side"}},yf={full:gf,left:kf,right:_f,center:wf,inlineLeft:pf,inlineRight:bf,inline:ff},xf=[{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 Af(e){Object(l.b)("image-style-configuration-definition-invalid",e)}var Cf={normalizeStyles:function(e){return(e.configuredStyles.options||[]).map(e=>function(e){e="string"==typeof e?vf[e]?{...vf[e]}:{name:e}:function(e,t){const i={...t};for(const o in e)Object.prototype.hasOwnProperty.call(t,o)||(i[o]=e[o]);return i}(vf[e.name],e);"string"==typeof e.icon&&(e.icon=yf[e.icon]||e.icon);return e}(e)).filter(t=>function(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:i}){const{modelElements:o,name:n}=e;if(!(o&&o.length&&n))return Af({style:e}),!1;{const n=[t?"imageBlock":null,i?"imageInline":null];if(!o.some(e=>n.includes(e)))return Object(l.b)("image-style-missing-dependency",{style:e,missingPlugins:o.map(e=>"imageBlock"===e?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(t,e))},getDefaultStylesConfiguration:function(e,t){return e&&t?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:e?{options:["block","side"]}:t?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(e){return e.has("ImageBlockEditing")&&e.has("ImageInlineEditing")?[...xf]:[]},warnInvalidStyle:Af,DEFAULT_OPTIONS:vf,DEFAULT_ICONS:yf,DEFAULT_DROPDOWN_DEFINITIONS:xf};function Tf(e,t){for(const i of t)if(i.name===e)return i}class Ef extends Qe{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Ug]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Cf,i=this.editor,o=i.plugins.has("ImageBlockEditing"),n=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(o,n)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:o,isInlinePluginLoaded:n}),this._setupConversion(o,n),this._setupPostFixer(),i.commands.add("imageStyle",new mf(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,o=i.model.schema,n=(r=this.normalizedStyles,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=Tf(t.attributeNewValue,r),n=Tf(t.attributeOldValue,r),s=i.mapper.toViewElement(t.item),a=i.writer;n&&a.removeClass(n.className,s),o&&a.addClass(o.className,s)});var r;const s=function(e){const t={imageInline:e.filter(e=>!e.isDefault&&e.modelElements.includes("imageInline")),imageBlock:e.filter(e=>!e.isDefault&&e.modelElements.includes("imageBlock"))};return(e,i,o)=>{if(!i.modelRange)return;const n=i.viewItem,r=Ns(i.modelRange.getItems());if(r&&o.schema.checkAttribute(r,"imageStyle"))for(const e of t[r.name])o.consumable.consume(n,{classes:e.className})&&o.writer.setAttribute("imageStyle",e.name,r)}}(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",n),i.data.downcastDispatcher.on("attribute:imageStyle",n),e&&(o.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),t&&(o.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(Ug),o=new Map(this.normalizedStyles.map(e=>[e.name,e]));t.registerPostFixer(e=>{let n=!1;for(const r of t.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let t="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(t&&t.is("element","paragraph")&&t.childCount>0&&(t=t.getChild(0)),!i.isImage(t))continue;const s=t.getAttribute("imageStyle");if(!s)continue;const a=o.get(s);a&&a.modelElements.includes(t.name)||(e.removeAttribute("imageStyle",t),n=!0)}return n})}}i(93);class Sf extends Qe{static get requires(){return[Ef]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=Pf(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const e of i)this._createButton(e);const o=Pf([...t.filter(w),...Cf.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const e of o)this._createDropdown(e,i)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,o=>{let n;const{defaultItem:r,items:s,title:a}=e,l=s.filter(e=>t.find(({name:t})=>If(t)===e)).map(e=>{const t=i.create(e);return e===r&&(n=t),t});s.length!==l.length&&Cf.warnInvalidStyle({dropdown:e});const c=Sd(o,ud),d=c.buttonView;return Pd(c,l),d.set({label:Mf(a,n.label),class:null,tooltip:!0}),d.bind("icon").toMany(l,"isOn",(...e)=>{const t=e.findIndex(Z);return t<0?n.icon:l[t].icon}),d.bind("label").toMany(l,"isOn",(...e)=>{const t=e.findIndex(Z);return Mf(a,t<0?n.label:l[t].label)}),d.bind("isOn").toMany(l,"isOn",(...e)=>e.some(Z)),d.bind("class").toMany(l,"isOn",(...e)=>e.some(Z)?"ck-splitbutton_flatten":null),d.on("execute",()=>{l.some(({isOn:e})=>e)?c.isOpen=!c.isOpen:n.fire("execute")}),c.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(Z)),c})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(If(t),i=>{const o=this.editor.commands.get("imageStyle"),n=new ed(i);return n.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(o,"isEnabled"),n.bind("isOn").to(o,"value",e=>e===t),n.on("execute",this._executeCommand.bind(this,t)),n})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Pf(e,t){for(const i of e)t[i.title]&&(i.title=t[i.title]);return e}function If(e){return"imageStyle:"+e}function Mf(e,t){return(e?e+": ":"")+t}function Nf(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}function Rf(e){return new Promise((t,i)=>{const o=e.getAttribute("src");fetch(o).then(e=>e.blob()).then(e=>{const i=Of(e,o),n=i.replace("image/",""),r=new File([e],"image."+n,{type:i});t(r)}).catch(e=>e&&"TypeError"===e.name?function(e){return function(e){return new Promise((t,i)=>{const o=vr.document.createElement("img");o.addEventListener("load",()=>{const e=vr.document.createElement("canvas");e.width=o.width,e.height=o.height;e.getContext("2d").drawImage(o,0,0),e.toBlob(e=>e?t(e):i())}),o.addEventListener("error",()=>i()),o.src=e})}(e).then(t=>{const i=Of(t,e),o=i.replace("image/","");return new File([t],"image."+o,{type:i})})}(o).then(t).catch(i):i(e))})}function Of(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class zf extends Qe{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=i=>{const o=new Zm(i),n=e.commands.get("uploadImage"),r=e.config.get("image.upload.types"),s=Nf(r);return o.set({acceptedType:r.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),o.buttonView.set({label:t("Insert image"),icon:Tc.image,tooltip:!0}),o.buttonView.bind("isEnabled").to(n),o.on("done",(t,i)=>{const o=Array.from(i).filter(e=>s.test(e.type));o.length&&e.execute("uploadImage",{file:o})}),o};e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i)}}i(95),i(97),i(99);class Vf extends Qe{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 250"><rect rx="4"/></svg>')}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",(...e)=>this.uploadStatusChange(...e)),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,i){const o=this.editor,n=t.item,r=n.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const s=o.plugins.get("ImageUtils"),a=o.plugins.get(Qm),l=r?t.attributeNewValue:null,c=this.placeholder,d=o.editing.mapper.toViewElement(n),u=i.writer;if("reading"==l)return Df(d,u),void Lf(s,c,d,u);if("uploading"==l){const e=a.loaders.get(r);return Df(d,u),void(e?(Bf(d,u),function(e,t,i,o){const n=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),n),i.on("change:uploadedPercent",(e,t,i)=>{o.change(e=>{e.setStyle("width",i+"%",n)})})}(d,u,e,o.editing.view),function(e,t,i,o){if(o.data){const n=e.findViewImgElement(t);i.setAttribute("src",o.data,n)}}(s,d,u,e)):Lf(s,c,d,u))}"complete"==l&&a.loaders.get(r)&&function(e,t,i){const o=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),o),setTimeout(()=>{i.change(e=>e.remove(e.createRangeOn(o)))},3e3)}(d,u,o.editing.view),function(e,t){Ff(e,t,"progressBar")}(d,u),Bf(d,u),function(e,t){t.removeClass("ck-appear",e)}(d,u)}}function Df(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function Lf(e,t,i,o){i.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",i);const n=e.findViewImgElement(i);n.getAttribute("src")!==t&&o.setAttribute("src",t,n),jf(i,"placeholder")||o.insert(o.createPositionAfter(n),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(o))}function Bf(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Ff(e,t,"placeholder")}function jf(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function Ff(e,t,i){const o=jf(e,i);o&&t.remove(t.createRangeOn(o))}class Hf extends Ze{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=eo(e.file),i=this.editor.model.document.selection,o=this.editor.plugins.get("ImageUtils"),n=Object.fromEntries(i.getAttributes());t.forEach((e,t)=>{const r=i.getSelectedElement();if(t&&r&&o.isImage(r)){const t=this.editor.model.createPositionAfter(r);this._uploadImage(e,n,t)}else this._uploadImage(e,n)})}_uploadImage(e,t,i){const o=this.editor,n=o.plugins.get(Qm).createLoader(e),r=o.plugins.get("ImageUtils");n&&r.insertImage({...t,uploadId:n.id},i)}}class Uf extends Qe{static get requires(){return[Qm,Fd,hh,Ug]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,o=e.plugins.get(Qm),n=e.plugins.get("ImageUtils"),r=Nf(e.config.get("image.upload.types")),s=new Hf(e);e.commands.add("uploadImage",s),e.commands.add("imageUpload",s),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,i)=>{if(o=i.dataTransfer,Array.from(o.types).includes("text/html")&&""!==o.getData("text/html"))return;var o;const n=Array.from(i.dataTransfer.files).filter(e=>!!e&&r.test(e.type));n.length&&(t.stop(),e.model.change(t=>{i.targetRanges&&t.setSelection(i.targetRanges.map(t=>e.editing.mapper.toModelRange(t))),e.model.enqueueChange("default",()=>{e.execute("uploadImage",{file:n})})}))}),this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",(t,i)=>{const r=Array.from(e.editing.view.createRangeIn(i.content)).filter(e=>function(e,t){return!(!e.isInlineImageView(t)||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))}(n,e.item)&&!e.item.getAttribute("uploadProcessed")).map(e=>({promise:Rf(e.item),imageElement:e.item}));if(!r.length)return;const s=new _u(e.editing.view.document);for(const e of r){s.setAttribute("uploadProcessed",!0,e.imageElement);const t=o.createLoader(e.promise);t&&(s.setAttribute("src","",e.imageElement),s.setAttribute("uploadId",t.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault()}),t.on("change",()=>{const i=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),n=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,r="$graveyard"==t.position.root.rootName;for(const t of Wf(e,i)){const e=t.getAttribute("uploadId");if(!e)continue;const i=o.loaders.get(e);i&&(r?n.has(e)||i.abort():(n.add(e),this._uploadImageElements.set(e,t),"idle"==i.status&&this._readAndUpload(i)))}}}),this.on("uploadComplete",(e,{imageElement:t,data:i})=>{const o=i.urls?i.urls:i;this.editor.model.change(e=>{e.setAttribute("src",o.default,t),this._parseAndSetSrcsetAttributeOnImage(o,t,e)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,o=t.locale.t,n=t.plugins.get(Qm),r=t.plugins.get(Fd),s=t.plugins.get("ImageUtils"),a=this._uploadImageElements;return i.enqueueChange("transparent",t=>{t.setAttribute("uploadStatus","reading",a.get(e.id))}),e.read().then(()=>{const o=e.upload(),n=a.get(e.id);if(Pn.isSafari){const e=t.editing.mapper.toViewElement(n),i=s.findViewImgElement(e);t.editing.view.once("render",()=>{if(!i.parent)return;const e=t.editing.view.domConverter.mapViewToDom(i.parent);if(!e)return;const o=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=o})}return i.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",n)}),o}).then(t=>{i.enqueueChange("transparent",i=>{const o=a.get(e.id);i.setAttribute("uploadStatus","complete",o),this.fire("uploadComplete",{data:t,imageElement:o})}),l()}).catch(t=>{if("error"!==e.status&&"aborted"!==e.status)throw t;"error"==e.status&&t&&r.showWarning(t,{title:o("Upload failed"),namespace:"upload"}),i.enqueueChange("transparent",t=>{t.remove(a.get(e.id))}),l()});function l(){i.enqueueChange("transparent",t=>{const i=a.get(e.id);t.removeAttribute("uploadId",i),t.removeAttribute("uploadStatus",i),a.delete(e.id)}),n.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let o=0;const n=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return o=Math.max(o,t),!0}).map(t=>`${e[t]} ${t}w`).join(", ");""!=n&&i.setAttribute("srcset",{data:n,width:o},t)}}function Wf(e,t){const i=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter(e=>i.isImage(e.item)).map(e=>e.item)}class $f extends Qe{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new et(e)),e.commands.add("outdent",new et(e))}}var qf='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',Yf='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>';class Gf extends Qe{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?qf:Yf,n="ltr"==t.uiLanguageDirection?Yf:qf;this._defineButton("indent",i("Increase indent"),o),this._defineButton("outdent",i("Decrease indent"),n)}_defineButton(e,t,i){const o=this.editor;o.ui.componentFactory.add(e,n=>{const r=o.commands.get(e),s=new ed(n);return s.set({label:t,icon:i,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",()=>{o.execute(e),o.editing.view.focus()}),s})}}class Kf{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(e=>this._definitions.add(e)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;const o=i.writer,n=o.document.selection;for(const e of this._definitions){const r=o.createAttributeElement("a",e.attributes,{priority:5});e.classes&&o.addClass(e.classes,r);for(const t in e.styles)o.setStyle(t,e.styles[t],r);o.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?o.wrap(n.getFirstRange(),r):o.wrap(i.mapper.toViewRange(t.range),r):o.unwrap(i.mapper.toViewRange(t.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(e,t,{writer:i,mapper:o})=>{const n=o.toViewElement(t.item),r=Array.from(n.getChildren()).find(e=>"a"===e.name);for(const e of this._definitions){const o=mo(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of o)"class"===e?i.addClass(t,r):i.setAttribute(e,t,r);e.classes&&i.addClass(e.classes,r);for(const t in e.styles)i.setStyle(t,e.styles[t],r)}else{for(const[e,t]of o)"class"===e?i.removeClass(t,r):i.removeAttribute(e,r);e.classes&&i.removeClass(e.classes,r);for(const t in e.styles)i.removeStyle(t,r)}}})}}}var Qf=function(e,t,i){var o=e.length;return i=void 0===i?o:i,!t&&i>=o?e:zo(e,t,i)},Jf=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Zf=function(e){return Jf.test(e)};var Xf=function(e){return e.split("")},ep="[\\ud800-\\udfff]",tp="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",ip="\\ud83c[\\udffb-\\udfff]",op="[^\\ud800-\\udfff]",np="(?:\\ud83c[\\udde6-\\uddff]){2}",rp="[\\ud800-\\udbff][\\udc00-\\udfff]",sp="(?:"+tp+"|"+ip+")"+"?",ap="[\\ufe0e\\ufe0f]?"+sp+("(?:\\u200d(?:"+[op,np,rp].join("|")+")[\\ufe0e\\ufe0f]?"+sp+")*"),lp="(?:"+[op+tp+"?",tp,np,rp,ep].join("|")+")",cp=RegExp(ip+"(?="+ip+")|"+lp+ap,"g");var dp=function(e){return e.match(cp)||[]};var up=function(e){return Zf(e)?dp(e):Xf(e)};var hp=function(e){return function(t){t=Io(t);var i=Zf(t)?up(t):void 0,o=i?i[0]:t.charAt(0),n=i?Qf(i,1).join(""):t.slice(1);return o[e]()+n}}("toUpperCase");const mp=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,gp=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,fp=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,pp=/^((\w+:(\/{2,})?)|(\W))/i;function bp(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function wp(e){return function(e){return e.replace(mp,"").match(gp)}(e=String(e))?e:"#"}function kp(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function _p(e,t){const i=(o=e,fp.test(o)?"mailto:":t);var o;const n=!!i&&!pp.test(e);return e&&n?i+e:e}class vp extends Ze{constructor(e){super(e),this.manualDecorators=new Zi,this.automaticDecorators=new Kf}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||Ns(t.getSelectedBlocks());kp(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,o=i.document.selection,n=[],r=[];for(const e in t)t[e]?n.push(e):r.push(e);i.change(t=>{if(o.isCollapsed){const s=o.getFirstPosition();if(o.hasAttribute("linkHref")){const a=Dm(s,"linkHref",o.getAttribute("linkHref"),i);t.setAttribute("linkHref",e,a),n.forEach(e=>{t.setAttribute(e,!0,a)}),r.forEach(e=>{t.removeAttribute(e,a)}),t.setSelection(t.createPositionAfter(a.end.nodeBefore))}else if(""!==e){const r=mo(o.getAttributes());r.set("linkHref",e),n.forEach(e=>{r.set(e,!0)});const{end:a}=i.insertContent(t.createText(e,r),s);t.setSelection(a)}["linkHref",...n,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=i.schema.getValidRanges(o.getRanges(),"linkHref"),a=[];for(const e of o.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const l=a.slice();for(const e of s)this._isRangeToUpdate(e,a)&&l.push(e);for(const i of l)t.setAttribute("linkHref",e,i),n.forEach(e=>{t.setAttribute(e,!0,i)}),r.forEach(e=>{t.removeAttribute(e,i)})}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,o=i.getSelectedElement();return kp(o,t.schema)?o.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}class yp extends Ze{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();kp(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,o=e.commands.get("link");t.change(e=>{const n=i.isCollapsed?[Dm(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of n)if(e.removeAttribute("linkHref",t),o)for(const i of o.manualDecorators)e.removeAttribute(i.id,t)})}}class xp{constructor({id:e,label:t,attributes:i,classes:o,styles:n,defaultValue:r}){this.id=e,this.set("value"),this.defaultValue=r,this.label=t,this.attributes=i,this.classes=o,this.styles=n}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}Ke(xp,Ue);i(101);const Ap=/^(https?:)?\/\//;class Cp extends Qe{static get pluginName(){return"LinkEditing"}static get requires(){return[ym,wm,hh]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:bp}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>bp(wp(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new vp(e)),e.commands.add("unlink",new yp(e));const t=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>(e.label&&i[e.label]&&(e.label=i[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[i,o]of Object.entries(e)){const e=Object.assign({},o,{id:"link"+hp(i)});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(e=>"automatic"===e.mode)),this._enableManualDecorators(t.filter(e=>"manual"===e.mode));e.plugins.get(ym).registerAttribute("linkHref"),function(e,t,i,o){const n=e.editing.view,r=new Set;n.document.registerPostFixer(n=>{const s=e.model.document.selection;let a=!1;if(s.hasAttribute(t)){const l=Dm(s.getFirstPosition(),t,s.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(o)&&(n.addClass(o,e),r.add(e),a=!0)}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){n.change(e=>{for(const t of r.values())e.removeClass(o,t),r.delete(t)})}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:"automatic",callback:e=>Ap.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),e=new xp(e),i.add(e),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,{writer:i})=>{if(t){const t=i.createAttributeElement("a",e.attributes,{priority:5});e.classes&&i.addClass(e.classes,t);for(const o in e.styles)i.setStyle(o,e.styles[o],t);return i.setCustomProperty("link",!0,t),t}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...e._createPattern()},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",()=>{const i=t.anchor.nodeBefore,o=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&i&&i.hasAttribute("linkHref")&&(o&&o.hasAttribute("linkHref")||e.change(t=>{Tp(t,Sp(e.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(ku);let i=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{i=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!i)return;i=!1;const e=t.document.selection;if(!e.isCollapsed)return;if(!e.hasAttribute("linkHref"))return;const o=e.getFirstPosition(),n=Dm(o,"linkHref",e.getAttribute("linkHref"),t);(o.isTouching(n.start)||o.isTouching(n.end))&&t.change(e=>{Tp(e,Sp(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i,o;this.listenTo(t.document,"delete",()=>{o=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const t=e.model.document.selection;t.isCollapsed||(o?o=!1:Ep(e)&&function(e){const t=e.document.selection,i=t.getFirstPosition(),o=t.getLastPosition(),n=i.nodeAfter;if(!n)return!1;if(!n.is("$text"))return!1;if(!n.hasAttribute("linkHref"))return!1;const r=o.textNode||o.nodeBefore;if(n===r)return!0;return Dm(i,"linkHref",n.getAttribute("linkHref"),e).containsRange(e.createRange(i,o),!0)}(e.model)&&(i=t.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(t,[n])=>{o=!1,Ep(e)&&i&&(e.model.change(e=>{for(const[t,o]of i)e.setAttribute(t,o,n)}),i=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,o=e.editing.view;let n=!1,r=!1;this.listenTo(o.document,"delete",(e,t)=>{r=t.domEvent.keyCode===Nn.backspace},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{n=!1;const e=i.getFirstPosition(),o=i.getAttribute("linkHref");if(!o)return;const r=Dm(e,"linkHref",o,t);n=r.containsPosition(e)||r.end.isEqual(e)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r&&(r=!1,n||e.model.enqueueChange(e=>{Tp(e,Sp(t.schema))}))},{priority:"low"})}}function Tp(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i)}function Ep(e){return e.plugins.get("Input").isInput(e.model.change(e=>e.batch))}function Sp(e){return e.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}i(103);class Pp extends Mc{constructor(e,t){super(e);const i=e.t;this.focusTracker=new Rs,this.keystrokes=new Os,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Tc.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Tc.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusables=new Ic,this._focusCycler=new sd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children}),Sc(this)}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),Pc({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Ld(this.locale,Bd);return t.label=e("Link URL"),t}_createButton(e,t,i,o){const n=new ed(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const o=new td(this.locale);o.set({name:i.id,label:i.label,withText:!0}),o.bind("isOn").toMany([i,e],"value",(e,t)=>void 0===t&&void 0===e?i.defaultValue:e),o.on("execute",()=>{i.set("value",!o.isOn)}),t.add(o)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new Mc;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}i(105);class Ip extends Mc{constructor(e){super(e);const t=e.t;this.focusTracker=new Rs,this.keystrokes=new Os,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(t("Edit link"),Tc.pencil,"edit"),this.set("href"),this._focusables=new Ic,this._focusCycler=new sd({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(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const o=new ed(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.delegate("execute").to(this,i),o}_createPreviewButton(){const e=new ed(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&wp(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||i("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}class Mp extends Qe{static get requires(){return[Qd]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(wu),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(Qd),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),e.conversion.for("editingDowncast").markerToHighlight({model:"link-ui",view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:"link-ui",view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const e=this.editor,t=new Ip(e.locale),i=e.commands.get("link"),o=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(o),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t()}),t.keystrokes.set("Ctrl+K",(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),o=new Pp(e.locale,t);return o.urlInputView.fieldView.bind("value").to(t,"value"),o.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),o.saveButtonView.bind("isEnabled").to(t),this.listenTo(o,"submit",()=>{const{value:t}=o.urlInputView.fieldView.element,n=_p(t,i);e.execute("link",n,o.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),o}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.keystrokes.set("Ctrl+K",(e,i)=>{i(),t.isEnabled&&this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const o=new ed(e);return o.isEnabled=!0,o.label=i("Link"),o.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',o.keystroke="Ctrl+K",o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",e=>!!e),this.listenTo(o,"execute",()=>this._showUI(!0)),o})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Ec({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),o=r();const n=()=>{const e=this._getSelectedLinkElement(),t=r();i&&!e||!i&&t!==o?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,o=t};function r(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",n),this.listenTo(this._balloon,"change:visibleView",n)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let o=null;if(t.markers.has("link-ui")){const t=Array.from(this.editor.editing.mapper.markerNameToElements("link-ui")),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));o=e.domConverter.viewRangeToDom(i)}else o=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:o}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&Th(i))return Np(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),o=Np(i.start),n=Np(i.end);return o&&o==n&&e.createRangeIn(o).getTrimmed().isEqual(i)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has("link-ui"))t.updateMarker("link-ui",{range:i});else if(i.start.isAtEnd){const o=i.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:i});t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:t.createRange(o,i.end)})}else t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has("link-ui")&&e.change(e=>{e.removeMarker("link-ui")})}}function Np(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}const Rp=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 Op extends Qe{static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new vm(e.model,e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=zp(e.substr(0,e.length-1));return t?{url:t}:void 0}),i=e.plugins.get("Input");t.on("matched:data",(t,o)=>{const{batch:n,range:r,url:s}=o;if(!i.isInput(n))return;const a=r.end.getShiftedBy(-1),l=a.getShiftedBy(-s.length),c=e.model.createRange(l,a);this._applyAutoLink(s,c)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:o}=_m(e,t),n=zp(i);if(n){const e=t.createRange(o.end.getShiftedBy(-n.length),o.end);this._applyAutoLink(n,e)}}_applyAutoLink(e,t){const i=this.editor.model;this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&i.enqueueChange(i=>{const o=this.editor.config.get("link.defaultProtocol"),n=_p(e,o);i.setAttribute("linkHref",n,t)})}}function zp(e){const t=Rp.exec(e);return t?t[2]:null}class Vp extends Ze{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,o=Array.from(i.selection.getSelectedBlocks()).filter(e=>Lp(e,t.schema)),n=void 0!==e.forceValue?!e.forceValue:this.value;t.change(e=>{if(n){let t=o[o.length-1].nextSibling,i=Number.POSITIVE_INFINITY,n=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<i&&(i=e);const o=e-i;n.push({element:t,listIndent:o}),t=t.nextSibling}n=n.reverse();for(const t of n)e.setAttribute("listIndent",t.listIndent,t.element)}if(!n){let e=Number.POSITIVE_INFINITY;for(const t of o)t.is("element","listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,Dp(o,!0,e),Dp(o,!1,e)}for(const t of o.reverse())n&&"listItem"==t.name?e.rename(t,"paragraph"):n||"listItem"==t.name?n||"listItem"!=t.name||t.getAttribute("listType")==this.type||e.setAttribute("listType",this.type,t):(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,"listItem"));this.fire("_executeCleanup",o)})}_getValue(){const e=Ns(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is("element","listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Ns(e.getSelectedBlocks());return!!i&&Lp(i,t)}}function Dp(e,t,i){const o=t?e[0]:e[e.length-1];if(o.is("element","listItem")){let n=o[t?"previousSibling":"nextSibling"],r=o.getAttribute("listIndent");for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=i;)r>n.getAttribute("listIndent")&&(r=n.getAttribute("listIndent")),n.getAttribute("listIndent")==r&&e[t?"unshift":"push"](n),n=n[t?"previousSibling":"nextSibling"]}}function Lp(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class Bp extends Ze{constructor(e,t){super(e),this._indentBy="forward"==t?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=i[i.length-1];let o=t.nextSibling;for(;o&&"listItem"==o.name&&o.getAttribute("listIndent")>t.getAttribute("listIndent");)i.push(o),o=o.nextSibling;this._indentBy<0&&(i=i.reverse());for(const t of i){const i=t.getAttribute("listIndent")+this._indentBy;i<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",i,t)}this.fire("_executeCleanup",i)})}_checkEnabled(){const e=Ns(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let o=e.previousSibling;for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=t;){if(o.getAttribute("listIndent")==t)return o.getAttribute("listType")==i;o=o.previousSibling}return!1}return!0}}function jp(e,t){const i=t.mapper,o=t.writer,n="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=qp,t}(o),s=o.createContainerElement(n,null);return o.insert(o.createPositionAt(s,0),r),i.bindElements(e,r),r}function Fp(e,t,i,o){const n=t.parent,r=i.mapper,s=i.writer;let a=r.toViewPosition(o.createPositionBefore(e));const l=Wp(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(e))}else if(c&&"listItem"==c.name){a=r.toViewPosition(o.createPositionAt(c,"end"));const e=r.findMappedViewAncestor(a),t=function(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}(e);a=t?s.createPositionBefore(t):s.createPositionAt(e,"end")}else a=r.toViewPosition(o.createPositionBefore(e));if(a=Up(a),s.insert(a,n),c&&"listItem"==c.name){const e=r.toViewElement(c),i=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of i)if(e.item.is("element","li")){const o=s.breakContainer(s.createPositionBefore(e.item)),n=e.item.parent,r=s.createPositionAt(t,"end");Hp(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(n),r),i.position=o}}else{const i=n.nextSibling;if(i&&(i.is("element","ul")||i.is("element","ol"))){let o=null;for(const t of i.getChildren()){const i=r.toModelElement(t);if(!(i&&i.getAttribute("listIndent")>e.getAttribute("listIndent")))break;o=t}o&&(s.breakContainer(s.createPositionAfter(o)),s.move(s.createRangeOn(o.parent),s.createPositionAt(t,"end")))}}Hp(s,n,n.nextSibling),Hp(s,n.previousSibling,n)}function Hp(e,t,i){return!t||!i||"ul"!=t.name&&"ol"!=t.name||t.name!=i.name||t.getAttribute("class")!==i.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function Up(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function Wp(e,t){const i=!!t.sameIndent,o=!!t.smallerIndent,n=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(i&&n==e||o&&n>e)return r;r="forward"===t.direction?r.nextSibling:r.previousSibling}return null}function $p(e,t,i,o){e.ui.componentFactory.add(t,n=>{const r=e.commands.get(t),s=new ed(n);return s.set({label:i,icon:o,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function qp(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:nn.call(this)}function Yp(e){return(t,i,o)=>{const n=o.consumable;if(!n.test(i.item,"insert")||!n.test(i.item,"attribute:listType")||!n.test(i.item,"attribute:listIndent"))return;n.consume(i.item,"insert"),n.consume(i.item,"attribute:listType"),n.consume(i.item,"attribute:listIndent");const r=i.item;Fp(r,jp(r,o),o,e)}}function Gp(e,t,i){if(!i.consumable.consume(t.item,"attribute:listType"))return;const o=i.mapper.toViewElement(t.item),n=i.writer;n.breakContainer(n.createPositionBefore(o)),n.breakContainer(n.createPositionAfter(o));const r=o.parent,s="numbered"==t.attributeNewValue?"ol":"ul";n.rename(s,r)}function Kp(e,t,i){const o=i.mapper.toViewElement(t.item).parent,n=i.writer;Hp(n,o,o.nextSibling),Hp(n,o.previousSibling,o);for(const e of t.item.getChildren())i.consumable.consume(e,"insert")}function Qp(e,t,i){if("listItem"!=t.item.name){let e=i.mapper.toViewPosition(t.range.start);const o=i.writer,n=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=o.breakContainer(e),"li"==e.parent.name);){const t=e,i=o.createPositionAt(e.parent,"end");if(!t.isEqual(i)){const e=o.remove(o.createRange(t,i));n.push(e)}e=o.createPositionAfter(e.parent)}if(n.length>0){for(let t=0;t<n.length;t++){const i=e.nodeBefore;if(e=o.insert(e,n[t]).end,t>0){const t=Hp(o,i,i.nextSibling);t&&t.parent==i&&e.offset--}}Hp(o,e.nodeBefore,e.nodeAfter)}}}function Jp(e,t,i){const o=i.mapper.toViewPosition(t.position),n=o.nodeBefore,r=o.nodeAfter;Hp(i.writer,n,r)}function Zp(e,t,i){if(i.consumable.consume(t.viewItem,{name:!0})){const e=i.writer,o=e.createElement("listItem"),n=function(e){let t=0,i=e.parent;for(;i;){if(i.is("element","li"))t++;else{const e=i.previousSibling;e&&e.is("element","li")&&t++}i=i.parent}return t}(t.viewItem);e.setAttribute("listIndent",n,o);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",r,o),!i.safeInsert(o,t.modelCursor))return;const s=function(e,t,i){const{writer:o,schema:n}=i;let r=o.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=i.convertItem(s,r).modelCursor;else{const t=i.convertItem(s,o.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!n.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:ob(t.modelCursor),r=o.createPositionAfter(e))}return r}(o,t.viewItem.getChildren(),i);t.modelRange=e.createRange(t.modelCursor,s),i.updateConversionResult(o,t)}}function Xp(e,t,i){if(i.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||rb(t))&&t._remove()}}}function eb(e,t,i){if(i.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let i=!1,o=!0;for(const t of e)i&&!rb(t)&&t._remove(),t.is("$text")?(o&&(t._data=t.data.trimStart()),t.nextSibling&&!rb(t.nextSibling)||(t._data=t.data.trimEnd())):rb(t)&&(i=!0),o=!1}}function tb(e){return(t,i)=>{if(i.isPhantom)return;const o=i.modelPosition.nodeBefore;if(o&&o.is("element","listItem")){const t=i.mapper.toViewElement(o),n=t.getAncestors().find(rb),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("element","li")){i.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==n){i.viewPosition=e.nextPosition;break}}}}}function ib(e,[t,i]){let o,n=t.is("documentFragment")?t.getChild(0):t;if(o=i?this.createSelection(i):this.document.selection,n&&n.is("element","listItem")){const e=o.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;n&&n.is("element","listItem");)n._setAttribute("listIndent",n.getAttribute("listIndent")+e),n=n.nextSibling}}}function ob(e){const t=new Zs({startPosition:e});let i;do{i=t.next()}while(!i.value.item.is("element","listItem"));return i.value.item}function nb(e,t,i,o,n,r){const s=Wp(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),a=n.mapper,l=n.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==e){const e=a.toViewElement(s).parent;d=l.createPositionAfter(e)}else{const e=r.createPositionAt(s,"end");d=a.toViewPosition(e)}else d=i;d=Up(d);for(const e of[...o.getChildren()])rb(e)&&(d=l.move(l.createRangeOn(e),d).end,Hp(l,e,e.nextSibling),Hp(l,e.previousSibling,e))}function rb(e){return e.is("element","ol")||e.is("element","ul")}class sb extends Qe{static get pluginName(){return"ListEditing"}static get requires(){return[bh,vh]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var o;e.model.document.registerPostFixer(t=>function(e,t){const i=e.document.differ.getChanges(),o=new Map;let n=!1;for(const o of i)if("insert"==o.type&&"listItem"==o.name)r(o.position);else if("insert"==o.type&&"listItem"!=o.name){if("$text"!=o.name){const i=o.position.nodeAfter;i.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",i),n=!0),i.hasAttribute("listType")&&(t.removeAttribute("listType",i),n=!0),i.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",i),n=!0);for(const t of Array.from(e.createRangeIn(i)).filter(e=>e.item.is("element","listItem")))r(t.previousPosition)}r(o.position.getShiftedBy(o.length))}else"remove"==o.type&&"listItem"==o.name?r(o.position):("attribute"==o.type&&"listIndent"==o.attributeKey||"attribute"==o.type&&"listType"==o.attributeKey)&&r(o.range.start);for(const e of o.values())s(e),a(e);return n;function r(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(o.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,o.has(e))return;o.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&o.set(t,t)}}function s(e){let i=0,o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(r>i){let s;null===o?(o=r-i,s=i):(o>r&&(o=r),s=r-o),t.setAttribute("listIndent",s,e),n=!0}else o=null,i=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let i=[],o=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(o&&o.getAttribute("listIndent")>r&&(i=i.slice(0,r+1)),0!=r)if(i[r]){const o=i[r];e.getAttribute("listType")!=o&&(t.setAttribute("listType",o,e),n=!0)}else i[r]=e.getAttribute("listType");o=e,e=e.nextSibling}}}(e.model,t)),i.mapper.registerViewToModelLength("li",ab),t.mapper.registerViewToModelLength("li",ab),i.mapper.on("modelToViewPosition",tb(i.view)),i.mapper.on("viewToModelPosition",(o=e.model,(e,t)=>{const i=t.viewPosition,n=i.parent,r=t.mapper;if("ul"==n.name||"ol"==n.name){if(i.isAtEnd){const e=r.toModelElement(i.nodeBefore),n=r.getModelLength(i.nodeBefore);t.modelPosition=o.createPositionBefore(e).getShiftedBy(n)}else{const e=r.toModelElement(i.nodeAfter);t.modelPosition=o.createPositionBefore(e)}e.stop()}else if("li"==n.name&&i.nodeBefore&&("ul"==i.nodeBefore.name||"ol"==i.nodeBefore.name)){const s=r.toModelElement(n);let a=1,l=i.nodeBefore;for(;l&&rb(l);)a+=r.getModelLength(l),l=l.previousSibling;t.modelPosition=o.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",tb(i.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",Qp,{priority:"high"}),t.on("insert:listItem",Yp(e.model)),t.on("attribute:listType:listItem",Gp,{priority:"high"}),t.on("attribute:listType:listItem",Kp,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,i,o)=>{if(!o.consumable.consume(i.item,"attribute:listIndent"))return;const n=o.mapper.toViewElement(i.item),r=o.writer;r.breakContainer(r.createPositionBefore(n)),r.breakContainer(r.createPositionAfter(n));const s=n.parent,a=s.previousSibling,l=r.createRangeOn(s);r.remove(l),a&&a.nextSibling&&Hp(r,a,a.nextSibling),nb(i.attributeOldValue+1,i.range.start,l.start,n,o,e),Fp(i.item,n,o,e);for(const e of i.item.getChildren())o.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,i,o)=>{const n=o.mapper.toViewPosition(i.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,r=o.writer;r.breakContainer(r.createPositionBefore(n)),r.breakContainer(r.createPositionAfter(n));const s=n.parent,a=s.previousSibling,l=r.createRangeOn(s),c=r.remove(l);a&&a.nextSibling&&Hp(r,a,a.nextSibling);nb(o.mapper.toModelElement(n).getAttribute("listIndent")+1,i.position,l.start,n,o,e);for(const e of r.createRangeIn(c).getItems())o.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",Jp,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",Qp,{priority:"high"}),t.on("insert:listItem",Yp(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",Xp,{priority:"high"}),e.on("element:ol",Xp,{priority:"high"}),e.on("element:li",eb,{priority:"high"}),e.on("element:li",Zp)}),e.model.on("insertContent",ib,{priority:"high"}),e.commands.add("numberedList",new Vp(e,"numbered")),e.commands.add("bulletedList",new Vp(e,"bulleted")),e.commands.add("indentList",new Bp(e,"forward")),e.commands.add("outdentList",new Bp(e,"backward"));const n=i.view.document;this.listenTo(n,"enter",(e,t)=>{const i=this.editor.model.document,o=i.selection.getLastPosition().parent;i.selection.isCollapsed&&"listItem"==o.name&&o.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{context:"li"}),this.listenTo(n,"delete",(e,t)=>{if("backward"!==t.direction)return;const i=this.editor.model.document.selection;if(!i.isCollapsed)return;const o=i.getFirstPosition();if(!o.isAtStart)return;const n=o.parent;if("listItem"!==n.name)return;n.previousSibling&&"listItem"===n.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{context:"li"});const r=e=>(t,i)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),i())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function ab(e){let t=1;for(const i of e.getChildren())if("ul"==i.name||"ol"==i.name)for(const e of i.getChildren())t+=ab(e);return t}class lb extends Qe{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;$p(this.editor,"numberedList",e("Numbered List"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>'),$p(this.editor,"bulletedList",e("Bulleted List"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>')}}function cb(e,t){return e=>{e.on("attribute:url:media",i)};function i(i,o,n){if(!n.consumable.consume(o.item,i.name))return;const r=o.attributeNewValue,s=n.writer,a=n.mapper.toViewElement(o.item),l=[...a.getChildren()].find(e=>e.getCustomProperty("media-content"));s.remove(l);const c=e.getMediaViewElement(s,r,t);s.insert(s.createPositionAt(a,0),c)}}function db(e,t,i,o){const n=e.createContainerElement("figure",{class:"media"});return e.insert(e.createPositionAt(n,0),t.getMediaViewElement(e,i,o)),n}function ub(e){const t=e.getSelectedElement();return t&&t.is("element","media")?t:null}function hb(e,t,i){e.change(o=>{const n=o.createElement("media",{url:t});e.insertContent(n,i),o.setSelection(n,"on")})}class mb extends Ze{refresh(){const e=this.editor.model,t=e.document.selection,i=ub(t);this.value=i?i.getAttribute("url"):null,this.isEnabled=function(e){const t=e.getSelectedElement();return!!t&&"media"===t.name}(t)||function(e,t){let i=Rh(e,t).start.parent;i.isEmpty&&!t.schema.isLimit(i)&&(i=i.parent);return t.schema.checkChild(i,"media")}(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,o=ub(i);o?t.change(t=>{t.setAttribute("url",e,o)}):hb(t,e,Rh(i,t))}}class gb{constructor(e,t){const i=t.providers,o=t.extraProviders||[],n=new Set(t.removeProviders),r=i.concat(o).filter(e=>{const t=e.name;return t?!n.has(t):(Object(l.b)("media-embed-no-provider-name",{provider:e}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new fb(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,o=eo(t.url);for(const t of o){const o=this._getUrlMatches(e,t);if(o)return new fb(this.locale,e,o,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let o=e.replace(/^https?:\/\//,"");return i=o.match(t),i||(o=o.replace(/^www\./,""),i=o.match(t),i||null)}}class fb{constructor(e,t,i,o){this.url=this._getValidUrl(t),this._t=e.t,this._match=i,this._previewRenderer=o}getViewElement(e,t){const i={};let o;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const n=this._getPreviewHtml(t);o=e.createRawElement("div",i,(function(e){e.innerHTML=n}))}else this.url&&(i.url=this.url),o=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,o),o}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new Xc,t=new Zc;e.text=this._t("Open media in new tab"),t.content='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>',t.viewBox="0 0 64 42";return new Nc({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[t]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},e]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}i(107);class pb extends Qe{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new gb(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,i=e.t,o=e.conversion,n=e.config.get("mediaEmbed.previewsInData"),r=e.config.get("mediaEmbed.elementName"),s=this.registry;e.commands.add("mediaEmbed",new mb(e)),t.register("media",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["url"]}),o.for("dataDowncast").elementToElement({model:"media",view:(e,{writer:t})=>{const i=e.getAttribute("url");return db(t,s,i,{elementName:r,renderMediaPreview:i&&n})}}),o.for("dataDowncast").add(cb(s,{elementName:r,renderMediaPreview:n})),o.for("editingDowncast").elementToElement({model:"media",view:(e,{writer:t})=>{const o=e.getAttribute("url");return function(e,t,i){return t.setCustomProperty("media",!0,e),Eh(e,t,{label:i})}(db(t,s,o,{elementName:r,renderForEditingView:!0}),t,i("media widget"))}}),o.for("editingDowncast").add(cb(s,{elementName:r,renderForEditingView:!0})),o.for("upcast").elementToElement({view:e=>["oembed",r].includes(e.name)&&e.getAttribute("url")?{name:!0}:null,model:(e,{writer:t})=>{const i=e.getAttribute("url");if(s.hasMedia(i))return t.createElement("media",{url:i})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(e,{writer:t})=>{const i=e.getAttribute("data-oembed-url");if(s.hasMedia(i))return t.createElement("media",{url:i})}})}}const bb=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class wb extends Qe{static get requires(){return[tm,Gm]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document;this.listenTo(e.plugins.get("ClipboardPipeline"),"inputTransformation",()=>{const e=t.selection.getFirstRange(),i=ec.fromPosition(e.start);i.stickiness="toPrevious";const o=ec.fromPosition(e.end);o.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(i,o),i.detach(),o.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(vr.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,o=i.plugins.get(pb).registry,n=new ba(e,t),r=n.getWalker({ignoreElementEnd:!0});let s="";for(const e of r)e.item.is("$textProxy")&&(s+=e.item.data);if(s=s.trim(),!s.match(bb))return void n.detach();if(!o.hasMedia(s))return void n.detach();i.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=ec.fromPosition(e),this._timeoutId=vr.window.setTimeout(()=>{i.model.change(e=>{let t;this._timeoutId=null,e.remove(n),n.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert),hb(i.model,s,t),this._positionToInsert.detach(),this._positionToInsert=null})},100)):n.detach()}}i(109);class kb extends Mc{constructor(e,t){super(t);const i=t.t;this.focusTracker=new Rs,this.keystrokes=new Os,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Tc.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",e=>!!e),this.cancelButtonView=this._createButton(i("Cancel"),Tc.cancel,"ck-button-cancel","cancel"),this._focusables=new Ic,this._focusCycler=new sd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]}),Sc(this)}render(){super.render(),Pc({view:this});[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e),this.listenTo(this.urlInputView.element,"selectstart",(e,t)=>{t.stopPropagation()},{priority:"high"})}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new Ld(this.locale,Bd),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}_createButton(e,t,i,o){const n=new ed(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.extendTemplate({attributes:{class:i}}),o&&n.delegate("execute").to(this,o),n}}class _b extends Qe{static get requires(){return[pb]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed"),i=e.plugins.get(pb).registry;e.ui.componentFactory.add("mediaEmbed",o=>{const n=Sd(o),r=new kb(function(e,t){return[t=>{if(!t.url.length)return e("The URL must not be empty.")},i=>{if(!t.hasMedia(i.url))return e("This media URL is not supported.")}]}(e.t,i),e.locale);return this._setUpDropdown(n,r,t,e),this._setUpForm(n,r,t),n})}_setUpDropdown(e,t,i){const o=this.editor,n=o.t,r=e.buttonView;function s(){o.editing.view.focus(),e.isOpen=!1}e.bind("isEnabled").to(i),e.panelView.children.add(t),r.set({label:n("Insert media"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M18.68 3.03c.6 0 .59-.03.59.55v12.84c0 .59.01.56-.59.56H1.29c-.6 0-.59.03-.59-.56V3.58c0-.58-.01-.55.6-.55h17.38zM15.77 15V5H4.2v10h11.57zM2 4v1h1V4H2zm0 2v1h1V6H2zm0 2v1h1V8H2zm0 2v1h1v-1H2zm0 2v1h1v-1H2zm0 2v1h1v-1H2zM17 4v1h1V4h-1zm0 2v1h1V6h-1zm0 2v1h1V8h-1zm0 2v1h1v-1h-1zm0 2v1h1v-1h-1zm0 2v1h1v-1h-1zM7.5 7.177a.4.4 0 0 1 .593-.351l5.133 2.824a.4.4 0 0 1 0 .7l-5.133 2.824a.4.4 0 0 1-.593-.35V7.176v.001z"/></svg>',tooltip:!0}),r.on("open",()=>{t.disableCssTransitions(),t.url=i.value||"",t.urlInputView.fieldView.select(),t.focus(),t.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{t.isValid()&&(o.execute("mediaEmbed",t.url),s())}),e.on("change:isOpen",()=>t.resetFormStatus()),e.on("cancel",()=>s())}_setUpForm(e,t,i){t.delegate("submit","cancel").to(e),t.urlInputView.bind("value").to(i,"value"),t.urlInputView.bind("isReadOnly").to(i,"isEnabled",e=>!e)}}i(111);function vb(e,t){if(!e.childCount)return;const i=new _u(e.document),o=function(e,t){const i=t.createRangeIn(e),o=new go({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),n=[];for(const e of i)if("elementStart"===e.type&&o.match(e.item)){const t=Ab(e.item);n.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return n}(e,i);if(!o.length)return;let n=null,r=1;o.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return t.indent-e.indent!=1;const i=t.element.previousSibling;if(!i)return!0;return o=i,!(o.is("element","ol")||o.is("element","ul"));var o}(o[s-1],e),l=a?null:o[s-1],c=(u=e,(d=l)?u.indent-d.indent:u.indent-1);var d,u;if(a&&(n=null,r=1),!n||0!==c){const o=function(e,t){const i=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),o=/mso-level-number-format:([^;]{0,100});/gi,n=i.exec(t);let r="decimal",s="ol";if(n&&n[1]){const t=o.exec(n[1]);if(t&&t[1]&&(r=t[1].trim(),s="bullet"!==r&&"image"!==r?"ol":"ul"),"bullet"===r){const t=function(e){const t=function(e){if(e.getChild(0).is("$text"))return null;for(const t of e.getChildren()){if(!t.is("element","span"))continue;const e=t.getChild(0);return e.is("$text")?e:e.getChild(0)}}(e);if(!t)return null;const i=t._data;if("o"===i)return"circle";if("·"===i)return"disc";if("§"===i)return"square";return null}(e.element);t&&(r=t)}}return{type:s,style:yb(r)}}(e,t);if(n){if(e.indent>r){const e=n.getChild(n.childCount-1),t=e.getChild(e.childCount-1);n=xb(o,t,i),r+=1}else if(e.indent<r){const t=r-e.indent;n=function(e,t){const i=e.getAncestors({parentFirst:!0});let o=null,n=0;for(const e of i)if("ul"!==e.name&&"ol"!==e.name||n++,n===t){o=e;break}return o}(n,t),r=parseInt(e.indent)}}else n=xb(o,e.element,i);e.indent<=r&&(n.is("element",o.type)||(n=i.rename(o.type,n)))}const h=function(e,t){return function(e,t){const i=new go({name:"span",styles:{"mso-list":"Ignore"}}),o=t.createRangeIn(e);for(const e of o)"elementStart"===e.type&&i.match(e.item)&&t.remove(e.item)}(e,t),t.rename("li",e)}(e.element,i);i.appendChild(h,n)})}function yb(e){switch(e){case"arabic-leading-zero":return"decimal-leading-zero";case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return e;default:return null}}function xb(e,t,i){const o=t.parent,n=i.createElement(e.type),r=o.getChildIndex(t)+1;return i.insertChild(r,n,o),e.style&&i.setStyle("list-style-type",e.style,n),n}function Ab(e){const t={},i=e.getStyle("mso-list");if(i){const e=i.match(/(^|\s{1,100})l(\d+)/i),o=i.match(/\s{0,100}lfo(\d+)/i),n=i.match(/\s{0,100}level(\d+)/i);e&&o&&n&&(t.id=e[2],t.order=o[1],t.indent=n[1])}return t}const Cb=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Tb{constructor(e){this.document=e}isActive(e){return Cb.test(e)}execute(e){const t=new _u(this.document),{body:i}=e._parsedData;!function(e,t){for(const i of e.getChildren())if(i.is("element","b")&&"normal"===i.getStyle("font-weight")){const o=e.getChildIndex(i);t.remove(i),t.insertChild(o,i.getChildren(),e)}}(i,t),function(e,t){for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","li")){const i=e.getChild(0);i&&i.is("element","p")&&t.unwrapElement(i)}}}(i,t),e.content=i}}function Eb(e,t){if(!e.childCount)return;const i=new _u;!function(e,t,i){const o=i.createRangeIn(t),n=new go({name:"img"}),r=[];for(const t of o)if(n.match(t.item)){const i=t.item,o=i.getAttribute("v:shapes")?i.getAttribute("v:shapes").split(" "):[];o.length&&o.every(t=>e.indexOf(t)>-1)?r.push(i):i.getAttribute("src")||r.push(i)}for(const e of r)i.remove(e)}(function(e,t){const i=t.createRangeIn(e),o=new go({name:/v:(.+)/}),n=[];for(const e of i){const t=e.item,i=t.previousSibling&&t.previousSibling.name||null;o.match(t)&&t.getAttribute("o:gfxdata")&&"v:shapetype"!==i&&n.push(e.item.getAttribute("id"))}return n}(e,i),e,i),function(e,t){const i=t.createRangeIn(e),o=new go({name:/v:(.+)/}),n=[];for(const e of i)o.match(e.item)&&n.push(e.item);for(const e of n)t.remove(e)}(e,i);const o=function(e,t){const i=t.createRangeIn(e),o=new go({name:"img"}),n=[];for(const e of i)o.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&n.push(e.item);return n}(e,i);o.length&&function(e,t,i){if(e.length===t.length)for(let n=0;n<e.length;n++){const r=`data:${t[n].type};base64,${o=t[n].hex,btoa(o.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}`;i.setAttribute("src",r,e[n])}var o}(o,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),o=e.match(i),n=[];if(o)for(const e of o){let i=!1;e.includes("\\pngblip")?i="image/png":e.includes("\\jpegblip")&&(i="image/jpeg"),i&&n.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:i})}return n}(t),i)}const Sb=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,Pb=/xmlns:o="urn:schemas-microsoft-com/i;class Ib{constructor(e){this.document=e}isActive(e){return Sb.test(e)||Pb.test(e)}execute(e){const{body:t,stylesString:i}=e._parsedData;vb(t,i),Eb(t,e.dataTransfer.getData("text/rtf")),e.content=t}}function Mb(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1===t.length?" ":Array(t.length+1).join("  ").substr(0,t.length))}function Nb(e,t){const i=new DOMParser,o=function(e){return Mb(Mb(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}(function(e){const t=e.indexOf("</body>");if(t<0)return e;const i=e.indexOf("</html>",t+"</body>".length);return e.substring(0,t+"</body>".length)+(i>=0?e.substring(i):"")}(e=e.replace(/<!--\[if gte vml 1]>/g,""))),n=i.parseFromString(o,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach(e=>{const t=e.innerText.length||0;e.innerHTML=Array(t+1).join("  ").substr(0,t)})}(n);const r=n.body.innerHTML,s=function(e,t){const i=new yn(t),o=new Er(i,{blockFillerMode:"nbsp"}),n=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)n.appendChild(r[0]);return o.domToView(n,{skipComments:!0})}(n,t),a=function(e){const t=[],i=[],o=Array.from(e.getElementsByTagName("style"));for(const e of o)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),i.push(e.innerHTML));return{styles:t,stylesString:i.join(" ")}}(n);return{body:s,bodyString:r,styles:a.styles,stylesString:a.stylesString}}function Rb(e,t,i,o,n=1){t>n?o.setAttribute(e,t,i):o.removeAttribute(e,i)}function Ob(e,t,i={}){const o=e.createElement("tableCell",i);return e.insertElement("paragraph",o),e.insert(o,t),o}function zb(e,t){const i=t.parent.parent,o=parseInt(i.getAttribute("headingColumns")||0),{column:n}=e.getCellLocation(t);return!!o&&n<o}function Vb(){return e=>{e.on("element:table",(e,t,i)=>{const o=t.viewItem;if(!i.consumable.test(o,{name:!0}))return;const{rows:n,headingRows:r,headingColumns:s}=function(e){const t={headingRows:0,headingColumns:0},i=[],o=[];let n;for(const r of Array.from(e.getChildren()))if("tbody"===r.name||"thead"===r.name||"tfoot"===r.name){"thead"!==r.name||n||(n=r);const e=Array.from(r.getChildren()).filter(e=>e.is("element","tr"));for(const r of e)if("thead"===r.parent.name&&r.parent===n)t.headingRows++,i.push(r);else{o.push(r);const e=Lb(r);e>t.headingColumns&&(t.headingColumns=e)}}return t.rows=[...i,...o],t}(o),a={};s&&(a.headingColumns=s),r&&(a.headingRows=r);const l=i.writer.createElement("table",a);if(i.safeInsert(l,t.modelCursor)){if(i.consumable.consume(o,{name:!0}),n.forEach(e=>i.convertItem(e,i.writer.createPositionAt(l,"end"))),i.convertChildren(o,i.writer.createPositionAt(l,"end")),l.isEmpty){const e=i.writer.createElement("tableRow");i.writer.insert(e,i.writer.createPositionAt(l,"end")),Ob(i.writer,i.writer.createPositionAt(e,"end"))}i.updateConversionResult(l,t)}})}}function Db(e){return t=>{t.on("element:"+e,(e,t,i)=>{if(t.modelRange&&t.viewItem.isEmpty){const e=t.modelRange.start.nodeAfter,o=i.writer.createPositionAt(e,0);i.writer.insertElement("paragraph",o)}},{priority:"low"})}}function Lb(e){let t=0,i=0;const o=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;i<o.length&&"th"===o[i].name;){const e=o[i];t+=parseInt(e.getAttribute("colspan")||1),i++}return t}class Bb{constructor(e,t={}){this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const o=parseInt(i.getAttribute("colspan")||1),n=parseInt(i.getAttribute("rowspan")||1);(o>1||n>1)&&this._recordSpans(i,n,o),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+o}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,i=this._column){return{done:!1,value:new jb(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,o=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||i||o}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const o={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+i;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,o)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,i)}}class jb{constructor(e,t,i,o){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=o,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||1)}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||1)}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function Fb(e={}){return t=>t.on("insert:table",(t,i,o)=>{const n=i.item;if(!o.consumable.consume(n,"insert"))return;o.consumable.consume(n,"attribute:headingRows:table"),o.consumable.consume(n,"attribute:headingColumns:table");const r=e&&e.asWidget,s=o.writer.createContainerElement("figure",{class:"table"}),a=o.writer.createContainerElement("table");let l;var c,d;o.writer.insert(o.writer.createPositionAt(s,0),a),r&&(c=s,(d=o.writer).setCustomProperty("table",!0,c),l=Eh(c,d,{hasSelectionHandle:!0}));const u=new Bb(n),h={headingRows:n.getAttribute("headingRows")||0,headingColumns:n.getAttribute("headingColumns")||0},m=new Map;for(const t of u){const{row:i,cell:r}=t,s=n.getChild(i),l=m.get(i)||qb(a,s,i,h,o);m.set(i,l),o.consumable.consume(r,"insert");$b(t,h,o.writer.createPositionAt(l,"end"),o,e)}for(const e of n.getChildren()){const t=e.index;e.is("element","tableRow")&&!m.has(t)&&m.set(t,qb(a,e,t,h,o))}const g=o.mapper.toViewPosition(i.range.start);o.mapper.bindElements(n,r?l:s),o.writer.insert(g,r?l:s)})}function Hb(e,t){const{writer:i}=t;if(e.parent.is("element","tableCell"))return Ub(e)?i.createContainerElement("span",{class:"ck-table-bogus-paragraph"}):i.createContainerElement("p")}function Ub(e){return 1===e.parent.childCount&&!Qb(e)}function Wb(e,t,i){const{cell:o}=e,n=Yb(e,t),r=i.mapper.toViewElement(o);r&&r.name!==n&&function(e,t,i){const o=i.writer,n=i.mapper.toViewElement(e),r=Nh(o.createEditableElement(t,n.getAttributes()),o);Ih(r,o,(e,t,i)=>i.addClass(eo(t.classes),e),(e,t,i)=>i.removeClass(eo(t.classes),e)),o.insert(o.createPositionAfter(n),r),o.move(o.createRangeIn(n),o.createPositionAt(r,0)),o.remove(o.createRangeOn(n)),i.mapper.unbindViewElement(n),i.mapper.bindElements(e,r)}(o,n,i)}function $b(e,t,i,o,n){const r=n&&n.asWidget,s=Yb(e,t),a=r?Nh(o.writer.createEditableElement(s),o.writer):o.writer.createContainerElement(s);r&&Ih(a,o.writer,(e,t,i)=>i.addClass(eo(t.classes),e),(e,t,i)=>i.removeClass(eo(t.classes),e));const l=e.cell,c=l.getChild(0),d=1===l.childCount&&"paragraph"===c.name;if(o.writer.insert(i,a),o.mapper.bindElements(l,a),!r&&d&&!Qb(c)){const e=l.getChild(0);o.consumable.consume(e,"insert"),o.mapper.bindElements(e,a)}}function qb(e,t,i,o,n){n.consumable.consume(t,"insert");const r=t.isEmpty?n.writer.createEmptyElement("tr"):n.writer.createContainerElement("tr");n.mapper.bindElements(t,r);const s=o.headingRows,a=function(e,t,i){const o=Gb(e,t);return o||function(e,t,i){const o=i.writer.createContainerElement(e),n=i.writer.createPositionAt(t,"tbody"==e?"end":0);return i.writer.insert(n,o),o}(e,t,i)}(function(e,t){return e<t.headingRows?"thead":"tbody"}(i,o),e,n),l=s>0&&i>=s?i-s:i,c=n.writer.createPositionAt(a,l);return n.writer.insert(c,r),r}function Yb(e,t){const{row:i,column:o}=e,{headingColumns:n,headingRows:r}=t;if(r&&r>i)return"th";return n&&n>o?"th":"td"}function Gb(e,t){for(const i of t.getChildren())if(i.name==e)return i}function Kb(e,t,i){const o=Gb(e,t);o&&0===o.childCount&&i.writer.remove(i.writer.createRangeOn(o))}function Qb(e){return!![...e.getAttributeKeys()].length}class Jb extends Ze{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=function(e,t){const i=e.getFirstPosition().parent,o=i===i.root?i:i.parent;return t.checkChild(o,"table")}(t,i)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=this.editor.plugins.get("TableUtils"),n=this.editor.config.get("table"),r=Rh(i,t),s=n.defaultHeadings.rows,a=n.defaultHeadings.columns;void 0===e.headingRows&&s&&(e.headingRows=s),void 0===e.headingColumns&&a&&(e.headingColumns=a),t.change(i=>{const n=o.createTable(i,e);t.insertContent(n,r),i.setSelection(i.createPositionAt(n.getNodeByPath([0,0,0]),0))})}}function Zb(e){const t=[];for(const i of nw(e.getRanges())){const e=i.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}function Xb(e){const t=[];for(const i of e.getRanges()){const e=i.start.findAncestor("tableCell");e&&t.push(e)}return t}function ew(e){const t=Zb(e);return t.length?t:Xb(e)}function tw(e){return rw(e.map(e=>e.parent.index))}function iw(e){const t=e[0].findAncestor("table");return rw([...new Bb(t)].filter(t=>e.includes(t.cell)).map(e=>e.column))}function ow(e,t){if(e.length<2||!function(e){const t=e[0].findAncestor("table"),i=tw(e),o=parseInt(t.getAttribute("headingRows")||0);if(!aw(i,o))return!1;const n=parseInt(t.getAttribute("headingColumns")||0);return aw(iw(e),n)}(e))return!1;const i=new Set,o=new Set;let n=0;for(const r of e){const{row:e,column:s}=t.getCellLocation(r),a=parseInt(r.getAttribute("rowspan")||1),l=parseInt(r.getAttribute("colspan")||1);i.add(e),o.add(s),a>1&&i.add(e+a-1),l>1&&o.add(s+l-1),n+=a*l}return function(e,t){const i=Array.from(e.values()),o=Array.from(t.values()),n=Math.max(...i),r=Math.min(...i),s=Math.max(...o),a=Math.min(...o);return(n-r+1)*(s-a+1)}(i,o)==n}function nw(e){return Array.from(e).sort(sw)}function rw(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}function sw(e,t){const i=e.start,o=t.start;return i.isBefore(o)?-1:1}function aw({first:e,last:t},i){return e<i===t<i}class lw extends Ze{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=!!ew(this.editor.model.document.selection).length;this.isEnabled=e}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),o="above"===this.order,n=ew(t),r=tw(n),s=o?r.first:r.last,a=n[0].findAncestor("table");i.insertRows(a,{at:o?s:s+1,copyStructureFromAbove:!o})}}class cw extends Ze{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=!!ew(this.editor.model.document.selection).length;this.isEnabled=e}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),o="left"===this.order,n=ew(t),r=iw(n),s=o?r.first:r.last,a=n[0].findAncestor("table");i.insertColumns(a,{columns:1,at:o?s:s+1})}}class dw extends Ze{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=ew(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=ew(this.editor.model.document.selection)[0],t="horizontally"===this.direction,i=this.editor.plugins.get("TableUtils");t?i.splitCellHorizontally(e,2):i.splitCellVertically(e,2)}}function uw(e,t,i){const{startRow:o,startColumn:n,endRow:r,endColumn:s}=t,a=i.createElement("table"),l=r-o+1;for(let e=0;e<l;e++)i.insertElement("tableRow",a,"end");const c=[...new Bb(e,{startRow:o,endRow:r,startColumn:n,endColumn:s,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:u,cellAnchorColumn:h}of c){const c=e-o,m=a.getChild(c);if(d){const o=i.cloneElement(l);i.append(o,m),pw(o,e,t,r,s,i)}else(u<o||h<n)&&Ob(i,i.createPositionAt(m,"end"))}return function(e,t,i,o,n){const r=parseInt(t.getAttribute("headingRows")||0);if(r>0){Rb("headingRows",r-i,e,n,0)}const s=parseInt(t.getAttribute("headingColumns")||0);if(s>0){Rb("headingColumns",s-o,e,n,0)}}(a,e,o,n,i),a}function hw(e,t,i=0){const o=[],n=new Bb(e,{startRow:i,endRow:t-1});for(const e of n){const{row:i,cellHeight:n}=e,r=i+n-1;i<t&&t<=r&&o.push(e)}return o}function mw(e,t,i){const o=e.parent,n=o.parent,r=o.index,s=t-r,a={},l=parseInt(e.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||1);c>1&&(a.colspan=c);const d=r+s,u=[...new Bb(n,{startRow:r,endRow:d,includeAllSlots:!0})];let h,m=null;for(const t of u){const{row:o,column:n,cell:r}=t;r===e&&void 0===h&&(h=n),void 0!==h&&h===n&&o===d&&(m=Ob(i,t.getPositionBefore(),a))}return Rb("rowspan",s,e,i),m}function gw(e,t){const i=[],o=new Bb(e);for(const e of o){const{column:o,cellWidth:n}=e,r=o+n-1;o<t&&t<=r&&i.push(e)}return i}function fw(e,t,i,o){const n=i-t,r={},s=parseInt(e.getAttribute("colspan"))-n;s>1&&(r.colspan=s);const a=parseInt(e.getAttribute("rowspan")||1);a>1&&(r.rowspan=a);const l=Ob(o,o.createPositionAfter(e),r);return Rb("colspan",n,e,o),l}function pw(e,t,i,o,n,r){const s=parseInt(e.getAttribute("colspan")||1),a=parseInt(e.getAttribute("rowspan")||1);if(i+s-1>n){Rb("colspan",n-i+1,e,r,1)}if(t+a-1>o){Rb("rowspan",o-t+1,e,r,1)}}function bw(e,t){const i=t.getColumns(e),o=new Array(i).fill(0);for(const{column:t}of new Bb(e))o[t]++;const n=o.reduce((e,t,i)=>t?e:[...e,i],[]);if(n.length>0){const i=n[n.length-1];return t.removeColumns(e,{at:i}),!0}return!1}function ww(e,t){const i=[],o=t.getRows(e);for(let t=0;t<o;t++){e.getChild(t).isEmpty&&i.push(t)}if(i.length>0){const o=i[i.length-1];return t.removeRows(e,{at:o}),!0}return!1}function kw(e,t){bw(e,t)||ww(e,t)}function _w(e,t){const i=Array.from(new Bb(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(i.every(({cellHeight:e})=>1===e))return t.lastRow;const o=i[0].cellHeight-1;return t.lastRow+o}function vw(e,t){const i=Array.from(new Bb(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(i.every(({cellWidth:e})=>1===e))return t.lastColumn;const o=i[0].cellWidth-1;return t.lastColumn+o}class yw extends Ze{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=Xb(e.document.selection)[0],i=this.value,o=this.direction;e.change(e=>{const n="right"==o||"down"==o,r=n?t:i,s=n?i:t,a=s.parent;!function(e,t,i){xw(e)||(xw(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end")));i.remove(e)}(s,r,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(t.getAttribute(l)||1),d=parseInt(i.getAttribute(l)||1);e.setAttribute(l,c+d,r),e.setSelection(e.createRangeIn(r));const u=this.editor.plugins.get("TableUtils");kw(a.findAncestor("table"),u)})}_getMergeableCell(){const e=Xb(this.editor.model.document.selection)[0];if(!e)return;const t=this.editor.plugins.get("TableUtils"),i=this.isHorizontal?function(e,t,i){const o=e.parent.parent,n="right"==t?e.nextSibling:e.previousSibling,r=(o.getAttribute("headingColumns")||0)>0;if(!n)return;const s="right"==t?e:n,a="right"==t?n:e,{column:l}=i.getCellLocation(s),{column:c}=i.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||1),u=zb(i,s),h=zb(i,a);if(r&&u!=h)return;return l+d===c?n:void 0}(e,this.direction,t):function(e,t,i){const o=e.parent,n=o.parent,r=n.getChildIndex(o);if("down"==t&&r===i.getRows(n)-1||"up"==t&&0===r)return;const s=parseInt(e.getAttribute("rowspan")||1),a=n.getAttribute("headingRows")||0,l="down"==t&&r+s===a,c="up"==t&&r===a;if(a&&(l||c))return;const d=parseInt(e.getAttribute("rowspan")||1),u="down"==t?r+d:r,h=[...new Bb(n,{endRow:u})],m=h.find(t=>t.cell===e).column,g=h.find(({row:e,cellHeight:i,column:o})=>o===m&&("down"==t?e===u:u===e+i));return g&&g.cell}(e,this.direction,t);if(!i)return;const o=this.isHorizontal?"rowspan":"colspan",n=parseInt(e.getAttribute(o)||1);return parseInt(i.getAttribute(o)||1)===n?i:void 0}}function xw(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}class Aw extends Ze{refresh(){const e=ew(this.editor.model.document.selection),t=e[0];if(t){const i=t.findAncestor("table"),o=this.editor.plugins.get("TableUtils").getRows(i)-1,n=tw(e),r=0===n.first&&n.last===o;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=ew(e.document.selection),o=tw(i),n=i[0],r=n.findAncestor("table"),s=t.getCellLocation(n).column;e.change(e=>{const i=o.last-o.first+1;t.removeRows(r,{at:o.first,rows:i});const n=function(e,t,i,o){const n=e.getChild(Math.min(t,o-1));let r=n.getChild(0),s=0;for(const e of n.getChildren()){if(s>i)return r;r=e,s+=parseInt(e.getAttribute("colspan")||1)}return r}(r,o.first,s,t.getRows(r));e.setSelection(e.createPositionAt(n,0))})}}class Cw extends Ze{refresh(){const e=ew(this.editor.model.document.selection),t=e[0];if(t){const i=t.findAncestor("table"),o=this.editor.plugins.get("TableUtils").getColumns(i),{first:n,last:r}=iw(e);this.isEnabled=r-n<o-1}else this.isEnabled=!1}execute(){const[e,t]=function(e){const t=ew(e),i=t[0],o=t.pop(),n=[i,o];return i.isBefore(o)?n:n.reverse()}(this.editor.model.document.selection),i=e.parent.parent,o=[...new Bb(i)],n={first:o.find(t=>t.cell===e).column,last:o.find(e=>e.cell===t).column},r=function(e,t,i,o){return parseInt(i.getAttribute("colspan")||1)>1?i:t.previousSibling||i.nextSibling?i.nextSibling||t.previousSibling:o.first?e.reverse().find(({column:e})=>e<o.first).cell:e.reverse().find(({column:e})=>e>o.last).cell}(o,e,t,n);this.editor.model.change(e=>{const t=n.last-n.first+1;this.editor.plugins.get("TableUtils").removeColumns(i,{at:n.first,columns:t}),e.setSelection(e.createPositionAt(r,0))})}}class Tw extends Ze{refresh(){const e=ew(this.editor.model.document.selection),t=e.length>0;this.isEnabled=t,this.value=t&&e.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,i=ew(t.document.selection),o=i[0].findAncestor("table"),{first:n,last:r}=tw(i),s=this.value?n:r+1,a=o.getAttribute("headingRows")||0;t.change(e=>{if(s){const t=hw(o,s,s>a?a:0);for(const{cell:i}of t)mw(i,s,e)}Rb("headingRows",s,o,e,0)})}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||0);return!!i&&e.parent.index<i}}class Ew extends Ze{refresh(){const e=ew(this.editor.model.document.selection),t=this.editor.plugins.get("TableUtils"),i=e.length>0;this.isEnabled=i,this.value=i&&e.every(e=>zb(t,e))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,i=ew(t.document.selection),o=i[0].findAncestor("table"),{first:n,last:r}=iw(i),s=this.value?n:r+1;t.change(e=>{if(s){const t=gw(o,s);for(const{cell:i,column:o}of t)fw(i,o,s,e)}Rb("headingColumns",s,o,e,0)})}}class Sw extends Qe{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,i=t.parent,o=i.getChildIndex(t),n=new Bb(i,{row:o});for(const{cell:t,row:i,column:o}of n)if(t===e)return{row:i,column:o}}createTable(e,t){const i=e.createElement("table"),o=parseInt(t.rows)||2,n=parseInt(t.columns)||2;return Pw(e,i,0,o,n),t.headingRows&&Rb("headingRows",Math.min(t.headingRows,o),i,e,0),t.headingColumns&&Rb("headingColumns",Math.min(t.headingColumns,n),i,e,0),i}insertRows(e,t={}){const i=this.editor.model,o=t.at||0,n=t.rows||1,r=void 0!==t.copyStructureFromAbove,s=t.copyStructureFromAbove?o-1:o,a=this.getRows(e),c=this.getColumns(e);if(o>a)throw new l.a("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change(t=>{const i=e.getAttribute("headingRows")||0;if(i>o&&Rb("headingRows",i+n,e,t,0),!r&&(0===o||o===a))return void Pw(t,e,o,n,c);const l=r?Math.max(o,s):o,d=new Bb(e,{endRow:l}),u=new Array(c).fill(1);for(const{row:e,column:i,cellHeight:a,cellWidth:l,cell:c}of d){const d=e+a-1,h=e<=s&&s<=d;e<o&&o<=d?(t.setAttribute("rowspan",a+n,c),u[i]=-l):r&&h&&(u[i]=l)}for(let i=0;i<n;i++){const i=t.createElement("tableRow");t.insert(i,e,o);for(let e=0;e<u.length;e++){const o=u[e],n=t.createPositionAt(i,"end");o>0&&Ob(t,n,o>1?{colspan:o}:null),e+=Math.abs(o)-1}}})}insertColumns(e,t={}){const i=this.editor.model,o=t.at||0,n=t.columns||1;i.change(t=>{const i=e.getAttribute("headingColumns");o<i&&t.setAttribute("headingColumns",i+n,e);const r=this.getColumns(e);if(0===o||r===o){for(const i of e.getChildren())i.is("element","tableRow")&&Iw(n,t,t.createPositionAt(i,o?"end":0));return}const s=new Bb(e,{column:o,includeAllSlots:!0});for(const e of s){const{row:i,cell:r,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<o){t.setAttribute("colspan",c+n,r);const e=l+d-1;for(let t=i;t<=e;t++)s.skipRow(t)}else Iw(n,t,e.getPositionBefore())}})}removeRows(e,t){const i=this.editor.model,o=t.rows||1,n=this.getRows(e),r=t.at,s=r+o-1;if(s>n-1)throw new l.a("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change(t=>{const{cellsToMove:i,cellsToTrim:o}=function(e,t,i){const o=new Map,n=[];for(const{row:r,column:s,cellHeight:a,cell:l}of new Bb(e,{endRow:i})){const e=r+a-1;if(r>=t&&r<=i&&e>i){const e=a-(i-r+1);o.set(s,{cell:l,rowspan:e})}if(r<t&&e>=t){let o;o=e>=i?i-t+1:e-t+1,n.push({cell:l,rowspan:a-o})}}return{cellsToMove:o,cellsToTrim:n}}(e,r,s);if(i.size){!function(e,t,i,o){const n=[...new Bb(e,{includeAllSlots:!0,row:t})],r=e.getChild(t);let s;for(const{column:e,cell:t,isAnchor:a}of n)if(i.has(e)){const{cell:t,rowspan:n}=i.get(e),a=s?o.createPositionAfter(s):o.createPositionAt(r,0);o.move(o.createRangeOn(t),a),Rb("rowspan",n,t,o),s=t}else a&&(s=t)}(e,s+1,i,t)}for(let i=s;i>=r;i--)t.remove(e.getChild(i));for(const{rowspan:e,cell:i}of o)Rb("rowspan",e,i,t);!function(e,t,i,o){const n=e.getAttribute("headingRows")||0;if(t<n){Rb("headingRows",i<n?n-(i-t+1):t,e,o,0)}}(e,r,s,t),bw(e,this)||ww(e,this)})}removeColumns(e,t){const i=this.editor.model,o=t.at,n=t.columns||1,r=t.at+n-1;i.change(t=>{!function(e,t,i){const o=e.getAttribute("headingColumns")||0;if(o&&t.first<o){const n=Math.min(o-1,t.last)-t.first+1;i.setAttribute("headingColumns",o-n,e)}}(e,{first:o,last:r},t);for(let i=r;i>=o;i--)for(const{cell:o,column:n,cellWidth:r}of[...new Bb(e)])n<=i&&r>1&&n+r>i?Rb("colspan",r-1,o,t):n===i&&t.remove(o);ww(e,this)||bw(e,this)})}splitCellVertically(e,t=2){const i=this.editor.model,o=e.parent.parent,n=parseInt(e.getAttribute("rowspan")||1),r=parseInt(e.getAttribute("colspan")||1);i.change(i=>{if(r>1){const{newCellsSpan:o,updatedSpan:s}=Mw(r,t);Rb("colspan",s,e,i);const a={};o>1&&(a.colspan=o),n>1&&(a.rowspan=n);Iw(r>t?t-1:r-1,i,i.createPositionAfter(e),a)}if(r<t){const s=t-r,a=[...new Bb(o)],{column:l}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:i,column:o})=>t!==e&&o===l||o<l&&o+i>l);for(const{cell:e,cellWidth:t}of c)i.setAttribute("colspan",t+s,e);const d={};n>1&&(d.rowspan=n),Iw(s,i,i.createPositionAfter(e),d);const u=o.getAttribute("headingColumns")||0;u>l&&Rb("headingColumns",u+s,o,i)}})}splitCellHorizontally(e,t=2){const i=this.editor.model,o=e.parent,n=o.parent,r=n.getChildIndex(o),s=parseInt(e.getAttribute("rowspan")||1),a=parseInt(e.getAttribute("colspan")||1);i.change(i=>{if(s>1){const o=[...new Bb(n,{startRow:r,endRow:r+s-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=Mw(s,t);Rb("rowspan",c,e,i);const{column:d}=o.find(({cell:t})=>t===e),u={};l>1&&(u.rowspan=l),a>1&&(u.colspan=a);for(const e of o){const{column:t,row:o}=e,n=t===d,s=(o+r+c)%l==0;o>=r+c&&n&&s&&Iw(1,i,e.getPositionBefore(),u)}}if(s<t){const o=t-s,l=[...new Bb(n,{startRow:0,endRow:r})];for(const{cell:t,cellHeight:n,row:s}of l)if(t!==e&&s+n>r){const e=n+o;i.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),Pw(i,n,r+1,o,1,c);const d=n.getAttribute("headingRows")||0;d>r&&Rb("headingRows",d+o,n,i)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||1),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0)}}function Pw(e,t,i,o,n,r={}){for(let s=0;s<o;s++){const o=e.createElement("tableRow");e.insert(o,t,i),Iw(n,e,e.createPositionAt(o,"end"),r)}}function Iw(e,t,i,o={}){for(let n=0;n<e;n++)Ob(t,i,o)}function Mw(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const i=Math.floor(e/t);return{newCellsSpan:i,updatedSpan:e-i*t+i}}class Nw extends Ze{refresh(){const e=Zb(this.editor.model.document.selection);this.isEnabled=ow(e,this.editor.plugins.get(Sw))}execute(){const e=this.editor.model,t=this.editor.plugins.get(Sw);e.change(i=>{const o=Zb(e.document.selection),n=o.shift(),{mergeWidth:r,mergeHeight:s}=function(e,t,i){let o=0,n=0;for(const e of t){const{row:t,column:r}=i.getCellLocation(e);o=zw(e,r,o,"colspan"),n=zw(e,t,n,"rowspan")}const{row:r,column:s}=i.getCellLocation(e);return{mergeWidth:o-s,mergeHeight:n-r}}(n,o,t);Rb("colspan",r,n,i),Rb("rowspan",s,n,i);for(const e of o)Rw(e,n,i);kw(n.findAncestor("table"),t),i.setSelection(n,"in")})}}function Rw(e,t,i){Ow(e)||(Ow(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e)}function Ow(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}function zw(e,t,i,o){const n=parseInt(e.getAttribute(o)||1);return Math.max(i,t+n)}class Vw extends Ze{refresh(){const e=ew(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=ew(e.document.selection),i=tw(t),o=t[0].findAncestor("table"),n=[];for(let t=i.first;t<=i.last;t++)for(const i of o.getChild(t).getChildren())n.push(e.createRangeOn(i));e.change(e=>{e.setSelection(n)})}}class Dw extends Ze{refresh(){const e=ew(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=ew(e.document.selection),i=t[0],o=t.pop(),n=i.findAncestor("table"),r=this.editor.plugins.get("TableUtils"),s=r.getCellLocation(i),a=r.getCellLocation(o),l=Math.min(s.column,a.column),c=Math.max(s.column,a.column),d=[];for(const t of new Bb(n,{startColumn:l,endColumn:c}))d.push(e.createRangeOn(t.cell));e.change(e=>{e.setSelection(d)})}}function Lw(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let o=!1;const n=new Set;for(const t of i){let i;"table"==t.name&&"insert"==t.type&&(i=t.position.nodeAfter),"tableRow"!=t.name&&"tableCell"!=t.name||(i=t.position.findAncestor("table")),Fw(t)&&(i=t.range.start.findAncestor("table")),i&&!n.has(i)&&(o=Bw(i,e)||o,o=jw(i,e)||o,n.add(i))}return o}(t,e))}function Bw(e,t){let i=!1;const o=function(e){const t=parseInt(e.getAttribute("headingRows")||0),i=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),o=[];for(const{row:n,cell:r,cellHeight:s}of new Bb(e)){if(s<2)continue;const e=n<t?t:i;if(n+s>e){const t=e-n;o.push({cell:r,rowspan:t})}}return o}(e);if(o.length){i=!0;for(const e of o)Rb("rowspan",e.rowspan,e.cell,t,1)}return i}function jw(e,t){let i=!1;const o=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:i}of new Bb(e,{includeAllSlots:!0}))t[i]++;return t}(e),n=[];for(const[t,i]of o.entries())!i&&e.getChild(t).is("element","tableRow")&&n.push(t);if(n.length){i=!0;for(const i of n.reverse())t.remove(e.getChild(i)),o.splice(i,1)}const r=o.filter((t,i)=>e.getChild(i).is("element","tableRow")),s=r[0];if(!r.every(e=>e===s)){const o=r.reduce((e,t)=>t>e?t:e,0);for(const[n,s]of r.entries()){const r=o-s;if(r){for(let i=0;i<r;i++)Ob(t,t.createPositionAt(e.getChild(n),"end"));i=!0}}}return i}function Fw(e){const t="attribute"===e.type,i=e.attributeKey;return t&&("headingRows"===i||"colspan"===i||"rowspan"===i)}function Hw(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let o=!1;for(const t of i)"insert"==t.type&&"table"==t.name&&(o=Uw(t.position.nodeAfter,e)||o),"insert"==t.type&&"tableRow"==t.name&&(o=Ww(t.position.nodeAfter,e)||o),"insert"==t.type&&"tableCell"==t.name&&(o=$w(t.position.nodeAfter,e)||o),qw(t)&&(o=$w(t.position.parent,e)||o);return o}(t,e))}function Uw(e,t){let i=!1;for(const o of e.getChildren())o.is("element","tableRow")&&(i=Ww(o,t)||i);return i}function Ww(e,t){let i=!1;for(const o of e.getChildren())i=$w(o,t)||i;return i}function $w(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const i=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of i)t.wrap(t.createRangeOn(e),"paragraph");return!!i.length}function qw(e){return!(!e.position||!e.position.parent.is("element","tableCell"))&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function Yw(e,t){e.document.registerPostFixer(()=>function(e,t){const i=new Set;for(const t of e.getChanges()){const e="attribute"==t.type?t.range.start.parent:t.position.parent;e.is("element","tableCell")&&i.add(e)}for(const o of i.values())for(const i of[...o.getChildren()].filter(e=>Gw(e,t)))e.refreshItem(i);return!1}(e.document.differ,t))}function Gw(e,t){if(!e.is("element","paragraph"))return!1;const i=t.toViewElement(e);return!!i&&Ub(e)!==i.is("element","span")}function Kw(e){e.document.registerPostFixer(()=>function(e){const t=e.document.differ,i=new Set;for(const e of t.getChanges()){if("attribute"!=e.type)continue;const t=e.range.start.nodeAfter;t&&t.is("element","table")&&"headingRows"==e.attributeKey&&i.add(t)}if(i.size){for(const e of i.values())t.refreshItem(e);return!0}return!1}(e))}i(113);class Qw extends Qe{static get pluginName(){return"TableEditing"}init(){const e=this.editor,t=e.model,i=t.schema,o=e.conversion;i.register("table",{allowWhere:"$block",allowAttributes:["headingRows","headingColumns"],isObject:!0,isBlock:!0}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowIn:"tableRow",allowChildren:"$block",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),o.for("upcast").add(e=>{e.on("element:figure",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const o=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!o||!i.consumable.test(o,{name:!0}))return;const n=Ns(i.convertItem(o,t.modelCursor).modelRange.getItems());n&&(i.convertChildren(t.viewItem,i.writer.createPositionAt(n,"end")),i.updateConversionResult(n,t))})}),o.for("upcast").add(Vb()),o.for("editingDowncast").add(Fb({asWidget:!0})),o.for("dataDowncast").add(Fb()),o.for("upcast").elementToElement({model:"tableRow",view:"tr"}),o.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()},{priority:"high"})}),o.for("editingDowncast").add(e=>e.on("insert:tableRow",(e,t,i)=>{const o=t.item;if(!i.consumable.consume(o,"insert"))return;const n=o.parent,r=function(e){for(const t of e.getChildren())if("table"===t.name)return t}(i.mapper.toViewElement(n)),s=n.getChildIndex(o),a=new Bb(n,{row:s}),l={headingRows:n.getAttribute("headingRows")||0,headingColumns:n.getAttribute("headingColumns")||0},c=new Map;for(const e of a){const t=c.get(s)||qb(r,o,s,l,i);c.set(s,t),i.consumable.consume(e.cell,"insert"),$b(e,l,i.writer.createPositionAt(t,"end"),i,{asWidget:!0})}})),o.for("editingDowncast").add(e=>e.on("remove:tableRow",(e,t,i)=>{e.stop();const o=i.writer,n=i.mapper,r=n.toViewPosition(t.position).getLastMatchingPosition(e=>!e.item.is("element","tr")).nodeAfter,s=r.parent.parent,a=o.createRangeOn(r),l=o.remove(a);for(const e of o.createRangeIn(l).getItems())n.unbindViewElement(e);Kb("thead",s,i),Kb("tbody",s,i)},{priority:"higher"})),o.for("upcast").elementToElement({model:"tableCell",view:"td"}),o.for("upcast").elementToElement({model:"tableCell",view:"th"}),o.for("upcast").add(Db("td")),o.for("upcast").add(Db("th")),o.for("editingDowncast").add(e=>e.on("insert:tableCell",(e,t,i)=>{const o=t.item;if(!i.consumable.consume(o,"insert"))return;const n=o.parent,r=n.parent,s=r.getChildIndex(n),a=new Bb(r,{row:s}),l={headingRows:r.getAttribute("headingRows")||0,headingColumns:r.getAttribute("headingColumns")||0};for(const e of a)if(e.cell===o){const t=i.mapper.toViewElement(n);return void $b(e,l,i.writer.createPositionAt(t,n.getChildIndex(o)),i,{asWidget:!0})}})),o.for("editingDowncast").elementToElement({model:"paragraph",view:Hb,converterPriority:"high"}),o.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),o.for("upcast").attributeToAttribute({model:{key:"colspan",value:Jw("colspan")},view:"colspan"}),o.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),o.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Jw("rowspan")},view:"rowspan"}),o.for("editingDowncast").add(e=>e.on("attribute:headingColumns:table",(e,t,i)=>{const o=t.item;if(!i.consumable.consume(t.item,e.name))return;const n={headingRows:o.getAttribute("headingRows")||0,headingColumns:o.getAttribute("headingColumns")||0},r=t.attributeOldValue,s=t.attributeNewValue,a=(r>s?r:s)-1;for(const e of new Bb(o,{endColumn:a}))Wb(e,n,i)})),e.data.mapper.on("modelToViewPosition",(e,t)=>{const i=t.modelPosition.parent,o=t.modelPosition.nodeBefore;if(!i.is("element","tableCell"))return;if(!o||!o.is("element","paragraph"))return;const n=t.mapper.toViewElement(o),r=t.mapper.toViewElement(i);n===r&&(t.viewPosition=t.mapper.findPositionIn(r,o.maxOffset))}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new Jb(e)),e.commands.add("insertTableRowAbove",new lw(e,{order:"above"})),e.commands.add("insertTableRowBelow",new lw(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new cw(e,{order:"left"})),e.commands.add("insertTableColumnRight",new cw(e,{order:"right"})),e.commands.add("removeTableRow",new Aw(e)),e.commands.add("removeTableColumn",new Cw(e)),e.commands.add("splitTableCellVertically",new dw(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new dw(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new Nw(e)),e.commands.add("mergeTableCellRight",new yw(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new yw(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new yw(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new yw(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new Ew(e)),e.commands.add("setTableRowHeader",new Tw(e)),e.commands.add("selectTableRow",new Vw(e)),e.commands.add("selectTableColumn",new Dw(e)),Kw(t),Lw(t),Yw(t,e.editing.mapper),Hw(t)}static get requires(){return[Sw]}}function Jw(e){return t=>{const i=parseInt(t.getAttribute(e));return Number.isNaN(i)||i<=0?null:i}}i(115);class Zw extends Mc{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(e,t)=>`${t} × ${e}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck-insert-table-dropdown__label"]},children:[{text:t.to("label")}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(e,t)=>{const{row:i,column:o}=t.target.dataset;this.set({rows:parseInt(i),columns:parseInt(o)})}),this.on("change:columns",()=>{this._highlightGridBoxes()}),this.on("change:rows",()=>{this._highlightGridBoxes()})}focus(){}focusLast(){}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((i,o)=>{const n=Math.floor(o/10)<e&&o%10<t;i.set("isOn",n)})}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),o=t%10;e.push(new Xw(this.locale,i+1,o+1))}return this.createCollection(e)}}class Xw extends Mc{constructor(e,t,i){super(e);const o=this.bindTemplate;this.set("isOn",!1),this.setTemplate({tag:"div",attributes:{class:["ck-insert-table-dropdown-grid-box",o.if("isOn","ck-on")],"data-row":t,"data-column":i}})}}class ek extends Qe{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,i="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",i=>{const o=e.commands.get("insertTable"),n=Sd(i);let r;return n.bind("isEnabled").to(o),n.buttonView.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 6v3h4V6H3zm0 4v3h4v-3H3zm0 4v3h4v-3H3zm5 3h4v-3H8v3zm5 0h4v-3h-4v3zm4-4v-3h-4v3h4zm0-4V6h-4v3h4zm1.5 8a1.5 1.5 0 0 1-1.5 1.5H3A1.5 1.5 0 0 1 1.5 17V4c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13zM12 13v-3H8v3h4zm0-4V6H8v3h4z"/></svg>',label:t("Insert table"),tooltip:!0}),n.on("change:isOpen",()=>{r||(r=new Zw(i),n.panelView.children.add(r),r.delegate("execute").to(n),n.buttonView.on("open",()=>{r.rows=0,r.columns=0}),n.on("execute",()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()}))}),n}),e.ui.componentFactory.add("tableColumn",e=>{const o=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:i?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:i?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',o,e)}),e.ui.componentFactory.add("tableRow",e=>{const i=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',i,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const o=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:i?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:i?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',o,e)})}_prepareDropdown(e,t,i,o){const n=this.editor,r=Sd(o),s=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(s,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r,"execute",e=>{n.execute(e.source.commandName),n.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,i,o){const n=this.editor,r=Sd(o,ud),s=n.commands.get("mergeTableCells"),a=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([s,...a],"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r.buttonView,"execute",()=>{n.execute("mergeTableCells"),n.editing.view.focus()}),this.listenTo(r,"execute",e=>{n.execute(e.source.commandName),n.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){const i=this.editor,o=[],n=new Zi;for(const e of t)tk(e,i,o,n);return Id(e,n,i.ui.componentFactory),o}}function tk(e,t,i,o){const n=e.model=new Hd(e.model),{commandName:r,bindIsOn:s}=e.model;if("button"===e.type||"switchbutton"===e.type){const e=t.commands.get(r);i.push(e),n.set({commandName:r}),n.bind("isEnabled").to(e),s&&n.bind("isOn").to(e,"value")}n.set({withText:!0}),o.add(e)}i(117);class ik extends Qe{static get pluginName(){return"TableSelection"}static get requires(){return[Sw]}init(){const e=this.editor.model;this.listenTo(e,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=Zb(this.editor.model.document.selection);return 0==e.length?null:e}getSelectionAsFragment(){const e=this.getSelectedTableCells();return e?this.editor.model.change(t=>{const i=t.createDocumentFragment(),o=this.editor.plugins.get("TableUtils"),{first:n,last:r}=iw(e),{first:s,last:a}=tw(e),l=e[0].findAncestor("table");let c=a,d=r;if(ow(e,o)){const e={firstColumn:n,lastColumn:r,firstRow:s,lastRow:a};c=_w(l,e),d=vw(l,e)}const u=uw(l,{startRow:s,startColumn:n,endRow:c,endColumn:d},t);return t.insert(u,i,0),i}):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(i.cells.map(t=>e.createRangeOn(t)),{backward:i.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=Ns(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,i,o)=>{const n=o.writer;!function(e){for(const i of t)e.removeClass("ck-editor__editable_selected",i);t.clear()}(n);const r=this.getSelectedTableCells();if(!r)return;for(const e of r){const i=o.mapper.toViewElement(e);n.addClass("ck-editor__editable_selected",i),t.add(i)}const s=o.mapper.toViewElement(r[r.length-1]);n.setSelection(s,0)},{priority:"lowest"}))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(i=>{const o=i.createPositionAt(t[0],0),n=e.model.schema.getNearestSelectionRange(o);i.setSelection(n)})}})}_handleDeleteContent(e,t){const[i,o]=t,n=this.editor.model,r=!o||"backward"==o.direction,s=Zb(i);s.length&&(e.stop(),n.change(e=>{const t=s[r?s.length-1:0];n.change(e=>{for(const t of s)n.deleteContent(e.createSelection(t,"in"))});const o=n.schema.getNearestSelectionRange(e.createPositionAt(t,0));i.is("documentSelection")?e.setSelection(o):i.setTo(o)}))}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),o=i.getCellLocation(e),n=i.getCellLocation(t),r=Math.min(o.row,n.row),s=Math.max(o.row,n.row),a=Math.min(o.column,n.column),l=Math.max(o.column,n.column),c=new Array(s-r+1).fill(null).map(()=>[]),d={startRow:r,endRow:s,startColumn:a,endColumn:l};for(const{row:t,cell:i}of new Bb(e.findAncestor("table"),d))c[t-r].push(i);const u=n.row<o.row,h=n.column<o.column;return u&&c.reverse(),h&&c.forEach(e=>e.reverse()),{cells:c.flat(),backward:u||h}}}class ok extends Qe{static get pluginName(){return"TableClipboard"}static get requires(){return[ik,Sw]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(t,"cut",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e.model,"insertContent",(e,t)=>this._onInsertContent(e,...t),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const i=this.editor.plugins.get(ik);if(!i.getSelectedTableCells())return;if("cut"==e.name&&this.editor.isReadOnly)return;t.preventDefault(),e.stop();const o=this.editor.data,n=this.editor.editing.view.document,r=o.toView(i.getSelectionAsFragment());n.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const o=this.editor.model,n=this.editor.plugins.get(Sw);let r=function(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const i=t.createRangeIn(e);for(const e of i.getItems())if(e.is("element","table")){const o=t.createRange(i.start,t.createPositionBefore(e));if(t.hasContent(o,{ignoreWhitespaces:!0}))return null;const n=t.createRange(t.createPositionAfter(e),i.end);return t.hasContent(n,{ignoreWhitespaces:!0})?null:e}return null}(t,o);if(!r)return;const s=ew(o.document.selection);s.length?(e.stop(),o.change(e=>{const t={width:n.getColumns(r),height:n.getRows(r)},i=function(e,t,i,o){const n=e[0].findAncestor("table"),r=iw(e),s=tw(e),a={firstColumn:r.first,lastColumn:r.last,firstRow:s.first,lastRow:s.last},l=1===e.length;l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,i,o){const n=o.getColumns(e),r=o.getRows(e);i>n&&o.insertColumns(e,{at:n,columns:i-n});t>r&&o.insertRows(e,{at:r,rows:t-r})}(n,a.lastRow+1,a.lastColumn+1,o));l||!ow(e,o)?function(e,t,i){const{firstRow:o,lastRow:n,firstColumn:r,lastColumn:s}=t,a={first:o,last:n},l={first:r,last:s};rk(e,r,a,i),rk(e,s+1,a,i),nk(e,o,l,i),nk(e,n+1,l,i,o)}(n,a,i):(a.lastRow=_w(n,a),a.lastColumn=vw(n,a));return a}(s,t,e,n),o=i.lastRow-i.firstRow+1,a=i.lastColumn-i.firstColumn+1,l={startRow:0,startColumn:0,endRow:Math.min(o,t.height)-1,endColumn:Math.min(a,t.width)-1};r=uw(r,l,e);const c=s[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(r,t,c,i,e);if(this.editor.plugins.get("TableSelection").isEnabled){const t=nw(d.map(t=>e.createRangeOn(t)));e.setSelection(t)}else e.setSelection(d[0],0)})):kw(r,n)}_replaceSelectedCellsWithPasted(e,t,i,o,n){const{width:r,height:s}=t,a=function(e,t,i){const o=new Array(i).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:i,cell:n}of new Bb(e))o[i][t]=n;return o}(e,r,s),l=[...new Bb(i,{startRow:o.firstRow,endRow:o.lastRow,startColumn:o.firstColumn,endColumn:o.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of l){const{row:t,column:i}=e;i===o.firstColumn&&(d=e.getPositionBefore());const l=t-o.firstRow,u=i-o.firstColumn,h=a[l%s][u%r],m=h?n.cloneElement(h):null,g=this._replaceTableSlotCell(e,m,d,n);g&&(pw(g,t,i,o.lastRow,o.lastColumn,n),c.push(g),d=n.createPositionAfter(g))}const u=parseInt(i.getAttribute("headingRows")||0),h=parseInt(i.getAttribute("headingColumns")||0),m=o.firstRow<u&&u<=o.lastRow,g=o.firstColumn<h&&h<=o.lastColumn;if(m){const e=nk(i,u,{first:o.firstColumn,last:o.lastColumn},n,o.firstRow);c.push(...e)}if(g){const e=rk(i,h,{first:o.firstRow,last:o.lastRow},n);c.push(...e)}return c}_replaceTableSlotCell(e,t,i,o){const{cell:n,isAnchor:r}=e;return r&&o.remove(n),t?(o.insert(t,i),t):null}}function nk(e,t,i,o,n=0){if(t<1)return;return hw(e,t,n).filter(({column:e,cellWidth:t})=>sk(e,t,i)).map(({cell:e})=>mw(e,t,o))}function rk(e,t,i,o){if(t<1)return;return gw(e,t).filter(({row:e,cellHeight:t})=>sk(e,t,i)).map(({cell:e,column:i})=>fw(e,i,t,o))}function sk(e,t,i){const o=e+t-1,{first:n,last:r}=i;return e>=n&&e<=r||e<n&&o>=n}class ak extends Qe{static get pluginName(){return"TableKeyboard"}static get requires(){return[ik]}init(){const e=this.editor.editing.view.document;this.editor.keystrokes.set("Tab",(...e)=>this._handleTabOnSelectedTable(...e),{priority:"low"}),this.editor.keystrokes.set("Tab",this._getTabHandler(!0),{priority:"low"}),this.editor.keystrokes.set("Shift+Tab",this._getTabHandler(!1),{priority:"low"}),this.listenTo(e,"arrowKey",(...e)=>this._onArrowKey(...e),{context:"table"})}_handleTabOnSelectedTable(e,t){const i=this.editor,o=i.model.document.selection.getSelectedElement();o&&o.is("element","table")&&(t(),i.model.change(e=>{e.setSelection(e.createRangeIn(o.getChild(0).getChild(0)))}))}_getTabHandler(e){const t=this.editor;return(i,o)=>{let n=Xb(t.model.document.selection)[0];if(n||(n=this.editor.plugins.get("TableSelection").getFocusCell()),!n)return;o();const r=n.parent,s=r.parent,a=s.getChildIndex(r),l=r.getChildIndex(n),c=0===l;if(!e&&c&&0===a)return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});const d=this.editor.plugins.get("TableUtils"),u=l===r.childCount-1,h=a===d.getRows(s)-1;if(e&&h&&u&&(t.execute("insertTableRowBelow"),a===d.getRows(s)-1))return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});let m;if(e&&u){const e=s.getChild(a+1);m=e.getChild(0)}else if(!e&&c){const e=s.getChild(a-1);m=e.getChild(e.childCount-1)}else m=r.getChild(l+(e?1:-1));t.model.change(e=>{e.setSelection(e.createRangeIn(m))})}}_onArrowKey(e,t){const i=this.editor,o=Dn(t.keyCode,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.model.document.selection,o=["right","down"].includes(e),n=Zb(i);if(n.length){let i;return i=t?this.editor.plugins.get("TableSelection").getFocusCell():o?n[n.length-1]:n[0],this._navigateFromCellInDirection(i,e,t),!0}const r=i.focus.findAncestor("tableCell");return!!r&&(!(t&&!i.isCollapsed&&i.isBackward==o)&&(!!this._isSelectionAtCellEdge(i,r,o)&&(this._navigateFromCellInDirection(r,e,t),!0)))}_isSelectionAtCellEdge(e,t,i){const o=this.editor.model,n=this.editor.model.schema,r=i?e.getLastPosition():e.getFirstPosition();if(!n.getLimitElement(r).is("element","tableCell")){return o.createPositionAt(t,i?"end":0).isTouching(r)}const s=o.createSelection(r);return o.modifySelection(s,{direction:i?"forward":"backward"}),r.isEqual(s.focus)}_navigateFromCellInDirection(e,t,i=!1){const o=this.editor.model,n=e.findAncestor("table"),r=[...new Bb(n,{includeAllSlots:!0})],{row:s,column:a}=r[r.length-1],l=r.find(({cell:t})=>t==e);let{row:c,column:d}=l;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>s||d<0&&c<=0||d>a&&c>=s)return void o.change(e=>{e.setSelection(e.createRangeOn(n))});d<0?(d=i?0:a,c--):d>a&&(d=i?a:0,c++);const u=r.find(e=>e.row==c&&e.column==d).cell,h=["right","down"].includes(t),m=this.editor.plugins.get("TableSelection");if(i&&m.isEnabled){const t=m.getAnchorCell()||e;m.setCellSelection(t,u)}else{const e=o.createPositionAt(u,h?0:"end");o.change(t=>{t.setSelection(e)})}}}class lk extends ts{constructor(e){super(e),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class ck extends Qe{static get pluginName(){return"TableMouse"}static get requires(){return[ik]}init(){this.editor.editing.view.addObserver(lk),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor;let t=!1;const i=e.plugins.get(ik);this.listenTo(e.editing.view.document,"mousedown",(o,n)=>{if(!this.isEnabled||!i.isEnabled)return;if(!n.domEvent.shiftKey)return;const r=i.getAnchorCell()||Xb(e.model.document.selection)[0];if(!r)return;const s=this._getModelTableCellFromDomEvent(n);s&&dk(r,s)&&(t=!0,i.setCellSelection(r,s),n.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{t=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{t&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,i,o=!1,n=!1;const r=e.plugins.get(ik);this.listenTo(e.editing.view.document,"mousedown",(e,i)=>{this.isEnabled&&r.isEnabled&&(i.domEvent.shiftKey||i.domEvent.ctrlKey||i.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(i)))}),this.listenTo(e.editing.view.document,"mousemove",(e,s)=>{if(!s.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(s);a&&dk(t,a)&&(i=a,o||i==t||(o=!0)),o&&(n=!0,r.setCellSelection(t,i),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{o=!1,n=!1,t=null,i=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{n&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}}function dk(e,t){return e.parent.parent==t.parent.parent}i(119);function uk(e){const t=e.getSelectedElement();return t&&mk(t)?t:null}function hk(e){let t=e.getFirstPosition().parent;for(;t;){if(t.is("element")&&mk(t))return t;t=t.parent}return null}function mk(e){return!!e.getCustomProperty("table")&&Th(e)}const gk={autoRefresh:!0};class fk{constructor(e,t=gk){if(!e)throw new l.a("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),this._refresh="function"==typeof e?e:()=>{return t=e,new Promise((e,i)=>{const o=new XMLHttpRequest;o.open("GET",t),o.addEventListener("load",()=>{const t=o.status,n=o.response;return t<200||t>299?i(new l.a("token-cannot-download-new-token",null)):e(n)}),o.addEventListener("error",()=>i(new Error("Network Error"))),o.addEventListener("abort",()=>i(new Error("Abort"))),o.send()});var t},this._options=Object.assign({},gk,t)}init(){return new Promise((e,t)=>{this.value?(this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)):this.refreshToken().then(e).catch(t)})}refreshToken(){return this._refresh().then(e=>{this._validateTokenValue(e),this.set("value",e),this._options.autoRefresh&&this._registerRefreshTokenTimeout()}).then(()=>this)}destroy(){clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t="string"==typeof e,i=!/^".*"$/.test(e),o=t&&3===e.split(".").length;if(!i||!o)throw new l.a("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(){const e=this._getTokenRefreshTimeoutTime();clearTimeout(this._tokenRefreshTimeout),this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},e)}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));if(!t)return 36e5;return Math.floor((1e3*t-Date.now())/2)}catch(e){return 36e5}}static create(e,t=gk){return new fk(e,t).init()}}Ke(fk,Ue);var pk=fk;const bk=/^data:(\S*?);base64,/;class wk{constructor(e,t,i){if(!e)throw new l.a("fileuploader-missing-file",null);if(!t)throw new l.a("fileuploader-missing-token",null);if(!i)throw new l.a("fileuploader-missing-api-address",null);this.file=function(e){if("string"!=typeof e)return!1;const t=e.match(bk);return!(!t||!t.length)}(e)?function(e,t=512){try{const i=e.match(bk)[1],o=atob(e.replace(bk,"")),n=[];for(let e=0;e<o.length;e+=t){const i=o.slice(e,e+t),r=new Array(i.length);for(let e=0;e<i.length;e++)r[e]=i.charCodeAt(e);n.push(new Uint8Array(r))}return new Blob(n,{type:i})}catch(e){throw new l.a("fileuploader-decoding-image-data-error",null)}}(e):e,this._token=t,this._apiAddress=i}onProgress(e){return this.on("progress",(t,i)=>e(i)),this}onError(e){return this.once("error",(t,i)=>e(i)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this,t=this.xhr;function i(t){return()=>e.fire("error",t)}t.addEventListener("error",i("Network Error")),t.addEventListener("abort",i("Abort")),t.upload&&t.upload.addEventListener("progress",e=>{e.lengthComputable&&this.fire("progress",{total:e.total,uploaded:e.loaded})}),t.addEventListener("load",()=>{const e=t.status,i=t.response;if(e<200||e>299)return this.fire("error",i.message||i.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((i,o)=>{t.addEventListener("load",()=>{const e=t.status,n=t.response;return e<200||e>299?n.message?o(new l.a("fileuploader-uploading-data-failed",this,{message:n.message})):o(n.error):i(n)}),t.addEventListener("error",()=>o(new Error("Network Error"))),t.addEventListener("abort",()=>o(new Error("Abort"))),t.send(e)})}}Ke(wk,u);class kk{constructor(e,t){if(!e)throw new l.a("uploadgateway-missing-token",null);if(!t)throw new l.a("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new wk(e,this._token,this._apiAddress)}}class _k extends so{static get pluginName(){return"CloudServicesCore"}createToken(e,t){return new pk(e,t)}createUploadGateway(e,t){return new kk(e,t)}}var vk=i(14),yk=i.n(vk);var xk=class extends Qe{init(){const e=this.editor;e.ui.componentFactory.add("insertAudio",t=>{console.log("env",window.globalApiPath);const i=new ed(t);return i.set({label:"Ses Ekle",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 23"><path d="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /></svg>',tooltip:!0}),i.on("execute",()=>{var t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("accept","audio/*"),t.click(),t.onchange=function(t){var i=Math.random().toString(16).slice(2),o=t.target.files[0];let n=new FormData;n.append("baslik","ckeditorSesWitId"),n.append("aciklama",i),n.append("dosya",o),yk.a.post(window.globalApiPath+"api/file",n,{headers:{"Content-Type":"multipart/form-data"}}).then(t=>{if("ERROR"!==t.data.status){var o=t.data.data.dosyaSHA1;yk.a.get(`${window.globalApiPath}api/file/presignedURL/${o}`).then(t=>{var o=t.data.data;const n=`<audio controls id=${i} src=${o} preload="none"></audio><br/>`,r=e.data.processor.toView(n),s=e.data.toModel(r);e.model.insertContent(s)}).catch(e=>{})}}).catch(e=>{})}}),i})}},Ak=[{model:"heading1",view:"h2"},{model:"heading2",view:"h3"},{model:"heading3",view:"h4"},{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"$htmlSection",modelSchema:{allowChildren:"$block",allowIn:["$root","$htmlSection"],isBlock:!0}},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlTable",view:"table",modelSchema:{allowIn:["$htmlSection","$root"],isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!0}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!0}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!0}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!0}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isBlock:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowChildren:["$block","$htmlSection"],isBlock:!0}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowChildren:["$block","$htmlSection"],isBlock:!0}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$htmlSection",isBlock:!0}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!0}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlSumary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!0}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlHeading1","htmlHeading2","htmlHeading3","htmlHeading4","htmlHeading5","htmlHeading6","heading1","heading2","heading3"],isBlock:!0}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$htmlSection",allowChildren:["$htmlList","htmlLi"],isBlock:!0}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!0}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"htmlDl",view:"dl",modelSchema:{allowIn:["$htmlSection","$root"],allowChildren:["htmlDt","htmlDd"],isBlock:!0}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!0}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!0}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$htmlSection"}},{model:"$htmlObjectBlock",isObject:!0,modelSchema:{isObject:!0,isBlock:!0,allowWhere:"$block"}}],Ck=[{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0}},{model:"htmlA",view:"a",priority:5,attributeProperties:{copyOnEnter:!0}},{model:"htmlStrong",view:"strong",attributeProperties:{copyOnEnter:!0}},{model:"htmlB",view:"b",attributeProperties:{copyOnEnter:!0}},{model:"htmlI",view:"i",attributeProperties:{copyOnEnter:!0}},{model:"htmlEm",view:"em",attributeProperties:{copyOnEnter:!0}},{model:"htmlS",view:"s",attributeProperties:{copyOnEnter:!0}},{model:"htmlDel",view:"del",attributeProperties:{copyOnEnter:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0}},{model:"htmlU",view:"u",attributeProperties:{copyOnEnter:!0}},{model:"htmlSub",view:"sub",attributeProperties:{copyOnEnter:!0}},{model:"htmlSup",view:"sup",attributeProperties:{copyOnEnter:!0}},{model:"htmlCode",view:"code",attributeProperties:{copyOnEnter:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0}},{model:"$htmlObjectInline",isObject:!0,modelSchema:{isObject:!0,isInline:!0,allowWhere:"$text",allowAttributesOf:"$text"}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$htmlObjectInline"}}];class Tk extends Qe{constructor(e){super(e),this._definitions=new Map}static get pluginName(){return"DataSchema"}init(){for(const e of Ak)this.registerBlockElement(e);for(const e of Ck)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.set(e.model,{...e,isBlock:!0})}registerInlineElement(e){this._definitions.set(e.model,{...e,isInline:!0})}getDefinitionsForView(e,t){const i=new Set;for(const o of this._getMatchingViewDefinitions(e)){if(t)for(const e of this._getReferences(o.model))i.add(e);i.add(o)}return i}_getMatchingViewDefinitions(e){return Array.from(this._definitions.values()).filter(t=>t.view&&function(e,t){if("string"==typeof e)return e===t;if(e instanceof RegExp)return e.test(t);return!1}(e,t.view))}*_getReferences(e){const{modelSchema:t}=this._definitions.get(e);if(!t)return;const i=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"];for(const o of i)for(const i of eo(t[o]||[])){const t=this._definitions.get(i);i!==e&&t&&(yield*this._getReferences(t.model),yield t)}}}function Ek(e,t,i){if(t.attributes)for(const[o,n]of Object.entries(t.attributes))e.setAttribute(o,n,i);t.styles&&e.setStyle(t.styles,i),t.classes&&e.addClass(t.classes,i)}function Sk(e,t){const i=Aa(e);for(const o in t)Array.isArray(t[o])?i[o]=Array.from(new Set([...e[o],...t[o]])):i[o]={...e[o],...t[o]};return i}function Pk({view:e},t){return i=>{i.on("element:"+e,(e,i,o)=>{t._consumeDisallowedAttributes(i.viewItem,o)},{priority:"high"})}}function Ik({model:e}){return(t,i)=>i.writer.createElement(e,{htmlContent:t.getCustomProperty("$rawContent")})}function Mk(e,{view:t,isInline:i}){const o=e.t;return(e,{writer:n,consumable:r})=>{const s=o("HTML object"),a=n.createContainerElement(i?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},{isAllowedInsideAttributeElement:i}),l=Nk(t,e,n);n.addClass("html-object-embed__content",l);const c=e.getAttribute("htmlAttributes");return c&&r.consume(e,"attribute:htmlAttributes:"+e.name)&&Ek(n,c,l),n.insert(n.createPositionAt(a,0),l),Eh(a,n,{widgetLabel:s})}}function Nk(e,t,i){return i.createRawElement(e,null,(function(e){e.innerHTML=t.getAttribute("htmlContent")}))}function Rk({priority:e,view:t}){return(i,o)=>{if(!i)return;const{writer:n}=o,r=n.createAttributeElement(t,null,{priority:e});return Ek(n,i,r),r}}function Ok({view:e},t){return i=>{i.on("element:"+e,(e,i,o)=>{if(!i.modelRange)return;const n=t._consumeAllowedAttributes(i.viewItem,o);n&&o.writer.setAttribute("htmlAttributes",n,i.modelRange)},{priority:"low"})}}function zk({model:e}){return t=>{t.on("attribute:htmlAttributes:"+e,(e,t,i)=>{const o=t.attributeNewValue;if(!i.consumable.consume(t.item,e.name))return;Ek(i.writer,o,i.mapper.toViewElement(t.item))})}}var Vk=function(e,t,i,o){for(var n=e.length,r=i+(o?1:-1);o?r--:++r<n;)if(t(e[r],r,e))return r;return-1};var Dk=function(e){return e!=e};var Lk=function(e,t,i){for(var o=i-1,n=e.length;++o<n;)if(e[o]===t)return o;return-1};var Bk=function(e,t,i){return t==t?Lk(e,t,i):Vk(e,Dk,i)};var jk=function(e,t,i,o){for(var n=i-1,r=e.length;++n<r;)if(o(e[n],t))return n;return-1},Fk=Array.prototype.splice;var Hk=function(e,t,i,o){var n=o?jk:Bk,r=-1,s=t.length,a=e;for(e===t&&(t=Xt(t)),i&&(a=To(e,Ae(i)));++r<s;)for(var l=0,c=t[r],d=i?i(c):c;(l=n(a,d,l,o))>-1;)a!==e&&Fk.call(a,l,1),Fk.call(e,l,1);return e};var Uk=se((function(e,t){return e&&e.length&&t&&t.length?Hk(e,t):e}));i(140);class Wk extends Qe{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new go,this._disallowedAttributes=new go,this._allowedElements=new Set,this._dataInitialized=!1,this._registerElementsAfterInit(),this._registerElementHandlers()}static get pluginName(){return"DataFilter"}static get requires(){return[Tk,qh]}loadAllowedConfig(e){this._loadConfig(e,e=>this.allowAttributes(e))}loadDisallowedConfig(e){this._loadConfig(e,e=>this.disallowAttributes(e))}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._allowedElements.has(t)||(this._allowedElements.add(t),this._dataInitialized&&this._fireRegisterEvent(t))}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}_loadConfig(e,t){for(const i of e){const e=i.name||/[\s\S]+/;this.allowElement(e),Kk(i).forEach(t)}}_consumeAllowedAttributes(e,t){return $k(e,t,this._allowedAttributes)}_consumeDisallowedAttributes(e,t){return $k(e,t,this._disallowedAttributes)}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:a.get("high")+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new l.a("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()},{priority:"lowest"})}_fireRegisterEvent(e){this.fire(e.view?"register:"+e.view:"register",e)}_registerObjectElement(e){const t=this.editor,i=t.model.schema,o=t.conversion,{view:n,model:r}=e;i.register(r,e.modelSchema),n&&(i.extend(e.model,{allowAttributes:["htmlAttributes","htmlContent"]}),t.data.registerRawContentMatcher({name:n}),o.for("upcast").add(Pk(e,this)),o.for("upcast").elementToElement({view:n,model:Ik(e),converterPriority:a.get("low")+1}),o.for("upcast").add(Ok(e,this)),o.for("editingDowncast").elementToElement({model:r,view:Mk(t,e)}),o.for("dataDowncast").elementToElement({model:r,view:(e,{writer:t})=>Nk(n,e,t)}),o.for("dataDowncast").add(zk(e)))}_registerBlockElement(e){const t=this.editor,i=t.model.schema,o=t.conversion,{view:n,model:r}=e;if(!i.isRegistered(e.model)){if(i.register(e.model,e.modelSchema),!n)return;o.for("upcast").elementToElement({model:r,view:n,converterPriority:a.get("low")+1}),o.for("downcast").elementToElement({model:r,view:n})}n&&(i.extend(e.model,{allowAttributes:"htmlAttributes"}),o.for("upcast").add(Pk(e,this)),o.for("upcast").add(Ok(e,this)),o.for("downcast").add(zk(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,o=t.conversion,n=e.model;i.extend("$text",{allowAttributes:n}),e.attributeProperties&&i.setAttributeProperties(n,e.attributeProperties),o.for("upcast").add(Pk(e,this)),o.for("upcast").add(function({view:e,model:t},i){return o=>{o.on("element:"+e,(e,o,n)=>{const r=i._consumeAllowedAttributes(o.viewItem,n);o.modelRange||(o=Object.assign(o,n.convertChildren(o.viewItem,o.modelCursor)));for(const e of o.modelRange.getItems())if(n.schema.checkAttribute(e,t)){const i=Sk(r||{},e.getAttribute(t)||{});n.writer.setAttribute(t,i,e)}},{priority:"low"})}}(e,this)),o.for("downcast").attributeToElement({model:n,view:Rk(e)})}}function $k(e,t,i){const o=function(e,{consumable:t},i){const o=i.matchAll(e)||[],n=[];for(const i of o)qk(t,e,i),delete i.match.name,t.consume(e,i.match)&&n.push(i);return n}(e,t,i),{attributes:n,styles:r,classes:s}=function(e){const t={attributes:new Set,classes:new Set,styles:new Set};for(const i of e)for(const e in t){(i.match[e]||[]).forEach(i=>t[e].add(i))}return t}(o),a={};return n.size&&(a.attributes=Yk(n,t=>e.getAttribute(t))),r.size&&(a.styles=Yk(r,t=>e.getStyle(t))),s.size&&(a.classes=Array.from(s)),Object.keys(a).length?a:null}function qk(e,t,i){for(const o of["attributes","classes","styles"]){const n=i.match[o];if(n)for(const i of n)e.test(t,{[o]:[i]})||Uk(n,i)}}function Yk(e,t){const i={};for(const o of e){void 0!==t(o)&&(i[o]=t(o))}return i}function Gk(e,t){const{name:i}=e;return lt(e[t])?Object.entries(e[t]).map(([e,o])=>({name:i,[t]:{[e]:o}})):Array.isArray(e[t])?e[t].map(e=>({name:i,[t]:[e]})):[e]}function Kk(e){const{name:t,attributes:i,classes:o,styles:n}=e,r=[];return i&&r.push(...Gk({name:t,attributes:i},"attributes")),o&&r.push(...Gk({name:t,classes:o},"classes")),n&&r.push(...Gk({name:t,styles:n},"styles")),r}class Qk extends Qe{static get requires(){return[Wk]}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,o=this.editor.plugins.get(Wk),n=this.editor.plugins.get(Tk),r=e.config.get("mediaEmbed.elementName");n.registerBlockElement({model:"media",view:r}),o.on("register:"+r,(e,n)=>{"media"===n.model&&(t.extend("media",{allowAttributes:["htmlAttributes","htmlFigureAttributes"]}),i.for("upcast").add(Pk(n,o)),i.for("upcast").add(function(e,t){return e=>{e.on("element:figure",i,{priority:"high"}),e.on("element:"+t,o)};function i(i,o,n){const r=o.viewItem;if(!n.consumable.test(r,{name:!0,classes:"media"}))return;const s=Array.from(r.getChildren()).find(e=>e.is("element",t));function a(t,i){const r=e._consumeAllowedAttributes(t,n);r&&n.writer.setAttribute(i,r,o.modelRange)}s&&(Object.assign(o,n.convertItem(s,o.modelCursor)),a(s,"htmlAttributes"),a(r,"htmlFigureAttributes"),n.consumable.consume(r,{name:!0}))}function o(t,i,o){const n=i.viewItem,r=e._consumeAllowedAttributes(n,o);r&&o.writer.setAttribute("htmlAttributes",r,i.modelRange)}}(o,r)),i.for("dataDowncast").add(function(e){return t=>{function i(e,i){t.on(`attribute:${i}:media`,(t,i,o)=>{if(!o.consumable.consume(i.item,t.name))return;const n=o.mapper.toViewElement(i.item),r=function(e,t,i){const o=e.writer.createRangeOn(t);for(const{item:e}of o.getWalker())if(e.is("element",i))return e}(o,n,e);Ek(o.writer,i.attributeNewValue,r)})}i(e,"htmlAttributes"),i("figure","htmlFigureAttributes")}}(r)),e.stop())})}}class Jk extends Qe{static get requires(){return[Wk]}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,o=e.plugins.get(Wk);o.on("register:table",(e,n)=>{"table"===n.model&&(t.extend("table",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(Pk(n,o)),i.for("upcast").add(function(e){return t=>{t.on("element:table",(t,i,o)=>{const n=i.viewItem;s(n,"htmlAttributes");const r=n.parent;r.is("element","figure")&&s(r,"htmlFigureAttributes");for(const e of n.getChildren())e.is("element","thead")&&s(e,"htmlTheadAttributes"),e.is("element","tbody")&&s(e,"htmlTbodyAttributes");function s(t,n){const r=e._consumeAllowedAttributes(t,o);r&&o.writer.setAttribute(n,r,i.modelRange)}},{priority:"low"})}}(o)),i.for("downcast").add(e=>{function t(t,i){e.on(`attribute:${i}:table`,(e,i,o)=>{if(!o.consumable.consume(i.item,e.name))return;const n=o.mapper.toViewElement(i.item),r=function(e,t,i){const o=e.writer.createRangeOn(t);for(const{item:e}of o.getWalker())if(e.is("element",i))return e}(o,n,t);Ek(o.writer,i.attributeNewValue,r)})}t("table","htmlAttributes"),t("figure","htmlFigureAttributes"),t("thead","htmlTheadAttributes"),t("tbody","htmlTbodyAttributes")}),e.stop())}),o.on("register:figure",()=>{i.for("upcast").add(e=>{e.on("element:figure",(e,t,i)=>{for(const e of t.viewItem.getChildren())if(e.is("element","table"))return void i.consumable.consume(t.viewItem,{name:!0})})})})}}class Zk extends Qe{static get requires(){return[Wk]}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(Wk);e.on("register:pre",(t,i)=>{if("codeBlock"!==i.model)return;const o=this.editor,n=o.model.schema,r=o.conversion;n.extend("codeBlock",{allowAttributes:["htmlAttributes","htmlContentAttributes"]}),r.for("upcast").add(Pk(i,e)),r.for("upcast").add(function(e){return t=>{t.on("element:code",(t,i,o)=>{const n=i.viewItem,r=n.parent;function s(t,n){const r=e._consumeAllowedAttributes(t,o);r&&o.writer.setAttribute(n,r,i.modelRange)}r&&r.is("element","pre")&&(s(r,"htmlAttributes"),s(n,"htmlContentAttributes"))},{priority:"low"})}}(e)),r.for("downcast").add(e=>{e.on("attribute:htmlAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=i.mapper.toViewElement(t.item).parent;Ek(i.writer,t.attributeNewValue,o)}),e.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=i.mapper.toViewElement(t.item);Ek(i.writer,t.attributeNewValue,o)})}),t.stop()})}}class Xk extends Qe{static get requires(){return[Wk]}init(){this.editor.plugins.get(Wk).on("register",(e,t)=>{const i=this.editor,o=i.model.schema,n=i.conversion;if(!t.paragraphLikeModel)return;if(o.isRegistered(t.model)||o.isRegistered(t.paragraphLikeModel))return;const r={model:t.paragraphLikeModel,view:t.view};o.register(t.model,t.modelSchema),o.register(r.model,{inheritAllFrom:"$block"}),n.for("upcast").elementToElement({view:t.view,model:(e,{writer:i})=>this._hasBlockContent(e)?i.createElement(t.model):i.createElement(r.model),converterPriority:a.get("low")+1}),n.for("downcast").elementToElement({view:t.view,model:t.model}),this._addAttributeConversion(t),n.for("downcast").elementToElement({view:r.view,model:r.model}),this._addAttributeConversion(r),e.stop()})}_hasBlockContent(e){const t=this.editor.editing.view.domConverter.blockElements;return Array.from(e.getChildren()).some(e=>t.includes(e.name))}_addAttributeConversion(e){const t=this.editor,i=t.conversion,o=t.plugins.get(Wk);t.model.schema.extend(e.model,{allowAttributes:"htmlAttributes"}),i.for("upcast").add(Pk(e,o)),i.for("upcast").add(Ok(e,o)),i.for("downcast").add(zk(e))}}class e_ extends Ze{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,o=e.value;t.change(e=>{if(i.isCollapsed)o?e.setSelectionAttribute(this.attributeKey,o):e.removeSelectionAttribute(this.attributeKey);else{const n=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of n)o?e.setAttribute(this.attributeKey,o,t):e.removeAttribute(this.attributeKey,t)}})}}class t_ extends Zi{constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",0===this.length)})}add(e,t){this.find(t=>t.color===e.color)||super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}Ke(t_,Ue);i(142);class i_ extends Mc{constructor(e,{colors:t,columns:i,removeButtonLabel:o,documentColorsLabel:n,documentColorsCount:r}){super(e),this.items=this.createCollection(),this.colorDefinitions=t,this.focusTracker=new Rs,this.keystrokes=new Os,this.set("selectedColor"),this.removeButtonLabel=o,this.columns=i,this.documentColors=new t_,this.documentColorsCount=r,this._focusCycler=new sd({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this._documentColorsLabel=n,this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items}),this.items.add(this._removeColorButton())}updateDocumentColors(e,t){const i=e.document,o=this.documentColorsCount;this.documentColors.clear();for(const n of i.getRootNames()){const r=i.getRoot(n),s=e.createRangeIn(r);for(const e of s.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=o))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}appendGrids(){if(!this.staticColorsGrid&&(this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount)){const e=Nc.bind(this.documentColors,this.documentColors),t=new Nd(this.locale);t.text=this._documentColorsLabel,t.extendTemplate({attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]}}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_removeColorButton(){const e=new ed;return e.set({withText:!0,icon:Tc.eraser,tooltip:!0,label:this.removeButtonLabel}),e.class="ck-color-table__remove-color",e.on("execute",()=>{this.fire("execute",{value:null})}),e}_createStaticColorsGrid(){const e=new ld(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.delegate("execute").to(this),e}_createDocumentColorsGrid(){const e=Nc.bind(this.documentColors,this.documentColors),t=new ld(this.locale,{columns:this.columns});return t.delegate("execute").to(this),t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(e=>{const t=new rd;return t.set({color:e.color,hasBorder:e.options&&e.options.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on("execute",()=>{this.fire("execute",{value:e.color})}),t}),this.documentColors.on("change:isEmpty",(e,i,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(t=>t.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}function o_(e,t){const i={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)i.model.values.push(e.model),i.view[e.model]=e.view,e.upcastAlso&&(i.upcastAlso[e.model]=e.upcastAlso);return i}function n_(e){return t=>t.getStyle(e).replace(/\s/g,"")}function r_(e){return(t,{writer:i})=>i.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class s_ extends e_{constructor(e){super(e,"fontFamily")}}function a_(e){return e.map(l_).filter(e=>!!e)}function l_(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),i=t[0],o=t.map(c_).join(", ");return{title:i,model:o,view:{name:"span",styles:{"font-family":o},priority:7}}}(e):void 0}function c_(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class d_ extends Qe{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define("fontFamily",{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"fontFamily"}),e.model.schema.setAttributeProperties("fontFamily",{isFormatting:!0,copyOnEnter:!0});const t=o_("fontFamily",a_(e.config.get("fontFamily.options")).filter(e=>e.model));e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(t),e.commands.add("fontFamily",new s_(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:"fontFamily",view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:"fontFamily",value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:"fontFamily",value:e=>e.getAttribute("face")}})}}class u_ extends Qe{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),o=e.commands.get("fontFamily");e.ui.componentFactory.add("fontFamily",n=>{const r=Sd(n);return Id(r,function(e,t){const i=new Zi;for(const o of e){const e={type:"button",model:new Hd({commandName:"fontFamily",commandParam:o.model,label:o.title,withText:!0})};e.model.bind("isOn").to(t,"value",e=>e===o.model||!(!e||!o.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===o.model.toLowerCase()),o.view&&o.view.styles&&e.model.set("labelStyle","font-family: "+o.view.styles["font-family"]),i.add(e)}return i}(i,o)),r.buttonView.set({label:t("Font Family"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t;return a_(e.config.get("fontFamily").options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class h_ extends Qe{static get requires(){return[d_,u_]}static get pluginName(){return"FontFamily"}}class m_ extends e_{constructor(e){super(e,"fontSize")}}function g_(e){return e.map(e=>function(e){if(t=e,"object"==typeof t&&t.title&&t.model&&t.view)return p_(e);var t;const i=function(e){return f_[e]||f_[e.model]}(e);if(i)return p_(i);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new l.a("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e))return;return function(e){"number"!=typeof e&&"string"!=typeof e||(e={title:String(e),model:parseFloat(e)+"px"});return e.view={name:"span",styles:{"font-size":e.model}},p_(e)}(e)}(e)).filter(e=>!!e)}const f_={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function p_(e){return e.view.priority||(e.view.priority=7),e}const b_=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class w_ extends Qe{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define("fontSize",{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"fontSize"}),e.model.schema.setAttributeProperties("fontSize",{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=o_("fontSize",g_(this.editor.config.get("fontSize.options")).filter(e=>e.model));t?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add("fontSize",new m_(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter(e=>!Mu(String(e))&&!Ru(String(e)));if(i.length)throw new l.a("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:"fontSize",view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:"fontSize",value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:"fontSize",value:e=>{const t=e.getAttribute("size"),i="-"===t[0]||"+"===t[0];let o=parseInt(t,10);i&&(o=3+o);const n=b_.length-1,r=Math.min(Math.max(o,0),n);return b_[r]}}})}}i(144);class k_ extends Qe{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),o=e.commands.get("fontSize");e.ui.componentFactory.add("fontSize",n=>{const r=Sd(n);return Id(r,function(e,t){const i=new Zi;for(const o of e){const e={type:"button",model:new Hd({commandName:"fontSize",commandParam:o.model,label:o.title,class:"ck-fontsize-option",withText:!0})};o.view&&o.view.styles&&e.model.set("labelStyle","font-size:"+o.view.styles["font-size"]),o.view&&o.view.classes&&e.model.set("class",`${e.model.class} ${o.view.classes}`),e.model.bind("isOn").to(t,"value",e=>e===o.model),i.add(e)}return i}(i,o)),r.buttonView.set({label:t("Font Size"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(o),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return g_(e.config.get("fontSize").options).map(e=>{const t=i[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class __ extends Qe{static get requires(){return[w_,k_]}static get pluginName(){return"FontSize"}}class v_ extends e_{constructor(e){super(e,"fontColor")}}class y_ extends Qe{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define("fontColor",{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:"fontColor",value:n_("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:"fontColor",value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:"fontColor",view:r_("color")}),e.commands.add("fontColor",new v_(e)),e.model.schema.extend("$text",{allowAttributes:"fontColor"}),e.model.schema.setAttributeProperties("fontColor",{isFormatting:!0,copyOnEnter:!0})}}class x_ extends Qe{constructor(e,{commandName:t,icon:i,componentName:o,dropdownLabel:n}){super(e),this.commandName=t,this.componentName=o,this.icon=i,this.dropdownLabel=n,this.columns=e.config.get(this.componentName+".columns"),this.colorTableView=void 0}init(){const e=this.editor,t=e.locale,i=t.t,o=e.commands.get(this.commandName),n=id(t,od(e.config.get(this.componentName).colors)),r=e.config.get(this.componentName+".documentColors");e.ui.componentFactory.add(this.componentName,t=>{const s=Sd(t);return this.colorTableView=function({dropdownView:e,colors:t,columns:i,removeButtonLabel:o,documentColorsLabel:n,documentColorsCount:r}){const s=e.locale,a=new i_(s,{colors:t,columns:i,removeButtonLabel:o,documentColorsLabel:n,documentColorsCount:r});return e.colorTableView=a,e.panelView.children.add(a),a.delegate("execute").to(e,"execute"),a}({dropdownView:s,colors:n.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),documentColorsLabel:0!==r?i("Document colors"):void 0,documentColorsCount:void 0===r?this.columns:r}),this.colorTableView.bind("selectedColor").to(o,"value"),s.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),s.bind("isEnabled").to(o),s.on("execute",(t,i)=>{e.execute(this.commandName,i),e.editing.view.focus()}),s.on("change:isOpen",(t,i,o)=>{s.colorTableView.appendGrids(),o&&(0!==r&&this.colorTableView.updateDocumentColors(e.model,this.componentName),this.colorTableView.updateSelectedColors())}),s})}}class A_ extends x_{constructor(e){super(e,{commandName:"fontColor",componentName:"fontColor",icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:(0,e.locale.t)("Font Color")})}static get pluginName(){return"FontColorUI"}}class C_ extends Qe{static get requires(){return[y_,A_]}static get pluginName(){return"FontColor"}}class T_ extends e_{constructor(e){super(e,"fontBackgroundColor")}}class E_ extends Qe{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define("fontBackgroundColor",{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(qu),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:"fontBackgroundColor",value:n_("background-color")}}),e.conversion.for("downcast").attributeToElement({model:"fontBackgroundColor",view:r_("background-color")}),e.commands.add("fontBackgroundColor",new T_(e)),e.model.schema.extend("$text",{allowAttributes:"fontBackgroundColor"}),e.model.schema.setAttributeProperties("fontBackgroundColor",{isFormatting:!0,copyOnEnter:!0})}}class S_ extends x_{constructor(e){super(e,{commandName:"fontBackgroundColor",componentName:"fontBackgroundColor",icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:(0,e.locale.t)("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class P_ extends Qe{static get requires(){return[E_,S_]}static get pluginName(){return"FontBackgroundColor"}}class I_ extends Ze{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("width")?this.value={width:t.getAttribute("width"),height:null}:this.value=null}execute(e){const t=this.editor,i=t.model,o=t.plugins.get("ImageUtils").getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change(t=>{t.setAttribute("width",e.width,o)})}}class M_ extends Qe{static get requires(){return[Ug]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new I_(e);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:"width"}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:"width"})}_registerConverters(e){const t=this.editor;t.conversion.for("downcast").add(t=>t.on("attribute:width:"+e,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const o=i.writer,n=i.mapper.toViewElement(t.item);null!==t.attributeNewValue?(o.setStyle("width",t.attributeNewValue,n),o.addClass("image_resized",n)):(o.removeStyle("width",n),o.removeClass("image_resized",n))})),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:e=>e.getStyle("width")}})}}const N_={small:Tc.objectSizeSmall,medium:Tc.objectSizeMedium,large:Tc.objectSizeLarge,original:Tc.objectSizeFull};class R_ extends Qe{static get requires(){return[M_]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:o,icon:n}=e,r=o?o+this._resizeUnit:null;t.ui.componentFactory.add(i,i=>{const o=new ed(i),s=t.commands.get("resizeImage"),a=this._getOptionLabelValue(e,!0);if(!N_[n])throw new l.a("imageresizebuttons-missing-icon",t,e);return o.set({label:a,icon:N_[n],tooltip:a,isToggleable:!0}),o.bind("isEnabled").to(this),o.bind("isOn").to(s,"value",O_(r)),this.listenTo(o,"execute",()=>{t.execute("resizeImage",{width:r})}),o})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,o=e.find(e=>!e.value),n=n=>{const r=t.commands.get("resizeImage"),s=Sd(n,dd),a=s.buttonView;return a.set({tooltip:i("Resize image"),commandValue:o.value,icon:N_.medium,isToggleable:!0,label:this._getOptionLabelValue(o),withText:!0,class:"ck-resize-image-button"}),a.bind("label").to(r,"value",e=>e&&e.width?e.width:this._getOptionLabelValue(o)),s.bind("isOn").to(r),s.bind("isEnabled").to(this),Id(s,this._getResizeDropdownListItemDefinitions(e,r)),s.listView.ariaLabel=i("Image resize list"),this.listenTo(s,"execute",e=>{t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus()}),s};t.ui.componentFactory.add("resizeImage",n),t.ui.componentFactory.add("imageResize",n)}_getOptionLabelValue(e,t){const i=this.editor.t;return e.label?e.label:t?e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const i=new Zi;return e.map(e=>{const o=e.value?e.value+this._resizeUnit:null,n={type:"button",model:new Hd({commandName:"resizeImage",commandValue:o,label:this._getOptionLabelValue(e),withText:!0,icon:null})};n.model.bind("isOn").to(t,"value",O_(o)),i.add(n)}),i}}function O_(e){return t=>null===e&&t===e||t&&t.width===e}const z_=/(image|image-inline)/;class V_ extends Qe{static get requires(){return[Lg]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view;t.addObserver(Zg),this.listenTo(t.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 n=e.editing.view.domConverter,r=n.domToView(o.target).findAncestor({classes:z_});let s=this.editor.plugins.get(Lg).getResizerByViewElement(r);if(s)return void s.redraw();const a=e.editing.mapper,l=a.toModelElement(r);s=e.plugins.get(Lg).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:l,viewElement:r,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:()=>n.viewToDom(a.toViewElement(l.parent)),isCentered(){const e=l.getAttribute("imageStyle");return!e||"block"==e||"alignCenter"==e},onCommit(i){t.change(e=>{e.removeClass("image_resized",r)}),e.execute("resizeImage",{width:i})}}),s.on("updateSize",()=>{r.hasClass("image_resized")||t.change(e=>{e.addClass("image_resized",r)})}),s.bind("isEnabled").to(this)})}}i(146);function D_(e,t){const{viewElement:i,defaultValue:o,modelAttribute:n,styleName:r,reduceBoxSides:s=!1}=t;e.for("upcast").attributeToAttribute({view:{name:i,styles:{[r]:/[\s\S]+/}},model:{key:n,value:e=>{const t=e.getNormalizedStyle(r),i=s?F_(t):t;if(o!==i)return i}}})}function L_(e,t,i){e.for("upcast").add(e=>e.on("element:"+t,(e,t,o)=>{if(!t.modelRange)return;const n=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(e=>t.viewItem.hasStyle(e));if(!n.length)return;const r={styles:n};if(!o.consumable.test(t.viewItem,r))return;const s=[...t.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(t.viewItem,r);const a={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},l={style:F_(a.style),color:F_(a.color),width:F_(a.width)};l.style!==i.style&&o.writer.setAttribute("borderStyle",l.style,s),l.color!==i.color&&o.writer.setAttribute("borderColor",l.color,s),l.width!==i.width&&o.writer.setAttribute("borderWidth",l.width,s)}))}function B_(e,{modelElement:t,modelAttribute:i,styleName:o}){e.for("downcast").attributeToAttribute({model:{name:t,key:i},view:e=>({key:"style",value:{[o]:e}})})}function j_(e,{modelAttribute:t,styleName:i}){e.for("downcast").add(e=>e.on(`attribute:${t}:table`,(e,t,o)=>{const{item:n,attributeNewValue:r}=t,{mapper:s,writer:a}=o;if(!o.consumable.consume(t.item,e.name))return;const l=[...s.toViewElement(n).getChildren()].find(e=>e.is("element","table"));r?a.setStyle(i,r,l):a.removeStyle(i,l)}))}function F_(e){if(!e)return;return["top","right","bottom","left"].map(t=>e[t]).reduce((e,t)=>e==t?e:null)||e}class H_ extends Ze{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,i=t.document.selection,{value:o,batch:n}=e,r=i.getFirstPosition().findAncestor("table"),s=this._getValueToSet(o);t.enqueueChange(n||"default",e=>{s?e.setAttribute(this.attributeName,s,r):e.removeAttribute(this.attributeName,r)})}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class U_ extends H_{constructor(e,t){super(e,"backgroundColor",t)}}function W_(e){if(!e||!w(e))return e;const{top:t,right:i,bottom:o,left:n}=e;return t==i&&i==o&&o==n?t:void 0}function $_(e,t){const i=parseFloat(e);return Number.isNaN(i)||String(i)!==String(e)?e:`${i}${t}`}function q_(e,t={}){const i=Object.assign({borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:""},e);return t.includeAlignmentProperty&&!i.alignment&&(i.alignment="center"),t.includePaddingProperty&&!i.padding&&(i.padding=""),t.includeVerticalAlignmentProperty&&!i.verticalAlignment&&(i.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!i.horizontalAlignment&&(i.horizontalAlignment=t.isRightToLeftContent?"right":"left"),i}class Y_ extends H_{constructor(e,t){super(e,"borderColor",t)}_getValue(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class G_ extends H_{constructor(e,t){super(e,"borderStyle",t)}_getValue(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class K_ extends H_{constructor(e,t){super(e,"borderWidth",t)}_getValue(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){if((e=$_(e,"px"))!==this._defaultValue)return e}}class Q_ extends H_{constructor(e,t){super(e,"width",t)}_getValueToSet(e){if((e=$_(e,"px"))!==this._defaultValue)return e}}class J_ extends H_{constructor(e,t){super(e,"height",t)}_getValueToSet(e){return(e=$_(e,"px"))===this._defaultValue?null:e}}class Z_ extends H_{constructor(e,t){super(e,"alignment",t)}}const X_=/^(left|center|right)$/,ev=/^(left|none|right)$/;class tv extends Qe{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[Qw]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const o=q_(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Gu),function(e,t,i){e.extend("table",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),L_(t,"table",i),j_(t,{modelAttribute:"borderColor",styleName:"border-color"}),j_(t,{modelAttribute:"borderStyle",styleName:"border-style"}),j_(t,{modelAttribute:"borderWidth",styleName:"border-width"})}(t,i,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),e.commands.add("tableBorderColor",new Y_(e,o.borderColor)),e.commands.add("tableBorderStyle",new G_(e,o.borderStyle)),e.commands.add("tableBorderWidth",new K_(e,o.borderWidth)),function(e,t,i){e.extend("table",{allowAttributes:["alignment"]}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"alignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:ev}},model:{key:"alignment",value:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t===i?null:t}}}).attributeToAttribute({view:{attributes:{align:X_}},model:{name:"table",key:"alignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,o.alignment),e.commands.add("tableAlignment",new Z_(e,o.alignment)),iv(t,i,{modelAttribute:"width",styleName:"width",defaultValue:o.width}),e.commands.add("tableWidth",new Q_(e,o.width)),iv(t,i,{modelAttribute:"height",styleName:"height",defaultValue:o.height}),e.commands.add("tableHeight",new J_(e,o.height)),e.data.addStyleProcessorRules(qu),function(e,t,i){const{modelAttribute:o}=i;e.extend("table",{allowAttributes:[o]}),D_(t,{viewElement:"table",...i}),j_(t,i)}(t,i,{modelAttribute:"backgroundColor",styleName:"background-color",defaultValue:o.backgroundColor}),e.commands.add("tableBackgroundColor",new U_(e,o.backgroundColor))}}function iv(e,t,i){const{modelAttribute:o}=i;e.extend("table",{allowAttributes:[o]}),D_(t,{viewElement:/^(table|figure)$/,...i}),B_(t,{modelElement:"table",...i})}i(148);class ov extends Mc{constructor(e,t){super(e);const i=this.bindTemplate;this.set("value",""),this.set("id"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.set("ariaDescribedById"),this.options=t,this._dropdownView=this._createDropdownView(),this._inputView=this._createInputTextView(),this._stillTyping=!1,this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color",i.if("hasError","ck-error")],id:i.to("id"),"aria-invalid":i.if("hasError",!0),"aria-describedby":i.to("ariaDescribedById")},children:[this._dropdownView,this._inputView]}),this.on("change:value",(e,t,i)=>this._setInputValue(i))}focus(){this._inputView.focus()}_createDropdownView(){const e=this.locale,t=e.t,i=this.bindTemplate,o=this._createColorGrid(e),n=Sd(e),r=new Mc,s=this._createRemoveColorButton();return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:i.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",i.if("value","ck-hidden",e=>""!=e)]}}]}),n.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),n.buttonView.children.add(r),n.buttonView.tooltip=t("Color picker"),n.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",n.panelView.children.add(s),n.panelView.children.add(o),n.bind("isEnabled").to(this,"isReadOnly",e=>!e),n}_createInputTextView(){const e=this.locale,t=new Dd(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const e=t.element.value,i=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=i&&i.color||e}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createRemoveColorButton(){const e=this.locale,t=e.t,i=new ed(e),o=this.options.defaultColorValue||"",n=t(o?"Restore default":"Remove color");return i.class="ck-input-color__remove-color",i.withText=!0,i.icon=Tc.eraser,i.label=n,i.on("execute",()=>{this.value=o,this._dropdownView.isOpen=!1,this.fire("input")}),i}_createColorGrid(e){const t=new ld(e,{colorDefinitions:this.options.colorDefinitions,columns:this.options.columns});return t.on("execute",(e,t)=>{this.value=t.value,this._dropdownView.isOpen=!1,this.fire("input")}),t.bind("selectedColor").to(this,"value"),t}_setInputValue(e){if(!this._stillTyping){const t=nv(e),i=this.options.colorDefinitions.find(e=>t===nv(e.color));this._inputView.value=i?i.label:e||""}}}function nv(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const rv=e=>""===e;function sv(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function av(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function lv(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function cv(e){return e=e.trim(),rv(e)||Eu(e)}function dv(e){return e=e.trim(),rv(e)||pv(e)||Mu(e)||Ru(e)}function uv(e){return e=e.trim(),rv(e)||pv(e)||Mu(e)}function hv(e,t){const i=new Zi,o=sv(e.t);for(const n in o){const r={type:"button",model:new Hd({_borderStyleValue:n,label:o[n],withText:!0})};"none"===n?r.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===n):r.model.bind("isOn").to(e,"borderStyle",e=>e===n),i.add(r)}return i}function mv(e){const{view:t,icons:i,toolbar:o,labels:n,propertyName:r,nameToValue:s,defaultValue:a}=e;for(const e in n){const l=new ed(t.locale);l.set({label:n[e],icon:i[e],tooltip:n[e]});const c=s?s(e):e;l.bind("isOn").to(t,r,e=>{let t=e;return""===e&&a&&(t=a),c===t}),l.on("execute",()=>{t[r]=c}),o.items.add(l)}}const gv=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function fv(e){return(t,i,o)=>{const n=new ov(t.locale,{colorDefinitions:(r=e.colorConfig,r.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue});var r;return n.set({id:i,ariaDescribedById:o}),n.bind("isReadOnly").to(t,"isEnabled",e=>!e),n.bind("hasError").to(t,"errorText",e=>!!e),n.on("input",()=>{t.errorText=null}),t.bind("isEmpty","isFocused").to(n),n}}function pv(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}i(150);class bv extends Mc{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach(e=>this.children.add(e)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")],role:i.to("_role"),"aria-labelledby":i.to("_ariaLabelledBy")},children:this.children})}}i(25),i(26),i(154);const wv={left:Tc.objectLeft,center:Tc.objectCenter,right:Tc.objectRight};class kv extends Mc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:o,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new Rs,this.keystrokes=new Os,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=o,this.borderColorInput=n,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=f,this._focusables=new Ic,this._focusCycler=new sd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Vd(e,{label:this.t("Table properties")})),this.children.add(new bv(e,{labelView:r,children:[r,i,n,o],class:"ck-table-form__border-row"})),this.children.add(new bv(e,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new bv(e,{children:[new bv(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new bv(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new bv(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Pc({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=fv({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color}),o=this.locale,n=this.t,r=new Nd(o);r.text=n("Border");const s=sv(this.t),a=new Ld(o,jd);a.set({label:n("Style"),class:"ck-table-form__border-style"}),a.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:n("Style")}),a.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>s[e||"none"]),a.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),a.bind("isEmpty").to(this,"borderStyle",e=>!e),Id(a.fieldView,hv(this,t.style));const l=new Ld(o,Bd);l.set({label:n("Width"),class:"ck-table-form__border-width"}),l.fieldView.bind("value").to(this,"borderWidth"),l.bind("isEnabled").to(this,"borderStyle",_v),l.fieldView.on("input",()=>{this.borderWidth=l.fieldView.element.value});const c=new Ld(o,i);return c.set({label:n("Color"),class:"ck-table-form__border-color"}),c.fieldView.bind("value").to(this,"borderColor"),c.bind("isEnabled").to(this,"borderStyle",_v),c.fieldView.on("input",()=>{this.borderColor=c.fieldView.value}),this.on("change:borderStyle",(e,i,o,n)=>{_v(o)||(this.borderColor="",this.borderWidth=""),_v(n)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:a,borderColorInput:c,borderWidthInput:l}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Nd(e);i.text=t("Background");const o=fv({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor}),n=new Ld(e,o);return n.set({label:t("Color"),class:"ck-table-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),{backgroundRowLabel:i,backgroundInput:n}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Nd(e);i.text=t("Dimensions");const o=new Ld(e,Bd);o.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),o.fieldView.bind("value").to(this,"width"),o.fieldView.on("input",()=>{this.width=o.fieldView.element.value});const n=new Mc(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Ld(e,Bd);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:o,operatorLabel:n,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Nd(e);i.text=t("Alignment");const o=new vd(e);return o.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),mv({view:this,icons:wv,toolbar:o,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:o}}_createActionButtons(){const e=this.locale,t=this.t,i=new ed(e),o=new ed(e),n=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),icon:Tc.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(n,"errorText",(...e)=>e.every(e=>!e)),o.set({label:t("Cancel"),icon:Tc.cancel,class:"ck-button-cancel",type:"cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _alignmentLabels(){const e=this.locale,t=this.t,i=t("Align table to the left"),o=t("Center table"),n=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:n,center:o,left:i}:{left:i,center:o,right:n}}}function _v(e){return"none"!==e}const vv=$d.defaultPositions,yv=[vv.northArrowSouth,vv.northArrowSouthWest,vv.northArrowSouthEast,vv.southArrowNorth,vv.southArrowNorthWest,vv.southArrowNorthEast],xv=[...yv,Oh];function Av(e,t){const i=e.plugins.get("ContextualBalloon");if(hk(e.editing.view.document.selection)){let o;o="cell"===t?Tv(e):Cv(e),i.updatePosition(o)}}function Cv(e){const t=e.model.document.selection.getFirstPosition().findAncestor("table"),i=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.viewToDom(i),positions:xv}}function Tv(e){const t=e.editing.mapper,i=e.editing.view.domConverter,o=e.model.document.selection;if(o.rangeCount>1)return{target:()=>function(e,t){const i=t.editing.mapper,o=t.editing.view.domConverter,n=Array.from(e).map(e=>{const t=Ev(e.start),n=i.toViewElement(t);return new Ts(o.viewToDom(n))});return Ts.getBoundingRect(n)}(o.getRanges(),e),positions:yv};const n=Ev(o.getFirstPosition()),r=t.toViewElement(n);return{target:i.viewToDom(r),positions:yv}}function Ev(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const Sv={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Pv extends Qe{static get requires(){return[Qd]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:gv,backgroundColors:gv})}init(){const e=this.editor,t=e.t;this._defaultTableProperties=q_(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(Qd),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableProperties",i=>{const o=new ed(i);o.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const n=Object.values(Sv).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),o})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),i=od(t.borderColors),o=id(e.locale,i),n=od(t.backgroundColors),r=id(e.locale,n),s=new kv(e.locale,{borderColors:o,backgroundColors:r,defaultTableProperties:this._defaultTableProperties}),a=e.t;s.render(),this.listenTo(s,"submit",()=>{this._hideView()}),this.listenTo(s,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),s.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),Ec({emitter:s,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const l=av(a),c=lv(a);return s.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle",this._defaultTableProperties.borderStyle)),s.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:s.borderColorInput,commandName:"tableBorderColor",errorText:l,validator:cv,defaultValue:this._defaultTableProperties.borderColor})),s.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:s.borderWidthInput,commandName:"tableBorderWidth",errorText:c,validator:uv,defaultValue:this._defaultTableProperties.borderWidth})),s.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:s.backgroundInput,commandName:"tableBackgroundColor",errorText:l,validator:cv,defaultValue:this._defaultTableProperties.backgroundColor})),s.on("change:width",this._getValidatedPropertyChangeCallback({viewField:s.widthInput,commandName:"tableWidth",errorText:c,validator:dv,defaultValue:this._defaultTableProperties.width})),s.on("change:height",this._getValidatedPropertyChangeCallback({viewField:s.heightInput,commandName:"tableHeight",errorText:c,validator:dv,defaultValue:this._defaultTableProperties.height})),s.on("change:alignment",this._getPropertyChangeCallback("tableAlignment",this._defaultTableProperties.alignment)),s}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(Sv).map(([t,i])=>{const o=this._defaultTableProperties[t]||"";return[t,e.get(i).value||o]}).forEach(([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})}_showView(){const e=this.editor;this.listenTo(e.ui,"update",()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Cv(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;hk(e.editing.view.document.selection)?this._isViewVisible&&Av(e,"table"):this._hideView()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e,t){return(i,o,n,r)=>{(r||t!==n)&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:o,errorText:n,defaultValue:r}=e,s=fs(()=>{i.errorText=n},500);return(e,n,a,l)=>{s.cancel(),(l||r!==a)&&(o(a)?(this.editor.execute(t,{value:a,batch:this._undoStepBatch}),i.errorText=null):s())}}}class Iv extends Qe{static get pluginName(){return"TableProperties"}static get requires(){return[tv,Pv]}}i(156);const Mv={left:Tc.alignLeft,center:Tc.alignCenter,right:Tc.alignRight,justify:Tc.alignJustify,top:Tc.alignTop,middle:Tc.alignMiddle,bottom:Tc.alignBottom};class Nv extends Mc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:o,borderColorInput:n,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new Rs,this.keystrokes=new Os,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=o,this.borderColorInput=n,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:f,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=f,this.cancelButtonView=p,this._focusables=new Ic,this._focusCycler=new sd({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Vd(e,{label:this.t("Cell properties")})),this.children.add(new bv(e,{labelView:r,children:[r,i,n,o],class:"ck-table-form__border-row"})),this.children.add(new bv(e,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new bv(e,{children:[new bv(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new bv(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new bv(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new bv(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),Pc({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=fv({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color}),o=this.locale,n=this.t,r=new Nd(o);r.text=n("Border");const s=sv(n),a=new Ld(o,jd);a.set({label:n("Style"),class:"ck-table-form__border-style"}),a.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:n("Style")}),a.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>s[e||"none"]),a.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),a.bind("isEmpty").to(this,"borderStyle",e=>!e),Id(a.fieldView,hv(this,t.style));const l=new Ld(o,Bd);l.set({label:n("Width"),class:"ck-table-form__border-width"}),l.fieldView.bind("value").to(this,"borderWidth"),l.bind("isEnabled").to(this,"borderStyle",Rv),l.fieldView.on("input",()=>{this.borderWidth=l.fieldView.element.value});const c=new Ld(o,i);return c.set({label:n("Color"),class:"ck-table-form__border-color"}),c.fieldView.bind("value").to(this,"borderColor"),c.bind("isEnabled").to(this,"borderStyle",Rv),c.fieldView.on("input",()=>{this.borderColor=c.fieldView.value}),this.on("change:borderStyle",(e,i,o,n)=>{Rv(o)||(this.borderColor="",this.borderWidth=""),Rv(n)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:r,borderStyleDropdown:a,borderColorInput:c,borderWidthInput:l}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Nd(e);i.text=t("Background");const o=fv({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor}),n=new Ld(e,o);return n.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),{backgroundRowLabel:i,backgroundInput:n}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Nd(e);i.text=t("Dimensions");const o=new Ld(e,Bd);o.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),o.fieldView.bind("value").to(this,"width"),o.fieldView.on("input",()=>{this.width=o.fieldView.element.value});const n=new Mc(e);n.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Ld(e,Bd);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:i,widthInput:o,operatorLabel:n,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,i=new Ld(e,Bd);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",()=>{this.padding=i.fieldView.element.value}),i}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Nd(e);i.text=t("Table cell text alignment");const o=new vd(e),n="rtl"===this.locale.contentLanguageDirection;o.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),mv({view:this,icons:Mv,toolbar:o,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(n){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new vd(e);return r.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),mv({view:this,icons:Mv,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:o,verticalAlignmentToolbar:r,alignmentLabel:i}}_createActionButtons(){const e=this.locale,t=this.t,i=new ed(e),o=new ed(e),n=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),icon:Tc.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(n,"errorText",(...e)=>e.every(e=>!e)),o.set({label:t("Cancel"),icon:Tc.cancel,class:"ck-button-cancel",type:"cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,i=t("Align cell text to the left"),o=t("Align cell text to the center"),n=t("Align cell text to the right"),r=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:n,center:o,left:i,justify:r}:{left:i,center:o,right:n,justify:r}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function Rv(e){return"none"!==e}const Ov={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",width:"tableCellWidth",height:"tableCellHeight",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class zv extends Qe{static get requires(){return[Qd]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:gv,backgroundColors:gv})}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=q_(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(Qd),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableCellProperties",i=>{const o=new ed(i);o.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(o,"execute",()=>this._showView());const n=Object.values(Ov).map(t=>e.commands.get(t));return o.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),o})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,i=e.config.get("table.tableCellProperties"),o=od(i.borderColors),n=id(e.locale,o),r=od(i.backgroundColors),s=id(e.locale,r),a=new Nv(e.locale,{borderColors:n,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties}),l=e.t;a.render(),this.listenTo(a,"submit",()=>{this._hideView()}),this.listenTo(a,"cancel",()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()}),a.keystrokes.set("Esc",(e,t)=>{this._hideView(),t()}),this.listenTo(e.ui,"update",()=>{hk(t.selection)?this._isViewVisible&&Av(e,"cell"):this._hideView()}),Ec({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=av(l),d=lv(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle",this._defaultTableCellProperties.borderStyle)),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:cv,defaultValue:this._defaultTableCellProperties.borderColor})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:uv,defaultValue:this._defaultTableCellProperties.borderWidth})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:dv,defaultValue:this._defaultTableCellProperties.padding})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:dv,defaultValue:this._defaultTableCellProperties.width})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:dv,defaultValue:this._defaultTableCellProperties.height})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:cv,defaultValue:this._defaultTableCellProperties.backgroundColor})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment",this._defaultTableCellProperties.horizontalAlignment)),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment",this._defaultTableCellProperties.verticalAlignment)),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(Ov).map(([t,i])=>{const o=this._defaultTableCellProperties[t]||"";return[t,e.get(i).value||o]}).forEach(([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})}_showView(){const e=this.editor;this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Tv(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){if(!this._isViewInBalloon)return;const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e,t){return(i,o,n,r)=>{(r||t!==n)&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:o,errorText:n,defaultValue:r}=e,s=fs(()=>{i.errorText=n},500);return(e,n,a,l)=>{s.cancel(),(l||r!==a)&&(o(a)?(this.editor.execute(t,{value:a,batch:this._undoStepBatch}),i.errorText=null):s())}}}class Vv extends Ze{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=ew(this.editor.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(e={}){const{value:t,batch:i}=e,o=this.editor.model,n=ew(o.document.selection),r=this._getValueToSet(t);o.enqueueChange(i||"default",e=>{r?n.forEach(t=>e.setAttribute(this.attributeName,r,t)):n.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class Dv extends Vv{constructor(e,t){super(e,"padding",t)}_getAttribute(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){if((e=$_(e,"px"))!==this._defaultValue)return e}}class Lv extends Vv{constructor(e,t){super(e,"width",t)}_getValueToSet(e){if((e=$_(e,"px"))!==this._defaultValue)return e}}class Bv extends Vv{constructor(e,t){super(e,"height",t)}_getValueToSet(e){return(e=$_(e,"px"))===this._defaultValue?null:e}}class jv extends Vv{constructor(e,t){super(e,"backgroundColor",t)}}class Fv extends Vv{constructor(e,t){super(e,"verticalAlignment",t)}}class Hv extends Vv{constructor(e,t){super(e,"horizontalAlignment",t)}}class Uv extends Vv{constructor(e,t){super(e,"borderStyle",t)}_getAttribute(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Wv extends Vv{constructor(e,t){super(e,"borderColor",t)}_getAttribute(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class $v extends Vv{constructor(e,t){super(e,"borderWidth",t)}_getAttribute(e){if(!e)return;const t=W_(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){if((e=$_(e,"px"))!==this._defaultValue)return e}}const qv=/^(top|middle|bottom)$/,Yv=/^(left|center|right|justify)$/;class Gv extends Qe{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[Qw]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const o=q_(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(Gu),function(e,t,i){e.extend("tableCell",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),L_(t,"td",i),L_(t,"th",i),B_(t,{modelElement:"tableCell",modelAttribute:"borderStyle",styleName:"border-style"}),B_(t,{modelElement:"tableCell",modelAttribute:"borderColor",styleName:"border-color"}),B_(t,{modelElement:"tableCell",modelAttribute:"borderWidth",styleName:"border-width"})}(t,i,{color:o.borderColor,style:o.borderStyle,width:o.borderWidth}),e.commands.add("tableCellBorderStyle",new Uv(e,o.borderStyle)),e.commands.add("tableCellBorderColor",new Wv(e,o.borderColor)),e.commands.add("tableCellBorderWidth",new $v(e,o.borderWidth)),function(e,t,i){e.extend("tableCell",{allowAttributes:["horizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"horizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":Yv}},model:{key:"horizontalAlignment",value:e=>{const t=e.getStyle("text-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Yv}},model:{key:"horizontalAlignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,o.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new Hv(e,o.horizontalAlignment)),Kv(t,i,{modelAttribute:"width",styleName:"width",defaultValue:o.width}),e.commands.add("tableCellWidth",new Lv(e,o.width)),Kv(t,i,{modelAttribute:"height",styleName:"height",defaultValue:o.height}),e.commands.add("tableCellHeight",new Bv(e,o.height)),e.data.addStyleProcessorRules(rh),Kv(t,i,{modelAttribute:"padding",styleName:"padding",reduceBoxSides:!0,defaultValue:o.padding}),e.commands.add("tableCellPadding",new Dv(e,o.padding)),e.data.addStyleProcessorRules(qu),Kv(t,i,{modelAttribute:"backgroundColor",styleName:"background-color",defaultValue:o.backgroundColor}),e.commands.add("tableCellBackgroundColor",new jv(e,o.backgroundColor)),function(e,t,i){e.extend("tableCell",{allowAttributes:["verticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"verticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":qv}},model:{key:"verticalAlignment",value:e=>{const t=e.getStyle("vertical-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:qv}},model:{key:"verticalAlignment",value:e=>{const t=e.getAttribute("valign");return t===i?null:t}}})}(t,i,o.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Fv(e,o.verticalAlignment))}}function Kv(e,t,i){const{modelAttribute:o}=i;e.extend("tableCell",{allowAttributes:[o]}),D_(t,{viewElement:/^(td|th)$/,...i}),B_(t,{modelElement:"tableCell",...i})}class Qv extends Qe{static get pluginName(){return"TableCellProperties"}static get requires(){return[Gv,zv]}}class Jv extends Ze{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const o=function(e,t){const i=Rh(e,t).start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,i);return t.checkChild(o,"pageBreak")}(i,t,e)}execute(){const e=this.editor.model;e.change(t=>{const i=t.createElement("pageBreak");e.insertContent(i);let o=i.nextSibling;!(o&&e.schema.checkChild(o,"$text"))&&e.schema.checkChild(i.parent,"paragraph")&&(o=t.createElement("paragraph"),e.insertContent(o,t.createPositionAfter(i))),o&&t.setSelection(o,0)})}}i(158);class Zv extends Qe{static get pluginName(){return"PageBreakEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,o=e.conversion;t.register("pageBreak",{isObject:!0,allowWhere:"$block"}),o.for("dataDowncast").elementToElement({model:"pageBreak",view:(e,{writer:t})=>{const i=t.createContainerElement("div",{class:"page-break",style:"page-break-after: always"}),o=t.createContainerElement("span",{style:"display: none"});return t.insert(t.createPositionAt(i,0),o),i}}),o.for("editingDowncast").elementToElement({model:"pageBreak",view:(e,{writer:t})=>{const o=i("Page break"),n=t.createContainerElement("div"),r=t.createRawElement("span",{class:"page-break__label"},(function(e){e.innerText=i("Page break")}));return t.addClass("page-break",n),t.insert(t.createPositionAt(n,0),r),function(e,t,i){return t.setCustomProperty("pageBreak",!0,e),Eh(e,t,{label:i})}(n,t,o)}}),o.for("upcast").elementToElement({view:e=>{const t="always"==e.getStyle("page-break-before"),i="always"==e.getStyle("page-break-after");if(t||i){if(1==e.childCount){const t=e.getChild(0);if(!t.is("element","span")||"none"!=t.getStyle("display"))return}else if(e.childCount>1)return;return{name:!0}}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new Jv(e))}}class Xv extends Qe{static get pluginName(){return"PageBreakUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("pageBreak",i=>{const o=e.commands.get("pageBreak"),n=new ed(i);return n.set({label:t("Page break"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z"/><path d="M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z"/><path d="M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z"/></svg>',tooltip:!0}),n.bind("isEnabled").to(o,"isEnabled"),this.listenTo(n,"execute",()=>{e.execute("pageBreak"),e.editing.view.focus()}),n})}}class ey extends lh{}ey.builtinPlugins=[class extends Qe{static get requires(){return[tm,bh,um,rm,km,Gm]}static get pluginName(){return"Essentials"}},class extends Qe{static get requires(){return[Qm]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(Qm).createUploadAdapter=t=>new ig(t,e,this.editor.t))}},class extends Qe{static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&og(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&og(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&og(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&og(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=sg(this.editor,"bold");ng(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),ng(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=sg(this.editor,"italic");ng(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),ng(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=sg(this.editor,"code");ng(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get("strikethrough")){const e=sg(this.editor,"strikethrough");ng(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(t=>{const i=t[7],o=new RegExp(`^(#{${i}})\\s$`);og(this.editor,this,o,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&og(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&og(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&og(this.editor,this,/^---$/,"horizontalLine")}},class extends Qe{static get requires(){return[lg,cg]}static get pluginName(){return"Bold"}},class extends Qe{static get requires(){return[dg,ug]}static get pluginName(){return"Italic"}},class extends Qe{static get requires(){return[pg,bg]}static get pluginName(){return"BlockQuote"}},class extends Qe{static get pluginName(){return"CKFinder"}static get requires(){return["Link","CKFinderUploadAdapter",vg,wg]}},class extends so{static get pluginName(){return"CloudServices"}static get requires(){return[_k]}init(){const e=this.context.config.get("cloudServices")||{};for(const t in e)this[t]=e[t];if(this._tokens=new Map,this.tokenUrl)return this.token=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl),this._tokens.set(this.tokenUrl,this.token),this.token.init();this.token=null}registerTokenUrl(e){if(this._tokens.has(e))return Promise.resolve(this.getTokenFor(e));const t=this.context.plugins.get("CloudServicesCore").createToken(e);return this._tokens.set(e,t),t.init()}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new l.a("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy()}},class extends Qe{static get requires(){return[yg,"ImageUpload"]}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||Object(l.b)("easy-image-image-feature-missing",e)}static get pluginName(){return"EasyImage"}},class extends Qe{static get requires(){return[Ig,Mg]}static get pluginName(){return"Heading"}},class extends Qe{static get requires(){return[nf,sf]}static get pluginName(){return"Image"}},class extends Qe{static get requires(){return[df,hf]}static get pluginName(){return"ImageCaption"}},class extends Qe{static get requires(){return[Ef,Sf]}static get pluginName(){return"ImageStyle"}},class extends Qe{static get requires(){return[Ng,Ug]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Ng),o=e.plugins.get("ImageUtils");var n;i.register("image",{ariaLabel:t("Image toolbar"),items:(n=e.config.get("image.toolbar")||[],n.map(e=>w(e)?e.name:e)),getRelatedElement:e=>o.getClosestSelectedImageWidget(e)})}},class extends Qe{static get pluginName(){return"ImageUpload"}static get requires(){return[Uf,zf,Vf]}},class extends Qe{static get pluginName(){return"Indent"}static get requires(){return[$f,Gf]}},class extends Qe{static get requires(){return[Cp,Mp,Op]}static get pluginName(){return"Link"}},class extends Qe{static get requires(){return[sb,lb]}static get pluginName(){return"List"}},class extends Qe{static get requires(){return[pb,_b,wb,qh]}static get pluginName(){return"MediaEmbed"}},Eg,class extends Qe{static get pluginName(){return"PasteFromOffice"}static get requires(){return[hh]}init(){const e=this.editor,t=e.editing.view.document,i=[];i.push(new Ib(t)),i.push(new Tb(t)),e.plugins.get("ClipboardPipeline").on("inputTransformation",(e,o)=>{if(o._isTransformedWithPasteFromOffice)return;const n=o.dataTransfer.getData("text/html"),r=i.find(e=>e.isActive(n));r&&(o._parsedData=Nb(n,t.stylesProcessor),r.execute(o),o._isTransformedWithPasteFromOffice=!0)},{priority:"high"})}},class extends Qe{static get requires(){return[Qw,ek,ik,ck,ak,ok,qh]}static get pluginName(){return"Table"}},class extends Qe{static get requires(){return[Ng]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Ng),o=e.config.get("table.contentToolbar"),n=e.config.get("table.tableToolbar");o&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:hk}),n&&i.register("table",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:uk})}},class extends Qe{static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:Nm}})}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,i=e.plugins.get("Input"),o=function(e){const t=e.extra||[],i=e.remove||[],o=e=>!i.includes(e);return function(e){const t=new Set;for(const i of e)if(Mm[i])for(const e of Mm[i])t.add(e);else t.add(i);return Array.from(t)}(e.include.concat(t).filter(o)).filter(o).map(e=>Im[e]||e).map(e=>({from:Rm(e.from),to:Om(e.to)}))}(e.config.get("typing.transformations")),n=new vm(e.model,e=>{for(const t of o){if(t.from.test(e))return{normalizedTransformation:t}}});n.on("matched:data",(e,o)=>{if(!i.isInput(o.batch))return;const{from:n,to:r}=o.normalizedTransformation,s=n.exec(o.text),a=r(s.slice(1)),l=o.range;let c=s.index;t.enqueueChange(e=>{for(let i=1;i<s.length;i++){const o=s[i],n=a[i-1];if(null==n){c+=o.length;continue}const r=l.start.getShiftedBy(c),d=t.createRange(r,r.getShiftedBy(o.length)),u=zm(r);t.insertContent(e.createText(n,u),d),c+=n.length}})}),n.bind("isEnabled").to(this)}},class extends Qe{static get requires(){return[Qm]}static get pluginName(){return"Base64UploadAdapter"}init(){this.editor.plugins.get(Qm).createUploadAdapter=e=>new eg(e)}},xk,class extends Qe{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[Wk,Jk,Zk,Xk,Qk]}init(){const e=this.editor,t=e.plugins.get(Wk);t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}},class extends Qe{static get requires(){return[h_,__,C_,P_]}static get pluginName(){return"Font"}},class extends Qe{static get requires(){return[M_,V_,R_]}static get pluginName(){return"ImageResize"}},Iv,Qv,Iv,Qv,class extends Qe{static get requires(){return[Zv,Xv,qh]}static get pluginName(){return"PageBreak"}},Fd],ey.defaultConfig={toolbar:{items:["heading","|","undo","redo","|","bold","italic","fontSize","fontFamily","fontColor","fontBackgroundColor","|","link","insertTable","uploadImage","mediaEmbed","insertAudio","|","outdent","indent","|","blockQuote","pageBreak","bulletedList","numberedList"]},image:{toolbar:["imageStyle:inline","imageStyle:block","imageStyle:side","|","toggleImageCaption","imageTextAlternative"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"]},language:"tr",htmlSupport:{allow:[{name:/.*/,attributes:!0,classes:!0,styles:!0}]}}}]).default}));
//# sourceMappingURL=ckeditor.js.map